[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source tools/source xmloff/source
sw/source/filter/html/htmlplug.cxx |2 +- sw/source/filter/xml/xmltexti.cxx |2 +- tools/source/fsys/urlobj.cxx |3 ++- xmloff/source/draw/ximpshap.cxx|2 +- 4 files changed, 5 insertions(+), 4 deletions(-) New commits: commit 9198322d9b4ed87e0e176fbfc712751a5f9b886f Author: Caolán McNamara AuthorDate: Sat Nov 4 19:57:51 2023 + Commit: Miklos Vajna CommitDate: Fri Nov 24 08:51:07 2023 +0100 warn about exotic protocols as well Change-Id: I50dcf4f36cd20d75f5ad3876353143268740a50f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151834 Tested-by: Jenkins Reviewed-by: Caolán McNamara (cherry picked from commit 1305f70cff8a81a58a5a6d9c96c5bb032005389e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159034 Reviewed-by: Eike Rathke Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159881 Reviewed-by: Miklos Vajna diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx index 1aec184d8a6c..1c1f5f49f13e 100644 --- a/sw/source/filter/html/htmlplug.cxx +++ b/sw/source/filter/html/htmlplug.cxx @@ -1121,7 +1121,7 @@ void SwHTMLParser::InsertFloatingFrame() OUString sHRef = aFrameDesc.GetURL().GetMainURL( INetURLObject::DecodeMechanism::NONE ); -if (INetURLObject(sHRef).GetProtocol() == INetProtocol::Macro) +if (INetURLObject(sHRef).IsExoticProtocol()) NotifyMacroEventRead(); xSet->setPropertyValue("FrameURL", uno::Any( sHRef ) ); diff --git a/sw/source/filter/xml/xmltexti.cxx b/sw/source/filter/xml/xmltexti.cxx index 7ec4616f76dd..4bbed6bb8ff8 100644 --- a/sw/source/filter/xml/xmltexti.cxx +++ b/sw/source/filter/xml/xmltexti.cxx @@ -826,7 +826,7 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertFloatingFra OUString sHRef = URIHelper::SmartRel2Abs( INetURLObject( GetXMLImport().GetBaseURL() ), rHRef ); -if (INetURLObject(sHRef).GetProtocol() == INetProtocol::Macro) +if (INetURLObject(sHRef).IsExoticProtocol()) GetXMLImport().NotifyMacroEventRead(); xSet->setPropertyValue("FrameURL", diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx index 2a9f7bc3d7dc..36a8af31a0fb 100644 --- a/tools/source/fsys/urlobj.cxx +++ b/tools/source/fsys/urlobj.cxx @@ -4834,7 +4834,8 @@ bool INetURLObject::IsExoticProtocol() const return m_eScheme == INetProtocol::Slot || m_eScheme == INetProtocol::Macro || m_eScheme == INetProtocol::Uno || - isSchemeEqualTo(u"vnd.sun.star.script"); + isSchemeEqualTo(u"vnd.sun.star.script") || + isSchemeEqualTo(u"service"); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx index 113f3a3ffc2a..263b4b937608 100644 --- a/xmloff/source/draw/ximpshap.cxx +++ b/xmloff/source/draw/ximpshap.cxx @@ -3177,7 +3177,7 @@ void SdXMLFloatingFrameShapeContext::startFastElement (sal_Int32 /*nElement*/, if( !maHref.isEmpty() ) { -if (INetURLObject(maHref).GetProtocol() == INetProtocol::Macro) +if (INetURLObject(maHref).IsExoticProtocol()) GetImport().NotifyMacroEventRead(); xProps->setPropertyValue("FrameURL", Any(maHref) );
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/layout/tabfrm.cxx |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) New commits: commit ce1120eecdafa04b03617dcb88eb6027b6b50679 Author: Michael Stahl AuthorDate: Fri Aug 25 18:31:42 2023 +0200 Commit: Christian Lohmaier CommitDate: Fri Sep 22 19:46:56 2023 +0200 (related? tdf#155177) sw: layout: fix another RemoveFollowFlowLine SNAFU This happens with the following commit, on testForcepoint76, for no obvious reason. A follow table frame is in SwTabFrame::MakeAll(), then its follow flow line becomes empty and it does SetRemoveFollowFlowLinePending() on the master, then it formats its follow flow line (but at that time there's again a text frame in it), then that content moves backward, formats its uppers until it gets to the master table frame, which wants to join the row frame that's being formatted on the stack. Obviously a SwFrameDeleteGuard in lcl_RecalcRow() can't hurt, but it needs an additional change later to prevent it from moving rows of the follow back. Change-Id: Idca90b7eb67994385ccd306562ea26ff39e884f9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156117 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 8c24bc5baa1f501943bf955e07787d80cb7a5763) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156196 Reviewed-by: Christian Lohmaier diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index 95a93c4112e7..d2e4618bf317 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -1691,6 +1691,8 @@ static void lcl_RecalcRow(SwRowFrame & rRow, tools::Long const nBottom) if( bCheck ) { +SwFrameDeleteGuard g(); + // #115759# - force another format of the // lowers, if at least one of it was invalid. bCheck = SwContentFrame::CalcLowers(rRow, *rRow.GetUpper(), nBottom, true); @@ -2244,7 +2246,9 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) if ( !bSplit && GetFollow() ) { bool bDummy; -if ( GetFollow()->ShouldBwdMoved( GetUpper(), bDummy ) ) +if (!(HasFollowFlowLine() +&& GetFollow()->GetFirstNonHeadlineRow()->IsDeleteForbidden()) +&& GetFollow()->ShouldBwdMoved(GetUpper(), bDummy)) { SwFrame *pTmp = GetUpper(); SwTwips nDeadLine = aRectFnSet.GetPrtBottom(*pTmp);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/frmedt/feshview.cxx |7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) New commits: commit c1e922b3718358d65a329b7a74738fc6523348af Author: Caolán McNamara AuthorDate: Thu Sep 14 20:18:55 2023 +0100 Commit: Michael Stahl CommitDate: Fri Sep 15 11:51:35 2023 +0200 crashreporting: apparent null deref at SwFEShell::IsShapeDefaultHoriTextDirR2L https: //crashreport.libreoffice.org/stats/crash_details/73028951-19a0-409b-89d2-a080495df925 Change-Id: I440465a3c7d5b98ecdd1c5f1973a2b8f64d6772e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156888 Tested-by: Jenkins Reviewed-by: Xisco Fauli (cherry picked from commit 7a33e2f4c6a1a3c489b6deaeaae1489acb0aa389) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156889 Reviewed-by: Michael Stahl diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index aec1e9693d7f..8e91c2af68cd 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -3320,8 +3320,11 @@ bool SwFEShell::IsShapeDefaultHoriTextDirR2L() const if ( dynamic_cast( pSdrObj) == nullptr ) { // determine page frame of the frame the shape is anchored. -const SwFrame* pAnchorFrame = - static_cast(GetUserCall(pSdrObj))->GetAnchorFrame( pSdrObj ); +const SwContact* pContact = GetUserCall(pSdrObj); +OSL_ENSURE( pContact, " - missing contact!" ); +if (!pContact) +return false; +const SwFrame* pAnchorFrame = static_cast(pContact)->GetAnchorFrame( pSdrObj ); OSL_ENSURE( pAnchorFrame, "inconsistent model - no anchor at shape!"); if ( pAnchorFrame ) {
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/layout/paintfrm.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 4f83442f2be2bf0ce1dcb75b44235f4fe13433df Author: Caolán McNamara AuthorDate: Fri Aug 25 09:54:28 2023 +0100 Commit: Xisco Fauli CommitDate: Mon Sep 4 10:41:18 2023 +0200 crash case seen on clicking on drawing text box inside a footer Change-Id: Id7645ad651d237c94fecb2fc2b6c57a88f3caa55 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156091 Tested-by: Jenkins Reviewed-by: Caolán McNamara (cherry picked from commit bbbd7e346c5b929ca3b867b6dd80c71b8dd788d6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156385 Reviewed-by: Xisco Fauli diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index e86ad990f83c..be694a390350 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -6946,7 +6946,8 @@ void SwPageFrame::PaintSubsidiaryLines( const SwPageFrame *, pLay = pLay->GetNext(); } -assert(pPageBody && "presumably this is impossible"); +if (!pPageBody) +return; SwRect aArea( pPageBody->getFrameArea() ); if ( pFootnoteCont )
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/access/AccessibilityCheck.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit 7f51cf11bca0b1712bf0877007c99cc0bfcee074 Author: Tomaž Vajngerl AuthorDate: Fri May 19 22:56:57 2023 +0900 Commit: Michael Stahl CommitDate: Mon Aug 21 13:12:22 2023 +0200 sw: prevent crash in TextContrastCheck Change-Id: Idc8740a275b9f49aca08d8a3add9a88f9d53a220 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152012 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl (cherry picked from commit c53a8284cf1740af7035b952fbc040a785117319) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155789 Reviewed-by: Michael Stahl diff --git a/sw/source/core/access/AccessibilityCheck.cxx b/sw/source/core/access/AccessibilityCheck.cxx index ac558a44c69e..2121ed10519b 100644 --- a/sw/source/core/access/AccessibilityCheck.cxx +++ b/sw/source/core/access/AccessibilityCheck.cxx @@ -436,6 +436,8 @@ private: } const SwPageDesc* pPageDescription = pTextNode->FindPageDesc(); +if (!pPageDescription) +return; const SwFrameFormat& rPageFormat = pPageDescription->GetMaster(); const SwAttrSet& rPageSet = rPageFormat.GetAttrSet();
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/layout/calcmove.cxx |3 +++ 1 file changed, 3 insertions(+) New commits: commit 0bfed8ac8f88f434081aa0694933419c77573b28 Author: Michael Stahl AuthorDate: Tue Aug 8 19:39:04 2023 +0200 Commit: Xisco Fauli CommitDate: Wed Aug 16 11:14:02 2023 +0200 tdf#151866 sw: layout: prevent deleting newly created SwSectionFrame A section frame is created so that content can move back from another page into it. Apparently only the pPrv frame is on the same page, and formatting it in SwFrame::MakePos() moves it backward, then CheckPageDescs() sees a page with only empty section frames on it and deletes the whole page. (regression from commit b9ef71476fd70bc13f50ebe80390e0730d1b7afb) Change-Id: I4f8e4debd4bcf993c9355dcfc3ced779fe6732ff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155467 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 2f9e67d1e70bdc45dfc59554547bc3730481a757) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155475 Reviewed-by: Xisco Fauli diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index 184373585928..73b72d03305c 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -542,6 +542,9 @@ void SwFrame::MakePos() !pPrv->GetAttrSet()->GetKeep().GetValue() ) { +// tdf#151866 pPrv may MoveBwd and if this is a newly created +// section frame then CheckPageDescs() may delete the whole page! +SwFrameDeleteGuard g(this); // Prevent it. pPrv->Calc(getRootFrame()->GetCurrShell() ? getRootFrame()->GetCurrShell()->GetOut() : nullptr); // This may cause Prev to vanish! } else if ( pPrv->getFrameArea().Top() == 0 )
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/inc/tabfrm.hxx|1 + sw/source/core/layout/fly.cxx|7 ++- sw/source/core/layout/tabfrm.cxx | 24 ++-- 3 files changed, 29 insertions(+), 3 deletions(-) New commits: commit 0bd916a78dc9e586d78dffdf57e6fa80b955eef6 Author: Michael Stahl AuthorDate: Tue Aug 8 12:21:20 2023 +0200 Commit: Xisco Fauli CommitDate: Wed Aug 16 11:13:32 2023 +0200 tdf#156551 tdf#150606 sw: layout: only invalidate SwTabFrame if it... ... wants to move back. In this document, the table 1709 splits across 3 columns of the section 1702 with 1 row each, and when its follows are invalidated in CalcContent(), the later SwTabFrame::MakeAll() of the 1st follow joins the 2nd follow and invalidates the size of the section frame, causing a loop. So only invalidate if that actually looks necessary. (regression from commit 59987d3c77ec7dbf59fbea9f47cc226f4e8903f9) Change-Id: I360c8f697a7666a19a08d8ebcabbcfa3a7cdf844 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155452 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit a9b19f78f3cdcbf5c949a85b45877e903114cc54) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155409 Reviewed-by: Xisco Fauli diff --git a/sw/source/core/inc/tabfrm.hxx b/sw/source/core/inc/tabfrm.hxx index 8bf2b863548e..6360405e4407 100644 --- a/sw/source/core/inc/tabfrm.hxx +++ b/sw/source/core/inc/tabfrm.hxx @@ -59,6 +59,7 @@ class SAL_DLLPUBLIC_RTTI SwTabFrame final: public SwLayoutFrame, public SwFlowFr bool m_bCalcLowers :1; /// For stability of the content in MakeAll bool m_bLowersFormatted :1; /// Communication between MakeAll and Layact bool m_bLockBackMove:1; /// The Master took care of the BackMove test +bool m_bWantBackMove:1; /// Table wants to move back but was locked bool m_bResizeHTMLTable :1; /// Call the Resize of the HTMLTableLayout in the MakeAll /// This is an optimization, so that we don't have to call /// it in ContentFrame::Grow; there it might be called for diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index d1d023dbf3ed..250b634bab16 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -1683,7 +1683,12 @@ void CalcContent( SwLayoutFrame *pLay, bool bNoColl ) { assert(static_cast(pFrame)->IsFollow()); static_cast(pFrame)->m_bLockBackMove = false; -pFrame->InvalidatePos(); +// tdf#150606 encourage it to move back in FormatLayout() +if (static_cast(pFrame)->m_bWantBackMove) +{ +static_cast(pFrame)->m_bWantBackMove = false; +pFrame->InvalidatePos(); +} } } diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index 0200c9fb09cd..95a93c4112e7 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -79,6 +79,7 @@ SwTabFrame::SwTabFrame( SwTable , SwFrame* pSib ) , m_bCalcLowers(false) , m_bLowersFormatted(false) , m_bLockBackMove(false) +, m_bWantBackMove(false) , m_bResizeHTMLTable(false) , m_bONECalcLowers(false) , m_bHasFollowFlowLine(false) @@ -124,6 +125,7 @@ SwTabFrame::SwTabFrame( SwTabFrame ) , m_bCalcLowers(false) , m_bLowersFormatted(false) , m_bLockBackMove(false) +, m_bWantBackMove(false) , m_bResizeHTMLTable(false) , m_bONECalcLowers(false) , m_bHasFollowFlowLine(false) @@ -3696,9 +3698,17 @@ bool SwTabFrame::ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool ) } else if (!m_bLockBackMove) bMoveAnyway = true; +else +{ +m_bWantBackMove = true; +} } else if (!m_bLockBackMove) bMoveAnyway = true; +else +{ +m_bWantBackMove = true; +} if ( bMoveAnyway ) { @@ -3711,7 +3721,7 @@ bool SwTabFrame::ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool ) // This frame fits into pNewUpper in case it has no space, but this // frame is empty. bFits = nSpace >= 0; -if (!m_bLockBackMove && bFits) +if (bFits) { // #i26945# - check, if follow flow line // contains frame, which are moved forward due to its object @@ -3730,7 +3740,17 @@ bool SwTabFrame::ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool ) // 'return nHeight <= nSpace' to 'return nTmpHeight < nSpace'. // This obviously results in problems with table frames in // sections. Remember: Every twip is sacred. -return nTmpHeight <= nSpace; +
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/uibase/wrtsh/wrtsh1.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 48a076e071369f5eee075f74947219dabfa63ec5 Author: Xisco Fauli AuthorDate: Thu Aug 10 17:59:01 2023 +0200 Commit: Michael Stahl CommitDate: Fri Aug 11 13:30:23 2023 +0200 tdf#156270: use double for width/height Otherwise 0.313159 is rounded to 0 Regression from commit 99f43923b66a98b75c78a50577f19293aa480998 Author: Xisco Fauli Date: Tue Apr 18 14:37:32 2023 +0200 sw: fix divide by 0 Change-Id: Ib8bf0a770834e0ff73d215c27788df7a3b98404d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155561 Reviewed-by: Caolán McNamara Tested-by: Xisco Fauli Reviewed-by: Xisco Fauli (cherry picked from commit 6ab45e1e2b256880d2f05b6669eb196e83682a14) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155489 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx index 3ef6559cae34..e00aee5c72c7 100644 --- a/sw/source/uibase/wrtsh/wrtsh1.cxx +++ b/sw/source/uibase/wrtsh/wrtsh1.cxx @@ -914,8 +914,8 @@ void SwWrtShell::CalcAndSetScale( svt::EmbeddedObjectRef& xObj, } else { -tools::Long nWidth(pCli->GetScaleWidth()); -tools::Long nHeight(pCli->GetScaleHeight()); +double nWidth(pCli->GetScaleWidth()); +double nHeight(pCli->GetScaleHeight()); if (nWidth && nHeight) { aArea.Width ( aArea.Width() / nWidth );
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/layout/findfrm.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit b308c3b3242d920e9ef054a0bf118623cf8d235c Author: Michael Stahl AuthorDate: Wed Aug 2 18:20:50 2023 +0200 Commit: Caolán McNamara CommitDate: Fri Aug 4 15:59:54 2023 +0200 tdf#145743 sw: don't delete empty page with ColLocked section In MakeFrames(), the new frames are inserted into a section frame, before an existing frame; the existing frame is MoveFwd() to the next page, so the call to CheckPageDescs() finds the page frame empty and deletes it, along with the section frame. Check the mbColLocked flag set by MakeFrames() to prevent it. (regression from commit b9ef71476fd70bc13f50ebe80390e0730d1b7afb) Change-Id: I4e02a85314adaf07794fd6b5447bd78d39597b8d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155266 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit bd996a23bc4780579fc17e23d8f9f16e2af60289) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155246 Reviewed-by: Caolán McNamara diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx index d6a70186231a..37dc2807574d 100644 --- a/sw/source/core/layout/findfrm.cxx +++ b/sw/source/core/layout/findfrm.cxx @@ -178,7 +178,7 @@ bool SwLayoutFrame::ContainsDeleteForbiddenLayFrame() const continue; } SwLayoutFrame const*const pLay(static_cast(pFrame)); -if (pLay->ContainsDeleteForbiddenLayFrame()) +if (pLay->ContainsDeleteForbiddenLayFrame() || pLay->IsColLocked()) { return true; }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/doc/DocumentRedlineManager.cxx | 13 + sw/source/core/docnode/ndtbl.cxx | 11 ++- 2 files changed, 19 insertions(+), 5 deletions(-) New commits: commit 809e7f777aa58d38f6aca6105b1659a09d22579c Author: Michael Stahl AuthorDate: Wed Jul 19 15:58:36 2023 +0200 Commit: Caolán McNamara CommitDate: Mon Jul 31 22:16:56 2023 +0200 tdf#153115 sw: SwDoc::TextToTable(), first remove all redlines The problem is that there are redlines that overlap the created table cell nodes. For the writerfilter-import-API TextToTable() that was solved by splitting the redlines, but that would take a lot of effort here as it's not known ahead of time where the cells start and end, so just get rid of the redlines. Another issue is that the temporary SwPaM in DocumentRedlineManager::AcceptRedline() caused ~SwIndexReg() assert. (reportedly regression from commit 471212d464f54054f7419ef1890267d0def852d9) Change-Id: I6b211b6c8e5c7e4bdab1dac858707d7d7fd85029 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154655 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit cd20d9512aa4f9fbe39fce48b3c49cdb13cca6e6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154621 Reviewed-by: Caolán McNamara diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx index 60ddf9d62151..1d0e2b561859 100644 --- a/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/sw/source/core/doc/DocumentRedlineManager.cxx @@ -2903,17 +2903,22 @@ bool DocumentRedlineManager::AcceptRedline( const SwPaM& rPam, bool bCallDelete // The Selection is only in the ContentSection. If there are Redlines // to Non-ContentNodes before or after that, then the Selections // expand to them. -SwPaM aPam( *rPam.GetMark(), *rPam.GetPoint() ); -lcl_AdjustRedlineRange( aPam ); +std::shared_ptr const pPam(m_rDoc.CreateUnoCursor(*rPam.GetPoint(), false)); +if (rPam.HasMark()) +{ +pPam->SetMark(); +*pPam->GetMark() = *rPam.GetMark(); +} +lcl_AdjustRedlineRange(*pPam); if (m_rDoc.GetIDocumentUndoRedo().DoesUndo()) { m_rDoc.GetIDocumentUndoRedo().StartUndo( SwUndoId::ACCEPT_REDLINE, nullptr ); -m_rDoc.GetIDocumentUndoRedo().AppendUndo( std::make_unique( aPam )); + m_rDoc.GetIDocumentUndoRedo().AppendUndo(std::make_unique(*pPam)); } int nRet = lcl_AcceptRejectRedl( lcl_AcceptRedline, maRedlineTable, - bCallDelete, aPam ); + bCallDelete, *pPam ); if( nRet > 0 ) { CompressRedlines(); diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 8b8e1b6af15e..a9d8494bf442 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -635,6 +635,16 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTableOpts, return nullptr; } +if (GetIDocumentUndoRedo().DoesUndo()) +{ +GetIDocumentUndoRedo().StartUndo(SwUndoId::TEXTTOTABLE, nullptr); +} + +// tdf#153115 first, remove all redlines; splitting them at cell boundaries +// would be tricky to implement, and it's unclear what the value of +// existing redlines is once it's been converted to a table +getIDocumentRedlineAccess().AcceptRedline(rRange, true); + // Save first node in the selection if it is a context node SwContentNode * pSttContentNd = pStt->GetNode().GetContentNode(); @@ -645,7 +655,6 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTableOpts, SwUndoTextToTable* pUndo = nullptr; if( GetIDocumentUndoRedo().DoesUndo() ) { -GetIDocumentUndoRedo().StartUndo( SwUndoId::TEXTTOTABLE, nullptr ); pUndo = new SwUndoTextToTable( aOriginal, rInsTableOpts, cCh, o3tl::narrowing(eAdjust), pTAFormat ); GetIDocumentUndoRedo().AppendUndo( std::unique_ptr(pUndo) );
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/unocore/unoobj2.cxx | 42 +++-- 1 file changed, 31 insertions(+), 11 deletions(-) New commits: commit 5f2c15fb652753fddf74c171abdf58295597366d Author: Michael Stahl AuthorDate: Fri Jul 28 17:33:20 2023 +0200 Commit: Caolán McNamara CommitDate: Mon Jul 31 22:14:26 2023 +0200 tdf#149555 sw: convert RANGE_IS_SECTION SwXTextRange if possible The writerfilter import got an exception in SectionPropertyMap::CloseSectionGroup() because XTextRangeToSwPaM() can't handle RANGE_IS_SECTION SwXTextRange. (regression from commit 7ab349296dac79dad3fec09f60348efcbb9ea17e) Change-Id: I38b37fdec64f4699c0fa1a090c72a8676ff386a6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155026 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 0f39ecfed57f3f32d4f5cadf50b7dd9de77f8d7e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154969 Reviewed-by: Caolán McNamara diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx index f1c5a7e3675a..4eb527c5111e 100644 --- a/sw/source/core/unocore/unoobj2.cxx +++ b/sw/source/core/unocore/unoobj2.cxx @@ -1064,20 +1064,40 @@ void SAL_CALL SwXTextRange::setString(const OUString& rString) bool SwXTextRange::GetPositions(SwPaM& rToFill, ::sw::TextRangeMode const eMode) const { -if (RANGE_IS_SECTION == m_pImpl->m_eRangePosition -&& eMode == ::sw::TextRangeMode::AllowNonTextNode) +if (RANGE_IS_SECTION == m_pImpl->m_eRangePosition) { if (auto const pSectFormat = static_cast(m_pImpl->m_pTableOrSectionFormat)) { -SwNodeIndex const*const pSectionNode(pSectFormat->GetContent().GetContentIdx()); -assert(pSectionNode); -assert(pSectionNode->GetNodes().IsDocNodes()); -rToFill.GetPoint()->Assign( pSectionNode->GetNode(), SwNodeOffset(1) ); -rToFill.SetMark(); -rToFill.GetMark()->Assign( *pSectionNode->GetNode().EndOfSectionNode(), SwNodeOffset(-1) ); -if (const SwContentNode* pCNd = rToFill.GetMark()->GetContentNode()) -rToFill.GetMark()->AssignEndIndex(*pCNd); -return true; +if (eMode == ::sw::TextRangeMode::AllowNonTextNode) +{ +SwNodeIndex const*const pSectionNode(pSectFormat->GetContent().GetContentIdx()); +assert(pSectionNode); +assert(pSectionNode->GetNodes().IsDocNodes()); +rToFill.GetPoint()->Assign( pSectionNode->GetNode(), SwNodeOffset(1) ); +rToFill.SetMark(); +rToFill.GetMark()->Assign( *pSectionNode->GetNode().EndOfSectionNode(), SwNodeOffset(-1) ); +if (const SwContentNode* pCNd = rToFill.GetMark()->GetContentNode()) +rToFill.GetMark()->AssignEndIndex(*pCNd); +return true; +} +else +{ +SwPaM aPaM(*pSectFormat->GetContent().GetContentIdx()); +aPaM.Move(fnMoveForward, GoInContent); +assert(aPaM.GetPoint()->GetNode() < *pSectFormat->GetContent().GetContentIdx()->GetNode().EndOfSectionNode()); +aPaM.SetMark(); +*aPaM.GetPoint() = SwPosition(*pSectFormat->GetContent().GetContentIdx()->GetNode().EndOfSectionNode()); +aPaM.Move(fnMoveBackward, GoInContent); +assert(*pSectFormat->GetContent().GetContentIdx() < aPaM.GetPoint()->GetNode()); +// tdf#149555 if there is no table involved, only nested +// sections, then PaM is valid +if (aPaM.GetPoint()->GetNode().FindTableNode() +== aPaM.GetMark()->GetNode().FindTableNode()) +{ +rToFill = aPaM; +return true; +} +} } } ::sw::mark::IMark const * const pBkmk = m_pImpl->GetBookmark();
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/layout/flowfrm.cxx |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) New commits: commit 9c5c63d567be3623d609feda47026631cb48263b Author: Satya AuthorDate: Mon Jul 31 20:59:07 2023 +0530 Commit: Justin Luth CommitDate: Mon Jul 31 20:04:22 2023 +0200 tdf#156372 sw: Stop adding GetLower to every cell in header table The code was doubling the lower spacing of the last paragraph in every cell of the table. This change is to not add the space when in tables, since that was intended to only apply to the last paragraph in the header. Change-Id: Ia8c2b31e3e56302735e858c39f80cc35e190af6b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154643 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155101 diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index 1b9ecf1cf03c..01f6b9e3cb34 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -1811,9 +1811,11 @@ SwTwips SwFlowFrame::CalcLowerSpace( const SwBorderAttrs* _pAttrs ) const // tdf#128195 Consider para spacing below last paragraph in header bool bHasSpacingBelowPara = m_rThis.GetUpper()->GetFormat()->getIDocumentSettingAccess().get( DocumentSettingId::HEADER_SPACING_BELOW_LAST_PARA); -if (bHasSpacingBelowPara && !m_rThis.IsInFly() && m_rThis.FindFooterOrHeader() && !GetFollow() -&& !m_rThis.GetIndNext()) +if (bHasSpacingBelowPara && !m_rThis.IsInTab() && !m_rThis.IsInFly() +&& m_rThis.FindFooterOrHeader() && !GetFollow() && !m_rThis.GetIndNext()) +{ nLowerSpace += _pAttrs->GetULSpace().GetLower() + _pAttrs->CalcLineSpacing(); +} return nLowerSpace; }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/layout/frmtool.cxx | 10 ++ 1 file changed, 10 insertions(+) New commits: commit b81829dc7aa94e92818d2545cd28f1ef6c298395 Author: Michael Stahl AuthorDate: Tue Jul 18 16:58:34 2023 +0200 Commit: Caolán McNamara CommitDate: Thu Jul 27 15:25:01 2023 +0200 tdf#146258 sw: invalidate section frame for new text frame at start SwFlowFrame::CalcUpperSpace() uses the first text frame inside to compute the upper margin of section frames. Before commit 69d2d24b3579ad21fb1ba2746f81a02f8bbfb984 this was working because a temporary SwTextFrame for the new SwTextNode was created and then deleted again, but while it was alive the SvULSpace item was copied and then it invalidated the section frame: 1 SwFrame::InvalidatePrt_() 2 SwContentFrame::Modify() at libreoffice-6-1/sw/source/core/layout/wsfrm.cxx:2336 3 SwTextFrame::SwClientNotify() ... 7 SwTextNode::Modify() 8 SwContentNode::SetAttr() 9 SwTextNode::SetAttr() 10 SwAttrSet::CopyToModify() 11 SwTextNode::CopyText() 12 SwTextNode::CopyText() 13 SwTextNode::MakeCopy() 14 SwNodes::CopyNodes() 15 sw::DocumentContentOperationsManager::CopyWithFlyInFly() 16 SwIntrnlSectRefLink::DataChanged() Now however nothing invalidates the section frame, so do it in InsertCnt_(), hopefully it works for columned sections too. (regression from commit 166b5010b402a41b192b1659093a25acf9065fd9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154594 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 34b607bb455bd30d3adf8e3f72182c7cc4d062ee) [commit 34b607bb455bd30d3adf8e3f72182c7cc4d062ee used wrong issue id] Change-Id: I339286ac37c9ee9a0bef730a73215bc139386514 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154614 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index f477400aea49..a1bb7d44bf71 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -1606,6 +1606,16 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc, pPageMaker->CheckInsert( nIndex ); pFrame->InsertBehind( pLay, pPrv ); +if (!pPrv) +{ +if (SwSectionFrame *const pSection = pLay->FindSctFrame()) +{ +if (pSection && pSection->ContainsAny() == pFrame) +{ // tdf#146258 section PrtArea depends on paragraph upper margin +pSection->InvalidatePrt(); +} +} +} // #i27138# // notify accessibility paragraphs objects about changed // CONTENT_FLOWS_FROM/_TO relation.
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/text/widorp.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit f70f822532d96feebd24645009f0368405dac9e4 Author: Michael Stahl AuthorDate: Mon Jul 17 21:37:07 2023 +0200 Commit: Caolán McNamara CommitDate: Thu Jul 27 15:24:22 2023 +0200 tdf#153319 sw: don't move footnotes to follow if portions in master SwTextFrameBreak::IsInside() may be called in different situations, during formatting it should be possible to move the footnotes, but when called from SwTextFrame::CalcPreps() this is problematic as it does not format the lines, it iterates over existing lines. The problem is that the footnote frame is moved to the follow's page, but the footnote portion remains on the master, and then the follow is joined while the footnote frame's mpReference still points to it. (regression from commit 391613785ae6fbb735cf7a86ea2f6a93161a8769) Change-Id: I4290dcd242a7f5292ad4f50c1407c9cd88e80a6a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154557 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 7e9b2b71db72b8c4c9c6ca83d08d3b6b05775ac8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154545 Reviewed-by: Caolán McNamara diff --git a/sw/source/core/text/widorp.cxx b/sw/source/core/text/widorp.cxx index ceae9ee8d70c..b4fe1f9d4440 100644 --- a/sw/source/core/text/widorp.cxx +++ b/sw/source/core/text/widorp.cxx @@ -178,6 +178,8 @@ bool SwTextFrameBreak::IsInside( SwTextMargin const ) const } } if (!bFit && rLine.MaybeHasHints() && m_pFrame->GetFollow() +// tdf#153319 RemoveFootnote only works if this frame doesn't +&& !rLine.GetNext() // contain the footnote portion // if using same footnote container as the follow, pointless to try? && m_pFrame->FindFootnoteBossFrame() != m_pFrame->GetFollow()->FindFootnoteBossFrame()) {
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/edit/edfcol.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit 88db6f673e7e9ade442ff08f1e5ddace47d475df Author: Khaled Hosny AuthorDate: Tue Jul 25 17:18:48 2023 +0300 Commit: خالد حسني CommitDate: Wed Jul 26 13:13:05 2023 +0200 tdf#156368: Fix setting watermark font for CJK/CTL text We were setting only Western font when getting the shape, so if there is no Western characters in the text the default font would be used. There is no separate setting for CJK/CTL fonts, so we sets the same font for all the three. Change-Id: If2ba2a206f95e0efe9139b9d092b1d6dbf05967c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154894 Tested-by: Jenkins Reviewed-by: خالد حسني (cherry picked from commit 24d0a62bd75b9a895c419aa165da648ab18f134d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154920 Reviewed-by: Michael Stahl diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx index 47b4eb61684d..9ac72b6a2902 100644 --- a/sw/source/core/edit/edfcol.cxx +++ b/sw/source/core/edit/edfcol.cxx @@ -1577,6 +1577,8 @@ static void lcl_placeWatermarkInHeader(const SfxWatermarkItem& rWatermark, xPropertySet->setPropertyValue(UNO_NAME_HORI_ORIENT_RELATION, uno::Any(text::RelOrientation::PAGE_PRINT_AREA)); xPropertySet->setPropertyValue(UNO_NAME_VERT_ORIENT_RELATION, uno::Any(text::RelOrientation::PAGE_PRINT_AREA)); xPropertySet->setPropertyValue(UNO_NAME_CHAR_FONT_NAME, uno::Any(sFont)); +xPropertySet->setPropertyValue(UNO_NAME_CHAR_FONT_NAME_ASIAN, uno::Any(sFont)); +xPropertySet->setPropertyValue(UNO_NAME_CHAR_FONT_NAME_COMPLEX, uno::Any(sFont)); xPropertySet->setPropertyValue(UNO_NAME_CHAR_HEIGHT, uno::Any(WATERMARK_AUTO_SIZE)); xPropertySet->setPropertyValue("Transformation", uno::Any(aMatrix));
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/docnode/ndtbl.cxx |6 ++ 1 file changed, 6 insertions(+) New commits: commit d60f4042bdc1dac465d38fcfae85b34630759be3 Author: Michael Stahl AuthorDate: Fri Jul 14 14:44:59 2023 +0200 Commit: Caolán McNamara CommitDate: Mon Jul 24 22:53:11 2023 +0200 tdf#156267 sw: remove DdeBookmarks in SwDoc::DelTable() On Copy, a SwTransferDdeLink is created, which also creates a DDE_BOOKMARK (it's the only thing that does that) without Undo. On Delete, the DelTable() creates SwUndoDelete which creates a SwHistoryBookmark; then the DeleteAndJoin() deletes the DdeBookmark. On Undo, the SwHistoryBookmark doesn't find its bookmark, and crashes. Because the DdeBookmark is artificial and deliberately created without Undo, DelTable() should prevent the SwHistoryBookmark by deleting it first. (regression from commit d81379db730a163c5ff75d4f3a3cddbd7b5eddda) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154440 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 4270552395600487f9d680cfdc9cd0ad6f457497) cid#1538889 Pointer to local outside scope Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154767 Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara (cherry picked from commit b6f3b76fb611a5f2c7f32296bc86316b6abb32cb) Change-Id: Ib24c788a49a6fee364b44a1dbc8d53870c074596 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154450 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index d004bbc32055..8b8e1b6af15e 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -1926,6 +1926,12 @@ void SwDoc::DeleteCol( const SwCursor& rCursor ) void SwDoc::DelTable(SwTableNode *const pTableNd) { +{ +// tdf#156267 remove DdeBookmarks before deleting nodes +SwPaM aTmpPaM(*pTableNd, *pTableNd->EndOfSectionNode()); +SwDataChanged aTmp(aTmpPaM); +} + bool bNewTextNd = false; // Is it alone in a FlyFrame? SwNodeIndex aIdx( *pTableNd, -1 );
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/layout/paintfrm.cxx |8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) New commits: commit 0a5c49aa4f65c8e661f7da3934ab9bea8cacf662 Author: László Németh AuthorDate: Tue Jul 18 16:41:52 2023 +0200 Commit: László Németh CommitDate: Thu Jul 20 12:19:58 2023 +0200 tdf#150308 sw: fix missing top table border after hidden table rows First visible line of a table with preceding hidden deleted rows hid also the top border of the table, if the inner horizontal row borders drawn only by bottom-only borders (like in the default table style). Note: re-use an existing workaround to show the missing line, see commit 3a4b7c3555f2ffb4e89502bb04ff063d8c08f628 "fdo#39415: sw: fix collapsing border painting more:" Note: layout testing doesn't work, because of the missing calculation with the width of the enabled border of the row frame. Also there is a problem with metafile testing (empty meta file?). Change-Id: Ia8476a2ec592be1dc36e0ea71c10a71c257c29e0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154595 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit 379acb934164e673b708d0f3ec6b3ec046c8d73f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154612 Tested-by: László Németh (cherry picked from commit bd392b1f7a7378e571e67858cb4bff3161ef07c1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154626 Reviewed-by: Michael Stahl diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index dbb1272efa9e..e86ad990f83c 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -2798,6 +2798,8 @@ void SwTabFramePainter::FindStylesForLine( Point& rStartPoint, /** * Special case: #i9860# * first line in follow table without repeated headlines + * Special case: tdf#150308 + * first visible line of a table with preceding hidden deleted rows */ static bool lcl_IsFirstRowInFollowTableWithoutRepeatedHeadlines( SwTabFrame const& rTabFrame, SwFrame const& rFrame, SvxBoxItem const& rBoxItem) @@ -2806,7 +2808,11 @@ static bool lcl_IsFirstRowInFollowTableWithoutRepeatedHeadlines( dynamic_cast(rFrame.GetUpper()); return (pThisRowFrame && (pThisRowFrame->GetUpper() == ) -&& rTabFrame.IsFollow() +&& ( rTabFrame.IsFollow() +// tdf#150308 first table row isn't equal to the table row of the first +// row frame of the first table frame: there are invisible deleted rows +// in Hide Changes mode before the first visible table row +|| rTabFrame.GetTable()->GetTabLines().front() != pThisRowFrame->GetTabLine() ) && !rTabFrame.GetTable()->GetRowsToRepeat() && ( !pThisRowFrame->GetPrev() || static_cast(pThisRowFrame->GetPrev())
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/crsr/crstrvl.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit 30933ad497fe0e8dd6af36721561706886ed0281 Author: Bjoern Michaelsen AuthorDate: Fri Jul 14 01:03:56 2023 +0200 Commit: Michael Stahl CommitDate: Fri Jul 14 15:09:58 2023 +0200 tdf#153866: Fix TOX crash Im not sure why it should be valid that the ContentFrame should ever be nullptr here, but a simple check prevents the immediate crash. Change-Id: I19a2d04e41271ae6a5b6a3a79c31c3efd5db7875 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154404 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit d86a6d2b47c6a22d185dc631388ca3f2c0386a35) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154417 diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index 0cf968a3d7e9..a1916c6cf691 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -365,6 +365,8 @@ void SwCursorShell::GotoTOXMarkBase() // Take the 1. and get the index type. Ask it for the actual index. const SwTOXType* pType = aMarks[0]->GetTOXType(); auto pContentFrame = pType->FindContentFrame(*GetDoc(), *GetLayout()); +if(!pContentFrame) +return; SwCallLink aLk(*this); // watch Cursor-Moves SwCursorSaveState aSaveState(*m_pCurrentCursor); assert(pContentFrame->IsTextFrame());
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/unocore/unostyle.cxx | 15 +++ 1 file changed, 15 insertions(+) New commits: commit bfc1eecc83a6b3b71fc7d5b5aa09389d682c611d Author: Michael Stahl AuthorDate: Tue Jul 4 14:54:47 2023 +0200 Commit: Caolán McNamara CommitDate: Sat Jul 8 22:38:14 2023 +0200 tdf#156155 sw: export draw:fill to top-level ODF graphic styles The default for XATTR_FILLSTYLE for Writer flys differs from the default in the item pool, which is intended for svx shapes/SdrObjects. This is implemented with an intermediate mpDfltFrameFormat but it needs some special handling so the attribute ends up in the styles.xml. Change-Id: I8f369809a9f3b7e85a8bc7ad5d309dbc3cd6ccfe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153970 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 9410a22cdbe7c977206456218c75683a305ef79e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153994 Reviewed-by: Caolán McNamara diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 3402d34ef060..2cdab9f14431 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -2573,6 +2573,21 @@ uno::Sequence SwXStyle::getPropertyStates(const uno::Seque } } break; +case XATTR_FILLSTYLE: +{ +if (m_rEntry.m_eFamily == SfxStyleFamily::Frame +&& xStyle->GetFrameFormat()->DerivedFrom() == GetDoc()->GetDfltFrameFormat()) +{ // tdf#156155 mpDfltFrameFormat is the parent, but because +// it IsDefault() it is not enumerated/exported as a style +// to ODF, so export its one important value here. +pStates[i] = beans::PropertyState_DIRECT_VALUE; +} +else +{ +pStates[i] = pPropSet->getPropertyState(*pEntry, *pSourceSet); +} +} +break; case RES_BACKGROUND: { // for FlyFrames we need to mark the used properties from type RES_BACKGROUND
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/txtnode/ndtxt.cxx |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) New commits: commit 98843d0817ec676576c5c224d158636599379144 Author: Xisco Fauli AuthorDate: Tue Jul 4 17:56:05 2023 +0200 Commit: Michael Stahl CommitDate: Fri Jul 7 11:16:27 2023 +0200 sw: fix crash in SwTextNode::Update FindPageFrame might return nullptr Introduced with c684301352bcca709bc8d1c99e0f08e7096e9716 "(related: tdf#149595) sw: also re-sort SwSortedObjs on SwPageFrame" See https://crashreport.libreoffice.org/stats/signature/SwTextNode::Update(SwContentIndex%20const%20&,long,SwContentIndexReg::UpdateMode) Change-Id: I2e8df1428400f6752eafaaa6102a1fc3de3f0daa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153977 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit a62af0444515ab28bc0ffdc8ff7f320ca962bbc0) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154112 diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index a334baf87634..9d5e0955d85e 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -1603,7 +1603,9 @@ void SwTextNode::Update( pSortedObjs->UpdateAll(); } // also sort the objs on the page frame -pSortedObjs = pFrame->FindPageFrame()->GetSortedObjs(); +if (SwPageFrame *pPage = pFrame->FindPageFrame()) +pSortedObjs = pPage->GetSortedObjs(); + if (pSortedObjs) // doesn't exist yet if called for inserting as-char fly { pSortedObjs->UpdateAll();
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/uibase/config/usrpref.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit dff8d3af57ebb4c3dab205e4deb966f5ebda55cd Author: Mike Kaganski AuthorDate: Wed Jul 5 15:30:30 2023 +0300 Commit: Caolán McNamara CommitDate: Wed Jul 5 22:57:06 2023 +0200 tdf#155462: Re-enable ShowScrollBarTips expert config ... accidentally broken by commit 4ed26badfd6fd9190cb6e54078b41eb38cb37dca. Change-Id: I407e1eab47277dd8fa00c123b32596557fd5f2a7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154038 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sw/source/uibase/config/usrpref.cxx b/sw/source/uibase/config/usrpref.cxx index e2599f4092b3..055949ef4b93 100644 --- a/sw/source/uibase/config/usrpref.cxx +++ b/sw/source/uibase/config/usrpref.cxx @@ -388,7 +388,7 @@ void SwLayoutViewConfig::Load() case 16: m_rParent.SetViewLayoutBookMode(bSet); break;// "ViewLayout/BookMode", case 17: m_rParent.SetDefaultPageMode(bSet,true); break;// "Other/IsSquaredPageMode", case 18: m_rParent.SetApplyCharUnit(bSet, true); break;// "Other/ApplyUserChar" -case 29: m_rParent.SetShowScrollBarTips(bSet); break;// "Window/ShowScrollBarTips", +case 19: m_rParent.SetShowScrollBarTips(bSet); break;// "Window/ShowScrollBarTips", } } }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/unocore/unoobj2.cxx | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) New commits: commit 98a3a5dc591e4317655895d2fd91b87890144332 Author: Xisco Fauli AuthorDate: Tue Jul 4 15:53:39 2023 +0200 Commit: Michael Stahl CommitDate: Wed Jul 5 11:24:54 2023 +0200 sw: fix crash in CreateParentXText See https://crashreport.libreoffice.org/stats/signature/SfxObjectShell::GetBaseModel() Change-Id: Idcfc8219b5765bca9c45819bde5f276ce68c45de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153971 Reviewed-by: Caolán McNamara Tested-by: Jenkins Reviewed-by: Xisco Fauli (cherry picked from commit a0669a1a4963b2611fb372c8394ea4530d2c9e96) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154003 Reviewed-by: Michael Stahl diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx index e5fefbc0e376..f1c5a7e3675a 100644 --- a/sw/source/core/unocore/unoobj2.cxx +++ b/sw/source/core/unocore/unoobj2.cxx @@ -1319,12 +1319,14 @@ CreateParentXText(SwDoc & rDoc, const SwPosition& rPos) break; default: { -// then it is the body text -const uno::Reference xModel = -rDoc.GetDocShell()->GetBaseModel(); -const uno::Reference< text::XTextDocument > xDoc( -xModel, uno::UNO_QUERY); -xParentText = xDoc->getText(); +if (SwDocShell *const pDocSh = rDoc.GetDocShell()) +{ +// then it is the body text +const uno::Reference xModel = pDocSh->GetBaseModel(); +const uno::Reference< text::XTextDocument > xDoc( +xModel, uno::UNO_QUERY); +xParentText = xDoc->getText(); +} } } OSL_ENSURE(xParentText.is(), "no parent text?");
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/text/itrform2.cxx | 21 - 1 file changed, 12 insertions(+), 9 deletions(-) New commits: commit 2c813b3745e2da2001d318a60d911107bfefc32c Author: Justin Luth AuthorDate: Fri Jun 2 20:29:34 2023 -0400 Commit: Miklos Vajna CommitDate: Mon Jun 5 09:11:28 2023 +0200 tdf#153040 sw content controls PDF export: output listbox entry This fixes a 7.5 regression/wrong implementation. Prior to 7.5, content controls were just exported as plain text to PDF. Now that the content control is exported, the selected entry in the list box was not being printed - just a big hole in the text. Fixed by informing PDF of the selected entry. TODO: the content control starts too late (a somewhat wide space at the front), and ends too soon (the last portion of the text is cut off). The unit test for the TODO will cover this case, so skipping that for now since I found no examples to follow. Change-Id: I1412a57efc070010c6d0d0a37f48d63699b085b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152567 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index ab31c524ba40..dbf5765ef1b6 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -976,6 +976,13 @@ bool SwContentControlPortion::DescribePDFControl(const SwTextPaintInfo& rInf) co return true; } +const SwPaM aPam(*pTextNode, nEnd, *pTextNode, nStart); +static sal_Unicode const aForbidden[] = { +CH_TXTATR_BREAKWORD, +0 +}; +const OUString aText = comphelper::string::removeAny(aPam.GetText(), aForbidden); + std::unique_ptr pDescriptor; switch (pContentControl->GetType()) { @@ -999,9 +1006,13 @@ bool SwContentControlPortion::DescribePDFControl(const SwTextPaintInfo& rInf) co pDescriptor = std::make_unique(); auto pListWidget = static_cast(pDescriptor.get()); pListWidget->DropDown = true; +sal_Int32 nIndex = 0; for (const auto& rItem : pContentControl->GetListItems()) { pListWidget->Entries.push_back(rItem.m_aDisplayText); +if (rItem.m_aDisplayText == aText) +pListWidget->SelectedEntries.push_back(nIndex); +++nIndex; } break; } @@ -1048,15 +1059,7 @@ bool SwContentControlPortion::DescribePDFControl(const SwTextPaintInfo& rInf) co } // Map the text of the content control to the descriptor's text. -SwPosition aPoint(*pTextNode, nStart); -SwPosition aMark(*pTextNode, nEnd); -SwPaM aPam(aMark, aPoint); -OUString aText = aPam.GetText(); -static sal_Unicode const aForbidden[] = { -CH_TXTATR_BREAKWORD, -0 -}; -pDescriptor->Text = comphelper::string::removeAny(aText, aForbidden); +pDescriptor->Text = aText; // Calculate the bounding rectangle of this content control, which can be one or more layout // portions in one or more lines.
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/text/txtftn.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 445698dca110520673c89138b80e822a5d8086b5 Author: Caolán McNamara AuthorDate: Thu Jun 1 20:49:22 2023 +0100 Commit: Xisco Fauli CommitDate: Fri Jun 2 11:29:00 2023 +0200 Related: tdf#122081 null-deref of SwFootnoteFrame load doc, ctrl+end, ctrl+home, ctrl+6 enter 29, return, wheel scroll down 7 or 8 times and this null-deref Change-Id: I1963a89e3223de89f3414e435accd8d8ebfe80a9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152511 Tested-by: Jenkins Reviewed-by: Caolán McNamara (cherry picked from commit 389a8d52d9961f89c0b2847b30ee1ca59a8fdc80) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152447 Reviewed-by: Xisco Fauli diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx index c86c1bc4ab0d..035158e2bd25 100644 --- a/sw/source/core/text/txtftn.cxx +++ b/sw/source/core/text/txtftn.cxx @@ -664,7 +664,7 @@ void SwTextFrame::ConnectFootnote( SwTextFootnote *pFootnote, const SwTwips nDea mbInFootnoteConnect = false; return; } -else if( pSrcFrame ) +else if (pSrcFrame && pFootnoteFrame) { SwFootnoteBossFrame *pFootnoteBoss = pFootnoteFrame->FindFootnoteBossFrame(); if( !pFootnoteBoss->IsInSct() ||
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/uibase/uiview/viewmdi.cxx | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) New commits: commit 10c79e145477e7a247c491756e5cd8ae0317ddaa Author: Michael Stahl AuthorDate: Tue May 30 14:49:22 2023 +0200 Commit: Xisco Fauli CommitDate: Wed May 31 10:15:50 2023 +0200 sw: SwView::SetZoom_() shouldn't subtract page margins In the PAGEWIDTH mode, this has the annoying habit of changing the zoom factor when moving the cursor between a page with a mirrored page style and a page with a non-mirrored page style. Change-Id: I0e4290432ebaa5012b10d896fc96ae53b39fa475 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152391 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 0c1aa15d05cc52e3f2b34d0ccc9fc47bcf2f379b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152329 Reviewed-by: Xisco Fauli diff --git a/sw/source/uibase/uiview/viewmdi.cxx b/sw/source/uibase/uiview/viewmdi.cxx index f2c9ad63034a..932d80b70250 100644 --- a/sw/source/uibase/uiview/viewmdi.cxx +++ b/sw/source/uibase/uiview/viewmdi.cxx @@ -121,14 +121,15 @@ void SwView::SetZoom_( const Size , SvxZoomType eZoomType, const MapMode aTmpMap( MapUnit::MapTwip ); const Size aWindowSize( GetEditWin().PixelToLogic( rEditSize, aTmpMap ) ); -if( UseOnPage::Mirror == rDesc.GetUseOn() )// mirrored pages -{ -const SvxLRSpaceItem = rDesc.GetLeft().GetLRSpace(); -aPageSize.AdjustWidth(std::abs( rLeftLRSpace.GetLeft() - rLRSpace.GetLeft() ) ); -} - if( SvxZoomType::OPTIMAL == eZoomType ) { +// unclear if this is useful for OPTIMAL, or completely useless? +if( UseOnPage::Mirror == rDesc.GetUseOn() )// mirrored pages +{ +const SvxLRSpaceItem = rDesc.GetLeft().GetLRSpace(); +aPageSize.AdjustWidth(std::abs( rLeftLRSpace.GetLeft() - rLRSpace.GetLeft() ) ); +} + if (!pPostItMgr->HasNotes() || !pPostItMgr->ShowNotes()) aPageSize.AdjustWidth( -( rLRSpace.GetLeft() + rLRSpace.GetRight() + nLeftOfst * 2 ) ); lLeftMargin = rLRSpace.GetLeft() + DOCUMENTBORDER + nLeftOfst;
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/text/porlay.cxx | 24 1 file changed, 24 deletions(-) New commits: commit 72835e8283f871e94c26049b06e813a804d2d04b Author: Khaled Hosny AuthorDate: Sun May 28 16:28:52 2023 +0300 Commit: Xisco Fauli CommitDate: Tue May 30 11:52:03 2023 +0200 tdf#139863, tdf#155514: Don’t split COMPLEX text portions When a COMPLEX text portion contains more than one script, it gets split into multiple portions. This is broken into more than one way: * ScriptTypeDetector::endOfCTLScriptType() does not handle surrogate pairs, so it split the portion in the middle of a surrogate pair, causing tdf#139863. * If a combing mark of a different COMPLEX script is used, it gets split into its own portion, causing tdf#155514 This was supposedly done to fix https://bz.apache.org/ooo/show_bug.cgi?id=28203, but testing the documents from this bug report with this change does not show recurrence of any of the kashida issue, so this split is unnecessary. Change-Id: I9bd60efe3023b96ee74f861a5dc15a2229c27d79 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152354 Tested-by: Jenkins Reviewed-by: خالد حسني (cherry picked from commit 98f7ec383db74a6491e925e30125d3fbf270afc2) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152318 Reviewed-by: Xisco Fauli diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx index 3b00fac71031..5dda6c2ac0e2 100644 --- a/sw/source/core/text/porlay.cxx +++ b/sw/source/core/text/porlay.cxx @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include @@ -1447,29 +1446,6 @@ void SwScriptInfo::InitScriptInfo(const SwTextNode& rNode, if (nChg > TextFrameIndex(rText.getLength()) || nChg < TextFrameIndex(0)) nChg = TextFrameIndex(rText.getLength()); -// #i28203# -// for 'complex' portions, we make sure that a portion does not contain more -// than one script: -if( i18n::ScriptType::COMPLEX == nScript ) -{ -const short nScriptType = ScriptTypeDetector::getCTLScriptType( -rText, sal_Int32(nSearchStt) ); -TextFrameIndex nNextCTLScriptStart = nSearchStt; -short nCurrentScriptType = nScriptType; -while( css::i18n::CTLScriptType::CTL_UNKNOWN == nCurrentScriptType || nScriptType == nCurrentScriptType ) -{ -nNextCTLScriptStart = TextFrameIndex( -ScriptTypeDetector::endOfCTLScriptType( -rText, sal_Int32(nNextCTLScriptStart))); -if (nNextCTLScriptStart >= TextFrameIndex(rText.getLength()) -|| nNextCTLScriptStart >= nChg) -break; -nCurrentScriptType = ScriptTypeDetector::getCTLScriptType( -rText, sal_Int32(nNextCTLScriptStart)); -} -nChg = std::min( nChg, nNextCTLScriptStart ); -} - // special case for dotted circle since it can be used with complex // before a mark, so we want it associated with the mark's script if (nChg < TextFrameIndex(rText.getLength()) && nChg > TextFrameIndex(0)
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/docnode/node.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit d995cdd8f67a5015e71c5676e400c79a853a57a3 Author: Xisco Fauli AuthorDate: Tue May 23 12:39:50 2023 +0200 Commit: Michael Stahl CommitDate: Fri May 26 13:34:09 2023 +0200 sw: fix crash in SwNode::GetFlyFormat() FindFlyFrame() might return nullptr See https://crashreport.libreoffice.org/stats/signature/SwNode::GetFlyFormat() Change-Id: Id99a806e62f03b8912747525c8b0235c1b23232b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152156 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit e518624da1bdad5fcb24feb41349efa4301329e3) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152210 diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index c50435e076fb..ced3b00c78eb 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -745,7 +745,7 @@ SwFrameFormat* SwNode::GetFlyFormat() const if( IsContentNode() ) { SwContentFrame* pFrame = SwIterator(*static_cast(this)).First(); -if( pFrame ) +if( pFrame && pFrame->FindFlyFrame()) pRet = pFrame->FindFlyFrame()->GetFormat(); } if( !pRet )
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/doc/DocumentLayoutManager.cxx |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) New commits: commit 05d8be5c4a13be63cfbea58954f1b0c4d8a9837f Author: Xisco Fauli AuthorDate: Fri May 19 16:12:18 2023 +0200 Commit: Michael Stahl CommitDate: Wed May 24 11:10:00 2023 +0200 sw: fix crash in DocumentLayoutManager::CopyLayoutFormat See https://crashreport.libreoffice.org/stats/signature/sw::DocumentLayoutManager::CopyLayoutFormat(SwFrameFormat%20const%20&,SwFormatAnchor%20const%20&,bool,bool) Change-Id: I1680bb79be4c1eb2ff18ed46dfa286da5e729e63 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152015 Reviewed-by: Michael Stahl Tested-by: Jenkins (cherry picked from commit 77bc0d1d7c0b895d089fa7ac2f7ca5221345b71a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152102 diff --git a/sw/source/core/doc/DocumentLayoutManager.cxx b/sw/source/core/doc/DocumentLayoutManager.cxx index e0366bdd3a0b..75c8e86acdb2 100644 --- a/sw/source/core/doc/DocumentLayoutManager.cxx +++ b/sw/source/core/doc/DocumentLayoutManager.cxx @@ -454,8 +454,9 @@ SwFrameFormat *DocumentLayoutManager::CopyLayoutFormat( { SwNode* pAnchorNode = rNewAnchor.GetAnchorNode(); SwFormatFlyCnt aFormat( pDest ); -pAnchorNode->GetTextNode()->InsertItem( -aFormat, rNewAnchor.GetAnchorContentOffset(), 0 ); +assert(pAnchorNode->GetTextNode() && "sw.core: text node expected"); +if (SwTextNode *pTextNd = pAnchorNode->GetTextNode()) +pTextNd->InsertItem( aFormat, rNewAnchor.GetAnchorContentOffset(), 0 ); } if( bMakeFrames )
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/uibase/uiview/view.cxx |7 +++ 1 file changed, 7 insertions(+) New commits: commit 96be41d5ba28e1d3b361efdad5e8cad9d9d0fe77 Author: Noel Grandin AuthorDate: Mon May 22 16:12:23 2023 +0200 Commit: Noel Grandin CommitDate: Wed May 24 08:10:33 2023 +0200 tdf#155410 speedup shutdown when document has lots of images prevent unnecessary broadcasting during teardown of draw model regression from commit 8611f6e259b807b4f19c8dc0eab86ca648891ce3 ref-count SdrObject The above patch seems to have changed the destruction ordering and now we do lots of unnecessary broadcasting. Change-Id: I90f4e560bc82834246a323275d13ef8ee8abeae0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152140 Tested-by: Jenkins Reviewed-by: Noel Grandin (cherry picked from commit 4fac9a110961f19006c3041be0c4b920a5eafe7b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152104 diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx index 5b14cd43842b..1ef5049e7982 100644 --- a/sw/source/uibase/uiview/view.cxx +++ b/sw/source/uibase/uiview/view.cxx @@ -1145,7 +1145,14 @@ SwView::~SwView() m_pViewImpl->Invalidate(); EndListening(*GetViewFrame()); EndListening(*GetDocShell()); + +// tdf#155410 speedup shutdown, prevent unnecessary broadcasting during teardown of draw model +auto pDrawModel = GetWrtShell().getIDocumentDrawModelAccess().GetDrawModel(); +const bool bWasLocked = pDrawModel->isLocked(); +pDrawModel->setLock(true); m_pWrtShell.reset(); // reset here so that it is not accessible by the following dtors. +pDrawModel->setLock(bWasLocked); + m_pHScrollbar.disposeAndClear(); m_pVScrollbar.disposeAndClear(); m_pHRuler.disposeAndClear();
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/crsr/crsrsh.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit 8a7fbac52b29da29564e1533030f111ec7e4e9ac Author: Michael Stahl AuthorDate: Wed May 17 14:49:55 2023 +0200 Commit: Xisco Fauli CommitDate: Mon May 22 11:27:32 2023 +0200 tdf#155346 sw: fix crash from changing modal mode When closing the dialog, UpdateCursor() creates a table cursor for ExtendedSelectedAll() because mbSelectAll isn't set. 1 SwShellTableCursor::SwShellTableCursor 2 SwCursorShell::UpdateCursor 3 SwCursorShell::ShowCursor 4 SwView::ShowCursor 5 SfxViewFrame::Enable 6 SfxViewFrame::Notify 7 SfxBroadcaster::Broadcast 8 SfxObjectShell::SetModalMode_Impl 9 SfxViewFrame::SetModalMode (regression from commit d81379db730a163c5ff75d4f3a3cddbd7b5eddda) Change-Id: Ie73f8e42f764f8041288eb0850721a530d106a0e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151880 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 1458d2f935c50ab7f3e2f1277d1bc7d1b5b5f894) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151926 Reviewed-by: Xisco Fauli diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 53ccb4a839d3..03cecdbbd8bf 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -2661,6 +2661,8 @@ void SwCursorShell::ShowCursor() if( m_bBasicHideCursor ) return; +comphelper::FlagRestorationGuard g(mbSelectAll, StartsWith_() != StartsWith::None && ExtendedSelectedAll()); + m_bSVCursorVis = true; m_pCurrentCursor->SetShowTextInputFieldOverlay( true ); m_pCurrentCursor->SetShowContentControlOverlay(true);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/doc/docnum.cxx | 21 - 1 file changed, 16 insertions(+), 5 deletions(-) New commits: commit d77beaf8bcae20ac72193a0ba767b4a199258dbc Author: Xisco Fauli AuthorDate: Fri May 19 10:49:28 2023 +0200 Commit: Xisco Fauli CommitDate: Mon May 22 11:08:10 2023 +0200 sw: fix crash in GotoNextLayoutTextFrame/GotoPrevLayoutTextFrame See https://crashreport.libreoffice.org/stats/signature/sw::GotoPrevLayoutTextFrame(SwNodeIndex%20&,SwRootFrame%20const%20*) and https://crashreport.libreoffice.org/stats/signature/sw::GotoNextLayoutTextFrame(SwNodeIndex%20&,SwRootFrame%20const%20*) Change-Id: I2233078051bd653de5634f1e0dabab9c1f59acb0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151994 Reviewed-by: Michael Stahl Tested-by: Jenkins (cherry picked from commit 4269977853bd51c4fc7f93e497246da163d71f17) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152030 Reviewed-by: Xisco Fauli diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index b4d32ea25b61..703c15f2187d 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -1439,11 +1439,16 @@ GotoPrevLayoutTextFrame(SwNodeIndex & rIndex, SwRootFrame const*const pLayout) { if (rIndex.GetNode().IsTextNode()) { -if (rIndex.GetNode().GetRedlineMergeFlag() != SwNode::Merge::None && -// not a tracked row deletion in Hide Changes mode -rIndex.GetNode().GetTextNode()->getLayoutFrame(pLayout) ) +if (rIndex.GetNode().GetRedlineMergeFlag() != SwNode::Merge::None) { -rIndex = *static_cast(rIndex.GetNode().GetTextNode()->getLayoutFrame(pLayout))->GetMergedPara()->pFirstNode; +// not a tracked row deletion in Hide Changes mode +if (SwContentFrame* pFrame = rIndex.GetNode().GetTextNode()->getLayoutFrame(pLayout)) +{ +if (sw::MergedPara* pMerged = static_cast(pFrame)->GetMergedPara()) +{ +rIndex = pMerged->pFirstNode->GetIndex(); +} +} } } else if (rIndex.GetNode().IsEndNode()) @@ -1471,7 +1476,13 @@ GotoNextLayoutTextFrame(SwNodeIndex & rIndex, SwRootFrame const*const pLayout) { if (rIndex.GetNode().GetRedlineMergeFlag() != SwNode::Merge::None) { -rIndex = *static_cast(rIndex.GetNode().GetTextNode()->getLayoutFrame(pLayout))->GetMergedPara()->pLastNode; +if (SwContentFrame* pFrame = rIndex.GetNode().GetTextNode()->getLayoutFrame(pLayout)) +{ +if (sw::MergedPara* pMerged = static_cast(pFrame)->GetMergedPara()) +{ +rIndex = pMerged->pLastNode->GetIndex(); +} +} } } else if (rIndex.GetNode().IsTableNode())
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/ui/dbui/mmresultdialogs.cxx |6 ++ 1 file changed, 6 insertions(+) New commits: commit 9f31ebf85efa13bd6363efefdb7c1e8272fa823d Author: Noel Grandin AuthorDate: Thu May 18 15:24:56 2023 +0200 Commit: Xisco Fauli CommitDate: Fri May 19 13:24:42 2023 +0200 prevent crash in mail merge seen reports in crashreporter Change-Id: I10ecac363eea0292f9dc257769da6d060dc350f9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151962 Tested-by: Jenkins Reviewed-by: Noel Grandin (cherry picked from commit 9efbcce8b3f6f40a2687b9e4892527b6974227b7) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151920 Reviewed-by: Xisco Fauli diff --git a/sw/source/ui/dbui/mmresultdialogs.cxx b/sw/source/ui/dbui/mmresultdialogs.cxx index 8d733118bbb4..b3404a30231a 100644 --- a/sw/source/ui/dbui/mmresultdialogs.cxx +++ b/sw/source/ui/dbui/mmresultdialogs.cxx @@ -893,6 +893,12 @@ IMPL_LINK(SwMMResultEmailDialog, SendTypeHdl_Impl, weld::ComboBox&, rBox, void) IMPL_LINK_NOARG(SwMMResultEmailDialog, SendAsHdl_Impl, weld::Button&, void) { +// work around crash when calling constructor with no active view +if (!GetActiveView()) +{ +SAL_WARN("sw", "ignoring SendAs button click, because no active view"); +return; +} SwMailBodyDialog aDlg(m_xDialog.get()); aDlg.SetBody(m_sBody); if (RET_OK == aDlg.run())
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/layout/flowfrm.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 5af29292af4564357b18610467d69ac35ad8271c Author: Michael Stahl AuthorDate: Thu May 11 19:01:53 2023 +0200 Commit: Christian Lohmaier CommitDate: Wed May 17 14:01:07 2023 +0200 tdf#144494 sw: fix layout loop There is a pre-existing loop here, where page 1 is layouted, the text frame splits due to the fly taking up space, page 2 is layouted, the fly moves to page 2 (invalidating page 1) and thus the text frame splits again, page 1 is layouted, happy to see all the free space, and joins all its follows. Previously this was eventually terminated by layact.cxx:639 calling SwLayouter::LoopControl() and this force-validates page 1, resulting in page 1 having the fly (which is actually anchored at the end of the text frame, on page 2). Now the CheckPageDescs() discovers that page 3 doesn't have any content, and deletes it; this causes it to be re-created on every iteration of the loop and somehow the SwLayouter now doesn't detect the loop. But the call that deletes the page 3 is actually unnecessary: the text frame does have a SwPageDescItem - but it is itself a follow, where break items doesn't matter anyway - so just check for this to get back to the previous layout result. (regression from commit b9ef71476fd70bc13f50ebe80390e0730d1b7afb) Change-Id: If15c31278bd36e51c64090a288e8bd1ab6753dd7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151680 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit ac9500105cc72d84ce120fd1dc125329aadb63a0) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151618 Reviewed-by: Christian Lohmaier diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index 538cb2b8f35c..370ad84b88ff 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -2129,7 +2129,7 @@ bool SwFlowFrame::MoveFwd( bool bMakePage, bool bPageBreak, bool bMoveAlways ) // i#106452 // check page description not only in situation with sections. if ( !bSamePage && - ( m_rThis.GetPageDescItem().GetPageDesc() || + ((!IsFollow() && m_rThis.GetPageDescItem().GetPageDesc()) || pOldPage->GetPageDesc()->GetFollow() != pNewPage->GetPageDesc() ) ) { SwFrame::CheckPageDescs( pNewPage, false );
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/inc/viewimp.hxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit ae1876f189a1f92aba6a3a40656f9f557b7df23f Author: Caolán McNamara AuthorDate: Mon May 15 21:09:05 2023 +0100 Commit: Michael Stahl CommitDate: Tue May 16 12:19:53 2023 +0200 tdf#155349 std::move of a std::optional leave behind a set std::optional unlike std::move of a std::unique_ptr which leaves behind an empty std::unique_ptr so if HasPaintRegion was true before TakePaintRegion it was still true after TakePaintRegion Change-Id: I6569f5ccd8081cbcec42190c474a98c4e28030a9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151774 Reviewed-by: Michael Stahl Tested-by: Michael Stahl diff --git a/sw/source/core/inc/viewimp.hxx b/sw/source/core/inc/viewimp.hxx index f68c9c7f1f90..4b249154c2f8 100644 --- a/sw/source/core/inc/viewimp.hxx +++ b/sw/source/core/inc/viewimp.hxx @@ -152,7 +152,7 @@ public: bool AddPaintRect( const SwRect ); bool HasPaintRegion() { return m_oPaintRegion.has_value(); } -std::optional TakePaintRegion() { return std::move(m_oPaintRegion); } +std::optional TakePaintRegion() { auto ret = std::move(m_oPaintRegion); m_oPaintRegion.reset(); return ret; } const std::optional& GetPaintRegion() { return m_oPaintRegion; } void DeletePaintRegion() { m_oPaintRegion.reset(); }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/inc/unoflatpara.hxx |3 --- sw/source/core/unocore/unoflatpara.cxx |6 -- 2 files changed, 9 deletions(-) New commits: commit 193c0f20fc1f8f836ebdabac0d8a1065162653a7 Author: Mike Kaganski AuthorDate: Fri May 12 23:05:33 2023 +0300 Commit: Xisco Fauli CommitDate: Mon May 15 11:01:51 2023 +0200 tdf#155232: drop m_aFlatParaList from SwXFlatParagraphIterator There is no need to keep those references. The set was there from the beginning, introduced in commits 677eba2322d2753951024c688d59553182bf2fbd (INTEGRATION: CWS gcframework_DEV300 (1.1.2); FILE ADDED, 2008-02-26) and ba76230f6f64b0d333da946a7e487acbeb0b (INTEGRATION: CWS gcframework_DEV300 (1.1.2); FILE ADDED, 2008-02-26). Change-Id: Iaf2482adb0aac063ad106c4198baf74577a75bf4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151712 Tested-by: Jenkins Reviewed-by: Mike Kaganski (cherry picked from commit a7ce722b476c4bb0c9a113ae0c2759181edfe48f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151771 Reviewed-by: Xisco Fauli diff --git a/sw/source/core/inc/unoflatpara.hxx b/sw/source/core/inc/unoflatpara.hxx index 6523609a6a5c..2cc2c354c292 100644 --- a/sw/source/core/inc/unoflatpara.hxx +++ b/sw/source/core/inc/unoflatpara.hxx @@ -131,9 +131,6 @@ private: SwXFlatParagraphIterator( const SwXFlatParagraphIterator & ) = delete; SwXFlatParagraphIterator & operator =(const SwXFlatParagraphIterator & ) = delete; -// container to hold the 'hard' references as long as necessary and valid -std::set< css::uno::Reference< css::text::XFlatParagraph > > m_aFlatParaList; - SwDoc* mpDoc; const sal_Int32 mnType; const bool mbAutomatic; diff --git a/sw/source/core/unocore/unoflatpara.cxx b/sw/source/core/unocore/unoflatpara.cxx index 3182812cecdb..d5f3c9c4130b 100644 --- a/sw/source/core/unocore/unoflatpara.cxx +++ b/sw/source/core/unocore/unoflatpara.cxx @@ -481,8 +481,6 @@ uno::Reference< text::XFlatParagraph > SwXFlatParagraphIterator::getNextPara() const OUString& aExpandText = aConversionMap.getViewText(); xRet = new SwXFlatParagraph( *pRet, aExpandText, aConversionMap ); -// keep hard references... -m_aFlatParaList.insert( xRet ); } return xRet; @@ -531,8 +529,6 @@ uno::Reference< text::XFlatParagraph > SwXFlatParagraphIterator::getParaAfter(co const OUString& aExpandText = aConversionMap.getViewText(); xRet = new SwXFlatParagraph( *pNextTextNode, aExpandText, aConversionMap ); -// keep hard references... -m_aFlatParaList.insert( xRet ); } return xRet; @@ -577,8 +573,6 @@ uno::Reference< text::XFlatParagraph > SwXFlatParagraphIterator::getParaBefore(c const OUString& aExpandText = aConversionMap.getViewText(); xRet = new SwXFlatParagraph( *pPrevTextNode, aExpandText, aConversionMap ); -// keep hard references... -m_aFlatParaList.insert( xRet ); } return xRet;
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/access/acccontext.cxx |7 ++- sw/source/core/access/acccontext.hxx |2 ++ sw/source/core/access/accmap.cxx |4 +++- 3 files changed, 11 insertions(+), 2 deletions(-) New commits: commit 594aac44a5e06ef8ecc5ab0b30a3620191a5b936 Author: Caolán McNamara AuthorDate: Tue May 9 14:16:20 2023 +0100 Commit: Michael Stahl CommitDate: Wed May 10 11:22:29 2023 +0200 Resolves: tdf#138512 don't crash on removing already Disposed a11y context Change-Id: I2a8f3d10a1349de233e11d841f7f244e4e513b2c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151523 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/sw/source/core/access/acccontext.cxx b/sw/source/core/access/acccontext.cxx index 49f783075128..57b9610821a4 100644 --- a/sw/source/core/access/acccontext.cxx +++ b/sw/source/core/access/acccontext.cxx @@ -518,9 +518,14 @@ bool SwAccessibleContext::IsEditableState() return bRet; } +bool SwAccessibleContext::IsDisposed() const +{ +return !(GetFrame() && GetMap()); +} + void SwAccessibleContext::ThrowIfDisposed() { -if (!(GetFrame() && GetMap())) +if (IsDisposed()) { throw lang::DisposedException("object is nonfunctional", static_cast(this)); diff --git a/sw/source/core/access/acccontext.hxx b/sw/source/core/access/acccontext.hxx index 32d13efbf513..d64939089622 100644 --- a/sw/source/core/access/acccontext.hxx +++ b/sw/source/core/access/acccontext.hxx @@ -349,6 +349,8 @@ public: virtual bool SetSelectedState(bool bSelected); bool IsSelectedInDoc() const { return m_isSelectedInDoc; } +bool IsDisposed() const; + static OUString GetResource(TranslateId pResId, const OUString *pArg1 = nullptr, const OUString *pArg2 = nullptr); diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index 2ada9c50b8c0..2fc8a76daa90 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -2679,7 +2679,9 @@ void SwAccessibleMap::InvalidateCursorPosition( const SwFrame *pFrame ) for (SwAccessibleParagraph* pAccPara : m_setParaRemove) { -if(pAccPara && pAccPara->getSelectedAccessibleChildCount() == 0 && pAccPara->getSelectedText().getLength() == 0) +if (pAccPara && !pAccPara->IsDisposed() && +pAccPara->getSelectedAccessibleChildCount() == 0 && +pAccPara->getSelectedText().getLength() == 0) { if(pAccPara->SetSelectedState(false)) {
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source sw/uiconfig
sw/source/uibase/docvw/SidebarTxtControl.cxx |7 +++ sw/source/uibase/docvw/SidebarTxtControl.hxx |1 + sw/uiconfig/swriter/ui/annotation.ui |2 +- 3 files changed, 9 insertions(+), 1 deletion(-) New commits: commit 9d01cf26715b1274fbe5f94f87a8ab8bcd90a85a Author: Caolán McNamara AuthorDate: Thu May 4 12:38:36 2023 +0100 Commit: Michael Stahl CommitDate: Fri May 5 10:51:23 2023 +0200 Resolves: tdf#155076 set annotation cursor to Text on mouse enter Change-Id: Ib3b1f90dd055ddd3b343f83d3118f090ea449b71 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151372 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx index bdf343bc80d1..6b082ad82112 100644 --- a/sw/source/uibase/docvw/SidebarTxtControl.cxx +++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx @@ -400,6 +400,13 @@ bool SidebarTextControl::MouseButtonUp(const MouseEvent& rMEvt) return bRet; } +bool SidebarTextControl::MouseMove(const MouseEvent& rMEvt) +{ +if (rMEvt.IsEnterWindow()) +GetDrawingArea()->set_cursor(PointerStyle::Text); +return WeldEditView::MouseMove(rMEvt); +} + IMPL_LINK( SidebarTextControl, OnlineSpellCallback, SpellCallbackInfo&, rInfo, void ) { if ( rInfo.nCommand == SpellCallbackCommand::STARTSPELLDLG ) diff --git a/sw/source/uibase/docvw/SidebarTxtControl.hxx b/sw/source/uibase/docvw/SidebarTxtControl.hxx index e0652aa5b856..891d3200380e 100644 --- a/sw/source/uibase/docvw/SidebarTxtControl.hxx +++ b/sw/source/uibase/docvw/SidebarTxtControl.hxx @@ -66,6 +66,7 @@ class SidebarTextControl : public WeldEditView virtual bool KeyInput(const KeyEvent& rKeyEvt) override; virtual bool MouseButtonDown(const MouseEvent& rMEvt) override; virtual bool MouseButtonUp(const MouseEvent& rMEvt) override; +virtual bool MouseMove(const MouseEvent& rMEvt) override; void SetMapMode(const MapMode& rNewMapMode) { diff --git a/sw/uiconfig/swriter/ui/annotation.ui b/sw/uiconfig/swriter/ui/annotation.ui index d44c442d50a2..fc0e4c39a1a2 100644 --- a/sw/uiconfig/swriter/ui/annotation.ui +++ b/sw/uiconfig/swriter/ui/annotation.ui @@ -129,7 +129,7 @@ True True -GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK +GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK True True
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/layout/tabfrm.cxx |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) New commits: commit 11990fdfae41255a1f1446d1d00f50838c5fcc83 Author: Caolán McNamara AuthorDate: Wed May 3 14:44:27 2023 +0100 Commit: Michael Stahl CommitDate: Thu May 4 10:31:20 2023 +0200 tdf#147526 a macro case which results in a null Lower() result while deleting a table Change-Id: I5e80a654e668fbcd7086a904bbed853eacbfc08a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151283 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index d75a20955409..0200c9fb09cd 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -2396,7 +2396,9 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) } else if (m_bONECalcLowers) { -lcl_RecalcRow(*static_cast(Lower()), LONG_MAX); +// tdf#147526 is a case of a macro which results in a null Lower() result +if (SwRowFrame* pLower = static_cast(Lower())) +lcl_RecalcRow(*pLower, LONG_MAX); m_bONECalcLowers = false; } }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/filter/html/htmlfldw.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit e09d7acd6148b8417487a4473fdc038c7e30d1c4 Author: Miklos Vajna AuthorDate: Wed Apr 19 09:17:21 2023 +0200 Commit: Xisco Fauli CommitDate: Mon Apr 24 15:43:48 2023 +0200 sw: fix crash in OutHTML_SwFormatField() Crashreport signature: program/libswlo.so SwDocShell::GetView() sw/inc/docsh.hxx:222 program/libswlo.so OutHTML_SwFormatField(Writer&, SfxPoolItem const&) sw/source/filter/html/htmlfldw.cxx:549 ... program/libswlo.so SwTransferable::WriteObject(tools::SvRef&, void*, unsigned int, com::sun::star::datatransfer::DataFlavor const&) sw/source/uibase/dochdl/swdtflvr.cxx:? I.e. clipboard documents don't have a doc shell, handle that. Change-Id: I48b22087f759a11b4aa46b83b310f4a661e1fbc4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150897 Tested-by: Jenkins Reviewed-by: Miklos Vajna (cherry picked from commit 5951e37eb24e09d3c24cb4cab4b0f3da41e3dfff) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150913 Reviewed-by: Xisco Fauli diff --git a/sw/source/filter/html/htmlfldw.cxx b/sw/source/filter/html/htmlfldw.cxx index 1cf3f5b24fed..1058ee9aff26 100644 --- a/sw/source/filter/html/htmlfldw.cxx +++ b/sw/source/filter/html/htmlfldw.cxx @@ -540,7 +540,7 @@ Writer& OutHTML_SwFormatField( Writer& rWrt, const SfxPoolItem& rHt ) { const SwTextField *pTextField = rField.GetTextField(); OSL_ENSURE( pTextField, "Where is the txt fld?" ); -if( pTextField ) +if( pTextField && rWrt.m_pDoc->GetDocShell() ) { // ReqIF-XHTML doesn't allow specifying a background color. bool bFieldShadings = SwViewOption::IsFieldShadings() && !rHTMLWrt.mbReqIF;
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/inc/sectfrm.hxx|2 +- sw/source/core/layout/frmtool.cxx | 10 +- sw/source/core/layout/sectfrm.cxx |6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) New commits: commit 38473155a499cc6b7ebc32c92a947194b2ae5e67 Author: Mike Kaganski AuthorDate: Tue Apr 18 15:46:26 2023 +0300 Commit: Xisco Fauli CommitDate: Fri Apr 21 10:37:18 2023 +0200 bApres -> bAfter Change-Id: Iac6965fa7695e9123b7861add6e4425bb31b79ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150574 Tested-by: Jenkins Reviewed-by: Mike Kaganski Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150744 diff --git a/sw/source/core/inc/sectfrm.hxx b/sw/source/core/inc/sectfrm.hxx index 09c742f8da79..6c40c6589f31 100644 --- a/sw/source/core/inc/sectfrm.hxx +++ b/sw/source/core/inc/sectfrm.hxx @@ -109,7 +109,7 @@ public: * Splits the SectionFrame surrounding the pFrame up in two parts: * pFrame and the start of the 2nd part */ -bool SplitSect( SwFrame* pFrame, bool bApres ); +bool SplitSect( SwFrame* pFrame, bool bAfter ); void DelEmpty( bool bRemove ); // Like Cut(), except for that Follow chaining is maintained SwFootnoteContFrame* ContainsFootnoteCont( const SwFootnoteContFrame* pCont = nullptr ) const; bool Growable() const; diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index e47c68283e33..b4f676b85745 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -2027,7 +2027,7 @@ void MakeFrames( SwDoc *pDoc, SwNode , SwNode ) pDoc->getIDocumentLayoutAccess().GetCurrentLayout()); if ( pNd ) { -bool bApres = *pNd < rSttIdx; +bool bAfter = *pNd < rSttIdx; SwNode2Layout aNode2Layout( *pNd, rSttIdx.GetIndex() ); sw::FrameMode eMode = sw::FrameMode::Existing; ::std::vector frames; @@ -2075,7 +2075,7 @@ void MakeFrames( SwDoc *pDoc, SwNode , SwNode ) SwFlowFrame *pTmp = SwFlowFrame::CastFlowFrame( pMove ); assert(pTmp); -if ( bApres ) +if ( bAfter ) { // The rest of this page should be empty. Thus, the following one has to move to // the next page (it might also be located in the following column). @@ -2168,12 +2168,12 @@ void MakeFrames( SwDoc *pDoc, SwNode , SwNode ) else { bool bSplit; -SwFrame* pPrv = bApres ? pFrame : pFrame->GetPrev(); +SwFrame* pPrv = bAfter ? pFrame : pFrame->GetPrev(); // If the section frame is inserted into another one, it must be split. if( pSct && rSttIdx.IsSectionNode() ) { -bSplit = pSct->SplitSect( pFrame, bApres ); -if( !bSplit && !bApres ) +bSplit = pSct->SplitSect( pFrame, bAfter ); +if( !bSplit && !bAfter ) { pUpper = pSct->GetUpper(); pPrv = pSct->GetPrev(); diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx index eb667dd51fc5..0a82b8cc0dfd 100644 --- a/sw/source/core/layout/sectfrm.cxx +++ b/sw/source/core/layout/sectfrm.cxx @@ -516,17 +516,17 @@ void SwSectionFrame::MergeNext( SwSectionFrame* pNxt ) |* This is required when inserting an inner section, because the MoveFwd |* cannot have the desired effect within a frame or a table cell. |*/ -bool SwSectionFrame::SplitSect( SwFrame* pFrame, bool bApres ) +bool SwSectionFrame::SplitSect( SwFrame* pFrame, bool bAfter ) { assert(pFrame && "SplitSect: Why?"); -SwFrame* pOther = bApres ? pFrame->FindNext() : pFrame->FindPrev(); +SwFrame* pOther = bAfter ? pFrame->FindNext() : pFrame->FindPrev(); if( !pOther ) return false; SwSectionFrame* pSect = pOther->FindSctFrame(); if( pSect != this ) return false; // Put the content aside -SwFrame* pSav = ::SaveContent( this, bApres ? pOther : pFrame ); +SwFrame* pSav = ::SaveContent( this, bAfter ? pOther : pFrame ); OSL_ENSURE( pSav, "SplitSect: What's on?" ); if( pSav ) // be robust { // Create a new SctFrame, not as a Follower/master
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/uibase/shells/textsh1.cxx | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) New commits: commit e915155353b72ed2401ffc99ed11b003d5990f17 Author: Justin Luth AuthorDate: Wed Apr 19 20:06:28 2023 -0400 Commit: Xisco Fauli CommitDate: Fri Apr 21 09:33:46 2023 +0200 tdf#154817 sw UI: no hatch/gradient name if not selected This fixes a LO 7.2.0 regression caused by commit 3f6797c29e9672eba354400f24a669244fd746c0. A unique name was being created for gradients and hatches every time the paragraph dialog box was OK'd, even if the Area tab was not selected or natigated to. Only create the name if the gradient or hatch is actually selected as the fill type. Change-Id: I088954db07d025570b0f5ecd5785020052c6f1f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150669 Tested-by: Jenkins Reviewed-by: Jim Raykowski Reviewed-by: Justin Luth (cherry picked from commit 06c61d3581d95354d627c7de1a7d97b62c8f61c6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150715 Reviewed-by: Xisco Fauli diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 589af9e5beeb..dc4625eb91d1 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -51,6 +51,7 @@ #include #include #include +#include #include #include #include @@ -1164,7 +1165,10 @@ void SwTextShell::Execute(SfxRequest ) pSet->Put(SfxStringItem(FN_DROP_CHAR_STYLE_NAME, sCharStyleName)); } -const XFillGradientItem* pTempGradItem = pSet->GetItem(XATTR_FILLGRADIENT); +const XFillStyleItem* pFS = pSet->GetItem(XATTR_FILLSTYLE); +bool bSet = pFS && pFS->GetValue() == drawing::FillStyle_GRADIENT; +const XFillGradientItem* pTempGradItem += bSet ? pSet->GetItem(XATTR_FILLGRADIENT) : nullptr; if (pTempGradItem && pTempGradItem->GetName().isEmpty()) { // MigrateItemSet guarantees unique gradient names @@ -1173,7 +1177,9 @@ void SwTextShell::Execute(SfxRequest ) SdrModel::MigrateItemSet(, pSet, pDrawModel); } -const XFillHatchItem* pTempHatchItem = pSet->GetItem(XATTR_FILLHATCH); +bSet = pFS && pFS->GetValue() == drawing::FillStyle_HATCH; +const XFillHatchItem* pTempHatchItem += bSet ? pSet->GetItem(XATTR_FILLHATCH) : nullptr; if (pTempHatchItem && pTempHatchItem->GetName().isEmpty()) { SfxItemSetFixed aMigrateSet(rWrtSh.GetView().GetPool());
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/uibase/sidebar/PageMarginControl.cxx | 42 +++-- 1 file changed, 19 insertions(+), 23 deletions(-) New commits: commit 2c2ebb664bb5fce15c4d466e4aad73c59ce4a819 Author: Caolán McNamara AuthorDate: Wed Apr 19 11:25:49 2023 +0100 Commit: Xisco Fauli CommitDate: Wed Apr 19 17:35:13 2023 +0200 backport writer sidebar "check SfxViewFrame::Current()" for crash seen in the wild as: https://crashreport.libreoffice.org/stats/crash_details/0f7afb28-ef99-4182-a260-98d8a5653890 Change-Id: I06dfecc6a072ec1de17d66e7c8fd5a81375b0839 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150601 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/source/uibase/sidebar/PageMarginControl.cxx b/sw/source/uibase/sidebar/PageMarginControl.cxx index f6e0caa727bc..217c6f7d7fa7 100644 --- a/sw/source/uibase/sidebar/PageMarginControl.cxx +++ b/sw/source/uibase/sidebar/PageMarginControl.cxx @@ -53,19 +53,14 @@ namespace { FieldUnit lcl_GetFieldUnit() { -FieldUnit eUnit = FieldUnit::INCH; -const SfxUInt16Item* pItem = nullptr; -SfxItemState eState = SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState( SID_ATTR_METRIC, pItem ); -if ( pItem && eState >= SfxItemState::DEFAULT ) +if (SfxViewFrame* pViewFrm = SfxViewFrame::Current()) { -eUnit = static_cast(pItem->GetValue()); +const SfxUInt16Item* pItem = nullptr; +SfxItemState eState = pViewFrm->GetBindings().GetDispatcher()->QueryState(SID_ATTR_METRIC, pItem); +if (pItem && eState >= SfxItemState::DEFAULT) +return static_cast(pItem->GetValue()); } -else -{ -return SfxModule::GetCurrentFieldUnit(); -} - -return eUnit; +return SfxModule::GetCurrentFieldUnit(); } MapUnit lcl_GetUnit() @@ -130,15 +125,15 @@ PageMarginControl::PageMarginControl(PageMarginPopup* pControl, weld::Widget* pP const SvxSizeItem* pSize = nullptr; const SvxLongLRSpaceItem* pLRItem = nullptr; const SvxLongULSpaceItem* pULItem = nullptr; -if ( SfxViewFrame::Current() ) +if (SfxViewFrame* pViewFrm = SfxViewFrame::Current()) { const SvxPageItem* pPageItem; -SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState( SID_ATTR_PAGE, pPageItem ); +pViewFrm->GetBindings().GetDispatcher()->QueryState( SID_ATTR_PAGE, pPageItem ); bLandscape = pPageItem->IsLandscape(); m_bMirrored = pPageItem->GetPageUsage() == SvxPageUsage::Mirror; -SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState( SID_ATTR_PAGE_SIZE, pSize ); -SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState( SID_ATTR_PAGE_LRSPACE, pLRItem ); -SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState( SID_ATTR_PAGE_ULSPACE, pULItem ); +pViewFrm->GetBindings().GetDispatcher()->QueryState( SID_ATTR_PAGE_SIZE, pSize ); +pViewFrm->GetBindings().GetDispatcher()->QueryState( SID_ATTR_PAGE_LRSPACE, pLRItem ); +pViewFrm->GetBindings().GetDispatcher()->QueryState( SID_ATTR_PAGE_ULSPACE, pULItem ); } if ( pLRItem ) @@ -398,7 +393,8 @@ IMPL_LINK( PageMarginControl, SelectMarginHdl, weld::Button&, rControl, void ) if ( !bApplyNewPageMargins ) return; -const css::uno::Reference< css::document::XUndoManager > xUndoManager( getUndoManager( SfxViewFrame::Current()->GetFrame().GetFrameInterface() ) ); +SfxViewFrame* pViewFrm = SfxViewFrame::Current(); +const css::uno::Reference xUndoManager(pViewFrm ? getUndoManager(pViewFrm->GetFrame().GetFrameInterface()) : nullptr); if ( xUndoManager.is() ) xUndoManager->enterUndoContext( "" ); @@ -421,12 +417,12 @@ void PageMarginControl::ExecuteMarginLRChange( const tools::Long nPageLeftMargin, const tools::Long nPageRightMargin ) { -if ( SfxViewFrame::Current() ) +if (SfxViewFrame* pViewFrm = SfxViewFrame::Current()) { SvxLongLRSpaceItem aPageLRMarginItem( 0, 0, SID_ATTR_PAGE_LRSPACE ); aPageLRMarginItem.SetLeft( nPageLeftMargin ); aPageLRMarginItem.SetRight( nPageRightMargin ); -SfxViewFrame::Current()->GetBindings().GetDispatcher()->ExecuteList( SID_ATTR_PAGE_LRSPACE, +pViewFrm->GetBindings().GetDispatcher()->ExecuteList( SID_ATTR_PAGE_LRSPACE, SfxCallMode::RECORD, { } ); } } @@ -435,23 +431,23 @@ void PageMarginControl::ExecuteMarginULChange( const tools::Long nPageTopMargin, const tools::Long nPageBottomMargin ) { -if ( SfxViewFrame::Current() ) +if (SfxViewFrame* pViewFrm = SfxViewFrame::Current()) { SvxLongULSpaceItem aPageULMarginItem( 0, 0, SID_ATTR_PAGE_ULSPACE ); aPageULMarginItem.SetUpper( nPageTopMargin ); aPageULMarginItem.SetLower( nPageBottomMargin ); -
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/layout/fly.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 03300969235b9d7ffcc4d4b3168215ee927ddaf2 Author: Xisco Fauli AuthorDate: Tue Apr 18 15:50:24 2023 +0200 Commit: Michael Stahl CommitDate: Wed Apr 19 12:14:01 2023 +0200 sw: fix divide by 0 in SwFlyFrame::CalcRel https: //crashreport.libreoffice.org/stats/signature/SwFlyFrame::CalcRel(SwFormatFrameSize%20const%20&) Change-Id: If7a1919a2829bbec3292b3aa5f7f719c5ba0beef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150579 Tested-by: Jenkins Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara (cherry picked from commit 6f36e44f248c8e3705779d6692daaf79865a1378) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150566 Reviewed-by: Michael Stahl diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index 4cee6d9e712d..09834d7defd0 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -2580,12 +2580,12 @@ Size SwFlyFrame::CalcRel( const SwFormatFrameSize ) const if ( rSz.GetHeightPercent() && rSz.GetHeightPercent() != SwFormatFrameSize::SYNCED ) aRet.setHeight( nRelHeight * rSz.GetHeightPercent() / 100 ); -if ( rSz.GetWidthPercent() == SwFormatFrameSize::SYNCED ) +if ( rSz.GetHeight() && rSz.GetWidthPercent() == SwFormatFrameSize::SYNCED ) { aRet.setWidth( aRet.Width() * ( aRet.Height()) ); aRet.setWidth( aRet.Width() / ( rSz.GetHeight()) ); } -else if ( rSz.GetHeightPercent() == SwFormatFrameSize::SYNCED ) +else if ( rSz.GetWidth() && rSz.GetHeightPercent() == SwFormatFrameSize::SYNCED ) { aRet.setHeight( aRet.Height() * ( aRet.Width()) ); aRet.setHeight( aRet.Height() / ( rSz.GetWidth()) );
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/uibase/wrtsh/wrtsh1.cxx |9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) New commits: commit 59e13bdd6d894f48b73eacd339d0ecfa0be87e74 Author: Xisco Fauli AuthorDate: Tue Apr 18 14:37:32 2023 +0200 Commit: Michael Stahl CommitDate: Wed Apr 19 12:12:14 2023 +0200 sw: fix divide by 0 See https://crashreport.libreoffice.org/stats/signature/operator/(Fraction%20const%20&,Fraction%20const%20&) Change-Id: Ia93e2969d6eb0bde71c8419f2aa90bb7aa231f61 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150553 Reviewed-by: Caolán McNamara Tested-by: Jenkins Reviewed-by: Xisco Fauli (cherry picked from commit d01dae0cbabc27f2ff2a242316206067cff73cf8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150562 Reviewed-by: Michael Stahl diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx index b989343266cb..3ef6559cae34 100644 --- a/sw/source/uibase/wrtsh/wrtsh1.cxx +++ b/sw/source/uibase/wrtsh/wrtsh1.cxx @@ -914,8 +914,13 @@ void SwWrtShell::CalcAndSetScale( svt::EmbeddedObjectRef& xObj, } else { -aArea.Width ( tools::Long( aArea.Width() / pCli->GetScaleWidth() ) ); -aArea.Height( tools::Long( aArea.Height() / pCli->GetScaleHeight() ) ); +tools::Long nWidth(pCli->GetScaleWidth()); +tools::Long nHeight(pCli->GetScaleHeight()); +if (nWidth && nHeight) +{ +aArea.Width ( aArea.Width() / nWidth ); +aArea.Height( aArea.Height() / nHeight ); +} } pCli->SetObjAreaAndScale( aArea.SVRect(), aScaleWidth, aScaleHeight );
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/filter/html/htmlfld.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 09dfba6441e0365860d3f2061c05ff2e31bc7799 Author: Noel Grandin AuthorDate: Thu Apr 13 10:58:38 2023 +0200 Commit: Xisco Fauli CommitDate: Mon Apr 17 15:28:54 2023 +0200 fix SwHTMLParser::InsertCommentText which went wrong in commit 7a504c8752bf7c5accbb9bcc33a98f79b31b8bf2 Author: Palenik Mihály Date: Fri Aug 9 13:51:08 2013 +0200 Change String to OUString in SwHTMLParser class Change-Id: I7623e5fe1f4ca07adff8de11d7c01b1cea3733d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150334 Tested-by: Noel Grandin Reviewed-by: Noel Grandin (cherry picked from commit 20daf957baea858e57630207896152e740a2fd59) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150495 Reviewed-by: Michael Stahl Tested-by: Jenkins diff --git a/sw/source/filter/html/htmlfld.cxx b/sw/source/filter/html/htmlfld.cxx index e5c46119fcbe..305f18a10b0f 100644 --- a/sw/source/filter/html/htmlfld.cxx +++ b/sw/source/filter/html/htmlfld.cxx @@ -593,7 +593,7 @@ void SwHTMLParser::InsertCommentText( const char *pTag ) m_aContents += aToken; if( bEmpty && pTag ) { -m_aContents = OUString::Concat("HTML: <") + OUStringChar(*pTag) + ">" + m_aContents; +m_aContents = OUString::Concat("HTML: <") + OUString::createFromAscii(pTag) + ">" + m_aContents; } }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/text/porfly.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 83fe224f0f5fd4a4516ce3f282d0cfb55f2ea8fe Author: Mike Kaganski AuthorDate: Thu Apr 13 19:03:36 2023 +0200 Commit: Michael Stahl CommitDate: Mon Apr 17 14:16:12 2023 +0200 sal_uInt16 is not a good choice to store SwTwips The latter is tools::Long, which is even 64-bit on most platforms. Just use auto here. Change-Id: I5b45220b79cd4798bafdb416ad7a44eb4d5d1f99 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150320 Tested-by: Jenkins Reviewed-by: Mike Kaganski (cherry picked from commit 465e66be927fa186d1cc2ffaf25ebccdfd9862d9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150494 Reviewed-by: Michael Stahl diff --git a/sw/source/core/text/porfly.cxx b/sw/source/core/text/porfly.cxx index 9abef0c83c26..7bee98d9821a 100644 --- a/sw/source/core/text/porfly.cxx +++ b/sw/source/core/text/porfly.cxx @@ -109,7 +109,7 @@ bool SwFlyCntPortion::Format( SwTextFormatInfo ) // KerningPortions at beginning of line, e.g., for grid layout // must be considered. const SwLinePortion* pLastPor = rInf.GetLast(); -const sal_uInt16 nLeft = ( pLastPor && +const auto nLeft = ( pLastPor && ( pLastPor->IsKernPortion() || pLastPor->IsErgoSumPortion() ) ) ? pLastPor->Width() :
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/uibase/shells/textfld.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 508cc73f5301abc00d1ed75e331a22eb01a65f09 Author: Caolán McNamara AuthorDate: Sat Apr 15 20:44:48 2023 +0100 Commit: Xisco Fauli CommitDate: Mon Apr 17 13:02:11 2023 +0200 tdf#137542 don't crash at least doesn't address the underlying issue though Change-Id: I7f5a5dba01c399ec78eceaab6ea85fc0b8897927 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150328 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx index 1efdf57abed0..1d32fef4934f 100644 --- a/sw/source/uibase/shells/textfld.cxx +++ b/sw/source/uibase/shells/textfld.cxx @@ -187,9 +187,9 @@ void SwTextShell::ExecField(SfxRequest ) SwCursorShell::StartOfInputFieldAtPos( *(rSh.GetCursor()->Start()) ) + 1, SwCursorShell::EndOfInputFieldAtPos( *(rSh.GetCursor()->Start()) ) - 1 ); } -else +else if (SwField* pCurrentField = rSh.GetCurField(true)) { -rSh.StartInputFieldDlg(rSh.GetCurField(true), false, false, GetView().GetFrameWeld()); +rSh.StartInputFieldDlg(pCurrentField, false, false, GetView().GetFrameWeld()); } bRet = true; }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/unocore/unofield.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit 71c7c3dddb1291e262b1f8132b75e95fc6f9fa02 Author: Caolán McNamara AuthorDate: Thu Apr 13 15:50:25 2023 +0100 Commit: Michael Stahl CommitDate: Fri Apr 14 14:02:55 2023 +0200 Resolves: tdf#152619 crash inspecting uninserted XFieldMaster Change-Id: I765dd5d7e1ed2c1749841491a50216a6afe903c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150351 Tested-by: Jenkins Reviewed-by: Caolán McNamara (cherry picked from commit 5464a1dad69c52d011b194baf7d543ce8dd27748) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150321 Reviewed-by: Michael Stahl diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index 84ae8fe2d8f5..c6d899d2c9f2 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -1325,6 +1325,8 @@ SwXTextField::getTextFieldMaster() SolarMutexGuard aGuard; SwFieldType* pType = m_pImpl->GetFieldType(); +if (!pType && !m_pImpl->m_pDoc) // tdf#152619 +return nullptr; uno::Reference const xRet( SwXFieldMaster::CreateXFieldMaster(m_pImpl->m_pDoc, pType)); return xRet;
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/fields/usrfld.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit eea22152b7544268c5fa2765030ff75cd74ddb3b Author: Eike Rathke AuthorDate: Mon Apr 10 16:37:54 2023 +0200 Commit: Adolfo Jayme Barrientos CommitDate: Tue Apr 11 08:03:48 2023 +0200 Related: tdf#154218 Use proper locale in SwUserFieldType::PutValue() The cast to sal_uInt16 actually called the overloaded DoubleToString(...,sal_uInt32) with the LanguageType value used as format key number. Change-Id: I74415ff5504369d437df8caab02ecb61eb853143 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150186 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit 5a6d03f656329263cc3be4ce0ea9a0ea2373606e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150198 Reviewed-by: Adolfo Jayme Barrientos diff --git a/sw/source/core/fields/usrfld.cxx b/sw/source/core/fields/usrfld.cxx index 9e490efd03c2..fb3095ced9bc 100644 --- a/sw/source/core/fields/usrfld.cxx +++ b/sw/source/core/fields/usrfld.cxx @@ -348,7 +348,7 @@ void SwUserFieldType::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) m_nValue = fVal; LanguageTag aContentLanguage(GetFieldTypeLanguage()); m_aContentLang = aContentLanguage.getBcp47(); -m_aContent = DoubleToString(m_nValue, static_cast(GetFieldTypeLanguage())); +m_aContent = DoubleToString(m_nValue, aContentLanguage.getLanguageType()); } break; case FIELD_PROP_PAR2:
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx | 18 ++ sw/source/uibase/sidebar/WriterInspectorTextPanel.hxx |5 - 2 files changed, 22 insertions(+), 1 deletion(-) New commits: commit 23b09987e06f637bd864f40d8cc43def8d8eaa18 Author: Caolán McNamara AuthorDate: Thu Apr 6 12:17:10 2023 +0100 Commit: Xisco Fauli CommitDate: Fri Apr 7 18:48:29 2023 +0200 tdf#154629 inspector sidebar panel use-after-free on switch to print preview Change-Id: I5489cd18213d82ae4174ca8d9d00f1da5aa1091d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150078 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx index 5f861000296a..8786a0390950 100644 --- a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx +++ b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx @@ -70,6 +70,10 @@ WriterInspectorTextPanel::WriterInspectorTextPanel(weld::Widget* pParent) { m_oldLink = m_pShell->GetChgLnk(); m_pShell->SetChgLnk(LINK(this, WriterInspectorTextPanel, AttrChangedNotify)); + +// tdf#154629 listen to know if the shell destructs before this panel does, +// which can happen on entering print preview +m_pShell->Add(this); } // Update panel on start @@ -80,10 +84,24 @@ WriterInspectorTextPanel::WriterInspectorTextPanel(weld::Widget* pParent) updateEntries(aStore, m_nParIdx); } +void WriterInspectorTextPanel::SwClientNotify(const SwModify& rModify, const SfxHint& rHint) +{ +if (rHint.GetId() == SfxHintId::SwLegacyModify) +{ +const sw::LegacyModifyHint& rLegacy = static_cast(rHint); +if (rLegacy.GetWhich() == RES_OBJECTDYING) +m_pShell = nullptr; +} +SwClient::SwClientNotify(rModify, rHint); +} + WriterInspectorTextPanel::~WriterInspectorTextPanel() { if (m_pShell) +{ m_pShell->SetChgLnk(m_oldLink); +m_pShell->Remove(this); +} } static OUString PropertyNametoRID(const OUString& rName) diff --git a/sw/source/uibase/sidebar/WriterInspectorTextPanel.hxx b/sw/source/uibase/sidebar/WriterInspectorTextPanel.hxx index fae619018851..2c2df34a9400 100644 --- a/sw/source/uibase/sidebar/WriterInspectorTextPanel.hxx +++ b/sw/source/uibase/sidebar/WriterInspectorTextPanel.hxx @@ -19,12 +19,13 @@ #pragma once #include +#include class SwWrtShell; namespace sw::sidebar { -class WriterInspectorTextPanel final : public svx::sidebar::InspectorTextPanel +class WriterInspectorTextPanel final : public svx::sidebar::InspectorTextPanel, public SwClient { public: static std::unique_ptr Create(weld::Widget* pParent); @@ -40,6 +41,8 @@ private: // attributes have changed DECL_LINK(AttrChangedNotify, LinkParamNone*, void); + +virtual void SwClientNotify(const SwModify&, const SfxHint& rHint) override; }; } // end of namespace svx::sidebar
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/filter/xml/xmlimp.cxx |3 ++- sw/source/filter/xml/xmlimp.hxx |7 +++ sw/source/filter/xml/xmltbli.cxx | 14 +- 3 files changed, 22 insertions(+), 2 deletions(-) New commits: commit 2d3a182c1e311977764d97a4a7d1dce796ec9b18 Author: Mike Kaganski AuthorDate: Fri Mar 31 10:51:32 2023 +0300 Commit: Michael Stahl CommitDate: Wed Apr 5 11:06:27 2023 +0200 tdf#154486: use importer-local map to deduplicate table names ... instead of SwDoc::GetUniqueTableName. The latter is expensive with many tables, has O(n^2) complexity with rather large O, and in corner cases of thousands tables with no or duplicate names, is unacceptably slow. Changes the test case import time from 39 s to 23 s on my system. Change-Id: Ia461c860d56cbbfdcb25bacbb9cca4961ced885e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149817 Tested-by: Jenkins Reviewed-by: Mike Kaganski Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149960 Reviewed-by: Michael Stahl diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index 2cb58cf2aa47..5ef66a1bf36f 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -324,7 +324,8 @@ SwXMLImport::SwXMLImport( m_bBlock( false ), m_bOrganizerMode( false ), m_bInititedXForms( false ), -m_pDoc( nullptr ) +m_pDoc( nullptr ), +m_sDefTableName(SwResId(STR_TABLE_DEFNAME)) { InitItemImport(); } diff --git a/sw/source/filter/xml/xmlimp.hxx b/sw/source/filter/xml/xmlimp.hxx index 22f012c4dbfc..8791958fc69c 100644 --- a/sw/source/filter/xml/xmlimp.hxx +++ b/sw/source/filter/xml/xmlimp.hxx @@ -84,6 +84,10 @@ class SwXMLImport: public SvXMLImport SwDoc* m_pDoc; // cached for getDoc() +// Optimization for new table name lookup +OUString m_sDefTableName; // See STR_TABLE_DEFNAME +std::map m_aTableNameMap; // Last used indices for duplicating table names + voidInitItemImport(); voidFinitItemImport(); voidUpdateTextCollConditions( SwDoc *pDoc ); @@ -167,6 +171,9 @@ public: const SwDoc* getDoc() const; SwDoc* getDoc(); + +const OUString& GetDefTableName() { return m_sDefTableName; } +std::map& GetTableNameMap() { return m_aTableNameMap; } }; inline const SvXMLImportItemMapper& SwXMLImport::GetTableItemMapper() const diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index 44ae125d30b0..fec24079defc 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -1178,7 +1178,19 @@ SwXMLTableContext::SwXMLTableContext( SwXMLImport& rImport, } if( sTableName.isEmpty() ) { -sTableName = pDoc->GetUniqueTableName(); +// Optimization: use import's own map to create unique names, because +// SwDoc::GetUniqueTableName scans all the already present tables, +// builds a bitset using rather complex rules, and that has quadratic +// complexity. Try once, then fallback to SwDoc::GetUniqueTableName +auto& tableNameMap = rImport.GetTableNameMap(); +sal_Int32 nextIx = ++tableNameMap[aName]; +OUString test = aName.isEmpty() + ? OUString(rImport.GetDefTableName() + OUString::number(nextIx)) + : OUString(aName + "_" + OUString::number(nextIx)); +if (const SwTableFormat* pExisting = pDoc->FindTableFormatByName(test); !pExisting) +sTableName = test; +else +sTableName = pDoc->GetUniqueTableName(); GetImport().GetTextImport() ->GetRenameMap().Add( XML_TEXT_RENAME_TYPE_TABLE, aName, sTableName ); }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/crsr/contentcontrolbutton.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit 3bf0727bb03f1b330e9c43f9f5d7eb3bced08e2e Author: Caolán McNamara AuthorDate: Mon Apr 3 17:08:42 2023 +0100 Commit: Adolfo Jayme Barrientos CommitDate: Mon Apr 3 23:14:51 2023 +0200 tdf#152257 popup already launched, don't relaunch Change-Id: I2503803b756fed179f6aa62cee2c549b6bc7c3c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149974 Reviewed-by: Adolfo Jayme Barrientos Tested-by: Jenkins diff --git a/sw/source/core/crsr/contentcontrolbutton.cxx b/sw/source/core/crsr/contentcontrolbutton.cxx index 908d5f1bff01..0d805cb492c3 100644 --- a/sw/source/core/crsr/contentcontrolbutton.cxx +++ b/sw/source/core/crsr/contentcontrolbutton.cxx @@ -88,6 +88,8 @@ void SwContentControlButton::MouseButtonDown(const MouseEvent&) { StartPopup(); void SwContentControlButton::StartPopup() { +if (m_xPopup) // tdf#152257 already launched, don't relaunch +return; LaunchPopup(); Invalidate(); }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/doc/docedt.cxx |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) New commits: commit 8d2bf27c3f683e313fea37f8399b4b0be0d16df8 Author: László Németh AuthorDate: Mon Mar 27 17:59:15 2023 +0200 Commit: László Németh CommitDate: Tue Mar 28 11:15:44 2023 + tdf#153628 sw: fix locked spell checking in spelling dialog Which resulted incomplete spell checking finished before checking the document. Regression from commit b484e5d9e0d22b794c2d1c73741191836158a4ad "use more SwPosition::Assign". Follow-up to commit 2780b026f912a103aea3f8dc19319b998d19a43a "tdf#152738 sw: fix lost SwPosition in spelling dialog" and commit 221d76260096b9e6b4c4479b1b89c95af8b05774 "simplify assignment". Change-Id: Ib66903596847016ddaf68da42813dd3a839adb59 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149633 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit 4fa0664acfd13111d96801bfd643d10ec838bd35) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149610 diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index 7898af3b540d..021e100efdc7 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -652,8 +652,10 @@ uno::Any SwDoc::Spell( SwPaM& rPaM, aRet <<= aResult; //put the cursor to the current error const linguistic2::SingleProofreadingError = aResult.aErrors[0]; -pSttPos->Assign(*pNd->GetTextNode(), aConversionMap.ConvertToModelPosition( rError.nErrorStart ).mnPos ); -pEndPos->Assign(*pNd->GetTextNode(), aConversionMap.ConvertToModelPosition( rError.nErrorStart + rError.nErrorLength ).mnPos ); +pSttPos->Assign(nCurrNd, pSttPos->GetContentIndex()); +pEndPos->Assign(nCurrNd, pEndPos->GetContentIndex()); + pSpellArgs->pStartPos->Assign(*pNd->GetTextNode(), aConversionMap.ConvertToModelPosition( rError.nErrorStart ).mnPos ); + pSpellArgs->pEndPos->Assign(*pNd->GetTextNode(), aConversionMap.ConvertToModelPosition( rError.nErrorStart + rError.nErrorLength ).mnPos ); nCurrNd = nEndNd; } }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/ui/misc/titlepage.cxx |3 +++ 1 file changed, 3 insertions(+) New commits: commit 6a6a1c12c368b2630a724a7b688a5cba92c3765b Author: Caolán McNamara AuthorDate: Thu Mar 23 16:18:22 2023 + Commit: Adolfo Jayme Barrientos CommitDate: Sun Mar 26 01:31:46 2023 + cid#1524497 Uninitialized pointer field Change-Id: Ic3f347b9a588bda459411f917be47cbfa442d3e0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149459 Tested-by: Jenkins Reviewed-by: Caolán McNamara (cherry picked from commit bba53ddf3634bda503398ebd466484f85fa2d994) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149446 Reviewed-by: Adolfo Jayme Barrientos diff --git a/sw/source/ui/misc/titlepage.cxx b/sw/source/ui/misc/titlepage.cxx index 8ce59993f26c..4308c8db246d 100644 --- a/sw/source/ui/misc/titlepage.cxx +++ b/sw/source/ui/misc/titlepage.cxx @@ -146,6 +146,9 @@ sal_uInt16 SwTitlePageDlg::GetInsertPosition() const SwTitlePageDlg::SwTitlePageDlg(weld::Window *pParent) : SfxDialogController(pParent, "modules/swriter/ui/titlepage.ui", "DLG_TITLEPAGE") +, mpTitleDesc(nullptr) +, mpIndexDesc(nullptr) +, mpNormalDesc(nullptr) , m_xUseExistingPagesRB(m_xBuilder->weld_radio_button("RB_USE_EXISTING_PAGES")) , m_xPageCountNF(m_xBuilder->weld_spin_button("NF_PAGE_COUNT")) , m_xDocumentStartRB(m_xBuilder->weld_radio_button("RB_DOCUMENT_START"))
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/layout/ssfrm.cxx |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) New commits: commit bb2d1555703e6f894fa158eeef4fae4bf7ac6915 Author: Caolán McNamara AuthorDate: Wed Mar 15 20:06:05 2023 + Commit: Adolfo Jayme Barrientos CommitDate: Sun Mar 26 01:29:44 2023 + Related: tdf#154205 avoid use of destroyed ViewShell Change-Id: Ife553269e0cdeb331931a885a3dd4f87c1c3d9bb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148940 Tested-by: Jenkins Reviewed-by: Caolán McNamara (cherry picked from commit 12233f437e6299e6dcea3ee1490a80da2bef2372) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149501 Reviewed-by: Adolfo Jayme Barrientos diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx index aef3dad2827d..c36a7de33e5f 100644 --- a/sw/source/core/layout/ssfrm.cxx +++ b/sw/source/core/layout/ssfrm.cxx @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -336,8 +337,9 @@ void SwFrame::DestroyImpl() && (GetDep() || IsTextFrame())) // sw_redlinehide: text frame may not have Dep! { assert(!IsTextFrame() || GetDep() || static_cast(this)->GetMergedPara()); +const bool bInDocDtor = IsTabFrame() && static_cast(this)->GetFormat()->GetDoc()->IsInDtor(); SwRootFrame *pRootFrame = getRootFrame(); -if( pRootFrame && pRootFrame->IsAnyShellAccessible() ) +if( !bInDocDtor && pRootFrame && pRootFrame->IsAnyShellAccessible() ) { SwViewShell *pVSh = pRootFrame->GetCurrShell(); if( pVSh && pVSh->Imp() )
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/docnode/ndtbl.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit 788e36d514260413633e03fc7c47cb390e867176 Author: Caolán McNamara AuthorDate: Wed Mar 15 20:05:33 2023 + Commit: Adolfo Jayme Barrientos CommitDate: Sun Mar 26 01:29:23 2023 + Related: tdf#154205 skip Invalidating content a11y relations when closing doc Change-Id: If6dbc02f1ec22be9f020290572199f89548c76e1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148939 Tested-by: Jenkins Reviewed-by: Caolán McNamara (cherry picked from commit 67d353ff50712a036d04b1c0ffab68f2a21b5008) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149500 Reviewed-by: Adolfo Jayme Barrientos diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index b5ad93d28a90..30eab0bf5ece 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -2445,6 +2445,7 @@ void SwTableNode::DelFrames(SwRootFrame const*const pLayout) // Relation CONTENT_FLOWS_FROM for current next paragraph will change // and relation CONTENT_FLOWS_TO for current previous paragraph will change. #if !ENABLE_WASM_STRIP_ACCESSIBILITY +if (!GetDoc().IsInDtor()) { SwViewShell* pViewShell( pFrame->getRootFrame()->GetCurrShell() ); if ( pViewShell && pViewShell->GetLayout() &&
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/ui/chrdlg/chardlg.cxx| 13 ++- sw/source/ui/chrdlg/drpcps.cxx | 64 ++--- sw/source/ui/chrdlg/swuiccoll.cxx | 16 +++- sw/source/ui/dbui/mmresultdialogs.cxx | 40 +++--- sw/source/ui/dialog/wordcountdialog.cxx| 25 +++--- sw/source/ui/fldui/fldpage.cxx |4 - sw/source/ui/fldui/fldtdlg.cxx |3 sw/source/ui/fmtui/tmpdlg.cxx | 27 +++ sw/source/ui/misc/pggrid.cxx |6 - sw/source/ui/misc/titlepage.cxx| 78 - sw/source/uibase/app/apphdl.cxx| 19 +++-- sw/source/uibase/app/swmodul1.cxx |3 sw/source/uibase/dbui/mailmergetoolbarcontrols.cxx | 12 +-- sw/source/uibase/envelp/syncbtn.cxx|3 sw/source/uibase/fldui/fldmgr.cxx |4 - sw/source/uibase/fldui/xfldui.cxx | 12 ++- sw/source/uibase/inc/drpcps.hxx|4 - sw/source/uibase/inc/swuiccoll.hxx |1 sw/source/uibase/inc/titlepage.hxx |2 sw/source/uibase/misc/redlndlg.cxx | 65 - sw/source/uibase/ribbar/inputwin.cxx | 16 ++-- sw/source/uibase/ribbar/workctrl.cxx | 17 ++-- sw/source/uibase/shells/tabsh.cxx |3 sw/source/uibase/shells/textsh.cxx | 26 +++ sw/source/uibase/table/chartins.cxx| 19 +++-- sw/source/uibase/utlui/content.cxx |2 sw/source/uibase/utlui/gloslst.cxx |4 - sw/source/uibase/utlui/navipi.cxx |7 + sw/source/uibase/utlui/numfmtlb.cxx|6 - 29 files changed, 297 insertions(+), 204 deletions(-) New commits: commit 1590db1d5388210444bbb26fe779652f7cb24f3f Author: Xisco Fauli AuthorDate: Tue Mar 21 16:55:59 2023 +0100 Commit: Caolán McNamara CommitDate: Thu Mar 23 09:22:10 2023 + sw: check GetActiveView() See https://crashreport.libreoffice.org/stats/signature/SwView::GetDocShell() Change-Id: I90ebbff5082f1f9cae7fa3b940cbb9796d6c6dd3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149223 Reviewed-by: Caolán McNamara Tested-by: Jenkins Reviewed-by: Xisco Fauli Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149320 diff --git a/sw/source/ui/chrdlg/chardlg.cxx b/sw/source/ui/chrdlg/chardlg.cxx index 0cf38a652bec..3f71bf2497c7 100644 --- a/sw/source/ui/chrdlg/chardlg.cxx +++ b/sw/source/ui/chrdlg/chardlg.cxx @@ -170,9 +170,11 @@ SwCharURLPage::SwCharURLPage(weld::Container* pPage, weld::DialogController* pCo m_xURLPB->connect_clicked(LINK( this, SwCharURLPage, InsertFileHdl)); m_xEventPB->connect_clicked(LINK( this, SwCharURLPage, EventHdl)); -SwView *pView = ::GetActiveView(); -::FillCharStyleListBox(*m_xVisitedLB, pView->GetDocShell()); -::FillCharStyleListBox(*m_xNotVisitedLB, pView->GetDocShell()); +if (SwView* pView = GetActiveView()) +{ +::FillCharStyleListBox(*m_xVisitedLB, pView->GetDocShell()); +::FillCharStyleListBox(*m_xNotVisitedLB, pView->GetDocShell()); +} m_xVisitedLB->set_active_id(OUString::number(RES_POOLCHR_INET_VISIT)); m_xVisitedLB->save_value(); m_xNotVisitedLB->set_active_id(OUString::number(RES_POOLCHR_INET_NORMAL)); @@ -302,8 +304,9 @@ IMPL_LINK_NOARG(SwCharURLPage, InsertFileHdl, weld::Button&, void) IMPL_LINK_NOARG(SwCharURLPage, EventHdl, weld::Button&, void) { -m_bModified |= SwMacroAssignDlg::INetFormatDlg(GetFrameWeld(), -::GetActiveView()->GetWrtShell(), m_oINetMacroTable); +if (SwView* pView = GetActiveView()) +m_bModified |= SwMacroAssignDlg::INetFormatDlg(GetFrameWeld(), +pView->GetWrtShell(), m_oINetMacroTable); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/chrdlg/drpcps.cxx b/sw/source/ui/chrdlg/drpcps.cxx index 46389d886c8c..a9c5ffbc4542 100644 --- a/sw/source/ui/chrdlg/drpcps.cxx +++ b/sw/source/ui/chrdlg/drpcps.cxx @@ -169,10 +169,15 @@ bool SwDropCapsPict::GetNextScriptSegment(size_t , sal_Int32 , sal_In #define LINES 10 #define BORDER 2 -void SwDropCapsPict::GetFontSettings( const SwDropCapsPage& _rPage, vcl::Font& _rFont, sal_uInt16 _nWhich ) +void SwDropCapsPict::GetFontSettings( vcl::Font& _rFont, sal_uInt16 _nWhich ) { -SfxItemSet aSet( _rPage.m_rSh.GetAttrPool(), _nWhich, _nWhich); -_rPage.m_rSh.GetCurAttr(aSet); +SwView* pView = GetActiveView(); +if (!pView) +return; +SwWrtShell& rWrtShell = pView->GetWrtShell(); + +SfxItemSet aSet( rWrtShell.GetAttrPool(), _nWhich, _nWhich); +rWrtShell.GetCurAttr(aSet); SvxFontItem aFormatFont(static_cast(
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/ui/frmdlg/frmpage.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 631215d52a78b728b0b2f3438b2faa9ce24a5960 Author: Caolán McNamara AuthorDate: Thu Mar 16 14:36:18 2023 + Commit: Caolán McNamara CommitDate: Sat Mar 18 11:18:22 2023 + Resolves: tdf#152704 old image remains underneath when new image drawn in this dialog preview widget Change-Id: Id33995d9a9557d235178be0d12cc6b44e146ff4c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149017 Reviewed-by: Michael Stahl Tested-by: Jenkins diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx index 8dff4cd41e59..e32147d2266d 100644 --- a/sw/source/ui/frmdlg/frmpage.cxx +++ b/sw/source/ui/frmdlg/frmpage.cxx @@ -2602,7 +2602,8 @@ void BmpWindow::SetDrawingArea(weld::DrawingArea* pDrawingArea) void BmpWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) { // Setup -rRenderContext.SetBackground(); + rRenderContext.SetBackground(Wallpaper(Application::GetSettings().GetStyleSettings().GetDialogColor())); +rRenderContext.Erase(); // #i119307# the graphic might have transparency, set up white as the color // to use when drawing a rectangle under the image rRenderContext.SetLineColor(COL_WHITE);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/uibase/app/docsh2.cxx | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) New commits: commit b524e2fcb52a28bd24854c23a8f5eedf10d9552e Author: Xisco Fauli AuthorDate: Thu Mar 16 16:26:17 2023 +0100 Commit: Michael Stahl CommitDate: Fri Mar 17 10:25:03 2023 + sw: fix null dereference See https://crashreport.libreoffice.org/stats/signature/SfxDispatcher::ExecuteList(unsigned%20short,SfxCallMode,std::initializer_list%3CSfxPoolItem%20const%20*%3E,std::initializer_list%3CSfxPoolItem%20const%20*%3E) Change-Id: I7f5471f003798f260d9d015782bd2a798baa22d2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148999 Reviewed-by: Caolán McNamara Tested-by: Jenkins Reviewed-by: Xisco Fauli (cherry picked from commit 11ce7e810ef5ba540afe676d58575fabf4ab386d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149018 Reviewed-by: Michael Stahl diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index bc9647d77dd7..d8195b7e200d 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -1197,11 +1197,12 @@ void SwDocShell::Execute(SfxRequest& rReq) // Ok. I did my best. break; -SfxStringItem aApp(SID_DOC_SERVICE, "com.sun.star.text.TextDocument"); -SfxStringItem aTarget(SID_TARGETNAME, "_blank"); -pViewShell->GetDispatcher()->ExecuteList(SID_OPENDOC, -SfxCallMode::API|SfxCallMode::SYNCHRON, -{ , }); +if (SfxDispatcher* pDispatch = pViewShell->GetDispatcher()) +{ +SfxStringItem aApp(SID_DOC_SERVICE, "com.sun.star.text.TextDocument"); +SfxStringItem aTarget(SID_TARGETNAME, "_blank"); +pDispatch->ExecuteList(SID_OPENDOC, SfxCallMode::API|SfxCallMode::SYNCHRON, { , }); +} } break; case SID_CLASSIFICATION_APPLY:
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/crsr/findtxt.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit 6b003da43a265a431b2a176e4df637523d10fefb Author: Stéphane Guillou AuthorDate: Tue Jan 17 06:52:46 2023 +0100 Commit: Michael Stahl CommitDate: Thu Mar 16 09:16:13 2023 + tdf#152959 sw: allow lowercase unicode literal for soft hyphen Change-Id: If0cd7a07badf9f518ca697beb065e26b48a64abf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145662 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 02c352d7fdb01e7b4899cbd3c5d62b81019ddb15) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148873 Reviewed-by: Stéphane Guillou diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index dc27f677b6be..26805b281adc 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -745,6 +745,7 @@ bool DoSearch(SwPaM & rSearchPam, if ( -1 != rSearchOpt.searchString.indexOf("\\xAD") || -1 != rSearchOpt.searchString.indexOf("\\x{00AD}") || -1 != rSearchOpt.searchString.indexOf("\\u00AD") +|| -1 != rSearchOpt.searchString.indexOf("\\u00ad") || -1 != rSearchOpt.searchString.indexOf("\\U00AD") || -1 != rSearchOpt.searchString.indexOf("\\N{SOFT HYPHEN}")) {
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/ui/misc/outline.cxx| 32 ++-- sw/source/uibase/inc/outline.hxx |1 + 2 files changed, 15 insertions(+), 18 deletions(-) New commits: commit f2da924f108468dcd662922e484a2ec28276b410 Author: Mike Kaganski AuthorDate: Tue Mar 14 11:01:28 2023 +0300 Commit: Michael Stahl CommitDate: Wed Mar 15 11:18:40 2023 + tdf#154179: fix pre-selection of the current outline level This seems to always be the intention, and never worked. The pre-selection made in SwOutlineSettingsTabPage::SetWrtShell was overridden later in the SwOutlineSettingsTabPage::ActivatePage, because SwOutlineTabDialog::s_nNumLevel wasn't updated to the wanted value. Additionally, it only could potentially work when the dialog opened the SwOutlineSettingsTabPage, not the other page (which would happen when it was active the last time when the dialog closed). And the active document level value must be sanitized. Change-Id: Iefefcdcde9da0e54e3acaffb981e057367a27197 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148837 Tested-by: Jenkins Reviewed-by: Mike Kaganski (cherry picked from commit 19aa70022b23745f52258b6db192b19ba8a531fa) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148864 Reviewed-by: Michael Stahl diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx index 5903fd55ea7b..f98603c6c7c3 100644 --- a/sw/source/ui/misc/outline.cxx +++ b/sw/source/ui/misc/outline.cxx @@ -129,7 +129,9 @@ SwNumNamesDlg::SwNumNamesDlg(weld::Window *pParent) static sal_uInt16 lcl_BitToLevel(sal_uInt16 nActLevel) { -sal_uInt16 nTmp = nActLevel; +constexpr sal_uInt16 MAXLEVEL_MASK = USHRT_MAX >> (sizeof(sal_uInt16) * CHAR_BIT - MAXLEVEL); +assert((nActLevel & MAXLEVEL_MASK) == nActLevel); +sal_uInt16 nTmp = nActLevel & MAXLEVEL_MASK; // a safety measure sal_uInt16 nTmpLevel = 0; while( 0 != (nTmp >>= 1) ) nTmpLevel++; @@ -152,6 +154,13 @@ SwOutlineTabDialog::SwOutlineTabDialog(weld::Window* pParent, const SfxItemSet* m_xNumRule.reset(new SwNumRule(*rSh.GetOutlineNumRule())); GetCancelButton().connect_clicked(LINK(this, SwOutlineTabDialog, CancelHdl)); +if (auto nOutlinePos = m_rWrtSh.GetOutlinePos(MAXLEVEL); nOutlinePos != SwOutlineNodes::npos) +{ +int nTmp = m_rWrtSh.getIDocumentOutlineNodesAccess()->getOutlineLevel(nOutlinePos); +assert(nTmp < MAXLEVEL); +SetActNumLevel(nTmp < 0 ? USHRT_MAX : (1 << nTmp)); +} + AddTabPage("position", ::Create, nullptr); AddTabPage("numbering", ::Create, nullptr); @@ -528,21 +537,15 @@ voidSwOutlineSettingsTabPage::Update() IMPL_LINK( SwOutlineSettingsTabPage, LevelHdl, weld::TreeView&, rBox, void ) { -m_nActLevel = 0; auto aRows = rBox.get_selected_rows(); -if (std::find(aRows.begin(), aRows.end(), MAXLEVEL) != aRows.end()) +assert(aRows.empty() || aRows.size() == 1); // Single selection only +if (aRows.empty() || aRows[0] == MAXLEVEL) { -m_nActLevel = 0x; +m_nActLevel = USHRT_MAX; } else { -sal_uInt16 nMask = 1; -for( sal_uInt16 i = 0; i < MAXLEVEL; i++ ) -{ -if (std::find(aRows.begin(), aRows.end(), i) != aRows.end()) -m_nActLevel |= nMask; -nMask <<= 1; -} +m_nActLevel = 1 << aRows[0]; } Update(); } @@ -754,13 +757,6 @@ void SwOutlineSettingsTabPage::SetWrtShell(SwWrtShell* pShell) } m_xNumberBox->SelectNumberingType(rNumFormat.GetNumberingType()); -SwOutlineNodes::size_type nOutlinePos = m_pSh->GetOutlinePos(MAXLEVEL); -int nTmp = 0; -if(nOutlinePos != SwOutlineNodes::npos) -{ -nTmp = o3tl::narrowing(m_pSh->getIDocumentOutlineNodesAccess()->getOutlineLevel(nOutlinePos)); -} -m_xLevelLB->select(nTmp-1); // collect char styles m_xCharFormatLB->clear(); diff --git a/sw/source/uibase/inc/outline.hxx b/sw/source/uibase/inc/outline.hxx index cf96ee6d8c86..2b5e6f079f16 100644 --- a/sw/source/uibase/inc/outline.hxx +++ b/sw/source/uibase/inc/outline.hxx @@ -33,6 +33,7 @@ class SwChapterNumRules; class SwOutlineTabDialog final : public SfxTabDialogController { static sal_uInt16s_nNumLevel; +static_assert(sizeof(s_nNumLevel) * CHAR_BIT >= MAXLEVEL); OUStringm_aCollNames[MAXLEVEL];
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/text/EnhancedPDFExportHelper.cxx |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) New commits: commit bc5f50127c8869c0fc2b2d46970385570b5e999e Author: Mike Kaganski AuthorDate: Mon Mar 13 12:04:03 2023 + Commit: Michael Stahl CommitDate: Mon Mar 13 17:05:21 2023 + Fix build ... after commit 470a2c0692533f42d333b9416daf3f0871cd951a and commit 544d6d781b3c8aa108ced362d708693b5127f3d7 landed, tested on CI independently. Change-Id: Ibc2ee083e9afde47c37af3c20a8fcb895b635861 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148765 Reviewed-by: Michael Stahl Tested-by: Jenkins (cherry picked from commit 9d829facd92d51c7eba8a8cc30bac4d5fbdea112) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148769 diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index c0790c5088fd..e16ace6364c7 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -1217,10 +1217,11 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() // Heading: H1 - H6 -if (pTextNd->IsOutline() +if (int nRealLevel = pTextNd->GetAttrOutlineLevel() - 1; +nRealLevel >= 0 +&& !pTextNd->IsInRedlines() && sw::IsParaPropsNode(*pFrame->getRootFrame(), *pTextNd)) { -int nRealLevel = pTextNd->GetAttrOutlineLevel()-1; switch(nRealLevel) { case 0 :
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/text/EnhancedPDFExportHelper.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit bed8aa41525a4194497f5a2e05633b4d41d8ab07 Author: Michael Stahl AuthorDate: Fri Mar 10 14:44:12 2023 +0100 Commit: Caolán McNamara CommitDate: Mon Mar 13 16:32:11 2023 + tdf#152218 sw: PDF/UA export: produce Link from footnote to body There was already a Link StructElem from the reference in the body to the footnote but it was missing for the other direction, so veraPDF complains about a Link annotation without StructElem: Specification: ISO 14289-1:2014, Clause: 7.18.5, Test number: 1 Links shall be tagged according to ISO 32000-1:2008, 14.8.4.4.2, Link Element. Change-Id: I57aa153d5899bcfa505e274a01b0183978a2e995 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148644 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit c105fbec07d0734b6b183ea8b4da15e8fe260f9b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148763 Reviewed-by: Caolán McNamara diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index cff239dec732..c0790c5088fd 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -1528,6 +1528,7 @@ void SwTaggedPDFHelper::BeginInlineStructureElements() } break; +case PortionType::FootnoteNum: // tdf#152218 link both directions case PortionType::Footnote : nPDFType = vcl::PDFWriter::Link; aPDFType = aLinkString;
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/text/EnhancedPDFExportHelper.cxx | 47 +++- 1 file changed, 46 insertions(+), 1 deletion(-) New commits: commit e442b691f157010467b830e391b09851ba3afd0a Author: Michael Stahl AuthorDate: Thu Mar 9 17:00:45 2023 +0100 Commit: Caolán McNamara CommitDate: Mon Mar 13 10:21:13 2023 + sw: PDF/UA export: produce ListNumbering As required by ISO 14289-1:2014: 7.6 Lists — An explicit ListNumbering attribute shall be used for L tags in ordered lists as specified in ISO 32000-1:2008, 14.8.5.5, Table 347. Change-Id: If3d1e4aa63f7bcfba1a28294fe9f59cf2e068070 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148557 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit a20591e08d8996db02f3811b62b06f12a9f033e1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148618 Reviewed-by: Caolán McNamara diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index ded04bd86aeb..cff239dec732 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -884,6 +884,51 @@ void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType ) } } } +else if (mpNumInfo && eType == vcl::PDFWriter::List) +{ +SwTextFrame const& rFrame(static_cast(mpNumInfo->mrFrame)); +SwTextNode const& rNode(*rFrame.GetTextNodeForParaProps()); +SwNumRule const*const pNumRule = rNode.GetNumRule(); +assert(pNumRule); // was required for List + +auto ToPDFListNumbering = [](SvxNumberFormat const& rFormat) { +switch (rFormat.GetNumberingType()) +{ +case css::style::NumberingType::CHARS_UPPER_LETTER: +return vcl::PDFWriter::UpperAlpha; +case css::style::NumberingType::CHARS_LOWER_LETTER: +return vcl::PDFWriter::LowerAlpha; +case css::style::NumberingType::ROMAN_UPPER: +return vcl::PDFWriter::UpperRoman; +case css::style::NumberingType::ROMAN_LOWER: +return vcl::PDFWriter::LowerRoman; +case css::style::NumberingType::ARABIC: +return vcl::PDFWriter::Decimal; +case css::style::NumberingType::CHAR_SPECIAL: +switch (rFormat.GetBulletChar()) +{ +case u'\u2022': case u'\uE12C': case u'\uE01E': case u'\uE437': +return vcl::PDFWriter::Disc; +case u'\u2218': case u'\u25CB': case u'\u25E6': +return vcl::PDFWriter::Circle; +case u'\u25A0': case u'\u25AA': case u'\uE00A': +return vcl::PDFWriter::Square; +default: +return vcl::PDFWriter::NONE; +} +default: // the other 50 types +return vcl::PDFWriter::NONE; +} +}; + +// Note: for every level, BeginNumberedListStructureElements() produces +// a separate List element, so even though in PDF this is limited to +// the whole List we can just export the current level here. +vcl::PDFWriter::StructAttributeValue const value( +ToPDFListNumbering(pNumRule->Get(rNode.GetActualListLevel(; +// ISO 14289-1:2014, Clause: 7.6 + mpPDFExtOutDevData->SetStructureAttribute(vcl::PDFWriter::ListNumbering, value); +} } void SwTaggedPDFHelper::BeginNumberedListStructureElements() @@ -893,7 +938,7 @@ void SwTaggedPDFHelper::BeginNumberedListStructureElements() return; const SwFrame& rFrame = mpNumInfo->mrFrame; -OSL_ENSURE( rFrame.IsTextFrame(), "numbered only for text frames" ); +assert(rFrame.IsTextFrame()); const SwTextFrame& rTextFrame = static_cast(rFrame); // Lowers of NonStructureElements should not be considered:
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/text/EnhancedPDFExportHelper.cxx | 30 1 file changed, 26 insertions(+), 4 deletions(-) New commits: commit b5ad63cc2b1c8ee2acc2b322aba5cd666954c05f Author: Michael Stahl AuthorDate: Tue Mar 7 15:39:56 2023 +0100 Commit: Michael Weghorn CommitDate: Thu Mar 9 21:03:46 2023 + sw: PDF/UA export: produce more headings H7..H10 ISO 14289-1:2014 adds a new feature: 7.4.3 Additional headings If a PDF that contains the tags H1, H2, H3, H4, H5, and H6 (in any permissible sequence) requires more headings, tags numbered from H7 upward (without limit) may be defined and used. Do not add new enum values H7..H10 to StructElement, because this approach results in veraPDF complaining: Specification: ISO 14289-1:2014, Clause: 7.1, Test number: 5 All non-standard structure types shall be mapped to the nearest functionally equivalent standard type, as defined in ISO 32000-1:2008, 14.8.4, in the role map dictionary of the structure tree root. Change-Id: Icf39667dee3847f6b755bfa592a9d30ce872c26e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148431 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 470a2c0692533f42d333b9416daf3f0871cd951a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148494 Reviewed-by: Michael Weghorn diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index 3f6a0c172142..ded04bd86aeb 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -148,6 +148,10 @@ constexpr OUStringLiteral aH3String = u"H3"; constexpr OUStringLiteral aH4String = u"H4"; constexpr OUStringLiteral aH5String = u"H5"; constexpr OUStringLiteral aH6String = u"H6"; +constexpr OUStringLiteral aH7String = u"H7"; +constexpr OUStringLiteral aH8String = u"H8"; +constexpr OUStringLiteral aH9String = u"H9"; +constexpr OUStringLiteral aH10String = u"H10"; constexpr OUStringLiteral aListString = u"L"; constexpr OUStringLiteral aListItemString = u"LI"; constexpr OUStringLiteral aListBodyString = u"LBody"; @@ -1172,9 +1176,6 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() && sw::IsParaPropsNode(*pFrame->getRootFrame(), *pTextNd)) { int nRealLevel = pTextNd->GetAttrOutlineLevel()-1; -nRealLevel = std::min(nRealLevel, 5); - -nPDFType = o3tl::narrowing(vcl::PDFWriter::H1 + nRealLevel); switch(nRealLevel) { case 0 : @@ -1192,10 +1193,31 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() case 4 : aPDFType = aH5String; break; -default: +case 5: aPDFType = aH6String; break; +case 6: +aPDFType = aH7String; +break; +case 7: +aPDFType = aH8String; +break; +case 8: +aPDFType = aH9String; +break; +case 9: +aPDFType = aH10String; +break; +default: +assert(false); +break; } + +// PDF/UA allows unlimited headings, but PDF only up to H6 +// ... and apparently the extra H7.. must be declared in +// RoleMap, or veraPDF complains. +nRealLevel = std::min(nRealLevel, 5); +nPDFType = o3tl::narrowing(vcl::PDFWriter::H1 + nRealLevel); } // Section: TOCI
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/layout/flowfrm.cxx |5 + 1 file changed, 5 insertions(+) New commits: commit ebc60f5ccab910d6974b5c386b2c0243f9eb030b Author: Miklos Vajna AuthorDate: Tue Mar 7 08:42:42 2023 +0100 Commit: Xisco Fauli CommitDate: Tue Mar 7 16:26:14 2023 + sw: fix crash in GetUpperSpaceAmountConsideredForPrevFrameAndPageGrid() Crashreport signature: program/libswlo.so SwFlowFrame::GetUpperSpaceAmountConsideredForPrevFrameAndPageGrid() const sw/source/core/layout/flowfrm.cxx:1741 program/libswlo.so objectpositioning::SwAnchoredObjectPosition::GetTopForObjPos(SwFrame const&, SwRectFnCollection* const&, bool) const include/svl/itemset.hxx:101 program/libswlo.so objectpositioning::SwToContentAnchoredObjectPosition::CalcPosition() sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx:1020 program/libswlo.so SwAnchoredDrawObject::MakeObjPosAnchoredAtPara() sw/source/core/layout/anchoreddrawobject.cxx:424 Change-Id: If162602f6a1cc2108c0de385652e93e23be920be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148395 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index 0e762f371aa4..538cb2b8f35c 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -1737,6 +1737,11 @@ SwTwips SwFlowFrame::GetUpperSpaceAmountConsideredForPrevFrameAndPageGrid() cons { SwTwips nUpperSpaceAmountConsideredForPrevFrameAndPageGrid = 0; +if (!m_rThis.GetUpper() || !m_rThis.GetUpper()->GetFormat()) +{ +return nUpperSpaceAmountConsideredForPrevFrameAndPageGrid; +} + if ( !m_rThis.GetUpper()->GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::USE_FORMER_OBJECT_POS) ) { nUpperSpaceAmountConsideredForPrevFrameAndPageGrid =
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/text/porlay.cxx |2 +- sw/source/core/text/txtfrm.cxx | 21 + 2 files changed, 22 insertions(+), 1 deletion(-) New commits: commit 6f077add4f8c9ca909374dcd45c21d87eb3c0938 Author: Michael Stahl AuthorDate: Mon Feb 20 20:06:57 2023 +0100 Commit: Caolán McNamara CommitDate: Thu Mar 2 09:12:18 2023 + tdf#114973 sw: don't allow every body SwTextFrame to be hidden Check this in SwTextFrame::IsHiddenNow() for the first one in the body. Also fix a bad entry in SwScriptInfo::m_HiddenChg that is then possible because it wasn't called on empty frames before. Change-Id: If57f8d1a30229cfbf97225b386365ae384c5083c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147347 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit b1814b7cc851c4346f6cfa81c5be74c46f42e90f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147440 Reviewed-by: Caolán McNamara diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx index 7115c90e7bca..3b00fac71031 100644 --- a/sw/source/core/text/porlay.cxx +++ b/sw/source/core/text/porlay.cxx @@ -1272,7 +1272,7 @@ void SwScriptInfo::InitScriptInfo(const SwTextNode& rNode, { const Range& rRange = aHiddenMulti.GetRange( i ); const sal_Int32 nStart = rRange.Min(); -const sal_Int32 nEnd = rRange.Max() + 1; +const sal_Int32 nEnd = rRange.Max() + (rText.isEmpty() ? 0 : 1); m_HiddenChg.push_back( TextFrameIndex(nStart) ); m_HiddenChg.push_back( TextFrameIndex(nEnd) ); diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index aa371cd3df63..5906c9c9d1f3 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -1432,6 +1432,27 @@ bool SwTextFrame::IsHiddenNow() const ( bHiddenCharsHidePara && !pVsh->GetViewOptions()->IsShowHiddenChar() ) ) { +// in order to put the cursor in the body text, one paragraph must +// be visible - check this for the 1st body paragraph +if (IsInDocBody() && FindPrevCnt() == nullptr) +{ +bool isAllHidden(true); +for (SwContentFrame const* pNext = FindNextCnt(true); +pNext != nullptr; pNext = pNext->FindNextCnt(true)) +{ +if (!pNext->IsTextFrame() +|| !static_cast(pNext)->IsHiddenNow()) +{ +isAllHidden = false; +break; +} +} +if (isAllHidden) +{ +SAL_INFO("sw.core", "unhiding one body paragraph"); +return false; +} +} return true; } }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/text/txtfld.cxx | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) New commits: commit 729ebba19d9a3d7a1de24654366e0517e30a999e Author: Justin Luth AuthorDate: Mon Feb 27 10:52:53 2023 -0500 Commit: Xisco Fauli CommitDate: Wed Mar 1 07:56:36 2023 + tdf#146168 tdf#150613 list attributes: limit hack to RTF This fixes an ODT regression from LO 7.2's commit 0a32371cc2f93fad7954e0fe9c48976aae6c5b9f. The hack applies the last character formatting in the paragraph to the numbering characters. This was a hack that existed for DOC and DOCX and RTF in various troublesome modes for quite a while. However, recently since 6.4ish era there have been some improvements for DOC and DOCX, so these have been excluded and now only RTF remains. Most of the time an RTF file also looks like a DOC (from a compat settings point of view), so even RTF files usually don't have this clause apply. In fact, I looked for the RTF files that this hack still applies to, but couldn't find a single example. Really? Did something change? I also looked for examples of files I will be excluding (!isOnlyRTF) and only found tdf135973.odt and tdf146955.odt. Neither one has character formatting on their numbered lists, so they can't be used effectively for a unit test. It is somewhat pointless to make a test. I don't even think we can round-trip an RTF that has these characteristics. Likely the best thing is to just drop the hack altogether, especially since it would pass the unit tests now. (I'm sure it was failing before.) If we can't round-trip it, is there any point in having this non-import hack in place? Change-Id: I2f95c10e1d0a9dc53b01027e9c97e5ded29c6750 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147939 Tested-by: Jenkins Reviewed-by: Justin Luth (cherry picked from commit 27df5ef405826875340645b9b979bd5c2c0b92cc) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147978 diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx index 1c05055c2ddc..5a4e7229334b 100644 --- a/sw/source/core/text/txtfld.cxx +++ b/sw/source/core/text/txtfld.cxx @@ -435,7 +435,16 @@ static void checkApplyParagraphMarkFormatToNumbering(SwFont* pNumFnt, SwTextForm // TODO remove this fallback for RTF bool isDOC = pIDSA->get(DocumentSettingId::ADD_FLY_OFFSETS); bool isDOCX = pIDSA->get(DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS); -if (!isDOC && !isDOCX && !pSet) +// tdf#146168 this hack should now only apply to RTF. Any other format (i.e. ODT) should only +// follow this fallback hack if it was created from RTF after its current implementation in 7.2. +// This can be approximated by 128197's new 6.4.7 compat for RTF MsWordCompMinLineHeightByFly +// Anything older than this which has APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING +// did not experience this hack, so it shouldn't apply to ODTs created from older RTFs either. +// In short: we don't want this hack to apply unless absolutely necessary for RTF. +const bool isOnlyRTF += !isDOC && !isDOCX && pIDSA->get(DocumentSettingId::MS_WORD_COMP_MIN_LINE_HEIGHT_BY_FLY); + +if (isOnlyRTF && !pSet) { TextFrameIndex const nTextLen(rInf.GetTextFrame()->GetText().getLength()); SwTextNode const* pNode(nullptr);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/filter/html/swhtml.cxx | 24 1 file changed, 12 insertions(+), 12 deletions(-) New commits: commit 02e03c5312b41a5714c56fdaddf3396ea404dc73 Author: Caolán McNamara AuthorDate: Sat Feb 25 21:54:46 2023 + Commit: Michael Stahl CommitDate: Mon Feb 27 11:30:38 2023 + RES_LR_SPACE should fall through to default not RES_BACKGROUND due to commit 29dfcc7521311e547fc069466cc3edc9fcbdbe03 Date: Mon Nov 23 16:17:37 2015 +0100 tdf#94088 add import of HTML inline graphics splitting the condition that used to fall through to default handling with an unrelated RES_BACKGROUND case instead Change-Id: I26a077c755f214cf35582ec146fcf34f87cc4494 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147689 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 6f9c71494461..16c4d6115c90 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -2952,18 +2952,6 @@ void SwHTMLParser::SetAttr_( bool bChkEnd, bool bBeforeTable, pAttr = pPrev; continue; -case RES_LR_SPACE: -if( aAttrPam.GetPoint()->GetNodeIndex() == -aAttrPam.GetMark()->GetNodeIndex()) -{ -// because of numbering set this attribute directly at node -pCNd->SetAttr( *pAttr->m_pItem ); -break; -} -OSL_ENSURE( false, -"LRSpace set over multiple paragraphs!" ); -[[fallthrough]]; // (shouldn't reach this point anyway) - // tdf#94088 expand RES_BACKGROUND to the new fill attribute // definitions in the range [XATTR_FILL_FIRST .. XATTR_FILL_LAST]. // This is the right place in the future if the adapted fill attributes @@ -2977,6 +2965,18 @@ void SwHTMLParser::SetAttr_( bool bChkEnd, bool bBeforeTable, m_xDoc->getIDocumentContentOperations().InsertItemSet(aAttrPam, aNewSet, SetAttrMode::DONTREPLACE); break; } + +case RES_LR_SPACE: +if( aAttrPam.GetPoint()->GetNodeIndex() == +aAttrPam.GetMark()->GetNodeIndex()) +{ +// because of numbering set this attribute directly at node +pCNd->SetAttr( *pAttr->m_pItem ); +break; +} +OSL_ENSURE( false, +"LRSpace set over multiple paragraphs!" ); +[[fallthrough]]; // (shouldn't reach this point anyway) default: // maybe jump to a bookmark
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/uibase/misc/redlndlg.cxx |6 ++ sw/source/uibase/utlui/content.cxx |5 + 2 files changed, 3 insertions(+), 8 deletions(-) New commits: commit af07387ade5218a5f584d122e022c2575db852ed Author: Caolán McNamara AuthorDate: Sat Feb 25 21:13:42 2023 + Commit: Michael Stahl CommitDate: Mon Feb 27 11:27:40 2023 + cid#1521509 Logically dead code and cid#1521507 Logically dead code Change-Id: I1d2c9ee4a4099fadb5da7a6850b4124488e2ebe8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147726 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx index 85ab6d718479..037e3f5c317d 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -246,8 +246,6 @@ void SwRedlineAcceptDlg::InitAuthors() SwView *pView = ::GetActiveView(); SwWrtShell* pSh = pView ? pView->GetWrtShellPtr() : nullptr; -if (!pSh) -return; SvxTPFilter *pFilterPage = m_xTabPagesCTRL->GetFilterPage(); @@ -1131,12 +1129,12 @@ IMPL_LINK_NOARG(SwRedlineAcceptDlg, SelectHdl, weld::TreeView&, void) IMPL_LINK_NOARG(SwRedlineAcceptDlg, GotoHdl, Timer *, void) { +m_aSelectTimer.Stop(); + SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr(); if (!pSh) return; -m_aSelectTimer.Stop(); - bool bIsNotFormated = false; bool bSel = false; diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 48be29d67b08..602037a91e5d 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -3723,10 +3723,7 @@ IMPL_LINK_NOARG(SwContentTree, TimerUpdate, Timer *, void) // Query view because the Navigator is cleared too late. SwView* pView = GetParentWindow()->GetCreateView(); -if (!pView) -return; - -SwWrtShell* pActShell = pView->GetWrtShellPtr(); +SwWrtShell* pActShell = pView ? pView->GetWrtShellPtr() : nullptr; if(pActShell && pActShell->GetWin() && (pActShell->GetWin()->HasFocus() || m_bDocHasChanged || m_bViewHasChanged) && !IsInDrag() && !pActShell->ActionPend())
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/ui/fldui/fldpage.cxx|3 + sw/source/ui/misc/pggrid.cxx |3 - sw/source/uibase/app/appenv.cxx |3 + sw/source/uibase/app/applab.cxx |1 sw/source/uibase/dbui/dbmgr.cxx | 84 -- sw/source/uibase/docvw/AnnotationWin.cxx | 14 +++-- sw/source/uibase/docvw/AnnotationWin2.cxx | 82 +++-- sw/source/uibase/docvw/edtwin2.cxx|6 -- sw/source/uibase/misc/redlndlg.cxx| 37 +++-- sw/source/uibase/ribbar/inputwin.cxx | 13 ++-- sw/source/uibase/shells/langhelper.cxx| 31 ++- sw/source/uibase/uiview/view.cxx | 19 +++--- sw/source/uibase/uno/unomailmerge.cxx |2 sw/source/uibase/uno/unotxdoc.cxx | 29 +- sw/source/uibase/uno/unotxvw.cxx | 25 sw/source/uibase/utlui/content.cxx| 12 ++-- sw/source/uibase/utlui/navipi.cxx |5 + 17 files changed, 224 insertions(+), 145 deletions(-) New commits: commit 59cfe55463526332e0ae91882cd8ccd187aa91e2 Author: Xisco Fauli AuthorDate: Mon Feb 20 16:29:19 2023 +0100 Commit: Xisco Fauli CommitDate: Wed Feb 22 08:11:44 2023 + sw: check GetWrtShellPtr() Change-Id: I8d99e9108f6163eafb7576603826f8d02a0ff416 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147336 Tested-by: Jenkins Reviewed-by: Caolán McNamara (cherry picked from commit 6cb076f6b08668cf2a0490fe17ce34e74969702a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147362 Reviewed-by: Xisco Fauli diff --git a/sw/source/ui/fldui/fldpage.cxx b/sw/source/ui/fldui/fldpage.cxx index 71ff3d33246e..0ba0d536a78d 100644 --- a/sw/source/ui/fldui/fldpage.cxx +++ b/sw/source/ui/fldui/fldpage.cxx @@ -120,6 +120,9 @@ void SwFieldPage::InsertField(SwFieldTypesEnum nTypeId, sal_uInt16 nSubType, con SwView* pView = GetActiveView(); SwWrtShell *pSh = m_pWrtShell ? m_pWrtShell : pView->GetWrtShellPtr(); +if (!pSh) +return; + if (!IsFieldEdit()) // insert new field { SwInsertField_Data aData(nTypeId, nSubType, rPar1, rPar2, nFormatId, nullptr, cSeparator, bIsAutomaticLanguage ); diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx index 4d26eead12d9..1e5f11332e67 100644 --- a/sw/source/ui/misc/pggrid.cxx +++ b/sw/source/ui/misc/pggrid.cxx @@ -93,8 +93,7 @@ SwTextGridPage::SwTextGridPage(weld::Container* pPage, weld::DialogController* p SwView *pView = ::GetActiveView(); if( pView ) { -SwWrtShell* pSh = pView->GetWrtShellPtr(); -if( pSh ) +if (SwWrtShell* pSh = pView->GetWrtShellPtr()) { m_bSquaredMode = pSh->GetDoc()->IsSquaredPageMode(); } diff --git a/sw/source/uibase/app/appenv.cxx b/sw/source/uibase/app/appenv.cxx index 86b92c8aabf7..6c744867ada1 100644 --- a/sw/source/uibase/app/appenv.cxx +++ b/sw/source/uibase/app/appenv.cxx @@ -150,6 +150,9 @@ void SwModule::InsertEnv( SfxRequest& rReq ) pNewView->AttrChangedNotify(nullptr); // so that SelectShell is being called pSh = pNewView->GetWrtShellPtr(); +if (!pSh) +return; + OUString aTmp = SwResId(STR_ENV_TITLE) + OUString::number( ++nTitleNo ); xDocSh->SetTitle( aTmp ); diff --git a/sw/source/uibase/app/applab.cxx b/sw/source/uibase/app/applab.cxx index 7ee421ed5ee7..ac6d69ca2849 100644 --- a/sw/source/uibase/app/applab.cxx +++ b/sw/source/uibase/app/applab.cxx @@ -207,6 +207,7 @@ void SwModule::InsertLab(SfxRequest& rReq, bool bLabel) SwWrtShell *pSh = pNewView->GetWrtShellPtr(); OSL_ENSURE( pSh, "missing WrtShell" ); +if (pSh) { // block for locks the dispatcher!! SwWait aWait( static_cast(*xDocSh), true ); diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index a62bd62b869b..defeec646801 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -919,49 +919,52 @@ static SfxObjectShell* lcl_CreateWorkingDocument( } SwView* pWorkView = static_cast< SwView* >( pWorkFrame->GetViewShell() ); -SwWrtShell* pWorkWrtShell = pWorkView->GetWrtShellPtr(); -pWorkWrtShell->GetViewOptions()->SetIdle( false ); -pWorkView->AttrChangedNotify(nullptr);// in order for SelectShell to be called -SwDoc* pWorkDoc = pWorkWrtShell->GetDoc(); -pWorkDoc->GetIDocumentUndoRedo().DoUndo( false ); -pWorkDoc->ReplaceDocumentProperties( *pSourceDoc ); - -// import print settings -const SwPrintData = pSourceDoc->getIDocumentDeviceAccess().getPrintData(); -pWorkDoc->getIDocumentDeviceAccess().setPrintData(rPrintData); -const JobSetup *pJobSetup = pSourceDoc->getIDocumentDeviceAccess().getJobsetup(); -if (pJobSetup) -pWorkDoc->getIDocumentDeviceAccess().setJobsetup(*pJobSetup); - -if( aType == WorkingDocType::TARGET ) -{ -assert( !ppDBManager ); -
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/ui/config/optload.cxx |9 +++--- sw/source/ui/fldui/flddb.cxx| 25 +-- sw/source/ui/fldui/fldfunc.cxx |2 - sw/source/ui/fldui/fldref.cxx | 17 ++--- sw/source/ui/fmtui/tmpdlg.cxx | 34 +++--- sw/source/ui/frmdlg/frmpage.cxx | 30 -- sw/source/ui/frmdlg/wrap.cxx|4 +-- sw/source/uibase/app/appopt.cxx | 47 +++- sw/source/uibase/utlui/content.cxx | 11 +--- sw/source/uibase/utlui/glbltree.cxx | 17 +++-- 10 files changed, 112 insertions(+), 84 deletions(-) New commits: commit a7f4de4573082e9455542a961ab610cd09f01b34 Author: Xisco Fauli AuthorDate: Thu Feb 16 12:38:55 2023 +0100 Commit: Caolán McNamara CommitDate: Fri Feb 17 11:49:20 2023 + check GetActiveWrtShell() and CheckAndGetWrtShell() See https://crashreport.libreoffice.org/stats/signature/SwModule::ApplyItemSet(unsigned%20short,SfxItemSet%20const%20&) Change-Id: I7c719c5fe4cda9f6571592c30f39bd440053dbe9 Change-Id: Iaa4448dccd1a0ec1aefa539e476b5046ed50f7b7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147201 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx index 93d6b7e4dabe..2c3ef5adbe4e 100644 --- a/sw/source/ui/config/optload.cxx +++ b/sw/source/ui/config/optload.cxx @@ -464,10 +464,11 @@ SwCaptionOptPage::SwCaptionOptPage(weld::Container* pPage, weld::DialogControlle SwStyleNameMapper::FillUIName(RES_POOLCOLL_LABEL_FRAME, m_sText); SwStyleNameMapper::FillUIName(RES_POOLCOLL_LABEL_DRAWING, m_sDrawing); -SwWrtShell* pSh = ::GetActiveWrtShell(); // m_xFormatBox sal_uInt16 nSelFormat = SVX_NUM_ARABIC; +SwWrtShell* pSh = ::GetActiveWrtShell(); + if (pSh) { for ( auto i = m_pMgr->GetFieldTypeCount(); i; ) @@ -663,13 +664,12 @@ void SwCaptionOptPage::UpdateEntry(int nSelEntry) m_xCategory->set_sensitive(bChecked); m_xPreview->set_sensitive(bChecked); -SwWrtShell *pSh = ::GetActiveWrtShell(); InsCaptionOpt* pOpt = weld::fromId(m_xCheckLB->get_id(nSelEntry)); m_xCategoryBox->clear(); m_xCategoryBox->append_text(m_sNone); -if (pSh) +if (::GetActiveWrtShell()) { const size_t nCount = m_pMgr->GetFieldTypeCount(); @@ -867,8 +867,7 @@ void SwCaptionOptPage::InvalidatePreview() aStr += m_xCategoryBox->get_active_text() + " "; } -SwWrtShell *pSh = ::GetActiveWrtShell(); -if (pSh) +if (SwWrtShell *pSh = ::GetActiveWrtShell()) { SwSetExpFieldType* pFieldType = static_cast(m_pMgr->GetFieldType( SwFieldIds::SetExp, m_xCategoryBox->get_active_text() )); diff --git a/sw/source/ui/fldui/flddb.cxx b/sw/source/ui/fldui/flddb.cxx index 3293a6bc670d..62dd538f01e0 100644 --- a/sw/source/ui/fldui/flddb.cxx +++ b/sw/source/ui/fldui/flddb.cxx @@ -73,7 +73,7 @@ SwFieldDBPage::SwFieldDBPage(weld::Container* pPage, weld::DialogController* pCo SwFieldDBPage::~SwFieldDBPage() { // If we have no stored SwWrtShell, it means we didn't do anything useful - no need to revoke. -if (SwWrtShell* pSh = GetWrtShell()) +if (SwWrtShell* pSh = CheckAndGetWrtShell()) { // This would cleanup in the case of cancelled dialog SwDBManager* pDbManager = pSh->GetDoc()->GetDBManager(); @@ -140,8 +140,7 @@ void SwFieldDBPage::Reset(const SfxItemSet*) } else { -SwWrtShell *pSh = CheckAndGetWrtShell(); -if(pSh) +if (SwWrtShell *pSh = CheckAndGetWrtShell()) { SwDBData aTmp(pSh->GetDBData()); m_xDatabaseTLB->Select(aTmp.sDataSource, aTmp.sCommand, u""); @@ -197,15 +196,16 @@ bool SwFieldDBPage::FillItemSet(SfxItemSet* ) aData.sDataSource = m_xDatabaseTLB->GetDBName(sTableName, sColumnName, ); aData.sCommand = sTableName; aData.nCommandType = bIsTable ? 0 : 1; -SwWrtShell *pSh = CheckAndGetWrtShell(); -assert(pSh); -SwDBManager* pDbManager = pSh->GetDoc()->GetDBManager(); -if (pDbManager) -pDbManager->CommitLastRegistrations(); +if (SwWrtShell *pSh = CheckAndGetWrtShell()) +{ +SwDBManager* pDbManager = pSh->GetDoc()->GetDBManager(); +if (pDbManager) +pDbManager->CommitLastRegistrations(); -if (aData.sDataSource.isEmpty()) -aData = pSh->GetDBData(); +if (aData.sDataSource.isEmpty()) +aData = pSh->GetDBData(); +} if(!aData.sDataSource.isEmpty()) // without database no new field command { @@ -292,8 +292,6 @@ void SwFieldDBPage::TypeHdl(const weld::TreeView* pBox) if (nOld == GetTypeSel()) return;
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/access/accselectionhelper.cxx | 13 + sw/source/core/doc/tblrwcl.cxx |6 -- sw/source/core/docnode/ndtbl.cxx | 22 +++--- sw/source/core/undo/untbl.cxx|3 ++- sw/source/core/unocore/unotbl.cxx|3 ++- sw/source/ui/vba/vbadocumentproperties.cxx |5 + sw/source/ui/vba/vbaselection.cxx|5 + sw/source/uibase/app/docst.cxx |7 +-- sw/source/uibase/shells/textsh1.cxx |3 ++- 9 files changed, 37 insertions(+), 30 deletions(-) New commits: commit 3f1da0d66dc2379e822f96c75a68674f50ebb0af Author: Xisco Fauli AuthorDate: Wed Feb 15 17:06:33 2023 +0100 Commit: Caolán McNamara CommitDate: Thu Feb 16 09:25:39 2023 + check GetFEShell() Similar to 24889135773204c6e3002dcb417c75ff1a99ccd0 "check GetEditShell()" These two crash reports might be related: - https://crashreport.libreoffice.org/stats/signature/SwView::GetDocShell() - https://crashreport.libreoffice.org/stats/signature/SwFEShell::UpdateTableStyleFormatting(SwTableNode%20*,bool,rtl::OUString%20const%20*) Change-Id: I7ce286f7be933b34af270abd11a4c9c4c58fe4a8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147114 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sw/source/core/access/accselectionhelper.cxx b/sw/source/core/access/accselectionhelper.cxx index 6bced3eaa053..fb56e71e35dd 100644 --- a/sw/source/core/access/accselectionhelper.cxx +++ b/sw/source/core/access/accselectionhelper.cxx @@ -89,8 +89,7 @@ void SwAccessibleSelectionHelper::selectAccessibleChild( // we can only select fly frames, so we ignore (should: return // false) all other attempts at child selection -SwFEShell* pFEShell = GetFEShell(); -if( pFEShell != nullptr ) +if (GetFEShell()) { const SdrObject *pObj = aChild.GetDrawObject(); if( pObj ) @@ -142,8 +141,7 @@ bool SwAccessibleSelectionHelper::isAccessibleChildSelected( // ... and compare to the currently selected frame bool bRet = false; -const SwFEShell* pFEShell = GetFEShell(); -if( pFEShell ) +if (const SwFEShell* pFEShell = GetFEShell()) { if ( aChild.GetSwFrame() != nullptr ) { @@ -172,7 +170,7 @@ void SwAccessibleSelectionHelper::selectAllAccessibleChildren( ) // the first we can select, and select it. SwFEShell* pFEShell = GetFEShell(); -if( !pFEShell ) +if (!pFEShell) return; std::list< SwAccessibleChild > aChildren; @@ -198,8 +196,7 @@ sal_Int64 SwAccessibleSelectionHelper::getSelectedAccessibleChildCount( ) sal_Int64 nCount = 0; // Only one frame can be selected at a time, and we only frames // for selectable children. -const SwFEShell* pFEShell = GetFEShell(); -if( pFEShell != nullptr ) +if (const SwFEShell* pFEShell = GetFEShell()) { const SwFlyFrame* pFlyFrame = pFEShell->GetSelectedFlyFrame(); if( pFlyFrame ) @@ -251,7 +248,7 @@ Reference SwAccessibleSelectionHelper::getSelectedAccessibleChild( // be 0, and a selection must exist, otherwise we have to throw an // lang::IndexOutOfBoundsException SwFEShell* pFEShell = GetFEShell(); -if( nullptr == pFEShell ) +if (!pFEShell) throwIndexOutOfBoundsException(); SwAccessibleChild aChild; diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index d45457e138d7..3f8e46ea7fb0 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -506,7 +506,8 @@ bool SwTable::InsertCol( SwDoc& rDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt, pPCD->AddRowCols( *this, rBoxes, nCnt, bBehind ); rDoc.UpdateCharts( GetFrameFormat()->GetName() ); -rDoc.GetDocShell()->GetFEShell()->UpdateTableStyleFormatting(); +if (SwFEShell* pFEShell = rDoc.GetDocShell()->GetFEShell()) +pFEShell->UpdateTableStyleFormatting(); return bRes; } @@ -624,7 +625,8 @@ bool SwTable::InsertRow_( SwDoc* pDoc, const SwSelBoxes& rBoxes, pPCD->AddRowCols( *this, rBoxes, nCnt, bBehind ); pDoc->UpdateCharts( GetFrameFormat()->GetName() ); -pDoc->GetDocShell()->GetFEShell()->UpdateTableStyleFormatting(pTableNd); +if (SwFEShell* pFEShell = pDoc->GetDocShell()->GetFEShell()) +pFEShell->UpdateTableStyleFormatting(pTableNd); return true; } diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 77f7a4d3e97c..55f47b780554 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -2081,7 +2081,8 @@ bool SwDoc::DeleteRowCol(const SwSelBoxes& rBoxes, RowColMode const eMode) getIDocumentContentOperations().DeleteSection( pTableNd ); } -GetDocShell()->GetFEShell()->UpdateTableStyleFormatting(); +if (SwFEShell* pFEShell =
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/uibase/uiview/view.cxx |5 + 1 file changed, 5 insertions(+) New commits: commit 3820e23c9f1547fe8c1dc9ece1686a405d101e78 Author: Miklos Vajna AuthorDate: Wed Feb 8 09:04:14 2023 +0100 Commit: Xisco Fauli CommitDate: Wed Feb 15 15:51:47 2023 + sw: fix crash in SwView::AttrChangedNotify() Crashreport signature: program/../program/libswlo.so SwView::AttrChangedNotify(LinkParamNone*) sw/source/uibase/uiview/view.cxx:507 program/../program/libswlo.so SwWrtShell::DrawSelChanged() sw/source/uibase/wrtsh/wrtsh3.cxx:261 program/../program/libswlo.so SwDrawView::MarkListHasChanged() sw/source/core/draw/dview.cxx:767 program/libmergedlo.so SdrMarkView::MarkObj(SdrObject*, SdrPageView*, bool, bool, std::vector >&&) svx/source/svdraw/svdmrkv.cxx:2196 program/../program/libswlo.so SwDrawContact::DisconnectFromLayout(bool) /opt/rh/devtoolset-10/root/usr/include/c++/10/bits/stl_vector.h:336 This seems to happen when the SwDrawContent delete is in progress, so we no longer have the shells at hand that are usually present. Change-Id: Iba0601654c946b85e7c2de33fe76d99b26a20eae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147052 Reviewed-by: Miklos Vajna Tested-by: Jenkins (cherry picked from commit dab3de66e057f8d6794c427fb38cb2e333dfc93f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147059 Reviewed-by: Xisco Fauli diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx index 8ed0e97301dc..8c3ffcde2322 100644 --- a/sw/source/uibase/uiview/view.cxx +++ b/sw/source/uibase/uiview/view.cxx @@ -528,6 +528,11 @@ IMPL_LINK_NOARG(SwView, AttrChangedNotify, LinkParamNone*, void) if ( GetEditWin().IsChainMode() ) GetEditWin().SetChainMode( false ); +if (!m_pWrtShell || !GetDocShell()) +{ +return; +} + //Opt: Not if PaintLocked. During unlock a notify will be once more triggered. if( !m_pWrtShell->IsPaintLocked() && !g_bNoInterrupt && GetDocShell()->IsReadOnly() )
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/fields/docufld.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 24c05688ad0db805196765a409c49f9ac6f2b6e7 Author: Bjoern Michaelsen AuthorDate: Sat Feb 11 23:52:01 2023 +0100 Commit: Caolán McNamara CommitDate: Tue Feb 14 13:21:55 2023 + tdf#134283: MakeSetList should iterate Setters, not Getters Change-Id: I811a3b562ead942c98705da29774b77c593eabc4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146828 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 75a863ee7fea133ae6bcd010d1aac46815fa49e2) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146977 Reviewed-by: Caolán McNamara diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index 2015216f2a91..dffc35132fca 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -2224,7 +2224,7 @@ bool SwRefPageGetFieldType::MakeSetList(SetGetExpFields& rTmpLst, { IDocumentRedlineAccess const& rIDRA(m_rDoc.getIDocumentRedlineAccess()); std::vector vFields; -GatherFields(vFields); + m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::RefPageSet)->GatherFields(vFields); for(auto pFormatField: vFields) { // update only the GetRef fields
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/uibase/app/applab.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit 15e08e498a64eca1d4305682d6055a9ab1d568c6 Author: Xisco Fauli AuthorDate: Thu Feb 9 14:36:51 2023 +0100 Commit: Michael Stahl CommitDate: Fri Feb 10 10:16:53 2023 + sw: fix crash in SwModule::InsertLab Seen in https://crashreport.libreoffice.org/stats/crash_details/e17357e9-d5e2-4eee-868e-ecf72e04dc41 Change-Id: I32f239249e72b6644b3a38d4dd9bbae65f7bede0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146704 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/sw/source/uibase/app/applab.cxx b/sw/source/uibase/app/applab.cxx index 1ea666ccdf61..7ee421ed5ee7 100644 --- a/sw/source/uibase/app/applab.cxx +++ b/sw/source/uibase/app/applab.cxx @@ -181,6 +181,8 @@ void SwModule::InsertLab(SfxRequest& rReq, bool bLabel) } SfxViewFrame* pViewFrame = SfxViewFrame::DisplayNewDocument( *xDocSh, rReq ); +if (!pViewFrame) +return; SwView *pNewView = static_cast( pViewFrame->GetViewShell()); pNewView->AttrChangedNotify(nullptr);// So that SelectShell is being called.
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/ui/frmdlg/cption.cxx |9 + 1 file changed, 1 insertion(+), 8 deletions(-) New commits: commit efbf1fad61882a52e92b9c4d9d277a5e8c7750ab Author: Szymon Kłos AuthorDate: Mon Feb 6 17:27:50 2023 +0100 Commit: Xisco Fauli CommitDate: Thu Feb 9 13:04:01 2023 + tdf#153244 apply caption options Change-Id: I2aa53a85ab9f38ddf74caac85047235ea85a40af Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146590 Tested-by: Jenkins Reviewed-by: Szymon Kłos (cherry picked from commit 6a7b3d59d790cb8ea55353fe4173d71a13931d50) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146630 Reviewed-by: Xisco Fauli diff --git a/sw/source/ui/frmdlg/cption.cxx b/sw/source/ui/frmdlg/cption.cxx index ab23c1f09987..e6b387a42910 100644 --- a/sw/source/ui/frmdlg/cption.cxx +++ b/sw/source/ui/frmdlg/cption.cxx @@ -72,14 +72,6 @@ public: void SetCharacterStyle(const OUString& rStyle); OUString GetCharacterStyle() const; - -virtual short run() override -{ -int nRet = GenericDialogController::run(); -if (nRet == RET_OK) -Apply(); -return nRet; -} }; } @@ -319,6 +311,7 @@ IMPL_LINK_NOARG(SwCaptionDialog, OptionHdl, weld::Button&, void) GenericDialogController::runAsync(pDlg, [pDlg, this](sal_Int32 nResult){ if (nResult == RET_OK) { +pDlg->Apply(); m_bCopyAttributes = pDlg->IsApplyBorderAndShadow(); m_sCharacterStyle = pDlg->GetCharacterStyle(); //#i61007# order of captions
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/layout/ftnfrm.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 51512d7bce52002ca29c0e6c5264ac34166ede85 Author: Caolán McNamara AuthorDate: Mon Feb 6 21:04:23 2023 + Commit: Michael Stahl CommitDate: Thu Feb 9 10:59:11 2023 + Related: tdf#153319 don't destroy frame with IsDeleteForbidden set not sufficient on its own to fix this crash. Change-Id: Ibd8b68d7e007d8a22770b3d73f0d17a1869cf279 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146598 Tested-by: Jenkins Reviewed-by: Caolán McNamara (cherry picked from commit df2ad816288a4729c9cea8d14b7d590ac271d18b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146626 Reviewed-by: Michael Stahl diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx index 9cc83c1bfc18..6fb88185a6f2 100644 --- a/sw/source/core/layout/ftnfrm.cxx +++ b/sw/source/core/layout/ftnfrm.cxx @@ -2420,7 +2420,8 @@ void SwFootnoteBossFrame::RearrangeFootnotes( const SwTwips nDeadLine, const boo if ( !bLock && bUnlockLastFootnoteFrame && !pLastFootnoteFrame->GetLower() && !pLastFootnoteFrame->IsColLocked() && - !pLastFootnoteFrame->IsBackMoveLocked() ) + !pLastFootnoteFrame->IsBackMoveLocked() && + !pLastFootnoteFrame->IsDeleteForbidden() ) { pLastFootnoteFrame->Cut(); SwFrame::DestroyFrame(pLastFootnoteFrame);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/edit/autofmt.cxx |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) New commits: commit cf12c44302d522fcf3fdd2180dfbb63e7591 Author: Justin Luth AuthorDate: Wed Feb 8 13:48:04 2023 -0500 Commit: Adolfo Jayme Barrientos CommitDate: Thu Feb 9 06:11:33 2023 + tdf#153423 tdf#150197: use getToken in proper order This fixes a LO 7.5 regression from my commit 727c5ed30f68abc28bb04531b25a1df30810760f getToken steps along the string and consumes it, so these needed to remain in the same order as they had been originally. Dumb thing to overlook. Change-Id: I483980eafb7deb0c224063ad41616bb21ddb2191 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146672 Tested-by: Jenkins Reviewed-by: Justin Luth (cherry picked from commit 6bc6da1d03327450571b6811e192787ad90ecea2) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146628 Reviewed-by: Adolfo Jayme Barrientos diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx index 4be8c9711188..a4c6e02dbc30 100644 --- a/sw/source/core/edit/autofmt.cxx +++ b/sw/source/core/edit/autofmt.cxx @@ -1616,8 +1616,9 @@ void SwAutoFormat::BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel ) if( !nDigitLevel ) { SwNumFormat aFormat( aRule.Get( nLvl ) ); +const OUString sPrefix = aPrefix.getToken(0, u'\x0001', nPrefixIdx); aFormat.SetStart( o3tl::narrowing(o3tl::toInt32(o3tl::getToken(aPrefix, 0, u'\x0001', nPrefixIdx ; -aFormat.SetListFormat(aPrefix.getToken(0, u'\x0001', nPrefixIdx), aPostfix.getToken(0, u'\x0001'), nLvl); +aFormat.SetListFormat(sPrefix, aPostfix.getToken(0, u'\x0001'), nLvl); aFormat.SetIncludeUpperLevels( 0 ); if( !aFormat.GetCharFormat() ) @@ -1639,8 +1640,8 @@ void SwAutoFormat::BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel ) { SwNumFormat aFormat( aRule.Get( n ) ); -aFormat.SetStart( o3tl::narrowing(o3tl::toInt32(o3tl::getToken(aPrefix, 0, u'\x0001', nPrefixIdx )) )); const OUString sPrefix = n ? "" : aPrefix.getToken(0, u'\x0001', nPrefixIdx); +aFormat.SetStart( o3tl::narrowing(o3tl::toInt32(o3tl::getToken(aPrefix, 0, u'\x0001', nPrefixIdx )) )); aFormat.SetListFormat(sPrefix, aPostfix.getToken(0, u'\x0001', nPostfixIdx), n); aFormat.SetIncludeUpperLevels( MAXLEVEL ); if( n < aNumTypes.getLength() )
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/filter/html/parcss1.cxx | 33 ++--- 1 file changed, 26 insertions(+), 7 deletions(-) New commits: commit 879db444dbc072a43fa0df460b48558ea4d9def5 Author: Julien Nabet AuthorDate: Fri Feb 3 19:01:54 2023 +0100 Commit: Michael Stahl CommitDate: Tue Feb 7 11:30:56 2023 + tdf#153341: try to parse alpha value when copying HTML text Change-Id: Ic7240358be19e73f3c3f021e0de9414e3e988aa6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146546 (cherry picked from commit a21aad5e084e3901a1e216ef9006b0f8b6132c39) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146524 Reviewed-by: Michael Stahl Tested-by: Jenkins diff --git a/sw/source/filter/html/parcss1.cxx b/sw/source/filter/html/parcss1.cxx index 0fa73d455fbc..2b03e0485195 100644 --- a/sw/source/filter/html/parcss1.cxx +++ b/sw/source/filter/html/parcss1.cxx @@ -633,7 +633,8 @@ CSS1Token CSS1Parser::GetNextToken() ( (('u'==m_aToken[0] || 'U'==m_aToken[0]) && m_aToken.equalsIgnoreAsciiCase( "url" )) || (('r'==m_aToken[0] || 'R'==m_aToken[0]) && - m_aToken.equalsIgnoreAsciiCase( "rgb" )) ) ) + (m_aToken.equalsIgnoreAsciiCase( "rgb" ) || m_aToken.equalsIgnoreAsciiCase( "rgba" ) ) + ) ) ) { int nNestCnt = 0; OUStringBuffer sTmpBuffer2(64); @@ -1268,18 +1269,24 @@ bool CSS1Expression::GetColor( Color ) const { case CSS1_RGB: { -sal_uInt8 aColors[3] = { 0, 0, 0 }; +// fourth value to 255 means no alpha transparency +// so the right by default value +sal_uInt8 aColors[4] = { 0, 0, 0, 255 }; +// it can be "rgb" or "rgba" if (!aValue.startsWithIgnoreAsciiCase( "rgb" ) || aValue.getLength() < 6 || -aValue[3] != '(' || aValue[aValue.getLength()-1] != ')') +(aValue[3] != '(' && aValue[4] != '(' ) || aValue[aValue.getLength()-1] != ')') { break; } -sal_Int32 nPos = 4; // start after "rgb(" -for ( int nCol = 0; nCol < 3 && nPos > 0; ++nCol ) +sal_Int32 nPos = aValue.startsWithIgnoreAsciiCase( "rgba" )?5:4; // start after "rgba(" or "rgb(" +char cSep = (aValue.indexOf(',') != -1)?',':' '; +// alpha value can be after a "/" or "," +bool bIsSepAlphaDiv = (aValue.indexOf('/') != -1)?true:false; +for ( int nCol = 0; nCol < 4 && nPos > 0; ++nCol ) { -const std::u16string_view aNumber = o3tl::getToken(aValue, 0, ',', nPos); +const std::u16string_view aNumber = o3tl::getToken(aValue, 0, cSep, nPos); sal_Int32 nNumber = o3tl::toInt32(aNumber); if( nNumber<0 ) @@ -1295,13 +1302,25 @@ bool CSS1Expression::GetColor( Color ) const } else if( nNumber > 255 ) nNumber = 255; - +else if( aNumber.find('.') != std::u16string_view::npos ) +{ +// in this case aNumber contains something like "0.3" so not an sal_Int32 +nNumber = static_cast(255.0*o3tl::toDouble(aNumber)); +} aColors[nCol] = static_cast(nNumber); +// rgb with alpha and '/' has this form: rgb(255 0 0 / 50%) +if (bIsSepAlphaDiv && nCol == 2) +{ +// but there can be some spaces or not before and after the "/", so skip them +while (aValue[nPos] == '/' || aValue[nPos] == ' ') + ++nPos; +} } rColor.SetRed( aColors[0] ); rColor.SetGreen( aColors[1] ); rColor.SetBlue( aColors[2] ); +rColor.SetAlpha( aColors[3] ); bRet = true;// something different than a colour isn't possible }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/unocore/unosrch.cxx | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) New commits: commit 53277b6d06e2b4bfef9e5d47329aabee77c15a18 Author: Julien Nabet AuthorDate: Wed Feb 1 12:10:13 2023 +0100 Commit: Xisco Fauli CommitDate: Mon Feb 6 13:05:20 2023 + Related tdf#153272: add some missing properties in SwSearchProperties RES_PARATR_ORPHANS RES_PARATR_WIDOWS Change-Id: Ied760289e1ef8d60602991e5cdc0c743a31fd236 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146435 Tested-by: Jenkins Reviewed-by: Julien Nabet (cherry picked from commit 52ebc632b3cfa122dcb178cf28d8dbc7c7c57007) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146525 Reviewed-by: Michael Stahl diff --git a/sw/source/core/unocore/unosrch.cxx b/sw/source/core/unocore/unosrch.cxx index 646d5955ba90..fe35dba300be 100644 --- a/sw/source/core/unocore/unosrch.cxx +++ b/sw/source/core/unocore/unosrch.cxx @@ -144,7 +144,9 @@ void SwSearchProperties_Impl::FillItemSet(SfxItemSet& rSet, bool bIsValueSearch) pCharReliefItem, pCharRotate, pCharScaleWidth, -pParaVertAlign; +pParaVertAlign, +pParaOrphans, +pParaWidows; auto funcClone = [](sal_uInt16 nWID, std::unique_ptr & rpPoolItem) { @@ -314,6 +316,12 @@ void SwSearchProperties_Impl::FillItemSet(SfxItemSet& rSet, bool bIsValueSearch) case RES_PARATR_VERTALIGN: pTempItem = funcClone(nWID, pParaVertAlign); break; +case RES_PARATR_ORPHANS: +pTempItem = funcClone(nWID, pParaOrphans); +break; +case RES_PARATR_WIDOWS: +pTempItem = funcClone(nWID, pParaWidows); +break; } if(pTempItem) {
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/text/txtfrm.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit ff023cef954cf6eb32118ec57f42de19e786d670 Author: Mike Kaganski AuthorDate: Fri Feb 3 17:21:19 2023 +0300 Commit: Xisco Fauli CommitDate: Mon Feb 6 11:17:13 2023 + Avoid UB as seen in https://ci.libreoffice.org/job/lo_ubsan/2671/ after commit 333183d9a72d1e2b7ae65145092efec5e357ad14 ("tdf#153304: Add undo entries and set modified in SwXFrame::setProperty*", 2023-02-02): [_RUN_] testImagePropsCreateUndoAndModifyDoc::TestBody warn:sal.file:4195:4195:sal/osl/unx/file_misc.cxx:401: Invalid directory URL warn:basic:4195:4195:basic/source/uno/namecont.cxx:953: Cannot access extensions! warn:sal.file:4195:4195:sal/osl/unx/file_misc.cxx:401: Invalid directory URL warn:basic:4195:4195:basic/source/uno/namecont.cxx:953: Cannot access extensions! warn:legacy.osl:4195:4195:sw/source/core/text/porfly.cxx:198: CalcFlyPos: Not Found! warn:legacy.osl:4195:4195:sw/source/core/text/txtfrm.cxx:3092: Prepare: Why me? /include/o3tl/strong_int.hxx:143:40: runtime error: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int' #0 0x7f79b14fee7a in o3tl::strong_int o3tl::operator+(o3tl::strong_int const&, o3tl::strong_int const&) /include/o3tl/strong_int.hxx:143:40 #1 0x7f79b553f7a5 in SwTextFrame::IsIdxInside(o3tl::strong_int, o3tl::strong_int) const /sw/source/core/text/txtfrm.cxx:1665:71 #2 0x7f79b559be6a in SwTextFrame::InvalidateRange(SwCharRange const&, long) /sw/source/core/text/txtfrm.cxx:1689:10 #3 0x7f79b5566a79 in SwTextFrame::Prepare(PrepareHint, void const*, bool) /sw/source/core/text/txtfrm.cxx:3093:17 #4 0x7f79b438c1b5 in SwFlyInContentFrame::SwClientNotify(SwModify const&, SfxHint const&) /sw/source/core/layout/flyincnt.cxx:137:28 #5 0x7f79b17c06e2 in SwModify::CallSwClientNotify(SfxHint const&) const /sw/source/core/attr/calbck.cxx:322:18 #6 0x7f79b17c09e5 in sw::BroadcastingModify::CallSwClientNotify(SfxHint const&) const /sw/source/core/attr/calbck.cxx:327:15 #7 0x7f79b17be1ef in SwModify::SwClientNotify(SwModify const&, SfxHint const&) /sw/source/core/attr/calbck.cxx:313:5 #8 0x7f79b1801e06 in SwFormat::SwClientNotify(SwModify const&, SfxHint const&) /sw/source/core/attr/format.cxx:314:19 #9 0x7f79b414fa7c in SwFrameFormat::SwClientNotify(SwModify const&, SfxHint const&) /sw/source/core/layout/atrfrm.cxx:2713:15 #10 0x7f79b17c0f13 in sw::ClientNotifyAttrChg(SwModify&, SwAttrSet const&, SwAttrSet&, SwAttrSet&) /sw/source/core/attr/calbck.cxx:336:13 #11 0x7f79b18090b5 in SwFormat::SetFormatAttr(SfxPoolItem const&) /sw/source/core/attr/format.cxx:520:13 #12 0x7f79b23c2e54 in SwDoc::SetFlyFrameAnchor(SwFrameFormat&, SfxItemSet&, bool) /sw/source/core/doc/docfly.cxx:326:13 #13 0x7f79b23cac22 in lcl_SetFlyFrameAttr(SwDoc&, signed char (SwDoc::*)(SwFrameFormat&, SfxItemSet&, bool), SwFrameFormat&, SfxItemSet&) /sw/source/core/doc/docfly.cxx:451:17 #14 0x7f79b23ca43d in SwDoc::SetFlyFrameAttr(SwFrameFormat&, SfxItemSet&) /sw/source/core/doc/docfly.cxx:560:23 #15 0x7f79b64818d2 in SwXFrame::setPropertyValue(rtl::OUString const&, com::sun::star::uno::Any const&) /sw/source/core/unocore/unoframe.cxx:1921:36 #16 0x7f79d562de12 in testImagePropsCreateUndoAndModifyDoc::TestBody() /sw/qa/core/undo/undo.cxx:136:13 ... See https://gerrit.libreoffice.org/c/core/+/146484/7#message-8ce5de47f17cc701fc58b932e80b1de8469053bf Hope it makes sense. Change-Id: Id5c86ed4c093993557a24e00b3288ccdfa4de2ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146542 Reviewed-by: Stephan Bergmann Tested-by: Jenkins Reviewed-by: Mike Kaganski (cherry picked from commit 274587f634e57b59b34f352409453b394064cadd) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146523 Reviewed-by: Xisco Fauli diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index 86cfe6555431..aa371cd3df63 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -1657,6 +1657,8 @@ TextFrameIndex SwTextFrame::FindBrk(std::u16string_view aText, bool SwTextFrame::IsIdxInside(TextFrameIndex const nPos, TextFrameIndex const nLen) const { +if (nPos == TextFrameIndex(COMPLETE_STRING)) // the "not found" range +return false; // Silence over-eager warning emitted at least by GCC trunk towards 6: #if defined __GNUC__ && !defined __clang__ #pragma GCC diagnostic push
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/unocore/unosrch.cxx | 18 +- 1 file changed, 17 insertions(+), 1 deletion(-) New commits: commit 52216e9aad59c6c43b47f3d29d73bde9d11280d3 Author: Julien Nabet AuthorDate: Mon Jan 30 22:00:31 2023 +0100 Commit: Michael Stahl CommitDate: Thu Feb 2 11:26:28 2023 + tdf#153272: add some missing properties in SwSearchProperties RES_CHRATR_RELIEF RES_CHRATR_ROTATE RES_CHRATR_SCALEW RES_PARATR_VERTALIGN Change-Id: Ic4a3323a4b4b4231dee083016a6112a9e2674c86 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146370 Tested-by: Jenkins Reviewed-by: Noel Grandin (cherry picked from commit 2d9570523b16dd157384040642e3c2e0ed05) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146401 Reviewed-by: Michael Stahl diff --git a/sw/source/core/unocore/unosrch.cxx b/sw/source/core/unocore/unosrch.cxx index ee260c077b61..646d5955ba90 100644 --- a/sw/source/core/unocore/unosrch.cxx +++ b/sw/source/core/unocore/unosrch.cxx @@ -140,7 +140,11 @@ void SwSearchProperties_Impl::FillItemSet(SfxItemSet& rSet, bool bIsValueSearch) pCTLLangItem, pCTLPostureItem, pCTLWeightItem, -pShadowItem ; +pShadowItem, +pCharReliefItem, +pCharRotate, +pCharScaleWidth, +pParaVertAlign; auto funcClone = [](sal_uInt16 nWID, std::unique_ptr & rpPoolItem) { @@ -298,6 +302,18 @@ void SwSearchProperties_Impl::FillItemSet(SfxItemSet& rSet, bool bIsValueSearch) case RES_CHRATR_SHADOW: pTempItem = funcClone(nWID, pShadowItem); break; +case RES_CHRATR_RELIEF: +pTempItem = funcClone(nWID, pCharReliefItem); +break; +case RES_CHRATR_ROTATE: +pTempItem = funcClone(nWID, pCharRotate); +break; +case RES_CHRATR_SCALEW: +pTempItem = funcClone(nWID, pCharScaleWidth); +break; +case RES_PARATR_VERTALIGN: +pTempItem = funcClone(nWID, pParaVertAlign); +break; } if(pTempItem) {
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/filter/ww8/docxattributeoutput.cxx | 17 +++-- 1 file changed, 15 insertions(+), 2 deletions(-) New commits: commit 77f7f28df730d4720188a59e43ea58fc47880975 Author: Michael Stahl AuthorDate: Wed Feb 1 12:31:46 2023 +0100 Commit: Caolán McNamara CommitDate: Thu Feb 2 08:58:29 2023 + tdf#148952 sw: DOCX export: ECMA-376 1st ed does not allow title ... attribute, so fallback to merge the value with the description into the descr attribute. Change-Id: I4e83a67788d0c82dd762c075f06db358a7884675 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146444 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit d09996a0d66c51908103afef9c56679b891570d8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146460 Reviewed-by: Caolán McNamara diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 7a203c85fbf4..538e861352c8 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -5682,9 +5682,22 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size rtl::Reference<::sax_fastparser::FastAttributeList> docPrattrList = FastSerializerHelper::createAttrList(); docPrattrList->add( XML_id, OString::number( m_anchorId++).getStr()); docPrattrList->add( XML_name, OUStringToOString( pFrameFormat->GetName(), RTL_TEXTENCODING_UTF8 ) ); -docPrattrList->add( XML_descr, OUStringToOString( pGrfNode ? pGrfNode->GetDescription() : pOLEFrameFormat->GetObjDescription(), RTL_TEXTENCODING_UTF8 )); +OUString const descr(pGrfNode ? pGrfNode->GetDescription() : pOLEFrameFormat->GetObjDescription()); +OUString const title(pGrfNode ? pGrfNode->GetTitle() : pOLEFrameFormat->GetObjTitle()); if( GetExport().GetFilter().getVersion( ) != oox::core::ECMA_DIALECT ) -docPrattrList->add( XML_title, OUStringToOString( pGrfNode ? pGrfNode->GetTitle() : pOLEFrameFormat->GetObjTitle(), RTL_TEXTENCODING_UTF8 )); +{ +docPrattrList->add(XML_descr, OUStringToOString(descr, RTL_TEXTENCODING_UTF8)); +docPrattrList->add(XML_title, OUStringToOString(title, RTL_TEXTENCODING_UTF8)); +} +else +{ // tdf#148952 no title attribute, merge it into descr +OUString const value(title.isEmpty() +? descr +: descr.isEmpty() +? title +: title + OUString::Concat("\n") + descr); +docPrattrList->add(XML_descr, OUStringToOString(value, RTL_TEXTENCODING_UTF8)); +} m_pSerializer->startElementNS( XML_wp, XML_docPr, docPrattrList ); OUString sURL, sRelId;
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/doc/docedt.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 1ca9f7fc85db66c7c6ba25d43f05476ea787dfc4 Author: László Németh AuthorDate: Wed Feb 1 18:00:25 2023 +0100 Commit: László Németh CommitDate: Thu Feb 2 08:54:09 2023 + tdf#152738 sw: fix lost SwPosition in spelling dialog Which resulted broken spell checking. Regression from commit b484e5d9e0d22b794c2d1c73741191836158a4ad "use more SwPosition::Assign". Change-Id: I7be215f629ed73a3009f8358172ee3a7e2e72ffc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146465 Reviewed-by: Noel Grandin Tested-by: Jenkins Reviewed-by: László Németh Tested-by: László Németh (cherry picked from commit 2780b026f912a103aea3f8dc19319b998d19a43a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146407 diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index 3a085c1d060e..7898af3b540d 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -607,8 +607,8 @@ uno::Any SwDoc::Spell( SwPaM& rPaM, pSpellArgs->pStartPos->GetContentIndex(); if( nCurrNd != nEndNd ) { -pSttPos->Assign(nCurrNd); -pEndPos->Assign(nCurrNd); +pSttPos->Assign(nCurrNd, pSttPos->GetContentIndex()); +pEndPos->Assign(nCurrNd, pEndPos->GetContentIndex()); nCurrNd = nEndNd; } }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/inc/SwUndoPageDesc.hxx |2 ++ sw/source/core/undo/SwUndoPageDesc.cxx | 12 2 files changed, 14 insertions(+) New commits: commit f7b9bb615b65a036458d2bd28cd13492407c0173 Author: Caolán McNamara AuthorDate: Thu Jan 26 15:05:36 2023 + Commit: Xisco Fauli CommitDate: Fri Jan 27 08:39:23 2023 + tdf#153220 exit header/footer edit mode, if active, on undo header/footer Change-Id: Ibe97a9239bff03b7bcffc11c02b6bdff840c4481 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146093 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/source/core/inc/SwUndoPageDesc.hxx b/sw/source/core/inc/SwUndoPageDesc.hxx index c8d88f6cbd04..ab90a3a65b5f 100644 --- a/sw/source/core/inc/SwUndoPageDesc.hxx +++ b/sw/source/core/inc/SwUndoPageDesc.hxx @@ -34,6 +34,8 @@ class SwUndoPageDesc final : public SwUndo // To avoid duplication of (header/footer)content nodes for simple page desc changes void ExchangeContentNodes( SwPageDesc& rSource, SwPageDesc ); +// tdf#153220 use to Exit HeaderFooter EditMode +void ExitHeaderFooterEdit(); public: SwUndoPageDesc(const SwPageDesc & aOld, const SwPageDesc & aNew, SwDoc * pDoc); diff --git a/sw/source/core/undo/SwUndoPageDesc.cxx b/sw/source/core/undo/SwUndoPageDesc.cxx index 0ec97951ed85..eec1300d5e67 100644 --- a/sw/source/core/undo/SwUndoPageDesc.cxx +++ b/sw/source/core/undo/SwUndoPageDesc.cxx @@ -18,6 +18,7 @@ */ #include +#include #include #include #include @@ -216,12 +217,22 @@ void SwUndoPageDesc::ExchangeContentNodes( SwPageDesc& rSource, SwPageDesc pNewFormat->SetFormatAttr( SwFormatContent() ); } +void SwUndoPageDesc::ExitHeaderFooterEdit() +{ +SwEditShell* pESh = m_pDoc->GetEditShell(); +if (!pESh) +return; +if (pESh->IsHeaderFooterEdit()) +pESh->ToggleHeaderFooterEdit(); +} + void SwUndoPageDesc::UndoImpl(::sw::UndoRedoContext &) { // Move (header/footer)content node responsibility from new page descriptor to old one again. if( m_bExchange ) ExchangeContentNodes( m_aNew.m_PageDesc, m_aOld.m_PageDesc ); m_pDoc->ChgPageDesc(m_aOld.GetName(), m_aOld); +ExitHeaderFooterEdit(); } void SwUndoPageDesc::RedoImpl(::sw::UndoRedoContext &) @@ -230,6 +241,7 @@ void SwUndoPageDesc::RedoImpl(::sw::UndoRedoContext &) if( m_bExchange ) ExchangeContentNodes( m_aOld.m_PageDesc, m_aNew.m_PageDesc ); m_pDoc->ChgPageDesc(m_aNew.GetName(), m_aNew); +ExitHeaderFooterEdit(); } SwRewriter SwUndoPageDesc::GetRewriter() const
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/text/porlay.cxx |9 + 1 file changed, 9 insertions(+) New commits: commit f8b7cdd6b017011a286215bde2d5d064048818a6 Author: László Németh AuthorDate: Mon Jan 23 20:06:32 2023 +0100 Commit: Michael Stahl CommitDate: Tue Jan 24 12:58:09 2023 + tdf#152541 sw: don't show hidden __RefHeading__ bookmarks In visible bookmark mode, don't show __RefHeading__ bookmarks, which are hidden in Navigator, too. Note: they are inserted automatically e.g. with the ToC at the beginning of the headings. Follow-up to commit 4ce8120f1e53f7b81e653b01d141643013bc69ab "tdf#45589 sw: create and paint text portions for bookmarks". Change-Id: Id337613342fa74f5edef59d01349810f9737b62c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146044 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 9bec4732915ef408d9a442ccbeb9b582a204b1ca) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146030 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx index 5e50f7ad5873..7115c90e7bca 100644 --- a/sw/source/core/text/porlay.cxx +++ b/sw/source/core/text/porlay.cxx @@ -1241,6 +1241,15 @@ void SwScriptInfo::InitScriptInfo(const SwTextNode& rNode, for (auto const& it : bookmarks) { +// don't show __RefHeading__ bookmarks, which are hidden in Navigator, too +// (They are inserted automatically e.g. with the ToC at the beginning of +// the headings) +if (it.first->GetName().startsWith( + IDocumentMarkAccess::GetCrossRefHeadingBookmarkNamePrefix())) +{ +continue; +} + // search for custom bookmark boundary mark color Color c = getBookmarkColor(rNode, it.first);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/ui/config/optpage.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 73c73d76513621b745ee94ab357bb337bc6b26c9 Author: Caolán McNamara AuthorDate: Mon Jan 23 09:46:28 2023 + Commit: Michael Stahl CommitDate: Tue Jan 24 12:55:12 2023 + gtk_tree_view_scroll_to_cell: assertion 'tree_view->priv->tree != NULL' failed Change-Id: Ie02dbee2e21fd5092f8be5f01383f2ce3b60c0aa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146020 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx index 6fb406ba2953..48e50acaab1d 100644 --- a/sw/source/ui/config/optpage.cxx +++ b/sw/source/ui/config/optpage.cxx @@ -420,7 +420,7 @@ voidSwAddPrinterTabPage::Reset( const SfxItemSet* ) auto nFound = m_xFaxLB->find_text(pAddPrinterAttr->m_sFaxName); if (nFound != -1) m_xFaxLB->set_active(nFound); -else +else if (m_xFaxLB->get_count()) m_xFaxLB->set_active(0); } if (m_xProspectCB->get_active())
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/crsr/crsrsh.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 06d106ddb8f34d98018bf4a169d200cd1257f6aa Author: Caolán McNamara AuthorDate: Fri Jan 20 09:21:46 2023 + Commit: Caolán McNamara CommitDate: Mon Jan 23 14:50:00 2023 + Resolves: tdf#153116 null-ptr-deref in get-surrounding-text #0 SwFrame::IsTextFrame() const (this=0x0) at sw/source/core/inc/frame.hxx:1236 #1 0x7fffa8dcb865 in sw::FrameContainsNode(SwContentFrame const&, o3tl::strong_int) (rFrame=..., nNodeIndex=...) at sw/source/core/text/txtfrm.cxx:292 #2 0x7fffa82c9fd4 in SwCursorShell::GetSelText() const (this=0x5509470) at sw/source/core/crsr/crsrsh.cxx:2565 #3 0x7fffa89017f0 in SwEditShell::GetSelectedText(rtl::OUString&, ParaBreakType) (this=0x5509470, rBuf="", nHndlParaBrk=ParaBreakType::ToOnlyCR) at sw/source/core/edit/edglss.cxx:264 #4 0x7fffa97e19a7 in SwEditWin::GetSurroundingText() const (this=0x4f1a9f0) at sw/source/uibase/docvw/edtwin.cxx:6628 #5 0x7fffee27cf02 in ImplHandleSurroundingTextRequest(vcl::Window*, rtl::OUString&, Selection&) (pWindow=0x1fe43f0, rText="", rSelRange=...) at vcl/source/window/winproc.cxx:2544 #6 0x7fffee27adf7 in ImplHandleSalSurroundingTextRequest(vcl::Window*, SalSurroundingTextRequestEvent*) (pWindow=0x1fe43f0, pEvt=0x7fffb970) at vcl/source/window/winproc.cxx:2555 #7 0x7fffee276ed6 in ImplWindowFrameProc(vcl::Window*, SalEvent, void const*) (_pWindow=0x1fe43f0, nEvent=SalEvent::SurroundingTextRequest, pEvent=0x7fffb970) at vcl/source/window/winproc.cxx:2884 #8 0x7fffe6ee3080 in SalFrame::CallCallback(SalEvent, void const*) const (this=0x1898310, nEvent=SalEvent::SurroundingTextRequest, pEvent=0x7fffb970) at vcl/inc/salframe.hxx:306 Change-Id: I7330865b5dda7766a6da08f57a7dd8dd1a09d198 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145805 Reviewed-by: Michael Stahl Tested-by: Jenkins diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 725c7ede3402..b270cdbe6334 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -2562,7 +2562,7 @@ OUString SwCursorShell::GetSelText() const if (GetLayout()->HasMergedParas()) { SwContentFrame const*const pFrame(GetCurrFrame(false)); -if (FrameContainsNode(*pFrame, m_pCurrentCursor->GetMark()->GetNodeIndex())) +if (pFrame && FrameContainsNode(*pFrame, m_pCurrentCursor->GetMark()->GetNodeIndex())) { OUStringBuffer buf; SwPosition const*const pStart(m_pCurrentCursor->Start());
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/docnode/nodes.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 4192d8cc3120473d0dbfcc7ff12bf8297ac999db Author: Noel Grandin AuthorDate: Fri Jan 20 10:18:54 2023 +0200 Commit: Xisco Fauli CommitDate: Mon Jan 23 12:04:46 2023 + tdf#150819 crash after a few paste and undo regression from commit 3a02b5f8aae803b7b5a232c724135594483627a4 Author: Noel Grandin Date: Tue Aug 16 18:44:31 2022 +0200 convert more nNode to SwPosition::GetNode Change-Id: I636590ec5eb28f0db3640464a49f0ab5582ff853 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145864 Tested-by: Jenkins Reviewed-by: Noel Grandin (cherry picked from commit b70eee2d394dd7249c2de0cb41ccc47f80a05f8f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145947 Reviewed-by: Michael Stahl diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx index 540d5ce7509b..afef83e76df5 100644 --- a/sw/source/core/docnode/nodes.cxx +++ b/sw/source/core/docnode/nodes.cxx @@ -1532,7 +1532,7 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes ) pDestNd->SplitContentNode(rPos, nullptr); } -if( rPos.GetNodeIndex() == aEndIdx.GetIndex() ) +if( rPos.GetNode() == aEndIdx.GetNode() ) { --aEndIdx; }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/access/accpara.cxx | 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) New commits: commit 2e3b1a683f490384bedd925cb57dc9bc9f5c6cf1 Author: Caolán McNamara AuthorDate: Sat Jan 21 16:20:29 2023 + Commit: Xisco Fauli CommitDate: Mon Jan 23 08:55:29 2023 + rhbz#2162862 null pFrame during teardown Change-Id: Iad2de93f0400b0ec49dae4c3d6979957784114f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145935 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index aea0d2b3518f..8121d1c62389 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -431,15 +431,18 @@ bool SwAccessibleParagraph::HasCursor() void SwAccessibleParagraph::UpdatePortionData() { // obtain the text frame -OSL_ENSURE( GetFrame() != nullptr, "The text frame has vanished!" ); -OSL_ENSURE( GetFrame()->IsTextFrame(), "The text frame has mutated!" ); const SwTextFrame* pFrame = static_cast( GetFrame() ); - -// build new portion data -m_pPortionData.reset( new SwAccessiblePortionData( -pFrame, GetMap()->GetShell()->GetViewOptions()) ); -pFrame->VisitPortions( *m_pPortionData ); - +OSL_ENSURE( pFrame != nullptr, "The text frame has vanished!" ); +if (!pFrame) +ClearPortionData(); +else +{ +OSL_ENSURE( pFrame->IsTextFrame(), "The text frame has mutated!" ); +// build new portion data +m_pPortionData.reset( new SwAccessiblePortionData( +pFrame, GetMap()->GetShell()->GetViewOptions()) ); +pFrame->VisitPortions( *m_pPortionData ); +} OSL_ENSURE( m_pPortionData != nullptr, "UpdatePortionData() failed" ); }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/crsr/bookmark.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 6c319584fbfeec3667080decd9af4ba54b434ee7 Author: Michael Stahl AuthorDate: Thu Jan 19 18:45:39 2023 +0100 Commit: Miklos Vajna CommitDate: Fri Jan 20 14:44:05 2023 + sw: crashtesting forum-mso-en-12641.docx, fix assert in FindFieldSep The fieldmark may overlap a section; at the start was considered here, but at the end was not and so the assertion wrongly fired. Change-Id: I118bc36c2d9c4ca7028a583278d0f193537c4cb2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145826 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 959f64dbb85d1785dbea5a4d2a41519c98769a7c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145801 Reviewed-by: Miklos Vajna diff --git a/sw/source/core/crsr/bookmark.cxx b/sw/source/core/crsr/bookmark.cxx index feb7e77a3163..2520e6312b79 100644 --- a/sw/source/core/crsr/bookmark.cxx +++ b/sw/source/core/crsr/bookmark.cxx @@ -113,7 +113,8 @@ namespace sw::mark } else { -assert(pNode->IsNoTextNode() || pNode->IsSectionNode()); +assert(pNode->IsNoTextNode() || pNode->IsSectionNode() +|| (pNode->IsEndNode() && pNode->StartOfSectionNode()->IsSectionNode())); } } assert(ret); // must have found it
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/uibase/docvw/HeaderFooterWin.cxx |9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) New commits: commit a64d8610fdbe56df67df03e6fadfff9ab7a0c441 Author: Caolán McNamara AuthorDate: Tue Jan 17 10:25:54 2023 + Commit: Xisco Fauli CommitDate: Tue Jan 17 20:35:39 2023 + Resolves: tdf#153059 after ChangeHeaderOrFooter the control can be disposed If the cursor is still on page one then when a header, via a control on another page, is added it jumps back to that page, so the widget on the now hidden page is removed, but the click handler hasn't completed so the follow up action to change it from a "plus" button to a dropdown menubutton was on a disposed widget. Change-Id: I981126412a0ee6a667d77fb97a3db2f2b0a0363c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145584 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/source/uibase/docvw/HeaderFooterWin.cxx b/sw/source/uibase/docvw/HeaderFooterWin.cxx index 0e79e1481012..539a310b08aa 100644 --- a/sw/source/uibase/docvw/HeaderFooterWin.cxx +++ b/sw/source/uibase/docvw/HeaderFooterWin.cxx @@ -549,8 +549,13 @@ IMPL_LINK_NOARG(SwHeaderFooterWin, ClickHdl, weld::Button&, void) const SwPageFrame* pPageFrame = SwFrameMenuButtonBase::GetPageFrame(m_pFrame); const OUString& rStyleName = pPageFrame->GetPageDesc()->GetName(); -rSh.ChangeHeaderOrFooter( rStyleName, m_bIsHeader, true, false ); - +{ +VclPtr xThis(this); +rSh.ChangeHeaderOrFooter( rStyleName, m_bIsHeader, true, false ); +//tdf#153059 after ChangeHeaderOrFooter is it possible that "this" is disposed +if (xThis->isDisposed()) +return; +} m_xPushButton->hide(); m_xMenuButton->show(); PaintButton();
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/doc/DocumentContentOperationsManager.cxx | 26 +--- sw/source/core/doc/doccorr.cxx |2 - sw/source/filter/xml/XMLRedlineImportHelper.cxx |5 +-- 3 files changed, 19 insertions(+), 14 deletions(-) New commits: commit e073e4afe5eb460083944eb22dc8d87ad334877a Author: Michael Stahl AuthorDate: Thu Jan 5 13:17:17 2023 +0100 Commit: Caolán McNamara CommitDate: Fri Jan 6 20:46:03 2023 + tdf#152710 sw: call and fix DeleteSection() instead Turns out there's a function to delete a complete nodes array section - and it has the same problem? Why does it move indexes only from startnode + 1? Let's try to fix it to be more consistent. Change-Id: Iedacc10e29c1646c4ccc85e53a479b0351f5cfcc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145078 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 475e59d29b7a6cc7f058af8ff863b3bb1a2a84a5) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145011 Reviewed-by: Caolán McNamara diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index f50308cd03af..21f67d9a9774 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -2070,6 +2070,18 @@ DocumentContentOperationsManager::CopyRange( SwPaM& rPam, SwPosition& rPos, return bRet; } +static auto GetCorrPosition(SwPaM const& rPam) -> SwPosition +{ +// tdf#152710 target position must be on node that survives deletion +// so that PaMCorrAbs can invalidate SwUnoCursors properly +return rPam.GetPoint()->GetNode().IsContentNode() +? *rPam.GetPoint() +: rPam.GetMark()->GetNode().IsContentNode() +? *rPam.GetMark() +// this would be the result in SwNodes::RemoveNode() +: SwPosition(rPam.End()->GetNode(), SwNodeOffset(+1)); +} + /// Delete a full Section of the NodeArray. /// The passed Node is located somewhere in the designated Section. void DocumentContentOperationsManager::DeleteSection( SwNode *pNode ) @@ -2087,8 +2099,9 @@ void DocumentContentOperationsManager::DeleteSection( SwNode *pNode ) { // move all Cursor/StackCursor/UnoCursor out of the to-be-deleted area -SwNodeIndex aMvStt( aSttIdx, 1 ); -SwDoc::CorrAbs( aMvStt, aEndIdx, SwPosition( aSttIdx ), true ); +SwPaM const range(aSttIdx, aEndIdx); +SwPosition const pos(GetCorrPosition(range)); +::PaMCorrAbs(range, pos); } m_rDoc.GetNodes().DelNodes( aSttIdx, aEndIdx.GetIndex() - aSttIdx.GetIndex() + 1 ); @@ -4243,14 +4256,7 @@ bool DocumentContentOperationsManager::DeleteRangeImpl(SwPaM & rPam, SwDeleteFla // passed PaM, because it could be a cursor that would be moved! SwPaM aDelPam( *rPam.GetMark(), *rPam.GetPoint() ); { -// tdf#152710 target position must be on node that survives deletion -// so that PaMCorrAbs can invalidate SwUnoCursors properly -SwPosition const pos(aDelPam.GetPoint()->GetNode().IsContentNode() -? *aDelPam.GetPoint() -: aDelPam.GetMark()->GetNode().IsContentNode() -? *aDelPam.GetMark() -// this would be the result in SwNodes::RemoveNode() -: SwPosition(aDelPam.End()->GetNode(), SwNodeOffset(+1))); +SwPosition const pos(GetCorrPosition(aDelPam)); ::PaMCorrAbs(aDelPam, pos); } diff --git a/sw/source/core/doc/doccorr.cxx b/sw/source/core/doc/doccorr.cxx index c26bced7ac00..783e1aa2346f 100644 --- a/sw/source/core/doc/doccorr.cxx +++ b/sw/source/core/doc/doccorr.cxx @@ -34,7 +34,7 @@ namespace /// returns NULL if no restrictions apply const SwStartNode* lcl_FindUnoCursorSection( const SwNode& rNode ) { -const SwStartNode* pStartNode = rNode.StartOfSectionNode(); +const SwStartNode* pStartNode = rNode.IsStartNode() ? rNode.GetStartNode() : rNode.StartOfSectionNode(); while( ( pStartNode != nullptr ) && ( pStartNode->StartOfSectionNode() != pStartNode ) && // section node is only start node allowing overlapped delete diff --git a/sw/source/filter/xml/XMLRedlineImportHelper.cxx b/sw/source/filter/xml/XMLRedlineImportHelper.cxx index 268ddd5cdf25..6d3bb6007ae6 100644 --- a/sw/source/filter/xml/XMLRedlineImportHelper.cxx +++ b/sw/source/filter/xml/XMLRedlineImportHelper.cxx @@ -718,9 +718,8 @@ void XMLRedlineImportHelper::InsertIntoDocument(RedlineInfo* pRedlineInfo) SAL_WARN("sw.xml", "Recursive change tracking, removing"); // reuse aPaM to remove it from nodes that will be deleted aPaM.GetPoint()->Assign(pRedlineInfo->pContentIndex->GetNode()); -aPaM.SetMark(); -
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/doc/DocumentContentOperationsManager.cxx | 12 +++- sw/source/core/doc/doccorr.cxx |5 - 2 files changed, 15 insertions(+), 2 deletions(-) New commits: commit e8d36908ca57af37dfea747d32356d3175e2a9b0 Author: Michael Stahl AuthorDate: Thu Jan 5 12:32:09 2023 +0100 Commit: Caolán McNamara CommitDate: Fri Jan 6 20:45:25 2023 + tdf#152710 sw: invalidate SwUnoCursors properly in DeleteRangeImpl() This crashes with: list.cxx:44: corrupt document structure, bailing out of infinite loop ndtxt.cxx:5437: void SwTextNode::TriggerNodeUpdate(const sw::LegacyModifyHint&): Assertion `dynamic_cast(static_cast(pOldValue)->pChangedFormat)' failed. Because the redline from 7 to 9 is deleted, but then some cursor ends up on node 10 which is invalid as it is an end node. [ 6] 0x60666a0StartNode , [ 7] 0x61195e0 StartNode , [ 8] 0x61197a8 TextNode "tainment", [ 9] 0x6119670 EndNode , [ 10] 0x6066730 EndNode , The first problem is that DeleteRangeImpl() uses the point node as the target position for PaMCorrAbs(), but in this case the point node will be deleted. PaMCorrAbs() has a check to invalidate SwUnoCursors that would be moved out of their parent sections, but due to the first problem it can't check it, and the second problem is that lcl_FindUnoCursorSection() doesn't work on redline sections, as those have node type SwNormalStartNode. After fixing the invalidation, subsequent access to the SwXTextCursor throws exceptions and importing the file fails. (regression from commit 477e489e71b4a96ff10d9f2d2b802d91dec3e319) Thanks to Dave Gilbert for identifying the problematic DeleteRange() call. Change-Id: I48a373cc122073b82bc47513fdae684f45b0efb8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145077 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 8e05bdd26f21fc304978ff3b454cf355841ec75f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145010 Reviewed-by: Caolán McNamara diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index 94f3baf31907..f50308cd03af 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -4242,7 +4242,17 @@ bool DocumentContentOperationsManager::DeleteRangeImpl(SwPaM & rPam, SwDeleteFla // Move all cursors out of the deleted range, but first copy the // passed PaM, because it could be a cursor that would be moved! SwPaM aDelPam( *rPam.GetMark(), *rPam.GetPoint() ); -::PaMCorrAbs( aDelPam, *aDelPam.GetPoint() ); +{ +// tdf#152710 target position must be on node that survives deletion +// so that PaMCorrAbs can invalidate SwUnoCursors properly +SwPosition const pos(aDelPam.GetPoint()->GetNode().IsContentNode() +? *aDelPam.GetPoint() +: aDelPam.GetMark()->GetNode().IsContentNode() +? *aDelPam.GetMark() +// this would be the result in SwNodes::RemoveNode() +: SwPosition(aDelPam.End()->GetNode(), SwNodeOffset(+1))); +::PaMCorrAbs(aDelPam, pos); +} bool const bSuccess( DeleteRangeImplImpl(aDelPam, flags) ); if (bSuccess) diff --git a/sw/source/core/doc/doccorr.cxx b/sw/source/core/doc/doccorr.cxx index 8cf23cc43ab5..c26bced7ac00 100644 --- a/sw/source/core/doc/doccorr.cxx +++ b/sw/source/core/doc/doccorr.cxx @@ -37,8 +37,11 @@ namespace const SwStartNode* pStartNode = rNode.StartOfSectionNode(); while( ( pStartNode != nullptr ) && ( pStartNode->StartOfSectionNode() != pStartNode ) && - ( pStartNode->GetStartNodeType() == SwNormalStartNode ) ) + // section node is only start node allowing overlapped delete + pStartNode->IsSectionNode() ) +{ pStartNode = pStartNode->StartOfSectionNode(); +} return pStartNode; }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/crsr/pam.cxx |9 +++-- sw/source/core/crsr/swcrsr.cxx| 11 -- sw/source/core/doc/CntntIdxStore.cxx |2 - sw/source/core/doc/DocumentTimerManager.cxx |4 +- sw/source/core/doc/doccorr.cxx|6 +-- sw/source/core/doc/docdesc.cxx|2 - sw/source/core/doc/tblafmt.cxx|6 +-- sw/source/core/docnode/ndtbl.cxx |8 +--- sw/source/core/edit/edfcol.cxx| 10 +++--- sw/source/core/fields/ddefld.cxx |3 - sw/source/core/frmedt/fetab.cxx |7 ++-- sw/source/core/layout/frmtool.cxx | 13 +-- sw/source/core/sw3io/swacorr.cxx |8 +++- sw/source/core/txtnode/txtedt.cxx | 22 +++-- sw/source/core/undo/docundo.cxx |3 - sw/source/core/undo/unsect.cxx|3 - sw/source/core/undo/untbl.cxx |9 - sw/source/core/unocore/unoframe.cxx |3 - sw/source/uibase/app/docstyle.cxx |9 + sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx | 30 +- sw/source/uibase/uno/SwXDocumentSettings.cxx |3 - 21 files changed, 93 insertions(+), 78 deletions(-) New commits: commit 09848e94d20c067499ad69edf81fa80a45d0a632 Author: Caolán McNamara AuthorDate: Thu Dec 22 15:40:46 2022 + Commit: Xisco Fauli CommitDate: Thu Dec 22 21:18:08 2022 + check GetEditShell() Change-Id: I975c7dca9ea569e326fc5d8670a078959ab9f093 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144730 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx index d162bfb9516b..bc3f9d7104a2 100644 --- a/sw/source/core/crsr/pam.cxx +++ b/sw/source/core/crsr/pam.cxx @@ -918,19 +918,20 @@ bool SwPaM::HasReadonlySel(bool bFormView, bool const isReplace) const // Allow editing when the cursor/selection is fully inside of a legacy form field. bRet = !( pA != nullptr && !bAtStartA && !bAtStartB && pA == pB ); -if (bRet && rDoc.GetEditShell() && rDoc.GetEditShell()->CursorInsideContentControl()) +if (bRet) { // Also allow editing inside content controls in general, similar to form fields. // Specific types will be disabled below. -bRet = false; +if (const SwEditShell* pEditShell = rDoc.GetEditShell()) +bRet = !pEditShell->CursorInsideContentControl(); } } if (!bRet) { // Paragraph Signatures and Classification fields are read-only. -if (rDoc.GetEditShell()) -bRet = rDoc.GetEditShell()->IsCursorInParagraphMetadataField(); +if (const SwEditShell* pEditShell = rDoc.GetEditShell()) +bRet = pEditShell->IsCursorInParagraphMetadataField(); } if (!bRet && diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index 566b225c7e61..132bbe644610 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -1782,9 +1782,10 @@ bool SwCursor::LeftRight( bool bLeft, sal_uInt16 nCnt, SwCursorSkipMode nMode, if ( !Move( fnMove, fnGo ) ) { -SwEditShell* rSh = GetDoc().GetEditShell(); -if (rSh && rSh->GetViewOptions() && - rSh->GetViewOptions()->IsShowOutlineContentVisibilityButton()) +const SwEditShell* pSh = GetDoc().GetEditShell(); +const SwViewOption* pViewOptions = pSh ? pSh->GetViewOptions() : nullptr; +if (pViewOptions && pViewOptions->IsShowOutlineContentVisibilityButton()) +{ // Fixes crash that occurs in documents with outline content folded at the end of // the document. When the cursor is at the end of the visible document and // right arrow key is pressed Move fails after moving the cursor to the @@ -1792,6 +1793,7 @@ bool SwCursor::LeftRight( bool bLeft, sal_uInt16 nCnt, SwCursorSkipMode nMode, // weird numbers to be displayed in the statusbar page number count. Left // arrow, when in this state, causes a crash without RestoredSavePos() added here. RestoreSavePos(); +} break; } @@ -2103,7 +2105,8 @@ bool SwCursor::UpDown( bool bUp, sal_uInt16 nCnt, //Update cursor to change nUpDownX. if ( aOldPos.GetContentIndex() == nOffset ) { -GetDoc().GetEditShell()->UpdateCursor(); +if (SwEditShell* pSh = GetDoc().GetEditShell()) +pSh->UpdateCursor(); bRet = false;
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) New commits: commit 1126fddc4a4bfaf9dcfb1fb79c4564e2babfa36d Author: Xisco Fauli AuthorDate: Thu Dec 22 13:28:14 2022 +0100 Commit: Xisco Fauli CommitDate: Thu Dec 22 17:01:21 2022 + sw: check for nullptr in WriterInspectorTextPanel GetEditShell() in sw/source/core/doc/doccorr.cxx might return nullptr See https://crashreport.libreoffice.org/stats/crash_details/75a28cf5-cf45-4d36-a1aa-471a0ad9251a Change-Id: I3de2dec461d590841d4ea3b7d98f384ee27ad4ad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144757 Tested-by: Jenkins Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara (cherry picked from commit 37ca1154f392dd9eefad8250509652b845434793) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144723 Reviewed-by: Xisco Fauli diff --git a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx index 518b61d8f1a1..9b85126ca856 100644 --- a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx +++ b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx @@ -74,7 +74,8 @@ WriterInspectorTextPanel::WriterInspectorTextPanel(weld::Widget* pParent) // Update panel on start std::vector aStore; -if (pDocSh && pDocSh->GetDoc()->GetEditShell()->GetCursor()->GetPointNode().GetTextNode()) +if (pDocSh && pDocSh->GetDoc()->GetEditShell() +&& pDocSh->GetDoc()->GetEditShell()->GetCursor()->GetPointNode().GetTextNode()) UpdateTree(pDocSh, aStore, m_nParIdx); updateEntries(aStore, m_nParIdx); } @@ -737,7 +738,8 @@ IMPL_LINK(WriterInspectorTextPanel, AttrChangedNotify, LinkParamNone*, pLink, vo SwDocShell* pDocSh = m_pShell->GetDoc()->GetDocShell(); std::vector aStore; -if (pDocSh && pDocSh->GetDoc()->GetEditShell()->GetCursor()->GetPointNode().GetTextNode()) +if (pDocSh && pDocSh->GetDoc()->GetEditShell() +&& pDocSh->GetDoc()->GetEditShell()->GetCursor()->GetPointNode().GetTextNode()) UpdateTree(pDocSh, aStore, m_nParIdx); updateEntries(aStore, m_nParIdx);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/core/crsr/pam.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 88cb29a51ac3556301d02921c573b57d6218bc04 Author: Xisco Fauli AuthorDate: Thu Dec 22 12:47:56 2022 +0100 Commit: Xisco Fauli CommitDate: Thu Dec 22 16:59:41 2022 + sw: check for nullptr GetEditShell() in sw/source/core/doc/doccorr.cxx might return nullptr Introduced in 7cb6be3e866bad39a37844802d49b1f5c7031910 "tdf#151190 sw content controls: make them read-write in protected sections" See https://crashreport.libreoffice.org/stats/crash_details/5d1da2eb-b0e9-4974-b726-c7837c47cc63 Change-Id: Ia133c5d7a680c3bdfabe1c43c538cb5f54e7df73 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144756 Tested-by: Jenkins Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara (cherry picked from commit 4c8517e7d89f7b87eeb36b2758a01d9dac515d5a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144725 Reviewed-by: Xisco Fauli diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx index 9295b09a7480..d162bfb9516b 100644 --- a/sw/source/core/crsr/pam.cxx +++ b/sw/source/core/crsr/pam.cxx @@ -918,7 +918,7 @@ bool SwPaM::HasReadonlySel(bool bFormView, bool const isReplace) const // Allow editing when the cursor/selection is fully inside of a legacy form field. bRet = !( pA != nullptr && !bAtStartA && !bAtStartB && pA == pB ); -if (bRet && rDoc.GetEditShell()->CursorInsideContentControl()) +if (bRet && rDoc.GetEditShell() && rDoc.GetEditShell()->CursorInsideContentControl()) { // Also allow editing inside content controls in general, similar to form fields. // Specific types will be disabled below.
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/uibase/inc/conttree.hxx |1 - sw/source/uibase/utlui/content.cxx | 33 ++--- 2 files changed, 6 insertions(+), 28 deletions(-) New commits: commit 84c2e39007c0ab29f90111d4fe0b24f0b55f7eba Author: Jim Raykowski AuthorDate: Wed Dec 21 00:07:30 2022 -0900 Commit: Xisco Fauli CommitDate: Thu Dec 22 13:08:03 2022 + tdf#152029 Headings can also use BringTypesWithFlowFramesToAttention Change-Id: If4c094471bda4e01151680dc1f356eefa48aa4f1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144689 Tested-by: Jenkins Reviewed-by: Jim Raykowski (cherry picked from commit c73354b9f66ba436d933cc6558a38470e00c6ba8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144720 Reviewed-by: Xisco Fauli diff --git a/sw/source/uibase/inc/conttree.hxx b/sw/source/uibase/inc/conttree.hxx index d10b5ba9da1e..1e6bacbcd4db 100644 --- a/sw/source/uibase/inc/conttree.hxx +++ b/sw/source/uibase/inc/conttree.hxx @@ -138,7 +138,6 @@ class SwContentTree final : public SfxListener void OverlayObject(std::vector&& aRanges); -void BringHeadingsToAttention(const SwOutlineNodes& rOutlineNodesArr); void BringFramesToAttention(const std::vector& rFrameFormats); void BringBookmarksToAttention(const std::vector& rNames); void BringURLFieldsToAttention(const SwGetINetAttrs& rINetAttrsArr); diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index e036d4202aae..d3fda99dfc05 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -1188,10 +1188,8 @@ IMPL_LINK(SwContentTree, MouseMoveHdl, const MouseEvent&, rMEvt, bool) { if (nType == ContentTypeId::OUTLINE) { -SwOutlineNodes aOutlineNodes; -aOutlineNodes.insert(m_pActiveShell->GetNodes(). - GetOutLineNds()[static_cast(pCnt)->GetOutlinePos()]); -BringHeadingsToAttention(aOutlineNodes); + BringTypesWithFlowFramesToAttention({m_pActiveShell->GetNodes(). + GetOutLineNds()[static_cast(pCnt)->GetOutlinePos()]}); } else if (nType == ContentTypeId::TABLE) { @@ -1285,7 +1283,10 @@ IMPL_LINK(SwContentTree, MouseMoveHdl, const MouseEvent&, rMEvt, bool) { if (nType == ContentTypeId::OUTLINE) { - BringHeadingsToAttention(m_pActiveShell->GetNodes().GetOutLineNds()); +std::vector aNodesArr( + m_pActiveShell->GetNodes().GetOutLineNds().begin(), + m_pActiveShell->GetNodes().GetOutLineNds().end()); +BringTypesWithFlowFramesToAttention(aNodesArr); } else if (nType == ContentTypeId::TABLE) { @@ -5786,28 +5787,6 @@ void SwContentTree::OverlayObject(std::vector&& aRanges) m_aOverlayObjectDelayTimer.Start(); } -void SwContentTree::BringHeadingsToAttention(const SwOutlineNodes& rOutlineNodesArr) -{ -std::vector aRanges; -for (const SwNode* p : rOutlineNodesArr) -{ -if (!p || !p->GetTextNode()) -continue; -const SwTextNode& rTextNode = *p->GetTextNode(); -if (const SwTextFrame* pFrame = static_cast( -rTextNode.getLayoutFrame(m_pActiveShell->GetLayout( -{ -SwContentIndex nIndex(); -auto nStart = nIndex.GetIndex(); -auto nEnd = nStart + rTextNode.GetText().getLength(); -SwPosition aStartPos(rTextNode, nStart), aEndPos(rTextNode, nEnd); -lcl_CalcOverlayRanges(pFrame, pFrame, aStartPos, aEndPos, aRanges); -} -} -if (aRanges.size()) -OverlayObject(std::move(aRanges)); -} - void SwContentTree::BringFramesToAttention(const std::vector& rFrameFormats) { std::vector aRanges;
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/source
sw/source/uibase/inc/conttree.hxx |1 sw/source/uibase/utlui/content.cxx | 85 ++--- 2 files changed, 61 insertions(+), 25 deletions(-) New commits: commit cd274347896dc88bb137ef8cae87a86d9b977aef Author: Jim Raykowski AuthorDate: Tue Dec 20 00:33:05 2022 -0900 Commit: Xisco Fauli CommitDate: Wed Dec 21 14:19:33 2022 + tdf#152029 follow up: Handle content that extends to following pages Brings section and table content to attention in the document view that extend to following pages. Previously only the frame area on the page these content types begin is brought to attention. Change-Id: Ia023e85cc7c14e0c50a0a0f9765a17fb207a95da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144583 Tested-by: Jenkins Reviewed-by: Noel Grandin (cherry picked from commit 5930f928e777ab95ed26619c43fa5ae334685deb) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144663 Reviewed-by: Xisco Fauli diff --git a/sw/source/uibase/inc/conttree.hxx b/sw/source/uibase/inc/conttree.hxx index 1764377f0312..d10b5ba9da1e 100644 --- a/sw/source/uibase/inc/conttree.hxx +++ b/sw/source/uibase/inc/conttree.hxx @@ -147,6 +147,7 @@ class SwContentTree final : public SfxListener void BringDrawingObjectsToAttention(std::vector& rDrawingObjectsArr); void BringTextFieldsToAttention(std::vector& rTextAttrsArr); void BringFootnotesToAttention(std::vector& rTextAttrsArr); +void BringTypesWithFlowFramesToAttention(const std::vector& rNodes); /** * Before any data will be deleted, the last active entry has to be found. diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 0185943ff419..e036d4202aae 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -109,6 +109,7 @@ #include #include #include +#include #define CTYPE_CNT 0 #define CTYPE_CTT 1 @@ -1194,11 +1195,15 @@ IMPL_LINK(SwContentTree, MouseMoveHdl, const MouseEvent&, rMEvt, bool) } else if (nType == ContentTypeId::TABLE) { - if (const SwFrameFormats* pFrameFormats = +if (const SwFrameFormats* pFrameFormats = m_pActiveShell->GetDoc()->GetTableFrameFormats()) if (const SwFrameFormat* pFrameFormat = pFrameFormats->FindFormatByName(pCnt->GetName())) -BringFramesToAttention(std::vector {pFrameFormat}); +{ +SwTable* pTable = SwTable::FindTable(pFrameFormat); +if (pTable) + BringTypesWithFlowFramesToAttention({pTable->GetTableNode()}); +} } else if (nType == ContentTypeId::FRAME || nType == ContentTypeId::GRAPHIC || nType == ContentTypeId::OLE) @@ -1221,7 +1226,7 @@ IMPL_LINK(SwContentTree, MouseMoveHdl, const MouseEvent&, rMEvt, bool) const SwSectionFormats& rFormats = m_pActiveShell->GetDoc()->GetSections(); const SwSectionFormat* pFormat = rFormats.FindFormatByName(pCnt->GetName()); if (pFormat) -BringFramesToAttention(std::vector {pFormat}); + BringTypesWithFlowFramesToAttention({pFormat->GetSectionNode()}); } else if (nType == ContentTypeId::URLFIELD) { @@ -1284,7 +1289,7 @@ IMPL_LINK(SwContentTree, MouseMoveHdl, const MouseEvent&, rMEvt, bool) } else if (nType == ContentTypeId::TABLE) { -std::vector aTableFormatsArr; +std::vector aNodesArr; const size_t nCount = m_pActiveShell->GetTableFrameFormatCount(false); const SwFrameFormats* pFrameFormats = m_pActiveShell->GetDoc()->GetTableFrameFormats(); @@ -1294,9 +1299,13 @@ IMPL_LINK(SwContentTree, MouseMoveHdl, const MouseEvent&, rMEvt, bool) if (const SwTableFormat* pTableFormat = static_cast(pFrameFormats->GetFormat(i))) if (!pTableFormat->GetInfo(aGetHt)) // skip deleted tables -aTableFormatsArr.push_back(pTableFormat); +{ +SwTable* pTable = SwTable::FindTable(pTableFormat); +if (pTable) + aNodesArr.push_back(pTable->GetTableNode()); +} } -BringFramesToAttention(aTableFormatsArr); +BringTypesWithFlowFramesToAttention(aNodesArr); }