[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/ui/misc/pggrid.cxx | 17 - 1 file changed, 12 insertions(+), 5 deletions(-) New commits: commit 713b19bde2dcd0a65e04bb99681e35cbfd2f25e9 Author: Caolán McNamara AuthorDate: Wed Oct 5 09:49:17 2022 +0100 Commit: Xisco Fauli CommitDate: Wed Oct 5 14:04:52 2022 +0200 tdf#151316 recalc what dependencies should be sensitive Change-Id: I40f78ec151c3d5901209b8587f6152ab76d04e88 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140960 Tested-by: Jenkins Reviewed-by: Xisco Fauli (cherry picked from commit 17612ee10f89a6bf5447a324a02eb0a73d7b27e1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140961 diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx index 46f78140a927..e59e4112f439 100644 --- a/sw/source/ui/misc/pggrid.cxx +++ b/sw/source/ui/misc/pggrid.cxx @@ -460,15 +460,18 @@ IMPL_LINK(SwTextGridPage, TextSizeChangedHdl, weld::MetricSpinButton&, rField, v IMPL_LINK(SwTextGridPage, GridTypeHdl, weld::Toggleable&, rButton, void) { -bool bEnable = m_xNoGridRB.get() != -m_xLayoutFL->set_sensitive(bEnable); -m_xDisplayFL->set_sensitive(bEnable); +if (!rButton.get_active()) +return; + +const bool bNoGrid = m_xNoGridRB.get() == +m_xLayoutFL->set_sensitive(!bNoGrid); +m_xDisplayFL->set_sensitive(!bNoGrid); //one special case -if (bEnable) +if (!bNoGrid) DisplayGridHdl(*m_xDisplayCB); -bEnable = m_xCharsGridRB.get() == +bool bEnable = m_xCharsGridRB.get() == m_xSnapToCharsCB->set_sensitive(bEnable); bEnable = m_xLinesGridRB.get() == @@ -481,6 +484,10 @@ IMPL_LINK(SwTextGridPage, GridTypeHdl, weld::Toggleable&, rButton, void) m_xCharWidthMF->set_sensitive(false); } +//recalc which dependencies are sensitive +if (!bNoGrid) +TextSizeChangedHdl(*m_xTextSizeMF); + GridModifyHdl(); }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/docnode/node.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 84fde6fb3151aae8506fc66554a4fa2983127e87 Author: Bjoern Michaelsen AuthorDate: Sun Sep 25 04:34:54 2022 +0200 Commit: Caolán McNamara CommitDate: Tue Oct 4 14:57:34 2022 +0200 tdf#144939: fix chapter numbering updates Change-Id: Icd29a380663a1c5f70e3a8ee86db64ec4eae8d86 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140558 Tested-by: Jenkins Reviewed-by: Bjoern Michaelsen (cherry picked from commit 2aed71fa9e8a36ff2dc9f48897092c26ab89ea9e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140594 Reviewed-by: Michael Stahl (cherry picked from commit cb43334ee9938d7b8e250f9ddbdc81e53779f8d0) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140883 Reviewed-by: Caolán McNamara diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index 12be064f370b..8a319c03e7aa 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -1266,7 +1266,7 @@ SwFormatColl *SwContentNode::ChgFormatColl( SwFormatColl *pNewColl ) ChkCondColl(static_cast(pNewColl)); SwFormatChg aTmp1( pOldColl ); SwFormatChg aTmp2( pNewColl ); -SwClientNotify( *this, sw::LegacyModifyHint(, ) ); +CallSwClientNotify( sw::LegacyModifyHint(, ) ); } } InvalidateInSwCache(RES_ATTRSET_CHG);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/ui/chrdlg/numpara.cxx | 14 -- sw/source/uibase/inc/numpara.hxx |2 +- 2 files changed, 9 insertions(+), 7 deletions(-) New commits: commit 2fd53f90ae83a978a3f5e715d5e790fa1b4add00 Author: Xisco Fauli AuthorDate: Mon Oct 3 19:00:35 2022 +0200 Commit: Caolán McNamara CommitDate: Tue Oct 4 14:56:50 2022 +0200 sw: fix crash in SwParagraphNumTabPage::ExecuteEditNumStyle_Impl SfxViewShell::Current() could be nullptr See https://crashreport.libreoffice.org/stats/signature/SfxShell::GetDispatcher() Change-Id: Ic2ffc2a35eff8b8acbb896ece198916ee074b019 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140889 Tested-by: Jenkins Reviewed-by: Caolán McNamara (cherry picked from commit cf15a1fc143536c20c81faab5950ab829ec8df19) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140892 diff --git a/sw/source/ui/chrdlg/numpara.cxx b/sw/source/ui/chrdlg/numpara.cxx index 205bcacadb6f..272c7161e869 100644 --- a/sw/source/ui/chrdlg/numpara.cxx +++ b/sw/source/ui/chrdlg/numpara.cxx @@ -307,10 +307,15 @@ IMPL_LINK_NOARG(SwParagraphNumTabPage, EditNumStyleHdl_Impl, weld::Button&, void } // Internal: Perform functions through the Dispatcher -bool SwParagraphNumTabPage::ExecuteEditNumStyle_Impl( +void SwParagraphNumTabPage::ExecuteEditNumStyle_Impl( sal_uInt16 nId, const OUString , SfxStyleFamily nFamily) { -SfxDispatcher = *SfxViewShell::Current()->GetDispatcher(); +SfxViewShell* pViewShell = SfxViewShell::Current(); + +if( !pViewShell) +return; + +SfxDispatcher* pDispatcher = pViewShell->GetDispatcher(); SfxStringItem aItem(nId, rStr); SfxUInt16Item aFamily(SID_STYLE_FAMILY, static_cast(nFamily)); const SfxPoolItem* pItems[ 3 ]; @@ -329,12 +334,9 @@ bool SwParagraphNumTabPage::ExecuteEditNumStyle_Impl( pInternalItems[ 0 ] = pInternalItems[ 1 ] = nullptr; -const SfxPoolItem* pItem = rDispatcher.Execute( +pDispatcher->Execute( nId, SfxCallMode::SYNCHRON | SfxCallMode::RECORD, pItems, 0, pInternalItems); - -return pItem != nullptr; - } IMPL_LINK(SwParagraphNumTabPage, StyleHdl_Impl, weld::ComboBox&, rBox, void) diff --git a/sw/source/uibase/inc/numpara.hxx b/sw/source/uibase/inc/numpara.hxx index cf43a1b6b155..19fea5b15b94 100644 --- a/sw/source/uibase/inc/numpara.hxx +++ b/sw/source/uibase/inc/numpara.hxx @@ -58,7 +58,7 @@ class SwParagraphNumTabPage final : public SfxTabPage static const WhichRangesContainer aPageRg; -bool ExecuteEditNumStyle_Impl(sal_uInt16 nId, const OUString& rStr, +void ExecuteEditNumStyle_Impl(sal_uInt16 nId, const OUString& rStr, SfxStyleFamily nFamily); public:
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/docnode/ndtbl1.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 49cdadd5878da393dc640a8f7ec75b98cb2e0147 Author: Xisco Fauli AuthorDate: Fri Sep 9 13:33:09 2022 +0200 Commit: Caolán McNamara CommitDate: Mon Sep 19 21:19:47 2022 +0200 sw: avoid divide by zero in SwDoc::AdjustCellWidth See https://crashreport.libreoffice.org/stats/signature/SwDoc::AdjustCellWidth(SwCursor%20const%20&,bool,bool) Change-Id: I98b90dcbed6b6f3ea0a7d1668a5c248f39e7a2a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139658 Reviewed-by: Miklos Vajna Tested-by: Jenkins (cherry picked from commit b884772e4aa3d6f438c8a74f3a15250530830162) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139661 Reviewed-by: Caolán McNamara diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx index 4d0e38b794ab..923999f647cb 100644 --- a/sw/source/core/docnode/ndtbl1.cxx +++ b/sw/source/core/docnode/ndtbl1.cxx @@ -1626,7 +1626,8 @@ void SwDoc::AdjustCellWidth( const SwCursor& rCursor, } fTotalWish += aWish[i]; } -const sal_uInt16 nEqualWidth = nSelectedWidth / nCols; +assert(nCols); +const sal_uInt16 nEqualWidth = nCols ? nSelectedWidth / nCols : 0; // bBalance: Distribute the width evenly for (sal_uInt16 & rn : aWish) if ( rn && bBalance )
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/uibase/docvw/PageBreakWin.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit 188555883266b661ec201548bc4b4ccd01460862 Author: Caolán McNamara AuthorDate: Mon Aug 29 20:06:33 2022 +0100 Commit: Miklos Vajna CommitDate: Tue Aug 30 08:47:19 2022 +0200 Resolves: tdf#150629 the window was destroyed from the fadetimer callback which is how it could be possible that SwPageBreakWin::dispose() could be both called, stopping the timer, but the timer callback could access the disposed SwPageBreakWin Change-Id: If29ffb45fbde607d35c12064b05e4b5d25c2f009 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138976 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/sw/source/uibase/docvw/PageBreakWin.cxx b/sw/source/uibase/docvw/PageBreakWin.cxx index 2db9b5141cec..d0e08356dc40 100644 --- a/sw/source/uibase/docvw/PageBreakWin.cxx +++ b/sw/source/uibase/docvw/PageBreakWin.cxx @@ -486,6 +486,7 @@ IMPL_LINK_NOARG(SwPageBreakWin, FadeHandler, Timer *, void) { Hide(); m_pLine->DestroyWin(); +return; } else {
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/text/porfld.cxx |3 +++ sw/source/core/text/porfld.hxx |2 +- 2 files changed, 4 insertions(+), 1 deletion(-) New commits: commit f6b48296968f8280c26e11b0129a88540f5236cf Author: Caolán McNamara AuthorDate: Fri Aug 26 14:42:32 2022 +0100 Commit: Xisco Fauli CommitDate: Fri Aug 26 21:55:33 2022 +0200 crashtesting: empty brace init of o3tl::enumarray doesn't zero each element so the stretch used to layout fdo66401-6.docx is random, leading to sometimes too much stretch for cairo/freetype to handle and the conversion crashes. A problem since: commit d51db77c8d87f210785a8a8c6dd875f7bacddb3c Date: Tue Oct 15 01:57:12 2019 +0300 Remove some memset calls Replace them with default initialization or calloc Change-Id: I49408eee6c7e36bd9c98cbb10c7f95a57c0f7a11 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138828 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx index 6ef492c1b9d5..6110edc415fe 100644 --- a/sw/source/core/text/porfld.cxx +++ b/sw/source/core/text/porfld.cxx @@ -1074,6 +1074,9 @@ void SwTextFrame::StopAnimation( const OutputDevice* pOut ) */ SwCombinedPortion::SwCombinedPortion( const OUString ) : SwFieldPortion( rText ) +, m_aWidth{ static_cast(0), +static_cast(0), +static_cast(0) } , m_nUpPos(0) , m_nLowPos(0) , m_nProportion(55) diff --git a/sw/source/core/text/porfld.hxx b/sw/source/core/text/porfld.hxx index 519e56f8f58c..f424edbf7632 100644 --- a/sw/source/core/text/porfld.hxx +++ b/sw/source/core/text/porfld.hxx @@ -207,7 +207,7 @@ public: class SwCombinedPortion : public SwFieldPortion { sal_uInt16 m_aPos[6]; // up to six X positions -o3tl::enumarray m_aWidth = {}; // one width for every scripttype +o3tl::enumarray m_aWidth; // one width for every scripttype SwFontScript m_aScrType[6]; // scripttype of every character sal_uInt16 m_nUpPos; // the Y position of the upper baseline sal_uInt16 m_nLowPos; // the Y position of the lower baseline
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/doc/DocumentRedlineManager.cxx |7 ++- sw/source/core/text/redlnitr.cxx |2 +- 2 files changed, 7 insertions(+), 2 deletions(-) New commits: commit afb52ce707679c2fe6f2dbdef2670b1d34f45604 Author: Michael Stahl AuthorDate: Wed Aug 17 10:43:04 2022 +0200 Commit: Thorsten Behrens CommitDate: Thu Aug 18 10:55:21 2022 +0200 tdf#147466 sw_redlinehide: avoid crashing by delete un-deleting After the first delete, there is a single redline from 170,0 to 177,9, which contains a section. [ 169] 0x6133358TextNode "b) 9 (Robin Cook, Jack Straw, Margaret Beckett, David Milliband, William Hague, Philip Hammond, Boris Johnson, Jeremy Hunt, Dominic Raab)", [ 170] 0x61349d8TextNode "Hangul script is used to write which language?", [ 171] 0x61396f0 SectionNode , [ 172] 0x6138cc8 TextNode "Japanese", [ 173] 0x613ab58 TextNode "Vietnamese", [ 174] 0x613ad78 TextNode "Korean", [ 175] 0x613bc28 TextNode "Chinese", [ 176] 0x24a61c0 EndNode , [ 177] 0x6139568TextNode "c) Korean", Then the next delete is from 169,137 to 170,0 and it is combined in AppendRedline() with the existing one, removing the existing one. Now the code for tdf#119571 at the end of AppendRedline() that splits up the one redline into 4 redlines, with the section start node and section end node not covered by any of them. AppendRedline() of a delete redline causing previously deleted nodes to become un-deleted is a situation that UpdateFramesForAddDeleteRedline() doesn't expect. Additionally there seems to be an issue with CheckParaRedlineMerge() setting the Section's m_bHiddenFlag, which was unintentional, it should only set m_eMerge flag, but fixing that isn't sufficient. Reportedly this crashes since commit 6433dc223f6d21570e7132c4a580d186a5d5a334 but the problem appears older. Change-Id: Ic83a93d5aaec4ee562fb960693b52bd7b25cb1a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138411 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 7d730cd580e957ab06b0c7f020ac37dd0c337aa2) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138417 Reviewed-by: Thorsten Behrens diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx index 8a9a70ae2bb9..5052e320f216 100644 --- a/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/sw/source/core/doc/DocumentRedlineManager.cxx @@ -1666,8 +1666,13 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall pNewRedl->SetEnd( *pRStt, pEnd ); break; -case SwComparePosition::CollideStart: case SwComparePosition::CollideEnd: +if (pRStt->nContent != 0) +{ // tdf#147466 HACK: don't combine in this case to avoid the tdf#119571 code from *undeleting* section nodes +break; +} +[[fallthrough]]; +case SwComparePosition::CollideStart: if( pRedl->IsOwnRedline( *pNewRedl ) && pRedl->CanCombine( *pNewRedl ) ) { diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx index 3613469d7703..5b1e30c47018 100644 --- a/sw/source/core/text/redlnitr.cxx +++ b/sw/source/core/text/redlnitr.cxx @@ -425,7 +425,7 @@ CheckParaRedlineMerge(SwTextFrame & rFrame, SwTextNode & rTextNode, } for (auto const pSectionNode : sections) { -pSectionNode->DelFrames(rFrame.getRootFrame()); + pSectionNode->GetSection().GetFormat()->DelFrames(/*rFrame.getRootFrame()*/); } } auto pRet(std::make_unique(rFrame, std::move(extents),
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/text/porlay.cxx |4 1 file changed, 4 insertions(+) New commits: commit d484e8ba447de90fd77d0244a2cda1400bbe6232 Author: Michael Stahl AuthorDate: Fri Aug 12 17:39:18 2022 +0200 Commit: Caolán McNamara CommitDate: Sun Aug 14 13:00:35 2022 +0200 sw: fix crash in InitBookmarks() with forum-mso-en-8410.docx Error: attempt to dereference a past-the-end iterator. Probably this only crashes in the assert(iter->pNode...) as the rest of the function already checks that "iter == end". (regression from commit 46e04a712e97f9095ef4da7f0e52f50cf2bfbb32) Change-Id: If652a15d1cdebb21fbce028fceeaee8dce8f7f6d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138130 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx index 9db1949870d0..e96686f93fbd 100644 --- a/sw/source/core/text/porlay.cxx +++ b/sw/source/core/text/porlay.cxx @@ -1009,6 +1009,10 @@ static void InitBookmarks( break; } } +if (iter == end) +{ +break; // remaining marks are hidden +} } }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/txtnode/modeltoviewhelper.cxx | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) New commits: commit 73cae0b440a3126af3c448d867d4ceebdfcc278c Author: Michael Stahl AuthorDate: Mon Aug 8 16:12:14 2022 +0200 Commit: Caolán McNamara CommitDate: Fri Aug 12 10:27:45 2022 +0200 sw_fieldmarkhide: fix crash on exporting forum-mso-en-4034.docx to ODT The problem is that there's a field in a preceding paragraph that ends immediately before another field starts, and so the backwards iteration erroneously picks it up in ModelToViewHelper ctor. Change-Id: I6e65c04e0372377b3af48f1d80de287b6113e1c3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137986 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 4f62ae798cc1f9f7bc524e408fc7a370345b40a8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138026 Reviewed-by: Caolán McNamara diff --git a/sw/source/core/txtnode/modeltoviewhelper.cxx b/sw/source/core/txtnode/modeltoviewhelper.cxx index 1f35cd1ee614..8f0d5ccd7676 100644 --- a/sw/source/core/txtnode/modeltoviewhelper.cxx +++ b/sw/source/core/txtnode/modeltoviewhelper.cxx @@ -140,8 +140,16 @@ ModelToViewHelper::ModelToViewHelper(const SwTextNode , // skip it, must be handled in loop below if (pFieldMark->GetMarkStart().nNode < rNode) { -SwPosition const sepPos(::sw::mark::FindFieldSep(*pFieldMark)); -startedFields.emplace_front(pFieldMark, sepPos.nNode < rNode); +// this can be a nested field's end - skip over those! +if (pFieldMark->GetMarkEnd().nNode < rNode) +{ + assert(cursor.GetPoint()->nNode.GetNode().GetTextNode()->GetText()[cursor.GetPoint()->nContent.GetIndex()] == CH_TXT_ATR_FIELDEND); +} +else +{ +SwPosition const sepPos(::sw::mark::FindFieldSep(*pFieldMark)); +startedFields.emplace_front(pFieldMark, sepPos.nNode < rNode); +} *cursor.GetPoint() = pFieldMark->GetMarkStart(); } if (!cursor.Move(fnMoveBackward, GoInContent))
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/filter/xml/xmlexp.hxx |4 sw/source/filter/xml/xmlfmte.cxx | 12 +- sw/source/filter/xml/xmliteme.cxx |2 sw/source/filter/xml/xmltble.cxx | 157 -- sw/source/filter/xml/xmltexte.hxx | 12 ++ 5 files changed, 107 insertions(+), 80 deletions(-) New commits: commit 72a103fb9f5ea77ef5d8f104709bfa9f497494d7 Author: Michael Stahl AuthorDate: Fri Jul 29 17:00:14 2022 +0200 Commit: Thorsten Behrens CommitDate: Fri Aug 5 01:24:33 2022 +0200 tdf#145226 sw: ODF export: fix table-row/table-cell styles The SwFrameFormat for table lines and table boxes gets an auto-generated name in SwDoc::MakeTableBoxFormat()/MakeTableLineFormat(). The problem is that xmltble.cxx assumes that these SwFrameFormats never have a name, and sets names on them temporarily during exportTextAutoStyles(), then later reads them when exporting the table-rows and table-cells, then eventually resets them all to an empty name. One issue is that it assumes that a non-empty SwFrameFormat name indicates a style has been exported, but that isn't always the case, and the name may still be an auto-generated one. Another issue is that overwriting the names interferes with the use of the names in Undo operations. So store the name for the ODF styles in members of the filter classes instead of the core model. (regression from commit 083fe09958658de8c3da87a28e0f8ff7b3b8a5e9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127548 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 5a9fe1d80ea977c439dd10ee2056abe6b0cb4d07) tdf#145226 sw: ODF export: fix table-row/table-cell style display-name Missed this attribute in commit 5a9fe1d80ea977c439dd10ee2056abe6b0cb4d07 (cherry picked from commit de0120d9f75159f85d723439a89a6449082de669) Change-Id: I9b17962decbf9f8ecd2a91551230cf0f012e7a9d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137763 Tested-by: Jenkins Reviewed-by: Thorsten Behrens diff --git a/sw/source/filter/xml/xmlexp.hxx b/sw/source/filter/xml/xmlexp.hxx index 53ab4431c645..86b919ac95a7 100644 --- a/sw/source/filter/xml/xmlexp.hxx +++ b/sw/source/filter/xml/xmlexp.hxx @@ -24,6 +24,7 @@ #include "xmlitmap.hxx" #include +#include #include #include @@ -75,7 +76,8 @@ class SwXMLExport : public SvXMLExport SwXMLTableInfo_Impl& rTableInfo, bool bTop=false ); -void ExportFormat( const SwFormat& rFormat, enum ::xmloff::token::XMLTokenEnum eClass ); +void ExportFormat(const SwFormat& rFormat, enum ::xmloff::token::XMLTokenEnum eClass, +::std::optional const oStyleName); void ExportTableFormat( const SwFrameFormat& rFormat, sal_uInt32 nAbsWidth ); void ExportTableColumnStyle( const SwXMLTableColumn_Impl& rCol ); diff --git a/sw/source/filter/xml/xmlfmte.cxx b/sw/source/filter/xml/xmlfmte.cxx index f7866c5290f8..0f38de983519 100644 --- a/sw/source/filter/xml/xmlfmte.cxx +++ b/sw/source/filter/xml/xmlfmte.cxx @@ -46,7 +46,8 @@ using namespace ::com::sun::star::drawing; using namespace ::com::sun::star::lang; using namespace ::xmloff::token; -void SwXMLExport::ExportFormat( const SwFormat& rFormat, enum XMLTokenEnum eFamily ) +void SwXMLExport::ExportFormat(const SwFormat& rFormat, enum XMLTokenEnum eFamily, +::std::optional const oStyleName) { // CheckAttrList(); @@ -57,11 +58,14 @@ void SwXMLExport::ExportFormat( const SwFormat& rFormat, enum XMLTokenEnum eFami return; OSL_ENSURE( eFamily != XML_TOKEN_INVALID, "family must be specified" ); // style:name="..." +assert(oStyleName || (eFamily != XML_TABLE_ROW && eFamily != XML_TABLE_CELL)); bool bEncoded = false; -AddAttribute( XML_NAMESPACE_STYLE, XML_NAME, EncodeStyleName( -rFormat.GetName(), ) ); +OUString const name(oStyleName ? *oStyleName : rFormat.GetName()); +AddAttribute(XML_NAMESPACE_STYLE, XML_NAME, EncodeStyleName(name, )); if( bEncoded ) -AddAttribute( XML_NAMESPACE_STYLE, XML_DISPLAY_NAME, rFormat.GetName() ); +{ +AddAttribute(XML_NAMESPACE_STYLE, XML_DISPLAY_NAME, name); +} if( eFamily != XML_TOKEN_INVALID ) AddAttribute( XML_NAMESPACE_STYLE, XML_FAMILY, eFamily ); diff --git a/sw/source/filter/xml/xmliteme.cxx b/sw/source/filter/xml/xmliteme.cxx index d60cc12b7d12..5102b2462af8 100644 --- a/sw/source/filter/xml/xmliteme.cxx +++ b/sw/source/filter/xml/xmliteme.cxx @@ -245,7 +245,7 @@ void SwXMLExport::ExportTableFormat( const SwFrameFormat& rFormat, sal_uInt32 nA { static_cast(m_pTableItemMapper.get()) ->SetAbsWidth( nAbsWidth ); -ExportFormat( rFormat, XML_TABLE ); +ExportFormat(rFormat, XML_TABLE, {}); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/txtnode/txtatr2.cxx | 15 +++ 1 file changed, 3 insertions(+), 12 deletions(-) New commits: commit d855c247bde36b7c353a7fb111dad28bbcf18832 Author: Jim Raykowski AuthorDate: Mon Jun 13 08:31:33 2022 -0800 Commit: Caolán McNamara CommitDate: Tue Aug 2 12:57:17 2022 +0200 tdf#149467 fix re-entrance crash This crash is caused by an odd re-entrance happening. In this case re-entrance to SwContentTree::UpdateTracking happens when SfxHintId::DocChanged is broadcast from SwDocShell::SetModified when GetContentAtPos is called from SwContentTree::UpdateTracking which eventually causes a stack crash. Getting model position for view point when getting content at position (GetContentAtPos call to GetModelPositionForViewPoint) shouldn't set the document modification state. Which is what happens using the steps to repro this crash. This patch disallows setting document modification state during the DocumentStylePoolManager::GetFormatFromPool call from SwTextINetFormat::GetCharFormat. backtrace of last 100 levels before crash: 1 SwTextFrame::GetModelPositionForViewPoint_ frmcrsr.cxx 551 0x7fffbddbde96 2 SwTextFrame::GetModelPositionForViewPoint frmcrsr.cxx 665 0x7fffbddbe891 3 SwLayoutFrame::GetModelPositionForViewPoint trvlfrm.cxx 168 0x7fffbdcf6c08 4 SwLayoutFrame::GetModelPositionForViewPoint trvlfrm.cxx 168 0x7fffbdcf6c08 5 SwPageFrame::GetModelPositionForViewPoint trvlfrm.cxx 211 0x7fffbdcf6f2f 6 SwRootFrame::GetModelPositionForViewPoint trvlfrm.cxx 452 0x7fffbdcf7fa0 7 SwCursorShell::GetContentAtPos crstrvl.cxx 1370 0x7fffbd581050 8 SwContentTree::UpdateTracking content.cxx 3700 0x7fffbe9864a0 9 SwContentTree::TimerUpdate content.cxx 3589 0x7fffbe985474 10 SwContentTree::Notify content.cxx 3047 0x7fffbe9811ad 11 SfxBroadcaster::Broadcast SfxBroadcaster.cxx 40 0x74180f32 12 SwDocShell::SetModified docsh2.cxx 1446 0x7fffbe53b663 13 SwDocShell::Ole2ModifiedHdl docsh.cxx 1150 0x7fffbe52d660 14 SwDocShell::LinkStubOle2ModifiedHdl docsh.cxx 1131 0x7fffbe52d597 15 Link::Call link.hxx 111 0x7fffbd8889f5 16 sw::DocumentStateManager::SetModified DocumentStateManager.cxx 50 0x7fffbd888729 17 SwDoc::MakeCharFormat docfmt.cxx 861 0x7fffbd6ef2b8 18 SwDoc::MakeCharFormat_ docfmt.cxx 883 0x7fffbd6ef43a 19 sw::DocumentStylePoolManager::GetFormatFromPool DocumentStylePoolManager.cxx 1514 0x7fffbd89132c 20 sw::DocumentStylePoolManager::GetCharFormatFromPool DocumentStylePoolManager.cxx 1718 0x7fffbd892d86 21 SwTextINetFormat::GetCharFormat txtatr2.cxx 144 0x7fffbdfa1a03 22 SwTextINetFormat::GetCharFormat txtinet.hxx 52 0x7fffbddb4f4e 23 CharFormat::GetItemSet atrstck.cxx 145 0x7fffbddb07e5 24 SwAttrHandler::PushAndChg atrstck.cxx 345 0x7fffbddb1047 25 SwAttrIter::Chg itratr.cxx 102 0x7fffbddf02db 26 SwAttrIter::SeekFwd itratr.cxx 296 0x7fffbddf1104 27 SwAttrIter::Seekitratr.cxx 419 0x7fffbddf17b3 28 SwAttrIter::SeekAndChgAttrIter itratr.cxx 158 0x7fffbddf06e2 29 SwTextIter::SeekAndChg itrtxt.hxx 313 0x7fffbde01791 30 SwTextCursor::GetModelPositionForViewPoint itrcrsr.cxx 1658 0x7fffbddff83f 31 SwTextFrame::GetModelPositionForViewPoint_ frmcrsr.cxx 604 0x7fffbddbe337 32 SwTextFrame::GetModelPositionForViewPoint frmcrsr.cxx 665 0x7fffbddbe891 33 SwLayoutFrame::GetModelPositionForViewPoint trvlfrm.cxx 168 0x7fffbdcf6c08 34 SwLayoutFrame::GetModelPositionForViewPoint trvlfrm.cxx 168 0x7fffbdcf6c08 35 SwPageFrame::GetModelPositionForViewPoint trvlfrm.cxx 211 0x7fffbdcf6f2f 36 SwRootFrame::GetModelPositionForViewPoint trvlfrm.cxx 452 0x7fffbdcf7fa0 37 SwCursorShell::GetContentAtPos crstrvl.cxx 1370 0x7fffbd581050 38 SwContentTree::UpdateTracking content.cxx 3700 0x7fffbe9864a0 39 SwContentTree::TimerUpdate content.cxx 3589 0x7fffbe985474 40 SwContentTree::Notify content.cxx 3047 0x7fffbe9811ad 41
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/uibase/dbui/dbmgr.cxx | 37 ++--- 1 file changed, 18 insertions(+), 19 deletions(-) New commits: commit ccd7b9435f41d4be750555fe23ff12a73fb5e345 Author: Gülşah Köse AuthorDate: Fri Jul 8 14:48:27 2022 +0300 Commit: Adolfo Jayme Barrientos CommitDate: Sat Jul 30 10:53:34 2022 +0200 tdf#149915 Proper creation of vnd.sun.star.pkg:// URL Using different methods of creation (one using DecodeMechanism::NONE, another using DecodeMechanism::WithCharset) gave differently encoded end results, comparing unequal. The proper way is using DecodeMechanism::NONE on the document's URL, as implemented in commit 06756e412b2a02030ce3355b3fe4e2ecc71d2301 Author Mike Kaganski Date Sat Nov 18 22:41:40 2017 +0300 One more proper construction of vnd.sun.star.pkg URL Co-authored-by: Mike Kaganski Change-Id: I272f277ef8b4bd23e6cb7884e68f3c79f742683a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136901 Reviewed-by: Mike Kaganski Tested-by: Mike Kaganski (cherry picked from commit 9790585a62cb55e0e0024819596592193a6de269) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137428 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index 9323c52770b2..aa9937065325 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -136,6 +136,21 @@ void lcl_emitEvent(SfxEventHintId nEventId, sal_Int32 nStrId, SfxObjectShell* pD pDocShell)); } +// Construct vnd.sun.star.pkg:// URL +OUString ConstructVndSunStarPkgUrl(const OUString& rMainURL, std::u16string_view rStreamRelPath) +{ +auto xContext(comphelper::getProcessComponentContext()); +auto xUri = css::uri::UriReferenceFactory::create(xContext)->parse(rMainURL); +assert(xUri.is()); +xUri = css::uri::VndSunStarPkgUrlReferenceFactory::create(xContext) +->createVndSunStarPkgUrlReference(xUri); +assert(xUri.is()); +return xUri->getUriReference() + "/" ++ INetURLObject::encode( +rStreamRelPath, INetURLObject::PART_FPATH, +INetURLObject::EncodeMechanism::All); +} + } std::vector> SwDBManager::s_aUncommittedRegistrations; @@ -256,10 +271,9 @@ void SAL_CALL SwDataSourceRemovedListener::revokedDatabaseLocation(const sdb::Da if (!pDocShell) return; -OUString aOwnURL = pDocShell->GetMedium()->GetURLObject().GetMainURL(INetURLObject::DecodeMechanism::WithCharset); -OUString sTmpName = "vnd.sun.star.pkg://" + -INetURLObject::encode(aOwnURL, INetURLObject::PART_AUTHORITY, INetURLObject::EncodeMechanism::All); -sTmpName += "/" + m_pDBManager->getEmbeddedName(); +const OUString sTmpName = ConstructVndSunStarPkgUrl( + pDocShell->GetMedium()->GetURLObject().GetMainURL(INetURLObject::DecodeMechanism::NONE), +m_pDBManager->getEmbeddedName()); if (sTmpName != rEvent.OldLocation) return; @@ -2760,21 +2774,6 @@ OUString LoadAndRegisterDataSource_Impl(DBConnURIType type, const uno::Reference } return sFind; } - -// Construct vnd.sun.star.pkg:// URL -OUString ConstructVndSunStarPkgUrl(const OUString& rMainURL, std::u16string_view rStreamRelPath) -{ -auto xContext(comphelper::getProcessComponentContext()); -auto xUri = css::uri::UriReferenceFactory::create(xContext)->parse(rMainURL); -assert(xUri.is()); -xUri = css::uri::VndSunStarPkgUrlReferenceFactory::create(xContext) -->createVndSunStarPkgUrlReference(xUri); -assert(xUri.is()); -return xUri->getUriReference() + "/" -+ INetURLObject::encode( -rStreamRelPath, INetURLObject::PART_FPATH, -INetURLObject::EncodeMechanism::All); -} } OUString SwDBManager::LoadAndRegisterDataSource(weld::Window* pParent, SwDocShell* pDocShell)
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/unocore/unobkm.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit 779e7696095d3fad440d67d262b4dda85da41bb6 Author: Michael Stahl AuthorDate: Wed Jul 27 16:06:05 2022 +0200 Commit: Xisco Fauli CommitDate: Thu Jul 28 10:22:01 2022 +0200 sw: SolarMutexGuard missing in SwXBookmark::setPropertyValue() Change-Id: I41187b02e6b0545529e2a2c5b07da671eae89079 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137506 Reviewed-by: Michael Stahl Tested-by: Jenkins (cherry picked from commit c7a76952b6fa0e6688028047726ac794fdd5cca3) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137518 Reviewed-by: Xisco Fauli diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx index e14df5b3a803..778a2f621af8 100644 --- a/sw/source/core/unocore/unobkm.cxx +++ b/sw/source/core/unocore/unobkm.cxx @@ -403,6 +403,8 @@ void SAL_CALL SwXBookmark::setPropertyValue(const OUString& PropertyName, const uno::Any& rValue) { +SolarMutexGuard g; + if (PropertyName == UNO_NAME_BOOKMARK_HIDDEN) { bool bNewValue = false;
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/layout/layact.cxx | 11 +-- 1 file changed, 1 insertion(+), 10 deletions(-) New commits: commit e61e77481174692d5be72962f6f029e6f4e2e8d9 Author: Luboš Luňák AuthorDate: Thu Jul 21 13:31:17 2022 +0200 Commit: Xisco Fauli CommitDate: Tue Jul 26 11:58:11 2022 +0200 Revert "avoid repeated writer layout calls with tiled rendering" (tdf#145396) This was incorrect, the proper fix was my previous Writer commit. This reverts commit b9c2207e1b5247b4d3184b137be9a75a4b8c6c37. Change-Id: I829da1633dd11cb0c6e944fbf5acef030fad7dc4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137294 Tested-by: Jenkins Reviewed-by: Luboš Luňák (cherry picked from commit 9dff8edf97f454f24a40acbed4a9297816f91da6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137316 Reviewed-by: Xisco Fauli diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index b2b246e5eb2f..9375ca13cd51 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -2275,16 +2275,7 @@ SwLayIdle::SwLayIdle( SwRootFrame *pRt, SwViewShellImp *pI ) : { --rSh.mnStartAction; -// When using tiled rendering, idle painting is disabled and paints are done -// only later by tiled rendering. But paints call SwViewShellImp::DeletePaintRegion() -// to reset this HasPaintRegion(), and if it's done too late, -// SwTiledRenderingTest::testTablePaintInvalidate() will end up in an infinite -// loop, because the idle layout will call this code repeatedly, because there -// will be no idle paints to reset HasPaintRegion(). -// This code dates back to the initial commit, and I find its purpose unclear, -// so I'm still leaving it here in case it turns out it serves a purpose. -static const bool blockOnRepaints = true; -if (!blockOnRepaints && rSh.Imp()->HasPaintRegion()) +if ( rSh.Imp()->HasPaintRegion() ) bActions = true; else {
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/view/viewsh.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit bb5643c1318de5b1ee0adcfbe8c4c4115a175ac1 Author: Luboš Luňák AuthorDate: Thu Jul 21 13:27:45 2022 +0200 Commit: Xisco Fauli CommitDate: Tue Jul 26 11:55:51 2022 +0200 Revert "do not draw directly in SwViewShell in LOK mode" It is actually needed to process SwViewShellImp's paint region, as otherwise testTablePaintInvalidate::TestBody from CppunitTest_sw_tiledrendering will end up in an infinite loop repeatedly calling SwLayIdle ctor. That's what I tried to handle in b9c2207e1b5247b4d3184b137be9a75a4b8c6c37 and got it wrong. This reverts commit 2aa2d03ec4e775d9399420c21cd1f2e972984154. Change-Id: I25e897ea4e38db48cd969a3c21d677701f75a0aa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137293 Tested-by: Jenkins Reviewed-by: Luboš Luňák (cherry picked from commit 94bde29634c095e40bfcf74d27821b48919595da) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137315 Reviewed-by: Xisco Fauli diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index b16b2d042727..7c4b55729ca7 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -478,7 +478,7 @@ void SwViewShell::ImplUnlockPaint( bool bVirDev ) CurrShell aCurr( this ); if ( GetWin() && GetWin()->IsVisible() ) { -if ( (bInSizeNotify || bVirDev ) && VisArea().HasArea() && !comphelper::LibreOfficeKit::isActive()) +if ( (bInSizeNotify || bVirDev ) && VisArea().HasArea() ) { //Refresh with virtual device to avoid flickering. VclPtrInstance pVout( *mpOut );
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source sw/uiconfig
sw/source/ui/index/cnttab.cxx| 25 + sw/uiconfig/swriter/ui/assignstylesdialog.ui |3 +-- 2 files changed, 26 insertions(+), 2 deletions(-) New commits: commit 6344bb8b24d8250508f29457508f0daf479e5b4c Author: Caolán McNamara AuthorDate: Thu Jul 21 09:06:19 2022 +0100 Commit: Adolfo Jayme Barrientos CommitDate: Sat Jul 23 14:12:36 2022 +0200 Resolves: tdf#148743 TOC->Edit Index->Assign Styles; Styles aren't sorted Change-Id: I1ec804d315f487d7bd1138681ab8e8ae60f21a52 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137306 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index 25d1d33ceaab..dc31fdd5d156 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -484,6 +484,7 @@ class SwAddStylesDlg_Impl : public SfxDialogController DECL_LINK(KeyInput, const KeyEvent&, bool); DECL_LINK(TreeSizeAllocHdl, const Size&, void); DECL_LINK(RadioToggleOnHdl, const weld::TreeView::iter_col&, void); +DECL_LINK(HeaderBarClick, int, void); public: SwAddStylesDlg_Impl(weld::Window* pParent, SwWrtShell const & rWrtSh, OUString rStringArr[]); @@ -507,6 +508,7 @@ SwAddStylesDlg_Impl::SwAddStylesDlg_Impl(weld::Window* pParent, m_xHeaderTree->connect_size_allocate(LINK(this, SwAddStylesDlg_Impl, TreeSizeAllocHdl)); m_xHeaderTree->enable_toggle_buttons(weld::ColumnToggleType::Radio); m_xHeaderTree->connect_toggled(LINK(this, SwAddStylesDlg_Impl, RadioToggleOnHdl)); +m_xHeaderTree->connect_column_clicked(LINK(this, SwAddStylesDlg_Impl, HeaderBarClick)); std::vector aWidths { @@ -578,11 +580,34 @@ SwAddStylesDlg_Impl::SwAddStylesDlg_Impl(weld::Window* pParent, } } } + m_xHeaderTree->make_sorted(); +m_xHeaderTree->set_sort_column(0); +m_xHeaderTree->set_sort_order(true); +m_xHeaderTree->set_sort_indicator(TRISTATE_TRUE, 0); + m_xHeaderTree->select(0); m_xHeaderTree->connect_key_release(LINK(this, SwAddStylesDlg_Impl, KeyInput)); } +IMPL_LINK(SwAddStylesDlg_Impl, HeaderBarClick, int, nColumn, void) +{ +bool bSortAtoZ = m_xHeaderTree->get_sort_order(); + +//set new arrow positions in headerbar +if (nColumn == m_xHeaderTree->get_sort_column()) +{ +bSortAtoZ = !bSortAtoZ; +m_xHeaderTree->set_sort_order(bSortAtoZ); +} + +if (nColumn != -1) +{ +//sort lists +m_xHeaderTree->set_sort_indicator(bSortAtoZ ? TRISTATE_TRUE : TRISTATE_FALSE, nColumn); +} +} + IMPL_LINK(SwAddStylesDlg_Impl, TreeSizeAllocHdl, const Size&, rSize, void) { auto nWidth = rSize.Width() - Application::GetSettings().GetStyleSettings().GetScrollBarSize(); diff --git a/sw/uiconfig/swriter/ui/assignstylesdialog.ui b/sw/uiconfig/swriter/ui/assignstylesdialog.ui index 1ed5cbb56e65..1e9f52faf87f 100644 --- a/sw/uiconfig/swriter/ui/assignstylesdialog.ui +++ b/sw/uiconfig/swriter/ui/assignstylesdialog.ui @@ -266,11 +266,10 @@ +True True 6 Style -True -0
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/uibase/shells/textsh1.cxx |9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) New commits: commit c1339170226b7c348f463b6a189aa86eed7839d5 Author: Miklos Vajna AuthorDate: Mon Jul 18 08:21:43 2022 +0200 Commit: Xisco Fauli CommitDate: Mon Jul 18 21:23:32 2022 +0200 sw: fix crash in SwTextShell::Execute() Crashreport signature: SwTextShell::Execute(SfxRequest&) sw/source/uibase/shells/textsh1.cxx:1540 SfxDispatcher::Call_Impl(SfxShell&, SfxSlot const&, SfxRequest&, bool) sfx2/source/control/dispatch.cxx:256 SfxDispatcher::Execute(unsigned short, SfxCallMode, SfxItemSet const*, SfxItemSet const*, unsigned short) sfx2/source/control/dispatch.cxx:811 SfxDispatchController_Impl::dispatch(com::sun::star::util::URL const&, com::sun::star::uno::Sequence const&, com::sun::star::uno::Reference const&) sfx2/source/control/unoctitm.cxx:671 This is the Grammar case, the Spelling case already checked for an empty xDictionary reference. Change-Id: If1f88e4bdf2d68d877fbb0bd89d0cadbd493771f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137198 Reviewed-by: Miklos Vajna Tested-by: Jenkins (cherry picked from commit c6d242ebf0d3ca5e57ac7d6e894d800faa38d15a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137176 Reviewed-by: Xisco Fauli diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 326716127493..68ebb51f5ed6 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -1533,9 +1533,12 @@ void SwTextShell::Execute(SfxRequest ) SwPaM *pPaM = rWrtSh.GetCursor(); if (pPaM) SwEditShell::IgnoreGrammarErrorAt( *pPaM ); -// refresh the layout of all paragraphs (workaround to launch a dictionary event) -xDictionary->setActive(false); -xDictionary->setActive(true); +if (xDictionary.is()) +{ +// refresh the layout of all paragraphs (workaround to launch a dictionary event) +xDictionary->setActive(false); +xDictionary->setActive(true); +} } catch( const uno::Exception& ) {
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/unocore/unotext.cxx | 60 + 1 file changed, 60 insertions(+) New commits: commit dab6149b056b0be51dbeefdd33397bf6a482a6da Author: Michael Stahl AuthorDate: Fri Jul 8 17:32:49 2022 +0200 Commit: Thorsten Behrens CommitDate: Mon Jul 11 16:33:40 2022 +0200 tdf#149649 sw_fieldmarkhide: delete any fieldmarks overlapping cells The DOCX bugdoc has a field that starts in the first cell of a table, but ends outside the table. [ 28] 0x3690e10 TableNode , [ 29] 0x78d6f80 StartNode , [ 30]0x6cfb408 TextNode "\a FORMTEXT \003Data File", [ 31] 0x6bf9620EndNode , [ 631] 0x779c768TextNode "", [ 632] 0x69bd5f8TextNode "\b", [ 633] 0x656f150 EndNode }, This triggers an assert in layout: soffice.bin: sw/source/core/layout/frmtool.cxx:1971: void InsertCnt_(SwLayoutFrame*, SwDoc*, SwNodeOffset, bool, SwNodeOffset, SwFrame*, sw::FrameMode): Assertion `!pLayout->HasMergedParas() || pNd->GetRedlineMergeFlag() != SwNode::Merge::Hidden' failed. This bad documnet model is created from writerfilter in a call to SwXText::convertToTable(), so add some preventive code there. The end of the field is erroneously also at the end of the body instead of a few paragraphs below the 1st table, because in PopFieldContext() the xTextAppend->createTextCursorByRange(pContext->GetStartRange()) throws, due to the bad document model. It turns out that Word can actually load this document, but the behaviour is rather funny and would be difficult to replicate... Change-Id: I20b9293db511bc0066c775d54fc59fcaa349 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136906 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 436ae10ec546391ce21875c69b0ec4bb3a06fa1f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136921 Reviewed-by: Thorsten Behrens diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index 2ad7fce679d8..bb488949d334 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -61,6 +61,7 @@ #include #include #include +#include #include #include #include @@ -2006,6 +2007,65 @@ void SwXText::Impl::ConvertCell( SwNodeRange aCellRange(aStartCellPam.Start()->nNode, aEndCellPam.End()->nNode); rRowNodes.push_back(aCellRange); // note: invalidates pLastCell! + +// tdf#149649 delete any fieldmarks overlapping the cell +IDocumentMarkAccess & rIDMA(*m_pDoc->getIDocumentMarkAccess()); +while (::sw::mark::IFieldmark *const pMark = rIDMA.getFieldmarkFor(*aStartCellPam.Start())) +{ +if (pMark->GetMarkEnd() <= *aEndCellPam.End()) +{ +if (pMark->GetMarkStart() < *aStartCellPam.Start()) +{ +SAL_INFO("sw.uno", "deleting fieldmark overlapping table cell"); +rIDMA.deleteMark(pMark); +} +else +{ +break; +} +} +else +{ +SwPosition const sepPos(::sw::mark::FindFieldSep(*pMark)); +if (*aStartCellPam.Start() <= sepPos && sepPos <= *aEndCellPam.End()) +{ +SAL_INFO("sw.uno", "deleting fieldmark with separator in table cell"); +rIDMA.deleteMark(pMark); +} +else +{ +break; +} +} +} +while (::sw::mark::IFieldmark *const pMark = rIDMA.getFieldmarkFor(*aEndCellPam.End())) +{ +if (*aStartCellPam.Start() <= pMark->GetMarkStart()) +{ +if (*aEndCellPam.End() < pMark->GetMarkEnd()) +{ +SAL_INFO("sw.uno", "deleting fieldmark overlapping table cell"); +rIDMA.deleteMark(pMark); +} +else +{ +break; +} +} +else +{ +SwPosition const sepPos(::sw::mark::FindFieldSep(*pMark)); +if (*aStartCellPam.Start() <= sepPos && sepPos <= *aEndCellPam.End()) +{ +SAL_INFO("sw.uno", "deleting fieldmark with separator in table cell"); +rIDMA.deleteMark(pMark); +} +else +{ +break; +} + } +} } typedef uno::Sequence< text::TableColumnSeparator > TableColumnSeparators;
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/layout/wsfrm.cxx |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) New commits: commit 0411e70f45d9b0ac05cad557b6b0c0f45952c279 Author: Xisco Fauli AuthorDate: Tue Jul 5 16:47:10 2022 +0200 Commit: Michael Stahl CommitDate: Fri Jul 8 11:46:54 2022 +0200 sw: fix null derefs of GetCurrShell() See https://crashreport.libreoffice.org/stats/signature/SwContentFrame::Cut() Change-Id: I00267b480d9c123f68996572d2e6fdebc4fb383f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136769 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index 43bd9a7037a1..65b9383543eb 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -1222,13 +1222,14 @@ void SwContentFrame::Cut() // find if there are pages without content following pPage // and if so request a call to CheckPageDescs() SwPageFrame const* pNext(pPage); -if (pRoot->GetCurrShell()->Imp()->IsAction()) +SwViewShell *pSh = pRoot->GetCurrShell(); +if (pSh && pSh->Imp()->IsAction()) { while ((pNext = static_cast(pNext->GetNext( { if (!sw::IsPageFrameEmpty(*pNext) && !pNext->IsFootnotePage()) { - pRoot->GetCurrShell()->Imp()->GetLayAction().SetCheckPageNum(pPage->GetPhyPageNum()); + pSh->Imp()->GetLayAction().SetCheckPageNum(pPage->GetPhyPageNum()); break; } }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/table/swtable.cxx |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) New commits: commit d5875107e505802ab8de9e759e295ed12b36e22b Author: Xisco Fauli AuthorDate: Tue May 31 13:42:23 2022 +0200 Commit: Christian Lohmaier CommitDate: Fri Jul 1 11:29:24 2022 +0200 sw: avoid another EXCEPTION_INT_DIVIDE_BY_ZERO See https://crashreport.libreoffice.org/stats/signature/lcl_ModifyBoxes Change-Id: I786bbf87734dd3963bd84caecc5c5f45693d42c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135185 Tested-by: Jenkins Reviewed-by: Xisco Fauli (cherry picked from commit aeeb0141aca4f1698b09bc8f06ded41247b54279) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135255 Reviewed-by: Christian Lohmaier diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index da159df14bd2..7992b430328b 100644 --- a/sw/source/core/table/swtable.cxx +++ b/sw/source/core/table/swtable.cxx @@ -249,7 +249,8 @@ namespace template T lcl_MulDiv64(sal_uInt64 nA, sal_uInt64 nM, sal_uInt64 nD) { -return static_cast((nA*nM)/nD); +assert(nD != 0); +return nD == 0 ? static_cast(nA*nM) : static_cast((nA*nM)/nD); } } @@ -299,8 +300,7 @@ static void lcl_ModifyBoxes( SwTableBoxes , const tools::Long nOld, SwFrameFormat *pFormat = rBox.GetFrameFormat(); sal_uInt64 nBox = pFormat->GetFrameSize().GetWidth(); nOriginalSum += nBox; -nBox *= nNew; -nBox /= nOld; +nBox = lcl_MulDiv64(nBox, nNew, nOld); const sal_uInt64 nWishedSum = lcl_MulDiv64(nOriginalSum, nNew, nOld) - nSum; if( nWishedSum > 0 ) {
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/ui/misc/pggrid.cxx | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) New commits: commit cff4a8943cd7bfd5b0e77dbc7e614a61de41276e Author: Caolán McNamara AuthorDate: Mon Jun 27 14:28:58 2022 +0100 Commit: Xisco Fauli CommitDate: Mon Jun 27 21:40:26 2022 +0200 sw: avoid divide by zero in SwTextGridPage::CharorLineChangedHdl See https://crashreport.libreoffice.org/stats/signature/SwTextGridPage::CharorLineChangedHdl(weld::SpinButton%20&) disable the offending widget if the value is zero. crash reproducible under gen with CJK features enabled by: format, page style, text grid, grid (lines and characters), max base text size of 1000 and then click in "characters per line" and then click in "lines per page". Change-Id: Ic0f8131955ab01412dd54bdd5d3bffe518938fb5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136470 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx index 875bee7ad331..46f78140a927 100644 --- a/sw/source/ui/misc/pggrid.cxx +++ b/sw/source/ui/misc/pggrid.cxx @@ -318,10 +318,13 @@ void SwTextGridPage::UpdatePageSize(const SfxItemSet& rSet) { sal_Int32 nCharsPerLine = m_aPageSize.Width() / nTextSize; m_xCharsPerLineNF->set_max(nCharsPerLine); +m_xCharsPerLineNF->set_sensitive(nCharsPerLine != 0); m_xCharsPerLineNF->set_value(nCharsPerLine); -m_xLinesPerPageNF->set_max(m_aPageSize.Height() / +sal_Int32 nMaxLines = m_aPageSize.Height() / ( m_xTextSizeMF->denormalize(m_xTextSizeMF->get_value(FieldUnit::TWIP)) + - m_xRubySizeMF->denormalize(m_xRubySizeMF->get_value(FieldUnit::TWIP; + m_xRubySizeMF->denormalize(m_xRubySizeMF->get_value(FieldUnit::TWIP))); +m_xLinesPerPageNF->set_max(nMaxLines); +m_xLinesPerPageNF->set_sensitive(nMaxLines != 0); SetLinesOrCharsRanges( *m_xCharsRangeFT , m_xCharsPerLineNF->get_max() ); SetLinesOrCharsRanges( *m_xLinesRangeFT , m_xLinesPerPageNF->get_max() ); } @@ -371,6 +374,7 @@ IMPL_LINK(SwTextGridPage, CharorLineChangedHdl, weld::SpinButton&, rField, void) ( m_xTextSizeMF->denormalize(m_xTextSizeMF->get_value(FieldUnit::TWIP)) + m_xRubySizeMF->denormalize(m_xRubySizeMF->get_value(FieldUnit::TWIP; m_xLinesPerPageNF->set_max(nMaxLines); +m_xLinesPerPageNF->set_sensitive(nMaxLines != 0); } SetLinesOrCharsRanges( *m_xLinesRangeFT , m_xLinesPerPageNF->get_max() ); SetLinesOrCharsRanges( *m_xCharsRangeFT , m_xCharsPerLineNF->get_max() ); @@ -417,6 +421,7 @@ IMPL_LINK(SwTextGridPage, TextSizeChangedHdl, weld::MetricSpinButton&, rField, v sal_Int32 nMaxChars = m_aPageSize.Width() / nTextSize; m_xCharsPerLineNF->set_value(nMaxChars); m_xCharsPerLineNF->set_max(nMaxChars); +m_xCharsPerLineNF->set_sensitive(nMaxChars != 0); SetLinesOrCharsRanges( *m_xCharsRangeFT , m_xCharsPerLineNF->get_max() ); } } @@ -426,6 +431,7 @@ IMPL_LINK(SwTextGridPage, TextSizeChangedHdl, weld::MetricSpinButton&, rField, v ( m_xTextSizeMF->denormalize(m_xTextSizeMF->get_value(FieldUnit::TWIP)) + m_xRubySizeMF->denormalize(m_xRubySizeMF->get_value(FieldUnit::TWIP; m_xLinesPerPageNF->set_max(nMaxLines); +m_xLinesPerPageNF->set_sensitive(nMaxLines != 0); SetLinesOrCharsRanges( *m_xLinesRangeFT , m_xLinesPerPageNF->get_max() ); } }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/layout/trvlfrm.cxx | 24 +++- 1 file changed, 19 insertions(+), 5 deletions(-) New commits: commit e8763ec437f66926196707b803c60dc7032e6e0c Author: Xisco Fauli AuthorDate: Thu Jun 23 12:27:34 2022 +0200 Commit: Caolán McNamara CommitDate: Sat Jun 25 21:22:42 2022 +0200 sw: fix crash in SwLayoutFrame::GetContentPos FindPageFrame might return nullptr See https://crashreport.libreoffice.org/stats/signature/SwLayoutFrame::GetContentPos(Point%20&,bool,bool,SwCursorMoveState%20*,bool) Change-Id: Ic69d26de4ab234ebd6283ace640d689f0ebe8eb3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136307 Tested-by: Jenkins Reviewed-by: Xisco Fauli (cherry picked from commit 7500c243fea02acbeaddf91f6b48a53d698c1cab) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136383 Reviewed-by: Caolán McNamara diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx index 6942dab6a2ba..375b9fe34fd6 100644 --- a/sw/source/core/layout/trvlfrm.cxx +++ b/sw/source/core/layout/trvlfrm.cxx @@ -1290,13 +1290,22 @@ const SwContentFrame *SwLayoutFrame::GetContentPos( Point& rPoint, if( !pStart->GetPrev()->IsLayoutFrame() ) return nullptr; pStart = static_cast(pStart->GetPrev()); -pContent = pStart->IsInDocBody() -? pStart->ContainsContent() -: pStart->FindPageFrame()->FindFirstBodyContent(); +if( pStart->IsInDocBody() ) +pContent = pStart->ContainsContent(); +else +{ +const SwPageFrame *pPage = pStart->FindPageFrame(); +if( !pPage ) +return nullptr; +pContent = pPage->FindFirstBodyContent(); +} } if ( !pContent ) // Somewhere down the road we have to start with one! { -pContent = pStart->FindPageFrame()->GetUpper()->ContainsContent(); +const SwPageFrame *pPage = pStart->FindPageFrame(); +if( !pPage ) +return nullptr; +pContent = pPage->GetUpper()->ContainsContent(); while ( pContent && !pContent->IsInDocBody() ) pContent = pContent->GetNextContentFrame(); if ( !pContent ) @@ -1314,7 +1323,12 @@ const SwContentFrame *SwLayoutFrame::GetContentPos( Point& rPoint, pContent = pStart->ContainsContent(); } else // Somewhere down the road we have to start with one! -pContent = pStart->FindPageFrame()->GetUpper()->ContainsContent(); +{ +const SwPageFrame *pPage = pStart->FindPageFrame(); +if( !pPage ) +return nullptr; +pContent = pPage->GetUpper()->ContainsContent(); +} } pActual = pContent; }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/uibase/docvw/edtwin.cxx | 109 +++--- 1 file changed, 56 insertions(+), 53 deletions(-) New commits: commit c9cacb99123b420a593a8fa857dfac451085 Author: Xisco Fauli AuthorDate: Wed Jun 22 12:49:04 2022 +0200 Commit: Caolán McNamara CommitDate: Wed Jun 22 17:08:58 2022 +0200 sw: fix crash in SwEditWin::MouseButtonDown Since GetPageAtPos might return nullptr See https://crashreport.libreoffice.org/stats/signature/SwEditWin::MouseButtonDown(MouseEvent%20const%20&) Change-Id: I4ad3492ef46bcd7b263a4de92efd9439a966fb56 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136243 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index ca94c561eadd..4898ba948f4e 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -2825,69 +2825,72 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) { const SwPageFrame* pPageFrame = rSh.GetLayout()->GetPageAtPos( aDocPos ); -// Is it active? -bool bActive = true; -const SwPageDesc* pDesc = pPageFrame->GetPageDesc(); - -const SwFrameFormat* pFormat = pDesc->GetLeftFormat(); -if ( pPageFrame->OnRightPage() ) - pFormat = pDesc->GetRightFormat(); - -if ( pFormat ) +if ( pPageFrame ) { -if ( eControl == FrameControlType::Header ) -bActive = pFormat->GetHeader().IsActive(); -else -bActive = pFormat->GetFooter().IsActive(); -} +// Is it active? +bool bActive = true; +const SwPageDesc* pDesc = pPageFrame->GetPageDesc(); -if ( !bActive ) -{ -// When in Hide-Whitespace mode, we don't want header -// and footer controls. -if (!rSh.GetViewOptions()->IsHideWhitespaceMode()) -{ -SwPaM aPam(*rSh.GetCurrentShellCursor().GetPoint()); -const bool bWasInHeader = aPam.GetPoint()->nNode.GetNode().FindHeaderStartNode() != nullptr; -const bool bWasInFooter = aPam.GetPoint()->nNode.GetNode().FindFooterStartNode() != nullptr; +const SwFrameFormat* pFormat = pDesc->GetLeftFormat(); +if ( pPageFrame->OnRightPage() ) + pFormat = pDesc->GetRightFormat(); -// Is the cursor in a part like similar to the one we clicked on? For example, -// if the cursor is in a header and we click on an empty header... don't change anything to -// keep consistent behaviour due to header edit mode (and the same for the footer as well). +if ( pFormat ) +{ +if ( eControl == FrameControlType::Header ) +bActive = pFormat->GetHeader().IsActive(); +else +bActive = pFormat->GetFooter().IsActive(); +} -// Otherwise, we hide the header/footer control if a separator is shown, and vice versa. -if (!(bWasInHeader && eControl == FrameControlType::Header) && -!(bWasInFooter && eControl == FrameControlType::Footer)) +if ( !bActive ) +{ +// When in Hide-Whitespace mode, we don't want header +// and footer controls. +if (!rSh.GetViewOptions()->IsHideWhitespaceMode()) { -const bool bSeparatorWasVisible = rSh.IsShowHeaderFooterSeparator(eControl); -rSh.SetShowHeaderFooterSeparator(eControl, !bSeparatorWasVisible); +SwPaM aPam(*rSh.GetCurrentShellCursor().GetPoint()); +const bool bWasInHeader = aPam.GetPoint()->nNode.GetNode().FindHeaderStartNode() != nullptr; +const bool bWasInFooter = aPam.GetPoint()->nNode.GetNode().FindFooterStartNode() != nullptr; -// Repaint everything -Invalidate(); - -// tdf#84929. If the footer control had not been showing, do not change the cursor position, -// because the user may have scrolled to turn on the separator control and -// if the cursor cannot be positioned on-screen, then the user would need to scroll back again to use the control. -// This should only be done for the footer. The cursor can always be re-positioned near the header. tdf#134023. -if ( eControl == FrameControlType::Footer && !bSeparatorWasVisible - && rSh.GetViewOptions()->IsUseHeaderFooterMenu() && !Application::IsHeadlessModeEnabled() ) -return; +// Is the cursor in a part like similar to the one we clicked on? For example, +// if the
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/view/viewimp.cxx |7 --- 1 file changed, 4 insertions(+), 3 deletions(-) New commits: commit c0d9d30d8e2900c23b5d0ccac49064d2fb6650f3 Author: Luboš Luňák AuthorDate: Mon Jun 20 12:32:07 2022 +0200 Commit: Caolán McNamara CommitDate: Mon Jun 20 17:09:33 2022 +0200 fix SwViewShellImp::AddPaintRect() for sub-rects (tdf#146536) Using just two corners to build the new resulting rect works only if the new rectangle actually really extends the previous one, but the <= means that this may compress also rects that are already contained in the previous rect, in which case it's necessary to make sure to use union to get the larger coordinate). Change-Id: Ie4303dfef903bded6d63625531e424a32cc01b06 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136144 Tested-by: Luboš Luňák Reviewed-by: Luboš Luňák (cherry picked from commit a6b9fbfc15b9e1756ac8ea939b4c588e3f170c1d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136158 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx index 854a9aaa03de..f08c3305e5d6 100644 --- a/sw/source/core/view/viewimp.cxx +++ b/sw/source/core/view/viewimp.cxx @@ -129,12 +129,13 @@ bool SwViewShellImp::AddPaintRect( const SwRect ) if(!m_pPaintRegion->empty()) { // This function often gets called with rectangles that line up vertically. -// Try to extend the last one downwards to include the new one. +// Try to extend the last one downwards to include the new one (use Union() +// in case the new one is actually already contained in the last one). SwRect& last = m_pPaintRegion->back(); if(last.Left() == rRect.Left() && last.Width() == rRect.Width() && last.Bottom() + 1 >= rRect.Top() && last.Bottom() <= rRect.Bottom()) { -last = SwRect( last.TopLeft(), rRect.BottomRight()); +last.Union(rRect); // And these rectangles lined up vertically often come up in groups // that line up horizontally. Try to extend the previous rectangle // to the right to include the last one. @@ -144,7 +145,7 @@ bool SwViewShellImp::AddPaintRect( const SwRect ) if(last2.Top() == last.Top() && last2.Height() == last.Height() && last2.Right() + 1 >= last.Left() && last2.Right() <= last2.Right()) { -last2 = SwRect( last2.TopLeft(), last.BottomRight()); +last2.Union(last); m_pPaintRegion->pop_back(); return true; }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/undo/unredln.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 249dbfec5174218d57ce6452e45ccb629884d08c Author: Michael Stahl AuthorDate: Wed Jun 15 15:06:59 2022 +0200 Commit: Xisco Fauli CommitDate: Thu Jun 16 10:03:33 2022 +0200 sw: fix odd m_bCanGroup check in SwUndoRedlineDelete This looks like copypasta, presumably both flags must be true to allow grouping. Change-Id: I96afeac98f94b122a3b1a155940776a3aa44b0a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135908 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit f31f11f3222933dbc96dc672e6fa52233cda12be) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135934 Reviewed-by: Xisco Fauli diff --git a/sw/source/core/undo/unredln.cxx b/sw/source/core/undo/unredln.cxx index eae6577d52ff..e48255c3ab5b 100644 --- a/sw/source/core/undo/unredln.cxx +++ b/sw/source/core/undo/unredln.cxx @@ -256,7 +256,7 @@ bool SwUndoRedlineDelete::CanGrouping( const SwUndoRedlineDelete& rNext ) { bool bRet = false; if( SwUndoId::DELETE == mnUserId && mnUserId == rNext.mnUserId && -m_bCanGroup == rNext.m_bCanGroup && +m_bCanGroup && rNext.m_bCanGroup && m_bIsDelim == rNext.m_bIsDelim && m_bIsBackspace == rNext.m_bIsBackspace && m_nSttNode == m_nEndNode &&
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/doc/DocumentRedlineManager.cxx |6 ++ 1 file changed, 6 insertions(+) New commits: commit 918f435d48de3f29814f187c8621c1a564c5b835 Author: Michael Stahl AuthorDate: Tue Jun 14 17:19:23 2022 +0200 Commit: Thorsten Behrens CommitDate: Thu Jun 16 00:07:47 2022 +0200 sw_redlinehide: skip unnecessary updates when undoing redlined delete When reproducing tdf#135976 and then Undo, an UAF crash happens here: assert(!pFrame->GetDrawObjs() || !pObjs->Contains(*pObj)); The pObjs was actually deleted and then re-created, because the pObj was removed from the frame and added again to the same frame. This is a bit unexpected, so prevent it by taking a shortcut in the caller UpdateFramesForRemoveDeleteRedline() to insert a check that had been removed in commit 14e87a4b15d31a34e6053f6194688f3aa23af991. If the rPam is inside a single node, the sw::RedlineUnDelText hint that was sent to the SwTextFrame should be sufficient to update it and the rest of the code in the loop that deals with newly split paragraph can be skipped. Change-Id: I5f36eb91bc20003887ee0bad03ea4a6e67135de9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135907 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit cf9a16caf5012d65b2a45a5525e36e40585dd35c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135892 Reviewed-by: Thorsten Behrens diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx index c2ddb046ef8b..8a9a70ae2bb9 100644 --- a/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/sw/source/core/doc/DocumentRedlineManager.cxx @@ -309,6 +309,12 @@ void UpdateFramesForRemoveDeleteRedline(SwDoc & rDoc, SwPaM const& rPam) break; } +// no nodes can be unmerged by this - skip MakeFrames() etc. +if (rPam.GetPoint()->nNode == rPam.GetMark()->nNode) +{ +break; // continue with AppendAllObjs() +} + // first, call CheckParaRedlineMerge on the first paragraph, // to init flag on new merge range (if any) + 1st node post the merge auto eMode(sw::FrameMode::Existing);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/uibase/inc/wrtsh.hxx|2 +- sw/source/uibase/wrtsh/delete.cxx |4 ++-- sw/source/uibase/wrtsh/wrtsh1.cxx |5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) New commits: commit 67eec140556edb42280def88e987448aaa221c5e Author: Michael Stahl AuthorDate: Fri Jun 10 18:25:05 2022 +0200 Commit: Xisco Fauli CommitDate: Tue Jun 14 21:28:47 2022 +0200 tdf#148868 sw: handle selection then Insert similar to Replace ... if the selection is inside one paragraph, to avoid deleting flys anchored in the selection. From a code point of view it's a bit inconsistent to do this, but from user point of view there are some ways to conveniently create a selection such as by double clicking a word. (see also tdf#133957) Also in SwWrtShell::AutoCorrect(), which oddly enough might get called with a selection from textsh*.cxx, at least in theory. Change-Id: I8cf9459e5a7ec7754ce8fe323cd158c7e84a5c93 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135606 Tested-by: Michael Stahl Reviewed-by: Michael Stahl (cherry picked from commit d72bee64a97650507d042f17846b6fc427b8434c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135839 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx index 41ef84d1d00f..a4ba598df693 100644 --- a/sw/source/uibase/inc/wrtsh.hxx +++ b/sw/source/uibase/inc/wrtsh.hxx @@ -282,7 +282,7 @@ typedef bool (SwWrtShell::*FNSimpleMove)(); boolDelLeft(); // also deletes the frame or sets the cursor in the frame when bDelFrame == false -boolDelRight(); +boolDelRight(bool isReplaceHeuristic = false); voidDelToEndOfPara(); voidDelToStartOfPara(); boolDelToEndOfSentence(); diff --git a/sw/source/uibase/wrtsh/delete.cxx b/sw/source/uibase/wrtsh/delete.cxx index 96ea6f56816d..6a43d8841e59 100644 --- a/sw/source/uibase/wrtsh/delete.cxx +++ b/sw/source/uibase/wrtsh/delete.cxx @@ -292,7 +292,7 @@ bool SwWrtShell::DelLeft() return bRet; } -bool SwWrtShell::DelRight() +bool SwWrtShell::DelRight(bool const isReplaceHeuristic) { // Will be or'ed, if a tableselection exists; // will here be implemented on SelectionType::Table @@ -319,7 +319,7 @@ bool SwWrtShell::DelRight() { SwActContext aActContext(this); ResetCursorStack(); -Delete(false); +Delete(isReplaceHeuristic); UpdateAttr(); } if( IsBlockMode() ) diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx index c6dee2be2ec6..3fb293405387 100644 --- a/sw/source/uibase/wrtsh/wrtsh1.cxx +++ b/sw/source/uibase/wrtsh/wrtsh1.cxx @@ -245,7 +245,8 @@ void SwWrtShell::Insert( const OUString ) StartUndo(SwUndoId::REPLACE, ); bStarted = true; Push(); -bDeleted = DelRight(); +// let's interpret a selection within the same node as "replace" +bDeleted = DelRight(GetCursor()->GetPoint()->nNode == GetCursor()->GetMark()->nNode); Pop(SwCursorShell::PopMode::DeleteCurrent); // Restore selection (if tracking changes) NormalizePam(false); // tdf#127635 put point at the end of deletion ClearMark(); @@ -1791,7 +1792,7 @@ void SwWrtShell::AutoCorrect( SvxAutoCorrect& rACorr, sal_Unicode cChar ) StartUndo( SwUndoId::REPLACE, ); bStarted = true; -DelRight(); +DelRight(true); } SwEditShell::AutoCorrect( rACorr, IsInsMode(), cChar );
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/undo/undobj1.cxx | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) New commits: commit c935e6d68c06e50fb8de81a8497b4d9a9c5dda1f Author: Michael Stahl AuthorDate: Mon Jun 13 15:59:12 2022 +0200 Commit: Caolán McNamara CommitDate: Tue Jun 14 15:13:30 2022 +0200 tdf#149507 sw: don't delete bookmarks in SwUndoInsLayFormat::UndoImpl() The problem is that the CorrAbs() here deletes the bookmarks in the fly, and this isn't supposed to happen at this point, because DelFly() will call SaveSection(), which saves the bookmarks in the m_pHistory via DelContentIndex(), so that they can be re-inserted in Redo/InsFly(). Also change the code that was inserted in commit 0ee28fdf3e9a0bd8763eda6299af1d5c873a9dcf to not call CorrAbs(). (although this bug has existed forever, crashing is a regression from commit 657de5fba12b0e9afcdee361654d2a2d0dbd7311) Change-Id: Iabac0ccf5587d5d974e88cbbc3e05bbaed3526f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135728 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 6de844c5da695bf4605bef5510d33e74a7ff04ee) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135750 Reviewed-by: Caolán McNamara diff --git a/sw/source/core/undo/undobj1.cxx b/sw/source/core/undo/undobj1.cxx index fa88f6179442..22eefa8a55a4 100644 --- a/sw/source/core/undo/undobj1.cxx +++ b/sw/source/core/undo/undobj1.cxx @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -295,7 +296,6 @@ void SwUndoInsLayFormat::UndoImpl(::sw::UndoRedoContext & rContext) if( rContent.GetContentIdx() ) // no content { assert(()->GetNodes() == ()); -bool bRemoveIdx = true; if( mnCursorSaveIndexPara > SwNodeOffset(0) ) { SwTextNode *const pNode = @@ -308,14 +308,11 @@ void SwUndoInsLayFormat::UndoImpl(::sw::UndoRedoContext & rContext) aIdx.GetNode().EndOfSectionIndex() ); SwIndex aIndex( pNode, mnCursorSaveIndexPos ); SwPosition aPos( *pNode, aIndex ); -SwDoc::CorrAbs( aIdx, aEndIdx, aPos, true ); -bRemoveIdx = false; +// don't delete bookmarks here, DelFly() will save them in history +::PaMCorrAbs(SwPaM(aIdx, aEndIdx), aPos); +// TODO: is aPos actually a sensible pos for e.g. SwXText* ? } } -if( bRemoveIdx ) -{ -RemoveIdxFromSection( rDoc, rContent.GetContentIdx()->GetIndex() ); -} } DelFly(& rDoc); }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/undo/undobj.cxx | 12 1 file changed, 8 insertions(+), 4 deletions(-) New commits: commit 054c248127c78521b4a4e7aacd8936bd54259996 Author: Michael Stahl AuthorDate: Wed Jun 8 17:34:32 2022 +0200 Commit: Miklos Vajna CommitDate: Fri Jun 10 13:08:48 2022 +0200 (related: tdf#139514) sw: fix Undo of delete with at-para fly Nonobviously, there are situations where the anchor node must be preserved and restored when it's not on the node that is being deleted. (probably regression from commit 91b2325808a75174f284c48c8b8afc118fad74e4) Change-Id: I39f09ddb631204c8ad522f9ec7068d235ca94ad2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135509 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 12acdce71dd6b6af2c52ba8fa3248d3166418543) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135518 Reviewed-by: Miklos Vajna diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx index 6cde5bed2f6a..c23aeba3ba51 100644 --- a/sw/source/core/undo/undobj.cxx +++ b/sw/source/core/undo/undobj.cxx @@ -1003,10 +1003,14 @@ void SwUndoSaveContent::DelContentIndex( const SwPosition& rMark, // Moving the anchor? else if (!((DelContentType::CheckNoCntnt|DelContentType::ExcludeFlyAtStartEnd) & nDelContentType) && -// at least for calls from SwUndoDelete, -// this should work - other Undos don't -// remember the order of the cursor -(rPoint.nNode.GetIndex() == pAPos->nNode.GetIndex()) +// for SwUndoDelete: rPoint is the node that +// will be Joined - so anchor should be moved +// off it - but UndoImpl() split will insert +// new node *before* existing one so a no-op +// may need to be done here to add it to +// history for Undo. +(rPoint.nNode.GetIndex() == pAPos->nNode.GetIndex() + || pStt->nNode.GetIndex() == pAPos->nNode.GetIndex()) // Do not try to move the anchor to a table! && rMark.nNode.GetNode().IsTextNode()) {
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/layout/pagechg.cxx | 16 +++- 1 file changed, 11 insertions(+), 5 deletions(-) New commits: commit 6e6b381b520def141f99c9350bc79d5177fd76f5 Author: Miklos Vajna AuthorDate: Wed Jun 8 11:51:21 2022 +0200 Commit: Michael Stahl CommitDate: Fri Jun 10 11:47:23 2022 +0200 sw: fix use-after-free in SwFrame::ImplFindPageFrame() Header-footer controls have a non-owning pointer to their page frames in Writer views, so whenever a page frame gets deleted, we need to manually make sure that the header-footer control doesn't have a pointer to the deleted page frame. This already works with a single view, but in case one view has a visible header-footer control and an other view deletes the page frame that is known to the header-footer control, then we have a problem. Fix the problematic outdated SwFrameMenuButtonBase::m_pFrame by extending SwPageFrame::DestroyImpl(), so it un-registers itself (before deletion) not only from the current view, but from all views. Found by online.git's: tst=/tmp/testfoo.odt cp test/data/hello-world.odt $tst ./coolstress wss://localhost:9980 $tst test/traces/writer-hello-shape.txt $tst test/traces/writer-document-edit.txt $tst test/traces/writer-mash-text-table.txt $tst test/traces/writer-rambling-text-table.txt $tst test/traces/writer-add-bullet.txt although also reproducible on the desktop, in case you have two views (windows), do cltr-enter to have 2 pages, go to the 2nd page in both views, view 1 clicks on the 2nd page's header, view 2 deletes the page (backspace) and finally view 1 clicks in the body text of the current page. Change-Id: I35e5d82256ab5db8e5f0ba198f5d2638cbff7d3c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135573 Reviewed-by: Miklos Vajna Tested-by: Jenkins (cherry picked from commit c3787043db572ff4b9933fad53dbcfec3428b75d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135543 Reviewed-by: Michael Stahl diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index e7a458737d30..a76b9a379a33 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -255,13 +255,19 @@ SwPageFrame::SwPageFrame( SwFrameFormat *pFormat, SwFrame* pSib, SwPageDesc *pPg void SwPageFrame::DestroyImpl() { -// Cleanup the header-footer controls in the SwEditWin +// Cleanup the header-footer controls in all SwEditWins SwViewShell* pSh = getRootFrame()->GetCurrShell(); -SwWrtShell* pWrtSh = dynamic_cast< SwWrtShell* >( pSh ); -if ( pWrtSh ) +if (pSh) { -SwEditWin& rEditWin = pWrtSh->GetView().GetEditWin(); -rEditWin.GetFrameControlsManager( ).RemoveControls( this ); +for (SwViewShell& rSh : pSh->GetRingContainer()) +{ +SwWrtShell* pWrtSh = dynamic_cast< SwWrtShell* >( ); +if ( pWrtSh ) +{ +SwEditWin& rEditWin = pWrtSh->GetView().GetEditWin(); +rEditWin.GetFrameControlsManager( ).RemoveControls( this ); +} +} } // empty FlyContainer, deletion of the Flys is done by the anchor (in base class SwFrame)
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/frmedt/fecopy.cxx | 45 ++- 1 file changed, 30 insertions(+), 15 deletions(-) New commits: commit 5fcee251c35002ae1362f018a381a8bbd3059578 Author: Michael Stahl AuthorDate: Fri Jun 3 17:56:02 2022 +0200 Commit: Caolán McNamara CommitDate: Thu Jun 9 09:49:48 2022 +0200 sw: fix pasting multiple flys in SwFEShell::Paste() This was most recently fixed in 3cfd63cb55ab1a7e6df53eaeb2a7623be05983d0 but that didn't take into account that now with Ctrl+A multiple flys can be selected and copied, and all of them should be pasted; remove the odd restriction to paste only one text frame. This reveals that pasting a text frame will actually select the text frame, so subsequent flys end up anchored inside the text frame; delay selection until all flys have been pasted. Change-Id: I049f60ca9656e5075d481d4501bb1ffdd28a4e21 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135366 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit badad69848f10b462a11f5b5e784cb468a94b180) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135390 Reviewed-by: Caolán McNamara diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index a907e0e838a0..28a439e2c566 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -709,7 +709,7 @@ namespace { } namespace { -bool lcl_PasteFlyOrDrawFormat(SwPaM& rPaM, SwFrameFormat* pCpyFormat, SwFEShell& rSh) +SwFrameFormat* lcl_PasteFlyOrDrawFormat(SwPaM& rPaM, SwFrameFormat* pCpyFormat, SwFEShell& rSh) { auto& rImp = *rSh.Imp(); auto& rDoc = *rSh.GetDoc(); @@ -752,7 +752,7 @@ namespace { // positioning for group members pNew->NbcSetAnchorPos(aGrpAnchor); pNew->SetSnapRect(aSnapRect); -return true; +return nullptr; } } SwFormatAnchor aAnchor(pCpyFormat->GetAnchor()); @@ -766,18 +766,18 @@ namespace { { const SdrObject *pCpyObj = pCpyFormat->FindSdrObject(); if(pCpyObj && CheckControlLayer(pCpyObj)) -return true; +return nullptr; } else if(pCpyFormat->Which() == RES_FLYFRMFMT && IsInTextBox(pCpyFormat)) { // This is a fly frame which is anchored in a TextBox, ignore it as // it's already copied as part of copying the content of the // TextBox. -return true; +return nullptr; } // Ignore TextBoxes, they are already handled in sw::DocumentLayoutManager::CopyLayoutFormat(). if(SwTextBoxHelper::isTextBox(pCpyFormat, RES_FLYFRMFMT)) -return true; +return nullptr; aAnchor.SetAnchor(pPos); } else if(RndStdIds::FLY_AT_PAGE == aAnchor.GetAnchorId()) @@ -791,9 +791,13 @@ namespace { } SwFrameFormat* pNew = rDoc.getIDocumentLayoutAccess().CopyLayoutFormat(*pCpyFormat, aAnchor, true, true); +return pNew; +} +void lcl_SelectFlyFormat(SwFrameFormat *const pNew, SwFEShell& rSh) +{ if(!pNew) -return true; +return; switch(pNew->Which()) { case RES_FLYFRMFMT: @@ -803,10 +807,11 @@ namespace { SwFlyFrame* pFlyFrame = static_cast(pNew)->GetFrame(); if(pFlyFrame) rSh.SelectFlyFrame(*pFlyFrame); -return false; +break; } case RES_DRAWFRMFMT: { +auto& rDrawView = *rSh.Imp()->GetDrawView(); assert(dynamic_cast(pNew)); SwDrawFrameFormat* pDrawFormat = static_cast(pNew); // #i52780# - drawing object has to be made visible on paste. @@ -821,7 +826,6 @@ namespace { default: SAL_WARN("sw.core", "unknown fly type"); } -return true; } } @@ -1038,13 +1042,24 @@ bool SwFEShell::Paste(SwDoc& rClpDoc, bool bNestedTable) // we need a DrawView if(!Imp()->GetDrawView()) MakeDrawView(); -for(auto pCpyFormat: *rClpDoc.GetSpzFrameFormats()) -if(pCpyFormat->Which() != RES_FLYFRMFMT) -lcl_PasteFlyOrDrawFormat(rPaM, pCpyFormat, *this); -for(auto pCpyFormat: *rClpDoc.GetSpzFrameFormats()) -if(pCpyFormat->Which() == RES_FLYFRMFMT) -if(!lcl_PasteFlyOrDrawFormat(rPaM, pCpyFormat, *this)) -break; +::std::vector inserted; +for (auto const pFlyFormat : *rClpDoc.GetSpzFrameFormats()) +
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/frmedt/feshview.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 28f1385bbc9d18051d2c10fb03dd0ba13e7fb915 Author: Miklos Vajna AuthorDate: Tue Jun 7 12:54:12 2022 +0200 Commit: Xisco Fauli CommitDate: Wed Jun 8 13:43:12 2022 +0200 sw: fix crash in SwFEShell::SelectObj() Fatal signal received: SIGSEGV code: 1 for address: 0x0 SwLayoutFrame::Lower() const sw/source/core/inc/layfrm.hxx:101 SwFEShell::SelectObj(Point const&, unsigned char, SdrObject*) sw/source/core/frmedt/feshview.cxx:317 SwEditWin::MouseButtonDown(MouseEvent const&) sw/source/uibase/docvw/edtwin.cxx:? Change-Id: I6c4076eef21dd80381b37ed89aa2dc8bc20fbc98 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135491 Reviewed-by: Miklos Vajna Tested-by: Jenkins (cherry picked from commit 437acab38f2404886a2b83138eb9eb11c4146a76) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135383 Reviewed-by: Xisco Fauli diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index e0212c28d57c..eab41d781c7a 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -314,7 +314,7 @@ bool SwFEShell::SelectObj( const Point& rPt, sal_uInt8 nFlag, SdrObject *pObj ) { const SwFlyFrame *pTmp = GetFlyFromMarked( , this ); OSL_ENSURE( pTmp, "Graphic without Fly" ); -if ( static_cast(pTmp->Lower())->HasAnimation() ) +if ( pTmp && static_cast(pTmp->Lower())->HasAnimation() ) static_cast(pTmp->Lower())->StopAnimation( GetOut() ); } }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/view/viewimp.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 76b284455ffee76d843fd8ee43a2f23c576efd23 Author: Luboš Luňák AuthorDate: Tue Jun 7 12:21:28 2022 +0200 Commit: Miklos Vajna CommitDate: Wed Jun 8 12:08:15 2022 +0200 fix SwViewShellImp::AddPaintRect() rectangle compression (tdf#148255) Both the checks test whether a follow-up rectangle can be merged with the previous one by merging it at the bottom or the right of it, so the previous one should be always the top-left and the follow-up one should be the bottom-right. Change-Id: Ie5809595ec9bf28bd169fc503a6b391c6188d0b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135468 Tested-by: Jenkins Reviewed-by: Luboš Luňák (cherry picked from commit 0372da98bf9b2af82afc2e4ff919068bdcaae7db) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135381 Reviewed-by: Miklos Vajna diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx index f1b2c2531897..854a9aaa03de 100644 --- a/sw/source/core/view/viewimp.cxx +++ b/sw/source/core/view/viewimp.cxx @@ -144,7 +144,7 @@ bool SwViewShellImp::AddPaintRect( const SwRect ) if(last2.Top() == last.Top() && last2.Height() == last.Height() && last2.Right() + 1 >= last.Left() && last2.Right() <= last2.Right()) { -last2 = SwRect( last.TopLeft(), rRect.BottomRight()); +last2 = SwRect( last2.TopLeft(), last.BottomRight()); m_pPaintRegion->pop_back(); return true; }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/uibase/docvw/FrameControlsManager.cxx | 30 ++-- sw/source/uibase/docvw/PageBreakWin.cxx | 176 sw/source/uibase/inc/FrameControl.hxx |3 sw/source/uibase/inc/PageBreakWin.hxx | 62 ++-- sw/source/uibase/inc/uiobject.hxx |4 sw/source/uibase/uitest/uiobject.cxx|4 6 files changed, 169 insertions(+), 110 deletions(-) New commits: commit 44bbe7dd3ca3dc924395eb9aa5ef7aa9ccac25bc Author: Caolán McNamara AuthorDate: Thu May 26 15:52:38 2022 +0100 Commit: Adolfo Jayme Barrientos CommitDate: Mon Jun 6 13:35:38 2022 +0200 tdf#147708 create floating menubutton on demand and destroy when it is fully faded out. Otherwise windows runs out of gdi handles with document with large number of page breaks todo: rename some things in a follow up commit after this more easily backportable commit is merged Change-Id: Ibbe3cd00d1027ac34915c4bff73e3a330e300f38 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135138 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos diff --git a/sw/source/uibase/docvw/FrameControlsManager.cxx b/sw/source/uibase/docvw/FrameControlsManager.cxx index 75ad1b600ed9..1e1387020baa 100644 --- a/sw/source/uibase/docvw/FrameControlsManager.cxx +++ b/sw/source/uibase/docvw/FrameControlsManager.cxx @@ -127,7 +127,7 @@ void SwFrameControlsManager::SetPageBreakControl( const SwPageFrame* pPageFrame else { SwFrameControlPtr pNewControl = std::make_shared( -VclPtr::Create( m_pEditWin, pPageFrame ).get() ); +VclPtr::Create( m_pEditWin, pPageFrame ).get() ); const SwViewOption* pViewOpt = m_pEditWin->GetView().GetWrtShell().GetViewOptions(); pNewControl->SetReadonly( pViewOpt->IsReadonly() ); @@ -136,7 +136,7 @@ void SwFrameControlsManager::SetPageBreakControl( const SwPageFrame* pPageFrame pControl.swap( pNewControl ); } -SwPageBreakWin* pWin = static_cast(pControl->GetWindow()); +SwBreakDashedLine* pWin = static_cast(pControl->GetWindow()); assert (pWin != nullptr); pWin->UpdatePosition(); if (!pWin->IsVisible()) @@ -215,15 +215,20 @@ void SwFrameControlsManager::SetOutlineContentVisibilityButton(const SwContentFr pWin->ShowAll(true); } -const SwPageFrame* SwFrameMenuButtonBase::GetPageFrame() const +const SwPageFrame* SwFrameMenuButtonBase::GetPageFrame(const SwFrame* pFrame) { -if (m_pFrame->IsPageFrame()) -return static_cast( m_pFrame ); +if (pFrame->IsPageFrame()) +return static_cast(pFrame); + +if (pFrame->IsFlyFrame()) +return static_cast(pFrame)->GetAnchorFrame()->FindPageFrame(); -if (m_pFrame->IsFlyFrame()) -return static_cast(m_pFrame)->GetAnchorFrame()->FindPageFrame(); +return pFrame->FindPageFrame(); +} -return m_pFrame->FindPageFrame(); +const SwPageFrame* SwFrameMenuButtonBase::GetPageFrame() const +{ +return SwFrameMenuButtonBase::GetPageFrame(m_pFrame); } void SwFrameMenuButtonBase::dispose() @@ -234,11 +239,16 @@ void SwFrameMenuButtonBase::dispose() InterimItemWindow::dispose(); } -void SwFrameMenuButtonBase::SetVirDevFont() +void SwFrameMenuButtonBase::SetVirDevFont(OutputDevice& rVirDev) { // Get the font and configure it vcl::Font aFont = Application::GetSettings().GetStyleSettings().GetToolFont(); -weld::SetPointFont(*m_xVirDev, aFont); +weld::SetPointFont(rVirDev, aFont); +} + +void SwFrameMenuButtonBase::SetVirDevFont() +{ +SetVirDevFont(*m_xVirDev); } SwFrameControl::SwFrameControl( const VclPtr ) diff --git a/sw/source/uibase/docvw/PageBreakWin.cxx b/sw/source/uibase/docvw/PageBreakWin.cxx index 3fcd9063efc1..2db9b5141cec 100644 --- a/sw/source/uibase/docvw/PageBreakWin.cxx +++ b/sw/source/uibase/docvw/PageBreakWin.cxx @@ -59,69 +59,91 @@ using namespace basegfx; using namespace basegfx::utils; -namespace +SwBreakDashedLine::SwBreakDashedLine(SwEditWin* pEditWin, const SwFrame *pFrame) +: SwDashedLine(pEditWin, ::GetPageBreakColor) +, m_pEditWin(pEditWin) +, m_pFrame(pFrame) { -class SwBreakDashedLine : public SwDashedLine -{ -private: -VclPtr m_pWin; +set_id("PageBreak"); // for uitest +} -public: -SwBreakDashedLine( vcl::Window* pParent, Color& ( *pColorFn )(), SwPageBreakWin* pWin ) : -SwDashedLine( pParent, pColorFn ), -m_pWin( pWin ) {}; -virtual ~SwBreakDashedLine() override { disposeOnce(); } -virtual void dispose() override { m_pWin.clear(); SwDashedLine::dispose(); } +SwPageBreakWin& SwBreakDashedLine::GetOrCreateWin() +{ +if (!m_pWin) +{ +m_pWin = VclPtr::Create(this, m_pEditWin, m_pFrame); +m_pWin->SetPosSizePixel(m_aBtnRect.TopLeft(), m_aBtnRect.GetSize()); +m_pWin->SetZOrder(this,
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/doc/docnew.cxx |6 ++ 1 file changed, 6 insertions(+) New commits: commit 57cd4735a7312174e63d2a1a3dd3831443169530 Author: Michael Stahl AuthorDate: Fri Jun 3 13:33:54 2022 +0200 Commit: Caolán McNamara CommitDate: Sun Jun 5 17:13:01 2022 +0200 tdf#148309 sw_redlinehide: fix mail merge performance regression The problem is that in the call to pTargetShell->EndAllAction(), the cursor is on the node before the newly appended one that has the page break, and only this node is formatted (via GetFormatted()), so no new page frames are inserted in the layout, which then creates massive performance problems later, particularly since the bugdoc contains multiple at-page anchored flys. (regression from commit 42448f48bb48a13d6618a181b12840db6d85c574) Change-Id: I05cd2a515a7f67132ab1c8c6fa0d675252ea3a15 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135356 Tested-by: Michael Stahl Reviewed-by: Michael Stahl (cherry picked from commit ff525d0d70ea9d189a430bde944b56d048b03e55) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135273 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 7aa134edf841..da65b2957229 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -1102,6 +1102,11 @@ SwNodeIndex SwDoc::AppendDoc(const SwDoc& rSource, sal_uInt16 const nStartPageNu // set break on the last paragraph getIDocumentContentOperations().InsertPoolItem(SwPaM(aBreakPos), pageDesc, SetAttrMode::DEFAULT, pTargetShell->GetLayout()); +// tdf#148309 move to the last node - so that the "flush page break" +// code below will format the frame of the node with the page break, +// which is required for new page frames to be created! Else layout +// performance will be terrible. +pTargetShell->SttEndDoc(false); // There is now a new empty text node on the new page. If it has // any marks, those are from the previous page: move them back @@ -1132,6 +1137,7 @@ SwNodeIndex SwDoc::AppendDoc(const SwDoc& rSource, sal_uInt16 const nStartPageNu if ( !bDeletePrevious ) { SAL_INFO( "sw.pageframe", "(Flush pagebreak AKA EndAllAction" ); + assert(pTargetShell->GetCursor()->GetPoint()->nNode.GetNode().GetTextNode()->GetSwAttrSet().HasItem(RES_PAGEDESC)); pTargetShell->EndAllAction(); SAL_INFO( "sw.pageframe", "Flush changes AKA EndAllAction)" ); pTargetShell->StartAllAction();
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) New commits: commit 232523e1303b3ed6b8f1916a0a28f32b4a258f53 Author: Caolán McNamara AuthorDate: Wed Jun 1 15:28:40 2022 +0100 Commit: Xisco Fauli CommitDate: Wed Jun 1 23:18:52 2022 +0200 Related: tdf#149408 inspector crash with a writer OLE inside calc also on *leaving* the OLE mode Change-Id: I97e9cd7cd4dc1803c4bc40865a08a194819c9ff2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135261 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx index 9ecce3226ac7..09c773a1d28a 100644 --- a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx +++ b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx @@ -80,7 +80,11 @@ WriterInspectorTextPanel::WriterInspectorTextPanel(weld::Widget* pParent) updateEntries(aStore, m_nParIdx); } -WriterInspectorTextPanel::~WriterInspectorTextPanel() { m_pShell->SetChgLnk(m_oldLink); } +WriterInspectorTextPanel::~WriterInspectorTextPanel() +{ +if (m_pShell) +m_pShell->SetChgLnk(m_oldLink); +} static OUString PropertyNametoRID(const OUString& rName) {
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/uibase/misc/redlndlg.cxx | 17 +++-- 1 file changed, 11 insertions(+), 6 deletions(-) New commits: commit 31b4e6df39687f4366ff1ac36bb6a727dfa41b10 Author: Caolán McNamara AuthorDate: Wed Jun 1 11:58:32 2022 +0100 Commit: Xisco Fauli CommitDate: Wed Jun 1 18:13:06 2022 +0200 Related: tdf#149408 various crashes seen in redline panel with this writer in calc ole case Change-Id: I1ecd7725703674cc1bcfc9b3d411ec890bfe4bcc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135238 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx index b3ca574b492d..e78460dcf410 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -206,7 +206,8 @@ SwRedlineAcceptDlg::~SwRedlineAcceptDlg() void SwRedlineAcceptDlg::Init(SwRedlineTable::size_type nStart) { -SwWait aWait( *::GetActiveView()->GetDocShell(), false ); +SwView *pView = ::GetActiveView(); +std::unique_ptr xWait(pView ? new SwWait(*pView->GetDocShell(), false) : nullptr); weld::TreeView& rTreeView = m_pTable->GetWidget(); m_aUsedSeqNo.clear(); @@ -234,18 +235,19 @@ void SwRedlineAcceptDlg::Init(SwRedlineTable::size_type nStart) void SwRedlineAcceptDlg::InitAuthors() { -SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr(); - if (!m_xTabPagesCTRL) return; +SwView *pView = ::GetActiveView(); +SwWrtShell* pSh = pView ? pView->GetWrtShellPtr() : nullptr; + SvxTPFilter *pFilterPage = m_xTabPagesCTRL->GetFilterPage(); std::vector aStrings; OUString sOldAuthor(pFilterPage->GetSelectedAuthor()); pFilterPage->ClearAuthors(); -SwRedlineTable::size_type nCount = pSh->GetRedlineCount(); +SwRedlineTable::size_type nCount = pSh ? pSh->GetRedlineCount() : 0; m_bOnlyFormatedRedlines = true; bool bIsNotFormated = false; @@ -276,7 +278,7 @@ void SwRedlineAcceptDlg::InitAuthors() pFilterPage->SelectAuthor(aStrings[0]); weld::TreeView& rTreeView = m_pTable->GetWidget(); -bool bEnable = rTreeView.n_children() != 0 && !pSh->getIDocumentRedlineAccess().GetRedlinePassword().hasElements(); +bool bEnable = rTreeView.n_children() != 0 && pSh && !pSh->getIDocumentRedlineAccess().GetRedlinePassword().hasElements(); bool bSel = rTreeView.get_selected(nullptr); rTreeView.selected_foreach([this, pSh, ](weld::TreeIter& rEntry){ @@ -705,7 +707,10 @@ void SwRedlineAcceptDlg::RemoveParents(SwRedlineTable::size_type nStart, SwRedli void SwRedlineAcceptDlg::InsertParents(SwRedlineTable::size_type nStart, SwRedlineTable::size_type nEnd) { -SwView *pView = ::GetActiveView(); +SwView *pView = ::GetActiveView(); +if (!pView) +return; + SwWrtShell* pSh = pView->GetWrtShellPtr(); bool bHasRedlineAutoFormat = HasRedlineAutoFormat();
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/layout/atrfrm.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 6bbc42687b795b6279b1b96bb721991f90eca4da Author: Xisco Fauli AuthorDate: Tue May 31 13:29:00 2022 +0200 Commit: Xisco Fauli CommitDate: Wed Jun 1 17:37:11 2022 +0200 sw: avoid EXCEPTION_INT_DIVIDE_BY_ZERO See https://crashreport.libreoffice.org/stats/signature/SwFormatCol::Calc(unsigned%20short,unsigned%20short) Change-Id: I79321737b7bed3acff3418d0b51dc6225baaf57f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135184 Reviewed-by: Michael Stahl Tested-by: Xisco Fauli (cherry picked from commit ea4cd397300120a0f825752182eb3b943eb8a1b2) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135254 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index 4791fda80169..5876f3624c53 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -1065,7 +1065,7 @@ void SwFormatCol::Calc( sal_uInt16 nGutterWidth, sal_uInt16 nAct ) { tools::Long nTmp = rCol.GetWishWidth(); nTmp *= GetWishWidth(); -nTmp /= nAct; +nTmp = nAct == 0 ? nTmp : nTmp / nAct; rCol.SetWishWidth(sal_uInt16(nTmp)); } }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/doc/docdesc.cxx | 132 ++--- 1 file changed, 72 insertions(+), 60 deletions(-) New commits: commit 104917ab65aa25f00358fdb56ae37f66b52e9b20 Author: Xisco Fauli AuthorDate: Wed Jun 1 12:02:36 2022 +0200 Commit: Xisco Fauli CommitDate: Wed Jun 1 17:11:37 2022 +0200 sw: fix crash in SwDoc::CopyMasterHeader and SwDoc::CopyMasterFooter Similar to 3eda5d345f14f8926358df7b425c452a8a165c7d "tdf#149184 DOCX: fix crash removing footer, then saving to doc" check that GetHeaderFormat and GetFooterFormat are not nullptr Also restructure the code a bit to reduce the scope of pRight See https://crashreport.libreoffice.org/stats/signature/SwDoc::CopyMasterHeader(SwPageDesc%20const%20&,SwFormatHeader%20const%20&,SwPageDesc%20&,bool,bool) and https://crashreport.libreoffice.org/stats/signature/SwDoc::CopyMasterFooter(SwPageDesc%20const%20&,SwFormatFooter%20const%20&,SwPageDesc%20&,bool,bool) Change-Id: Ia30d06593124d90b88f7d26ed7be9a5d7a64872c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135230 Reviewed-by: Miklos Vajna Tested-by: Jenkins (cherry picked from commit 89b0d94850aeda0a97907945538e4d5f41bac970) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135256 Reviewed-by: Xisco Fauli diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx index d22fee74ca79..1ba9d86b480f 100644 --- a/sw/source/core/doc/docdesc.cxx +++ b/sw/source/core/doc/docdesc.cxx @@ -268,8 +268,6 @@ void SwDoc::CopyMasterHeader(const SwPageDesc , const SwFormatHeader } else { -const SwFrameFormat *pRight = rHead.GetHeaderFormat(); -const SwFormatContent = pRight->GetContent(); const SwFormatContent = rFormatHead.GetHeaderFormat()->GetContent(); if (!aCnt.GetContentIdx()) @@ -277,36 +275,44 @@ void SwDoc::CopyMasterHeader(const SwPageDesc , const SwFormatHeader const SwFrameFormat& rChgedFrameFormat = getConstFrameFormat(rChged, bLeft, bFirst); rDescFrameFormat.SetFormatAttr( rChgedFrameFormat.GetHeader() ); } -else if ((*aRCnt.GetContentIdx() == *aCnt.GetContentIdx()) || -// The ContentIdx is _always_ different when called from -// SwDocStyleSheet::SetItemSet, because it deep-copies the -// PageDesc. So check if it was previously shared. - (bFirst ? rDesc.IsFirstShared() : rDesc.IsHeaderShared())) +else { -SwFrameFormat *pFormat = new SwFrameFormat( GetAttrPool(), -bFirst ? "First header" : "Left header", -GetDfltFrameFormat() ); -::lcl_DescSetAttr( *pRight, *pFormat, false ); -// The section which the right header attribute is pointing -// is copied, and the Index to the StartNode is set to -// the left or first header attribute. -SwNodeIndex aTmp( GetNodes().GetEndOfAutotext() ); -SwStartNode* pSttNd = SwNodes::MakeEmptySection( aTmp, SwHeaderStartNode ); -SwNodeRange aRange( aRCnt.GetContentIdx()->GetNode(), SwNodeOffset(0), - *aRCnt.GetContentIdx()->GetNode().EndOfSectionNode() ); -aTmp = *pSttNd->EndOfSectionNode(); -GetNodes().Copy_( aRange, aTmp, false ); -aTmp = *pSttNd; -GetDocumentContentOperationsManager().CopyFlyInFlyImpl(aRange, nullptr, aTmp); -SwPaM const source(aRange.aStart, aRange.aEnd); -SwPosition dest(aTmp); -sw::CopyBookmarks(source, dest); -pFormat->SetFormatAttr( SwFormatContent( pSttNd ) ); -rDescFrameFormat.SetFormatAttr( SwFormatHeader( pFormat ) ); +const SwFrameFormat *pRight = rHead.GetHeaderFormat(); +if (!pRight) +return; +const SwFormatContent = pRight->GetContent(); + +if ((*aRCnt.GetContentIdx() == *aCnt.GetContentIdx()) || +// The ContentIdx is _always_ different when called from +// SwDocStyleSheet::SetItemSet, because it deep-copies the +// PageDesc. So check if it was previously shared. + (bFirst ? rDesc.IsFirstShared() : rDesc.IsHeaderShared())) +{ +SwFrameFormat *pFormat = new SwFrameFormat( GetAttrPool(), +bFirst ? "First header" : "Left header", +GetDfltFrameFormat() ); +::lcl_DescSetAttr( *pRight, *pFormat, false ); +// The section which the right header attribute is pointing +// is copied, and
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit f23faaa44b8bde98bd979032fda9bfce71f7ff96 Author: Caolán McNamara AuthorDate: Wed Jun 1 11:57:30 2022 +0100 Commit: Caolán McNamara CommitDate: Wed Jun 1 16:32:09 2022 +0200 Resolves: tdf#149408 inspector crash with a writer OLE inside calc toplevel isn't a SwDocShell at this point, its a ScDocShell Change-Id: I3aa3c72e494cf6c0ceff1286a7026ca01385ab8e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135173 Reviewed-by: Michael Stahl Tested-by: Jenkins diff --git a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx index 33d2ae6774e0..9ecce3226ac7 100644 --- a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx +++ b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx @@ -65,7 +65,7 @@ WriterInspectorTextPanel::WriterInspectorTextPanel(weld::Widget* pParent) : InspectorTextPanel(pParent) , m_nParIdx(0) { -SwDocShell* pDocSh = static_cast(SfxObjectShell::Current()); +SwDocShell* pDocSh = dynamic_cast(SfxObjectShell::Current()); m_pShell = pDocSh ? pDocSh->GetWrtShell() : nullptr; if (m_pShell) {
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/layout/anchoredobject.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 15ba58dfb4be1920f562927273cc867eb556a3ec Author: Xisco Fauli AuthorDate: Tue May 31 15:06:53 2022 +0200 Commit: Xisco Fauli CommitDate: Wed Jun 1 10:28:23 2022 +0200 sw: fix crash in SwAnchoredObject::UpdateObjInSortedList See https://crashreport.libreoffice.org/stats/signature/SwAnchoredObject::UpdateObjInSortedList() Just a few lines above (line 636) the same checks are used inside the DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION condition so I don't understand why they weren't added here as well Change-Id: Id8ade0a506d5996d9e357d45c20fe56a68a93eec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135188 Reviewed-by: Miklos Vajna Tested-by: Xisco Fauli (cherry picked from commit 64f8a70298695d1952c3a399e897755ab861add5) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135170 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/source/core/layout/anchoredobject.cxx b/sw/source/core/layout/anchoredobject.cxx index 23c1e2f17906..c38cfcb03931 100644 --- a/sw/source/core/layout/anchoredobject.cxx +++ b/sw/source/core/layout/anchoredobject.cxx @@ -651,7 +651,8 @@ void SwAnchoredObject::UpdateObjInSortedList() AnchorFrame()->GetDrawObjs()->Update( *this ); // update its position in the sorted object list of its page frame // note: as-character anchored object aren't registered at a page frame -if ( GetFrameFormat().GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR ) +if ( GetPageFrame() && GetPageFrame()->GetSortedObjs() && +GetFrameFormat().GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR ) { GetPageFrame()->GetSortedObjs()->Update( *this ); }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source sw/uiconfig
sw/source/ui/index/cnttab.cxx| 71 +++ sw/source/uibase/inc/swuicnttab.hxx |3 + sw/uiconfig/swriter/ui/tocentriespage.ui |2 3 files changed, 49 insertions(+), 27 deletions(-) New commits: commit fffb3bc365be55010fdb4e4a7c5738c6dfdb66f5 Author: Caolán McNamara AuthorDate: Fri May 20 19:47:01 2022 +0200 Commit: Adolfo Jayme Barrientos CommitDate: Tue May 31 16:15:39 2022 +0200 tdf#149186: Table of contents editor not showing buttons in Dutch UI an alternative approach that doesn't leave things too wide for the English UI Change-Id: Idbdd75790607b1928bfc583004041f7f98688ae6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134852 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index c57f47278f2f..25d1d33ceaab 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -1788,6 +1788,7 @@ SwTOXEntryTabPage::SwTOXEntryTabPage(weld::Container* pPage, weld::DialogControl , m_xChapterInfoPB(m_xBuilder->weld_button("chapterinfo")) , m_xPageNoPB(m_xBuilder->weld_button("pageno")) , m_xHyperLinkPB(m_xBuilder->weld_button("hyperlink")) +, m_xFieldBox(m_xBuilder->weld_widget("fieldbox")) , m_xAuthFieldsLB(m_xBuilder->weld_combo_box("authfield")) , m_xAuthInsertPB(m_xBuilder->weld_button("insert")) , m_xAuthRemovePB(m_xBuilder->weld_button("remove")) @@ -1904,8 +1905,17 @@ SwTOXEntryTabPage::SwTOXEntryTabPage(weld::Container* pPage, weld::DialogControl m_xSecondKeyLB->set_active(0); m_xThirdKeyLB->set_active(0); -//lock size +// lock size of dialog. Determine the field box's widest possible +// configuration (tdf#149186) before doing so. +int nFieldBoxWidth = 0; +for (int eType = TOX_CITATION; eType >= TOX_INDEX; --eType) +{ +ShowHideControls(eType); +nFieldBoxWidth = std::max(m_xFieldBox->get_preferred_size().Width(), nFieldBoxWidth); +} +m_xFieldBox->set_size_request(nFieldBoxWidth, -1); Size aPrefSize(m_xContainer->get_preferred_size()); +m_xFieldBox->set_size_request(-1, -1); m_xContainer->set_size_request(aPrefSize.Width(), aPrefSize.Height()); } @@ -1969,6 +1979,39 @@ void SwTOXEntryTabPage::Reset( const SfxItemSet* ) m_xCommaSeparatedCB->set_active(m_pCurrentForm->IsCommaSeparated()); } +void SwTOXEntryTabPage::ShowHideControls(int eType) +{ +bool bToxIsAuthorities = TOX_AUTHORITIES == eType; +bool bToxIsIndex = TOX_INDEX == eType; +bool bToxIsContent = TOX_CONTENT == eType; +bool bToxSupportsLinks = TOX_CONTENT == eType || + TOX_ILLUSTRATIONS == eType || + TOX_TABLES == eType || + TOX_OBJECTS == eType || + TOX_USER == eType; + +//show or hide controls +m_xEntryNoPB->set_visible(bToxIsContent); +m_xHyperLinkPB->set_visible(bToxSupportsLinks); +m_xRelToStyleCB->set_visible(!bToxIsAuthorities); +m_xChapterInfoPB->set_visible(!bToxIsContent && !bToxIsAuthorities); +m_xEntryPB->set_visible(!bToxIsAuthorities); +m_xPageNoPB->set_visible(!bToxIsAuthorities); +m_xAuthFieldsLB->set_visible(bToxIsAuthorities); +m_xAuthInsertPB->set_visible(bToxIsAuthorities); +m_xAuthRemovePB->set_visible(bToxIsAuthorities); + +m_xFormatFrame->set_visible(!bToxIsAuthorities); + +m_xSortingFrame->set_visible(bToxIsAuthorities); +m_xSortKeyFrame->set_visible(bToxIsAuthorities); + +m_xMainEntryStyleFT->set_visible(bToxIsIndex); +m_xMainEntryStyleLB->set_visible(bToxIsIndex); +m_xAlphaDelimCB->set_visible(bToxIsIndex); +m_xCommaSeparatedCB->set_visible(bToxIsIndex); +} + void SwTOXEntryTabPage::ActivatePage( const SfxItemSet& /*rSet*/) { SwMultiTOXTabDialog* pTOXDlg = static_cast(GetDialogController()); @@ -1979,12 +2022,6 @@ void SwTOXEntryTabPage::ActivatePage( const SfxItemSet& /*rSet*/) { bool bToxIsAuthorities = TOX_AUTHORITIES == aCurType.eType; bool bToxIsIndex = TOX_INDEX == aCurType.eType; -bool bToxIsContent = TOX_CONTENT == aCurType.eType; -bool bToxSupportsLinks = TOX_CONTENT == aCurType.eType || - TOX_ILLUSTRATIONS == aCurType.eType || - TOX_TABLES == aCurType.eType || - TOX_OBJECTS == aCurType.eType || - TOX_USER == aCurType.eType; m_xLevelLB->clear(); for(sal_uInt16 i = 1; i < m_pCurrentForm->GetFormMax(); i++) @@ -2047,25 +2084,7 @@ void SwTOXEntryTabPage::ActivatePage( const SfxItemSet& /*rSet*/) m_xLevelLB->select(bToxIsIndex ? 1 : 0); //show or hide controls -m_xEntryNoPB->set_visible(bToxIsContent); -m_xHyperLinkPB->set_visible(bToxSupportsLinks);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/uibase/dochdl/swdtflvr.cxx |5 + 1 file changed, 5 insertions(+) New commits: commit daafc32c5625757091e7cf80711a18639bd36bf0 Author: Szymon Kłos AuthorDate: Fri May 27 14:50:21 2022 +0200 Commit: Caolán McNamara CommitDate: Mon May 30 20:57:55 2022 +0200 tdf#145875 don't open Insert section dialog when pasting image This happens when we "copy image" in Firefox of the resource which cannot be accessed without logging in on some website. In that case we used HTML format and that resulted in pasting login webpage as a section. This patch detects simple HTML containing only an image while it also contains BITMAP format in the clipboard which we can use directly. That way we paste image data from the clipboard. Change-Id: Ia2ee7e246f8c71e1d0958c6c955ec056a0a96f8c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135011 Tested-by: Jenkins Reviewed-by: Andras Timar (cherry picked from commit 0599a73c3c2bffdbfa4e695e2d694f1947215a07) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135013 Reviewed-by: Caolán McNamara diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index db217051359e..b76476b4e02a 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -1501,6 +1501,11 @@ bool SwTransferable::Paste(SwWrtShell& rSh, TransferableDataHelper& rData, RndSt ); } +// when HTML is just an image don't generate new section +if (rData.HasFormat(SotClipboardFormatId::HTML_SIMPLE) && rData.HasFormat(SotClipboardFormatId::HTML_NO_COMMENT) +&& rData.HasFormat(SotClipboardFormatId::BITMAP) && nFormat == SotClipboardFormatId::FILE_LIST) +nFormat = SotClipboardFormatId::BITMAP; + // tdf#37223 avoid non-native insertion of Calc worksheets in the following cases: // content of 1-cell worksheets are inserted as simple text using RTF format, // bigger worksheets within native (Writer) table cells are inserted as native tables,
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/layout/flycnt.cxx | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) New commits: commit 906151f18771418ee899f59fc98c774b07dadf16 Author: Attila Bakos (NISZ) AuthorDate: Tue May 17 15:28:59 2022 +0200 Commit: László Németh CommitDate: Mon May 30 11:17:15 2022 +0200 tdf#148365 sw: fix freezing with FrameIsAutomaticHeight Lock layout update temporarily during setting horizontal and after that, vertical orientations of textboxes with FrameIsAutomaticHeight to avoid freezing SwObjectFormatter, and depending on the platform, freezing Writer completely. Regression from commit 3b0a0e70cb67fc2e1fd2e8cbb9cfcd8c670e "Related tdf#66039 DOCX import: fix Z-order of group shapes". Change-Id: Ib106182b9f0d3d74ebdc3e746345380c8b685fdf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134480 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 182d2a47a2b4ed0affdc828a534c1659cc2e926d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135007 Tested-by: Jenkins Reviewed-by: Attila Bakos diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx index 5e9bdfe92ef0..5bcdad916e13 100644 --- a/sw/source/core/layout/flycnt.cxx +++ b/sw/source/core/layout/flycnt.cxx @@ -549,8 +549,14 @@ void SwFlyAtContentFrame::MakeAll(vcl::RenderContext* pRenderContext) aHOri.SetPos(aHOri.GetPos() + aTextRectangle.Left()); aVOri.SetPos(aVOri.GetPos() + aTextRectangle.Top()); // save the new position for the shape -GetFormat()->SetFormatAttr(aHOri); -GetFormat()->SetFormatAttr(aVOri); +auto pFormat = GetFormat(); +const bool bLocked = pFormat->IsModifyLocked(); +if (!bLocked) +pFormat->LockModify(); +pFormat->SetFormatAttr(aHOri); +pFormat->SetFormatAttr(aVOri); +if (!bLocked) +pFormat->UnlockModify(); } if ( bOsz || bConsiderWrapInfluenceDueToOverlapPrevCol || // #i40444#
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/layout/wsfrm.cxx | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) New commits: commit c3a1f4cc50fa4a17589ca1b4643a554964af59a3 Author: Michael Stahl AuthorDate: Tue May 24 15:20:42 2022 +0200 Commit: Caolán McNamara CommitDate: Sat May 28 22:32:39 2022 +0200 sw: fix mysterious layout loop in CppunitTest_sw_uiwriter3 testTdf104649 This didn't happen with master from a week ago on Fedora 35, but happens with Monday's master on Fedora 36. Also happens with libreoffice-7-3 branch. Fundamentally the problem with the bugdoc is that there are tables in footnotes, which aren't really supported and can't split across pages like they would need to. The loop happens because a footnote on page 48 invalidates position of its anchor frame 549 on page 45. This is probably pointless, let's only invalidate if the anchor is on the same page (it should be on the same page, but probably the tables in other footnotes get in the way). Change-Id: I87976c7f8b35725bc8e642133bebb396d37ff0be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134877 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 0496252c2c7fd2d694c4a73f387ef75e0021de3e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134894 Reviewed-by: Caolán McNamara diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index 62c99a5f6e87..43bd9a7037a1 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -3001,7 +3001,16 @@ SwTwips SwLayoutFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo ) pTmp->InvalidateSize(); } else -pCnt->InvalidatePos(); +{ +if (pCnt->FindPageFrame() == FindPageFrame()) +{ +pCnt->InvalidatePos(); +} +else +{ +SAL_WARN("sw.layout", "footnote frame on different page than ref frame?"); +} +} } } return nReal;
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/frmedt/fecopy.cxx | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) New commits: commit ca41437a880a3c40d22557ed3a29203b06eec993 Author: Michael Stahl AuthorDate: Fri May 20 16:01:57 2022 +0200 Commit: Caolán McNamara CommitDate: Tue May 24 12:44:50 2022 +0200 sw: avoid ~SwIndexReg() assert in SwFEShell::PastePages() Change-Id: I5337dc8568255a778d29b676a39c99f72c42486b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134693 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 1b8c42f8b007d690a85676f260b28b44639fc79a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134777 Tested-by: Thorsten Behrens Reviewed-by: Thorsten Behrens Reviewed-by: Caolán McNamara diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index b7a12a828b90..a907e0e838a0 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -1133,7 +1133,7 @@ void SwFEShell::PastePages( SwFEShell& rToFill, sal_uInt16 nStartPage, sal_uInt1 return; } MovePage( GetThisFrame, GetFirstSub ); -SwPaM aCpyPam( *GetCursor()->GetPoint() ); +::std::optional oSourcePam( *GetCursor()->GetPoint() ); OUString sStartingPageDesc = GetPageDesc( GetCurPageDesc()).GetName(); SwPageDesc* pDesc = rToFill.FindPageDescByName( sStartingPageDesc, true ); if( pDesc ) @@ -1145,7 +1145,7 @@ void SwFEShell::PastePages( SwFEShell& rToFill, sal_uInt16 nStartPage, sal_uInt1 return; } //if the page starts with a table a paragraph has to be inserted before -SwNode* pTableNode = aCpyPam.GetNode().FindTableNode(); +SwNode *const pTableNode = oSourcePam->GetNode().FindTableNode(); if(pTableNode) { //insert a paragraph @@ -1155,22 +1155,23 @@ void SwFEShell::PastePages( SwFEShell& rToFill, sal_uInt16 nStartPage, sal_uInt1 if(GetDoc()->getIDocumentContentOperations().AppendTextNode( aBefore )) { SwPaM aTmp(aBefore); -aCpyPam = aTmp; +*oSourcePam = aTmp; } EndUndo(SwUndoId::INSERT); } MovePage( GetThisFrame, GetLastSub ); -aCpyPam.SetMark(); -*aCpyPam.GetMark() = *GetCursor()->GetPoint(); +oSourcePam->SetMark(); +*oSourcePam->GetMark() = *GetCursor()->GetPoint(); CurrShell aCurr( this ); StartAllAction(); GetDoc()->getIDocumentFieldsAccess().LockExpFields(); -SetSelection(aCpyPam); +SetSelection(*oSourcePam); // copy the text of the selection SwEditShell::Copy(rToFill); +oSourcePam.reset(); // delete it because Undo will remove its node! if(pTableNode) {
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/uibase/utlui/glbltree.cxx | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) New commits: commit ee67c82c210ec4bcac0a6e92a13dc63b06006239 Author: Jim Raykowski AuthorDate: Mon May 23 15:35:57 2022 -0800 Commit: Michael Stahl CommitDate: Tue May 24 11:35:04 2022 +0200 tdf#149231 Fix crash on print preview of master caused by commit 1f9a792a391f0811bbb5f570ad5c84d13312c539. Change-Id: Iecfa019b04b84bb70b5e04af51f9f786d7cd9fdf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134846 Tested-by: Jenkins Reviewed-by: Jim Raykowski (cherry picked from commit f817b3de1aa827d93e2a622735c4d570514f4849) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134788 Reviewed-by: Michael Stahl diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx index d658a6db7271..45a03e537216 100644 --- a/sw/source/uibase/utlui/glbltree.cxx +++ b/sw/source/uibase/utlui/glbltree.cxx @@ -773,7 +773,8 @@ void SwGlobalTree::ExecuteContextMenuAction(std::string_view rSelectedPopupEntry IMPL_LINK_NOARG(SwGlobalTree, Timeout, Timer *, void) { -if (m_pActiveShell && m_pActiveShell->GetView().GetEditWin().HasFocus()) +SwView* pView = GetParentWindow()->GetCreateView(); +if (pView && pView->GetEditWin().HasFocus()) { if (Update(false)) Display(); @@ -877,14 +878,13 @@ bool SwGlobalTree::Update(bool bHard) bool bRet = false; if (pActView && pActView->GetWrtShellPtr()) { -SwWrtShell* pOldShell = m_pActiveShell; +const SwWrtShell* pOldShell = m_pActiveShell; m_pActiveShell = pActView->GetWrtShellPtr(); if(m_pActiveShell != pOldShell) { -if (pOldShell) -EndListening(*pOldShell->GetView().GetDocShell()); -StartListening(*m_pActiveShell->GetView().GetDocShell()); m_pSwGlblDocContents.reset(); +if (!IsListening(*m_pActiveShell->GetView().GetDocShell())) +StartListening(*m_pActiveShell->GetView().GetDocShell()); } if(!m_pSwGlblDocContents) {
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/crsr/crbm.cxx | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) New commits: commit 9b767013115b967bb2a9215a4ee49f7b0ef2 Author: Michael Stahl AuthorDate: Fri May 20 15:46:20 2022 +0200 Commit: Caolán McNamara CommitDate: Tue May 24 09:58:39 2022 +0200 sw_redlinehide: fix crash in IsMarkHidden() if pointing to table node This is called during mail merge from documentStartPageNumber() and if the document starts with a table, the passed UNO mark will point to SwTableNode. (regression from commit 943d9be770e550d20ca72274fa5e914d1f61e605) Change-Id: Ic69c12ba0d819eda85de5dde95e35a8071466c2e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134692 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 4d3b750d08d05c475fb38f8b3961696d9cc9882f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134776 Reviewed-by: Caolán McNamara diff --git a/sw/source/core/crsr/crbm.cxx b/sw/source/core/crsr/crbm.cxx index 9e2027a2ceba..02f554014568 100644 --- a/sw/source/core/crsr/crbm.cxx +++ b/sw/source/core/crsr/crbm.cxx @@ -128,9 +128,14 @@ bool IsMarkHidden(SwRootFrame const& rLayout, ::sw::mark::IMark const& rMark) { return false; } -SwTextNode const& rNode(*rMark.GetMarkPos().nNode.GetNode().GetTextNode()); +SwNode const& rNode(rMark.GetMarkPos().nNode.GetNode()); +SwTextNode const*const pTextNode(rNode.GetTextNode()); +if (pTextNode == nullptr) +{ // UNO_BOOKMARK may point to table node +return rNode.GetRedlineMergeFlag() == SwNode::Merge::Hidden; +} SwTextFrame const*const pFrame(static_cast( -rNode.getLayoutFrame())); +pTextNode->getLayoutFrame())); if (!pFrame) { return true; @@ -145,14 +150,14 @@ bool IsMarkHidden(SwRootFrame const& rLayout, ::sw::mark::IMark const& rMark) } else { -if (rMark.GetMarkPos().nContent.GetIndex() == rNode.Len()) +if (rMark.GetMarkPos().nContent.GetIndex() == pTextNode->Len()) { // at end of node: never deleted (except if node deleted) -return rNode.GetRedlineMergeFlag() == SwNode::Merge::Hidden; +return pTextNode->GetRedlineMergeFlag() == SwNode::Merge::Hidden; } else { // check character following mark pos return pFrame->MapModelToViewPos(rMark.GetMarkPos()) -== pFrame->MapModelToView(, rMark.GetMarkPos().nContent.GetIndex() + 1); +== pFrame->MapModelToView(pTextNode, rMark.GetMarkPos().nContent.GetIndex() + 1); } } }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/filter/ww8/docxattributeoutput.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 6f6d61ea5d7700fb18bfb49c6e1d16a55944e581 Author: Stephan Bergmann AuthorDate: Mon May 23 10:08:08 2022 +0200 Commit: Xisco Fauli CommitDate: Mon May 23 21:24:45 2022 +0200 tdf#149198 Fix use of nullptr ...which would have caused std::abort for non-production debug builds since 4f0c70fb5554325e0cc2129741175bf07de22029 "Avoid calling OString ctor with null pointer", and started to erroneously pass a nullptr argument into a std::string_view for all kinds of builds with af16aa625682b649e8843237652b9246d519cbae "Improve loplugin:stringview" Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134758 Tested-by: Jenkins Reviewed-by: Stephan Bergmann (cherry picked from commit c8d4ae2ad0cfdac770d897e7aca72fbb4a87765f, plus follow-up f546767b4e9bf3de288ea50336cf1e15f1ee7435 "tdf#149198 Fix previous fix") Change-Id: Iad4d1576ed651a74c0f8b2e8dee3c59f5214accd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134780 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 6f8a24acd255..a6da6244898a 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3064,7 +3064,7 @@ void DocxAttributeOutput::WriteCollectedRunProperties() { const char* pVal = nullptr; m_pColorAttrList->getAsChar(FSNS(XML_w, XML_val), pVal); -if (std::string_view("auto") != pVal) +if (pVal == nullptr || std::string_view("auto") != pVal) { m_pSerializer->startElementNS(XML_w14, XML_textFill); m_pSerializer->startElementNS(XML_w14, XML_solidFill);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/uibase/docvw/HeaderFooterWin.cxx |5 + 1 file changed, 5 insertions(+) New commits: commit 24d8300c1b5a44c4b30c1e062b449df8507d80dc Author: Miklos Vajna AuthorDate: Thu May 19 14:17:10 2022 +0200 Commit: Xisco Fauli CommitDate: Fri May 20 15:43:49 2022 +0200 sw: fix crash in SwHeaderFooterWin::IsEmptyHeaderFooter() Crashreport signature: Fatal signal received: SIGSEGV code: 1 for address: 0x0 program/../program/libswlo.so SwPageFrame::GetPageDesc() const sw/source/core/inc/pagefrm.hxx:144 program/../program/libswlo.so SwHeaderFooterWin::IsEmptyHeaderFooter() const sw/source/uibase/docvw/HeaderFooterWin.cxx:403 program/../program/libswlo.so SwHeaderFooterWin::ShowAll(bool) sw/source/uibase/docvw/HeaderFooterWin.cxx:273 program/../program/libswlo.so SwFrameControl::ShowAll(bool) sw/source/uibase/inc/FrameControl.hxx:49 Change-Id: I3c1a6f46c7a15c2ca1a3db69a14d49abbea8c879 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134656 Tested-by: Jenkins Reviewed-by: Miklos Vajna (cherry picked from commit 68da277559597c52833067c1749323ac38f3364a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134622 Reviewed-by: Xisco Fauli diff --git a/sw/source/uibase/docvw/HeaderFooterWin.cxx b/sw/source/uibase/docvw/HeaderFooterWin.cxx index d74c25084f14..99cdc0072861 100644 --- a/sw/source/uibase/docvw/HeaderFooterWin.cxx +++ b/sw/source/uibase/docvw/HeaderFooterWin.cxx @@ -399,6 +399,11 @@ bool SwHeaderFooterWin::IsEmptyHeaderFooter( ) const { bool bResult = true; +if (!GetPageFrame()) +{ +return bResult; +} + // Actually check it const SwPageDesc* pDesc = GetPageFrame()->GetPageDesc();
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/docnode/node.cxx |6 ++ 1 file changed, 6 insertions(+) New commits: commit 6767a309b7c3ddd283a83bcf7dc36fecaf9cc6b9 Author: Michael Stahl AuthorDate: Tue May 17 14:09:08 2022 +0200 Commit: Caolán McNamara CommitDate: Wed May 18 10:39:11 2022 +0200 tdf#148461 sw_redlinehide: fix assert in SwContentNode::DelFrames() The assert(pMerged->pFirstNode->GetIndex() <= i) is intended for when frames are really deleted, but CheckParaRedlineMerge() calls it while the now-outdated MergedPara is still on the frame, but the nodes already have new flags; assign a dummy node in this situation. Change-Id: I23fbfdb6901e6e15abf92913aa252e59877bc280 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134475 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 6ee57b39ba912f0902714d8c4d1a267511a3c6ca) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134446 Reviewed-by: Caolán McNamara diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index c9b4a41f42fe..12be064f370b 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -1450,6 +1450,12 @@ void SwContentNode::DelFrames(SwRootFrame const*const pLayout) pMerged->pParaPropsNode = pNode->GetTextNode(); break; } +else if (pMerged->pFirstNode->GetIndex() == i) +{ // this can only happen when called from CheckParaRedlineMerge() +// and the pMerged will be deleted anyway +pMerged->pParaPropsNode = pMerged->pFirstNode; +break; +} } assert(pMerged->listener.IsListeningTo(pMerged->pParaPropsNode)); }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/uibase/uiview/viewling.cxx | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) New commits: commit d2819832dcd092195c2c2dec5450dba6bd86b045 Author: Michael Stahl AuthorDate: Tue May 17 13:12:49 2022 +0200 Commit: Xisco Fauli CommitDate: Tue May 17 21:26:47 2022 +0200 tdf#148869 sw_redlinehide: fix SwView::ExecSpellPopup() How could i forget that MovePara(GoCurrPara, fnParaStart) will move to a previous paragraph when it's already at the start of the current one, it's so intuitive. (regression from commit d814941b31b4f9cc8b6e9bd4ddc5188015529707) Change-Id: Ief9bcd42b7ea78feef50ac42bc93580c29c080b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134468 Tested-by: Michael Stahl Reviewed-by: Michael Stahl (cherry picked from commit e2ff01a08a70a96517287ac9b9e9de6fbfd6a00b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134445 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx index ad7e9e697d04..461f7c8afa58 100644 --- a/sw/source/uibase/uiview/viewling.cxx +++ b/sw/source/uibase/uiview/viewling.cxx @@ -694,9 +694,15 @@ bool SwView::ExecSpellPopup(const Point& rPt) if (pNode) { pCursorShell->Push(); -pCursorShell->MovePara(GoCurrPara, fnParaStart); +if (!pCursorShell->IsSttPara()) +{ +pCursorShell->MovePara(GoCurrPara, fnParaStart); +} pCursorShell->SetMark(); -pCursorShell->MovePara(GoCurrPara, fnParaEnd); +if (!pCursorShell->IsEndPara()) +{ +pCursorShell->MovePara(GoCurrPara, fnParaEnd); +} aParaText = pCursorShell->GetSelText(); pCursorShell->Pop(SwCursorShell::PopMode::DeleteCurrent); }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/uibase/shells/drawsh.cxx |5 + 1 file changed, 5 insertions(+) New commits: commit 6bbdce82dba84204f17bcd5f4588f3a903cfb91c Author: Miklos Vajna AuthorDate: Mon May 9 11:56:06 2022 +0200 Commit: Xisco Fauli CommitDate: Fri May 13 16:10:16 2022 +0200 sw: fix crash in SwDrawShell::Execute() Crashreport signature: SwDrawShell::Execute(SfxRequest&) [clone .cold] include/svx/svdhdl.hxx:194 SfxDispatcher::Call_Impl(SfxShell&, SfxSlot const&, SfxRequest&, bool) sfx2/source/control/dispatch.cxx:255 which is a bit tricky to read (probably due to LTO), but what happens here is that the handle index is user input and we look at index up in a list without error handling. This is a problem since commit 7eed711a6115bf892c998cbd73a2c5b706c6f99d (Extended MoveShapeHandle command for Anchors as well, 2021-05-24), which assumed that handle indexes and the handle list can't get out of sync. Fix the problem similar to what commit 48beccf52413981d3d1c525a81a2c57048abe261 (sw: fix crash in SwView::Execute(), 2021-09-03) did at SID_MOVE_SHAPE_HANDLE handler for Writer images (this one is for Draw shapes). This fix just makes sure we don't crash, there may be some deeper reason why the handle index is out of sync with the handle list in the first place. Change-Id: I8f3a25d74082984cedce09362a690f24d7236ba6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134216 Tested-by: Jenkins Reviewed-by: Miklos Vajna (cherry picked from commit 3f318b314eb161d293990efa401a626ed8017c87) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134184 Reviewed-by: Xisco Fauli diff --git a/sw/source/uibase/shells/drawsh.cxx b/sw/source/uibase/shells/drawsh.cxx index 9dc1ad6163c6..5286c85b3830 100644 --- a/sw/source/uibase/shells/drawsh.cxx +++ b/sw/source/uibase/shells/drawsh.cxx @@ -212,6 +212,11 @@ void SwDrawShell::Execute(SfxRequest ) const sal_uLong newPosY = newPosYTwips->GetValue(); const Point mPoint(newPosX, newPosY); const SdrHdl* handle = pSdrView->GetHdlList().GetHdl(handleNum); +if (!handle) +{ +break; +} + if (handle->GetKind() == SdrHdlKind::Anchor || handle->GetKind() == SdrHdlKind::Anchor_TR) { rSh.FindAnchorPos(mPoint, /*bMoveIt=*/true);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/ui/chrdlg/swuiccoll.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit ba9e78e00fda5438fa743dd44f4a3b2f854cf61f Author: Justin Luth AuthorDate: Thu May 5 21:08:24 2022 +0200 Commit: Xisco Fauli CommitDate: Fri May 6 15:55:45 2022 +0200 tdf#91035 sw page-style UI: All styles shown, not hidden The first entry in the list (All styles) is what is shown by default, so that means that the 0th entry should be pre-selected, not the 1st. Change-Id: I4c204fda41a0551b9f30724df361e4f797a87325 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133911 Tested-by: Jenkins Reviewed-by: Justin Luth (cherry picked from commit 3a79bd968869f782b8540aea6598c1f8ee14cced) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133862 Reviewed-by: Xisco Fauli diff --git a/sw/source/ui/chrdlg/swuiccoll.cxx b/sw/source/ui/chrdlg/swuiccoll.cxx index c0953f830ff5..2b1aca870165 100644 --- a/sw/source/ui/chrdlg/swuiccoll.cxx +++ b/sw/source/ui/chrdlg/swuiccoll.cxx @@ -86,7 +86,7 @@ SwCondCollPage::SwCondCollPage(weld::Container* pPage, weld::DialogController* p } } -m_xFilterLB->set_active(1); +m_xFilterLB->set_active(0); m_xTbLinks->show(); }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/text/frmpaint.cxx |9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) New commits: commit f1cc1d09934a45b47a3d4be44603d50859ce8e77 Author: Xisco Fauli AuthorDate: Mon May 2 11:37:18 2022 +0200 Commit: Adolfo Jayme Barrientos CommitDate: Wed May 4 16:35:45 2022 +0200 sw: avoid one more EXCEPTION_INT_DIVIDE_BY_ZERO Seen in https://crashreport.libreoffice.org/stats/signature/SwTextFrame::PaintExtraData(SwRect%20const%20&) Change-Id: Ie6924254dca73360d384987834460a6f813e0d69 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133691 Tested-by: Jenkins Reviewed-by: Noel Grandin Reviewed-by: Caolán McNamara (cherry picked from commit fae937b6859517bd9fe8e400cad3c84561ff98ab) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133715 Reviewed-by: Adolfo Jayme Barrientos diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx index 95ecf6cd54ff..8637faca988c 100644 --- a/sw/source/core/text/frmpaint.cxx +++ b/sw/source/core/text/frmpaint.cxx @@ -82,9 +82,14 @@ public: sal_Int16 eHor, bool bLnNm ); SwFont* GetFont() const { return m_pFnt.get(); } void IncLineNr() { ++m_nLineNr; } -bool HasNumber() const { return !( m_nLineNr % m_rLineInf.GetCountBy() ); } +bool HasNumber() const { +if( m_rLineInf.GetCountBy() == 0 ) +return false; +return !( m_nLineNr % m_rLineInf.GetCountBy() ); +} bool HasDivider() const { -if( !m_nDivider ) return false; +if( !m_nDivider || m_rLineInf.GetDividerCountBy() == 0 ) +return false; return !(m_nLineNr % m_rLineInf.GetDividerCountBy()); }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/text/porrst.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 1f335ad91f9df58268aa97a2b6297a9578380037 Author: Xisco Fauli AuthorDate: Thu Apr 28 15:38:56 2022 +0200 Commit: Michael Stahl CommitDate: Tue May 3 10:32:04 2022 +0200 sw: avoid EXCEPTION_INT_DIVIDE_BY_ZERO Seen in https://crashreport.libreoffice.org/stats/signature/SwBookmarkPortion::DoPaint(SwTextPaintInfo%20const%20&,rtl::OUString%20&,SwFont%20&,int%20&) Introduced by 4ce8120f1e53f7b81e653b01d141643013bc69ab "tdf#45589 sw: create and paint text portions for bookmarks" Change-Id: I7d025878164e1f97b86f9d129af9ba93e93b6ba3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133562 Tested-by: Jenkins Reviewed-by: Xisco Fauli (cherry picked from commit 7c8b9fa98f4c5f7f5620e797dbbe24081e252548) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133601 Reviewed-by: Michael Stahl diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx index c762056c30fe..96002d3620c4 100644 --- a/sw/source/core/text/porrst.cxx +++ b/sw/source/core/text/porrst.cxx @@ -594,7 +594,7 @@ bool SwBookmarkPortion::DoPaint(SwTextPaintInfo const& rTextPaintInfo, Size aSize(rFont.GetSize(rFont.GetActual())); // use also the external leading (line gap) of the portion, but don't use // 100% of it because i can't figure out how to baseline align that -auto const nFactor = (Height() * 95) / aSize.Height(); +auto const nFactor = aSize.Height() > 0 ? (Height() * 95) / aSize.Height() : Height(); rFont.SetProportion(nFactor); rFont.SetWeight(WEIGHT_THIN, rFont.GetActual()); rFont.SetColor(SwViewOption::GetFieldShadingsColor());
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/uibase/shells/tabsh.cxx | 46 -- 1 file changed, 44 insertions(+), 2 deletions(-) New commits: commit ed7243ec27d8cdc883ccc5f7eaa732155c4a2096 Author: László Németh AuthorDate: Fri Apr 22 13:23:55 2022 +0200 Commit: Xisco Fauli CommitDate: Tue Apr 26 09:28:30 2022 +0200 tdf#147453 sw: disable Delete Table functions on tracked deletions In Show Changes mode, disable "Delete Selected Rows" icons and the same menu options in the following cases: - no table selection, but the text cursor in a deleted table row; - with table selection, all selected cells in deleted table rows. Disable also "Deleted Selected Columns" and "Delete Table" icons and the same menu options, when the cursor is there in a deleted table. Follow-up to commit c4f6fee3bea0d8618b5815e60304ff9359ccd21c "tdf#147435 sw: enable Accept Change for table selection". Change-Id: Ic6781ccee794c7458e6979f2e981840339cd3883 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133320 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit 0204c00f241313e1d292b4c3ea117d42af7dec69) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133292 Reviewed-by: Xisco Fauli diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx index 7798b6c0da9c..84a090b111fd 100644 --- a/sw/source/uibase/shells/tabsh.cxx +++ b/sw/source/uibase/shells/tabsh.cxx @@ -55,6 +55,7 @@ #include #include #include +#include #include #include #include @@ -445,6 +446,43 @@ static void lcl_TabGetMaxLineWidth(const SvxBorderLine* pBorderLine, SvxBorderLi rBorderLine.SetColor(pBorderLine->GetColor()); } +static bool lcl_BoxesInDeletedRows(SwWrtShell , const SwSelBoxes& rBoxes) +{ +// cursor and selection are there only in deleted rows in Show Changes mode +if ( rSh.GetLayout()->IsHideRedlines() ) +return false; + +// not selected or all selected rows are deleted +bool bRet = true; +SwRedlineTable::size_type nRedlinePos = 0; +if ( rBoxes.empty() ) +bRet = rSh.GetCursor()->GetNode().GetTableBox()->GetUpper()->IsDeleted(nRedlinePos); +else +{ +tools::Long nBoxes = rBoxes.size(); +SwTableLine* pPrevLine = nullptr; +for ( tools::Long i = 0; i < nBoxes; i++ ) +{ +SwTableLine* pLine = rBoxes[i]->GetUpper(); +if ( pLine != pPrevLine ) +bRet &= pLine->IsDeleted(nRedlinePos); +pPrevLine = pLine; +} +} + +return bRet; +} + +static bool lcl_CursorInDeletedTable(SwWrtShell ) +{ +// cursor and selection are there only in deleted table in Show Changes mode +if ( rSh.GetLayout()->IsHideRedlines() ) +return false; + +SwTableNode* pTableNd = rSh.GetCursor()->GetPoint()->nNode.GetNode().FindTableNode(); +return pTableNd && pTableNd->GetTable().IsDeleted(); +} + void SwTableShell::Execute(SfxRequest ) { const SfxItemSet* pArgs = rReq.GetArgs(); @@ -1381,7 +1419,7 @@ void SwTableShell::GetState(SfxItemSet ) { SwSelBoxes aBoxes; ::GetTableSel( rSh, aBoxes, SwTableSearchType::Row ); -if( ::HasProtectedCells( aBoxes )) +if( ::HasProtectedCells( aBoxes ) || lcl_BoxesInDeletedRows( rSh, aBoxes ) ) rSet.DisableItem( nSlot ); } break; @@ -1389,10 +1427,14 @@ void SwTableShell::GetState(SfxItemSet ) { SwSelBoxes aBoxes; ::GetTableSel( rSh, aBoxes, SwTableSearchType::Col ); -if( ::HasProtectedCells( aBoxes )) +if( ::HasProtectedCells( aBoxes ) || lcl_CursorInDeletedTable( rSh ) ) rSet.DisableItem( nSlot ); } break; +case FN_TABLE_DELETE_TABLE: +if( lcl_CursorInDeletedTable( rSh ) ) +rSet.DisableItem( nSlot ); +break; case FN_TABLE_UNSET_READ_ONLY_CELLS: // disable in readonly sections, but enable in protected cells
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/inc/layfrm.hxx |1 + sw/source/core/layout/findfrm.cxx | 21 + sw/source/core/layout/pagechg.cxx |2 ++ 3 files changed, 24 insertions(+) New commits: commit af0955d600cd3d54d26a87b9ff30e3c402a226dd Author: Michael Stahl AuthorDate: Wed Apr 20 18:48:30 2022 +0200 Commit: Xisco Fauli CommitDate: Thu Apr 21 20:48:52 2022 +0200 sw: layout: fix crash when deleting page with section being formatted This crashes only when calling storeToURL() with writer_pdf_Export? There is a text frame 112, followed by section frame 126, which contains table frame 127. The section frame 126 is being formatted, which in SwFrame::PrepareMake() formats its prev, text frame 112. This does MoveBwd() and in SwContentFrame::MakeAll() formats its next, tab frame 127. This also does MoveBwd() and then there is this really odd condition in SwTabFrame::Paste() where it calls SwFrame::CheckPageDescs() if it *doesn't* have a RES_PAGEDESC item and the page has a non-default page style - this condition remains inexplicable since initial CVS import. Then CheckPageDesc() sees the (next) page is empty and deletes it. So check in sw::IsPageFrameEmpty() that there aren't any sections with IsDeleteForbidden() set. (regression from commit b9ef71476fd70bc13f50ebe80390e0730d1b7afb) Change-Id: I3c64fe40fabffc255c4146a35c678ce6a1cc09c9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133222 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 85aa57359befd7a21b3fdf36f2b362f50495f77c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133150 Reviewed-by: Xisco Fauli diff --git a/sw/source/core/inc/layfrm.hxx b/sw/source/core/inc/layfrm.hxx index 3f73602e6bfa..b0f981477499 100644 --- a/sw/source/core/inc/layfrm.hxx +++ b/sw/source/core/inc/layfrm.hxx @@ -100,6 +100,7 @@ public: SwPrintData const*const pPrintData = nullptr ) const override; const SwFrame *Lower() const { return m_pLower; } SwFrame *Lower() { return m_pLower; } +bool ContainsDeleteForbiddenLayFrame() const; const SwContentFrame *ContainsContent() const; inline SwContentFrame *ContainsContent(); const SwCellFrame *FirstCell() const; diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx index d100e24526a4..3d92f2a9ce0e 100644 --- a/sw/source/core/layout/findfrm.cxx +++ b/sw/source/core/layout/findfrm.cxx @@ -165,6 +165,27 @@ const SwFrame *SwLayoutFrame::ContainsAny( const bool _bInvestigateFootnoteForSe return nullptr; } +bool SwLayoutFrame::ContainsDeleteForbiddenLayFrame() const +{ +if (IsDeleteForbidden()) +{ +return true; +} +for (SwFrame const* pFrame = Lower(); pFrame; pFrame = pFrame->GetNext()) +{ +if (!pFrame->IsLayoutFrame()) +{ +continue; +} +SwLayoutFrame const*const pLay(static_cast(pFrame)); +if (pLay->ContainsDeleteForbiddenLayFrame()) +{ +return true; +} +} +return false; +} + const SwFrame* SwFrame::GetLower() const { return IsLayoutFrame() ? static_cast(this)->Lower() : nullptr; diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index fe84f956a35c..e7a458737d30 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -1024,6 +1024,8 @@ bool IsPageFrameEmpty(SwPageFrame const& rPage) rPage.FindFootnoteCont() || (nullptr != (pBody = rPage.FindBodyCont()) && ( pBody->ContainsContent() || + // check for section frames that are being formatted on the stack + rPage.ContainsDeleteForbiddenLayFrame() || // #i47580# // Do not delete page if there's an empty tabframe // left. I think it might be correct to use ContainsAny()
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/doc/docbm.cxx |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) New commits: commit 93234133477d5f3268ffd441b1e2b7758c809dd4 Author: Michael Stahl AuthorDate: Wed Apr 20 15:04:47 2022 +0200 Commit: Xisco Fauli CommitDate: Thu Apr 21 13:56:48 2022 +0200 tdf#147723 sw_fieldmarkhide: fix crash when copying multiple fieldmarks The problem is the UpdateFramesForAddDeleteRedline() call in makeMark(), this is called in a loop for multiple fieldmarks and when it's called for the first one, of course the other ones aren't in the document yet, so HideIterator::Next() can't find them. But this is only needed when inserting a new fieldmark anyway, so just disable for copying. (regression from commit 92384a813176b964a67bcbeb2fa617c554dbc4a2) Change-Id: Ic1b34d469a553cf7bbf2d1a99edaea900bdd7417 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133215 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 2f726fa41cbd249f2fb30222b29d5f30bce52e6e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133148 Reviewed-by: Xisco Fauli diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx index 35d016c93ac0..e3c87f5ea065 100644 --- a/sw/source/core/doc/docbm.cxx +++ b/sw/source/core/doc/docbm.cxx @@ -687,8 +687,9 @@ namespace sw::mark // no special array for these break; } -if (eType == IDocumentMarkAccess::MarkType::TEXT_FIELDMARK -|| eType == IDocumentMarkAccess::MarkType::DATE_FIELDMARK) +if (eMode == InsertMode::New +&& (eType == IDocumentMarkAccess::MarkType::TEXT_FIELDMARK +|| eType == IDocumentMarkAccess::MarkType::DATE_FIELDMARK)) { // due to SwInsText notifications everything is visible now - tell // layout to hide as appropriate
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/ui/fldui/flddok.cxx | 13 + 1 file changed, 13 insertions(+) New commits: commit 911d7c3336f07a4ea49bb539bf1bd35f11eea2a0 Author: Vasily Melenchuk AuthorDate: Wed Apr 13 20:19:35 2022 +0300 Commit: Thorsten Behrens CommitDate: Sun Apr 17 00:12:30 2022 +0200 tdf#148551: sw ui: set default format value for Insert Field dlg My previous implementation was changing current format selection only for field edit dialog. However it should be initialized also for insert field dlg. It is not always first element. Instead of older confusing approach right now there is a switch to set defaults: it is less confusing IMO. Change-Id: I189339ba66effc49267004a42345a28892cb693c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132980 Tested-by: Jenkins Reviewed-by: Thorsten Behrens (cherry picked from commit b2b821715a3745718a941fa99dda92137c0f0c86) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133045 diff --git a/sw/source/ui/fldui/flddok.cxx b/sw/source/ui/fldui/flddok.cxx index fba96e93cb4a..3bd1b4f5dea1 100644 --- a/sw/source/ui/fldui/flddok.cxx +++ b/sw/source/ui/fldui/flddok.cxx @@ -471,6 +471,19 @@ sal_Int32 SwFieldDokPage::FillFormatLB(SwFieldTypesEnum nTypeId) { m_xFormatLB->select_id(OUString::number(GetCurField()->GetFormat() & ~AF_FIXED)); } +else +{ +// Select default selected value for "Insert" dialog +switch (nTypeId) +{ +case SwFieldTypesEnum::PageNumber: +case SwFieldTypesEnum::DocumentStatistics: +m_xFormatLB->select_text(SwResId(FMT_NUM_PAGEDESC)); +break; +default: +m_xFormatLB->select(0); +} +} FormatHdl(*m_xFormatLB);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/uibase/utlui/content.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit a24a97f7d3ae88d81df3341bfc4296ab4a7237fb Author: Caolán McNamara AuthorDate: Sat Apr 16 12:29:37 2022 +0100 Commit: Adolfo Jayme Barrientos CommitDate: Sat Apr 16 21:52:02 2022 +0200 Resolves: tdf#148197 crash on launching context menu with no row selected Change-Id: I4b05e6013ec4fb8f3968484a59c2dacf1e1c97ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133047 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 7e197dafdd67..4985e4f2075e 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -1934,7 +1934,7 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool) xPop->remove("footnotetracking"); bool bSetSensitiveCollapseAllCategories = false; -if (!m_bIsRoot) +if (!m_bIsRoot && xEntry) { bool bEntry = m_xTreeView->get_iter_first(*xEntry); while (bEntry)
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/text/porfld.cxx | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) New commits: commit 712f54a7047aeb27bc6de96b56cae84e24a01302 Author: Caolán McNamara AuthorDate: Fri Mar 11 21:47:43 2022 + Commit: Michael Stahl CommitDate: Tue Apr 12 12:48:26 2022 +0200 an inconsistent SwTextFormatInfo index, len, text length case seen on loading sw/qa/python/testdocuments/TESTMETA.odt maybe since: commit 2f3684b2289a8c46dc6144064a452cc529400f28 Date: Tue Jul 31 16:00:02 2018 +0200 [API CHANGE] add some more asserts to the string functions but probably an underlying issue since conversion from UniString to OUString Change-Id: If731163fbc5e05b813ccd21df65164fe476cba9a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131361 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx index c366401c9153..6ef492c1b9d5 100644 --- a/sw/source/core/text/porfld.cxx +++ b/sw/source/core/text/porfld.cxx @@ -175,10 +175,18 @@ SwFieldSlot::SwFieldSlot( const SwTextFormatInfo* pNew, const SwFieldPortion *pP pInf->SetFakeLineStart( nIdx > pInf->GetLineStart() ); pInf->SetIdx(TextFrameIndex(0)); } -else if (nIdx < TextFrameIndex(pOldText->getLength())) +else { -sal_Int32 const nFieldLen(pPor->GetFieldLen()); -aText = (*pOldText).replaceAt(sal_Int32(nIdx), nFieldLen, aText); +TextFrameIndex nEnd(pOldText->getLength()); +if (nIdx < nEnd) +{ +sal_Int32 const nFieldLen(pPor->GetFieldLen()); +aText = (*pOldText).replaceAt(sal_Int32(nIdx), nFieldLen, aText); +} +else if (nIdx == nEnd) +aText = *pOldText + aText; +else +SAL_WARN("sw.core", "SwFieldSlot bad SwFieldPortion index."); } pInf->SetText( aText ); }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/ui/dbui/mmoutputtypepage.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 8e467c88d0ba6e70159382676af55b8ef8d65d54 Author: Mike Kaganski AuthorDate: Tue Apr 5 21:50:30 2022 +0300 Commit: Adolfo Jayme Barrientos CommitDate: Mon Apr 11 04:00:49 2022 +0200 Related tdf#148384: do not pause after last email's failure In this case, SwSendMailDialog::AllMailsSent will keep the dialog open anyway, to allow to see the resulting report containing errors. Change-Id: I351a5da01c3ab50677be1d735b261d8e5516cb43 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132588 Tested-by: Jenkins Reviewed-by: Mike Kaganski (cherry picked from commit 6453502fa8d3cc83e066c550d8df98facb1f4471) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132605 Reviewed-by: Adolfo Jayme Barrientos diff --git a/sw/source/ui/dbui/mmoutputtypepage.cxx b/sw/source/ui/dbui/mmoutputtypepage.cxx index 5a7ba198d6b1..dcf17151eca5 100644 --- a/sw/source/ui/dbui/mmoutputtypepage.cxx +++ b/sw/source/ui/dbui/mmoutputtypepage.cxx @@ -463,8 +463,8 @@ void SwSendMailDialog::DocumentSent( uno::Reference< mail::XMailMessage> const & bool bResult, const OUString* pError ) { -//sending should stop on send errors -if(pError && +//sending should stop on send errors, except after last error - it will stop in AllMailsSent +if (pError && m_nSendCount + 1 < m_nExpectedCount && m_pImpl->xMailDispatcher.is() && m_pImpl->xMailDispatcher->isStarted()) { Application::PostUserEvent( LINK( this, SwSendMailDialog,
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/ui/dbui/mmresultdialogs.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 1e50737b57df0b3683063f73d78abee5ea20fb27 Author: Mike Kaganski AuthorDate: Tue Apr 5 09:53:39 2022 +0300 Commit: Adolfo Jayme Barrientos CommitDate: Thu Apr 7 08:22:34 2022 +0200 tdf#148382: Keep first entry selected when address field is not set Regression after commit f1ca64800074530d95e507f93c764a687310b9eb Author Caolán McNamara Date Thu Oct 18 09:52:28 2018 +0100 weld SwMMResultEmailDialog ListBox::SelectEntry did not change previous selection in case the entry was not found (because GetEntryPos would then return a huge "not found" value). OTOH, weld::ComboBox::set_active_text clears selection in that case (because find_text would return -1). The code makes sure to pre-select entry 0 before attempting to select an explicitly configured adderss field name; so keeping that entry selected when no field name is configured is expected. Change-Id: I9c8704261ce19bf06633bd4791d294fb16e76f63 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132562 Tested-by: Mike Kaganski Reviewed-by: Mike Kaganski (cherry picked from commit 304be70b5b082ac4854dadc9e6a7c15075dd28b2) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132597 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos diff --git a/sw/source/ui/dbui/mmresultdialogs.cxx b/sw/source/ui/dbui/mmresultdialogs.cxx index 9fb2a0e98919..e801329df5a6 100644 --- a/sw/source/ui/dbui/mmresultdialogs.cxx +++ b/sw/source/ui/dbui/mmresultdialogs.cxx @@ -444,7 +444,8 @@ void SwMMResultEmailDialog::FillInEmailSettings() Sequence< OUString> aAssignment = xConfigItem->GetColumnAssignment(xConfigItem->GetCurrentDBData()); if (aAssignment.getLength() > MM_PART_E_MAIL && !aAssignment[MM_PART_E_MAIL].isEmpty()) sEMailColumn = aAssignment[MM_PART_E_MAIL]; -m_xMailToLB->set_active_text(sEMailColumn); +if (int pos = m_xMailToLB->find_text(sEMailColumn); pos >= 0) +m_xMailToLB->set_active(pos); // HTML format pre-selected m_xSendAsLB->set_active(3);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/ui/dbui/mmoutputtypepage.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit f02673722dc14c9f1864887d5b159cda0d7ae8c4 Author: Mike Kaganski AuthorDate: Tue Apr 5 10:16:35 2022 +0300 Commit: Xisco Fauli CommitDate: Wed Apr 6 17:40:30 2022 +0200 Related tdf#148384: Don't overwrite task name with result Regression after commit ed200d9f2586b714718aaa7319ea68cf480261ad Author Caolán McNamara Date Fri Jun 28 16:01:00 2019 +0100 weld SwSendMailDialog Change-Id: I397d3263268b94f83f2ccd7137c3de36e91a03a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132564 Tested-by: Mike Kaganski Reviewed-by: Mike Kaganski (cherry picked from commit 64b046b908cdf1204b105f1ebddfc41a5054e884) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132599 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/source/ui/dbui/mmoutputtypepage.cxx b/sw/source/ui/dbui/mmoutputtypepage.cxx index b0c22b9144cf..5a7ba198d6b1 100644 --- a/sw/source/ui/dbui/mmoutputtypepage.cxx +++ b/sw/source/ui/dbui/mmoutputtypepage.cxx @@ -392,7 +392,7 @@ void SwSendMailDialog::IterateMails() m_xStatus->append(); m_xStatus->set_image(m_nSendCount, RID_BMP_FORMULA_CANCEL, 0); m_xStatus->set_text(m_nSendCount, sMessage.replaceFirst("%1", pCurrentMailDescriptor->sEMail), 1); -m_xStatus->set_text(m_nSendCount, m_sFailed, 1); +m_xStatus->set_text(m_nSendCount, m_sFailed, 2); ++m_nSendCount; ++m_nErrorCount; UpdateTransferStatus( ); @@ -476,7 +476,7 @@ void SwSendMailDialog::DocumentSent( uno::Reference< mail::XMailMessage> const & m_xStatus->append(); m_xStatus->set_image(m_nSendCount, sInsertImg, 0); m_xStatus->set_text(m_nSendCount, sMessage.replaceFirst("%1", xMessage->getRecipients()[0]), 1); -m_xStatus->set_text(m_nSendCount, bResult ? m_sCompleted : m_sFailed, 1); +m_xStatus->set_text(m_nSendCount, bResult ? m_sCompleted : m_sFailed, 2); ++m_nSendCount; if(!bResult) ++m_nErrorCount;
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/ui/dbui/mmoutputtypepage.cxx |9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) New commits: commit ac165ad008d820dc102f98569f8bb9b6653b852d Author: Mike Kaganski AuthorDate: Tue Apr 5 10:06:51 2022 +0300 Commit: Michael Stahl CommitDate: Wed Apr 6 10:33:14 2022 +0200 tdf#148384: Really leave mail merge results dialog open upon errors Restructuring mail merge in 5.2 cycle had broken the dialog keeping open when errors happened during sending. Later, in 2017, in commit bfaa6e35ff09a0426d2c3c9c36f069fabc0c9489 Author Alex McMurchy1917 Date Thu Aug 24 14:34:13 2017 +0100 tdf#103919 mailmerge: prevent premature end of emailing SwSendMailDialog::AllMailsSent was changed in attempt to restore that expected behavior, but the condition was incorrect: m_nSendCount == m_nExpectedCount means "all mails processed", not "everything went without errors". So fix this by considering the error count when deciding to close the dialog. Change-Id: I98d61165803deaf0da985167ba0152e6f50f9246 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132563 Tested-by: Mike Kaganski Reviewed-by: Mike Kaganski (cherry picked from commit 2d9f12be1530f2532276a2447102ed2f1f0ecb5b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132598 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/sw/source/ui/dbui/mmoutputtypepage.cxx b/sw/source/ui/dbui/mmoutputtypepage.cxx index e8c8e35bc3dc..b0c22b9144cf 100644 --- a/sw/source/ui/dbui/mmoutputtypepage.cxx +++ b/sw/source/ui/dbui/mmoutputtypepage.cxx @@ -511,12 +511,15 @@ void SwSendMailDialog::UpdateTransferStatus() void SwSendMailDialog::AllMailsSent() { -// Leave open if some kind of error occurred if (m_nSendCount == m_nExpectedCount) { m_xStop->set_sensitive(false); -m_xDialog->hide(); -m_xDialog->response(RET_CANCEL); +// Leave open if some kind of error occurred +if (m_nErrorCount == 0) +{ +m_xDialog->hide(); +m_xDialog->response(RET_CANCEL); +} } }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/uibase/shells/annotsh.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 3d76a0edad1f10f846de59fbd706c2cd395b74c6 Author: Jim Raykowski AuthorDate: Fri Apr 1 22:08:42 2022 -0800 Commit: Michael Stahl CommitDate: Tue Apr 5 10:51:10 2022 +0200 tdf#147925 fix view scrolling back to comment fixes regression caused by fix done for commit 85057da7f19e8e5d6023c16fa07d138e2b519a66 Change-Id: I427513bd920f4e0047c64210feecfeac22ecfd10 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132451 Tested-by: Jenkins Reviewed-by: Jim Raykowski (cherry picked from commit 2d6af46a82c6b9f1565933e8a1175e7a184256ca) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132381 Reviewed-by: Michael Stahl diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx index d7fb25861c92..ca8c0c133ff9 100644 --- a/sw/source/uibase/shells/annotsh.cxx +++ b/sw/source/uibase/shells/annotsh.cxx @@ -134,7 +134,8 @@ SwAnnotationShell::SwAnnotationShell( SwView& r ) SwAnnotationShell::~SwAnnotationShell() { -m_rView.GetWrtShell().Edit(); +if (m_rView.GetWrtShell().CanInsert()) +m_rView.ShowCursor(true); } SfxUndoManager* SwAnnotationShell::GetUndoManager()
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/uibase/dbui/mailmergehelper.cxx |7 --- 1 file changed, 4 insertions(+), 3 deletions(-) New commits: commit 9e889c39feef8bc8da0adc498f9ad7f5bad4542d Author: Mike Kaganski AuthorDate: Sat Apr 2 11:10:22 2022 +0300 Commit: Xisco Fauli CommitDate: Mon Apr 4 13:12:37 2022 +0200 tdf#148338: allow single-letter lowest-level domain The check that required lowest-level domain name to be at least two characters long, was introduced for #i25107# in 2004 in the commit dfcb4aa47b81ebd9affddefda88bf9b451508221 Author Rüdiger Timm Date Mon Sep 20 12:13:22 2004 + INTEGRATION: CWS swmailmerge (1.1.2); FILE ADDED (See also related #i20057# for feature specification.) It didn't mention a rationale behind that check; but obviously, it's unjustified. There are single-letter second-level domain names [1], like 'x.com', and also under many other TLDs. Also the check prevented single-character third-level names like "a.foo.bar", etc. Plus, RFC 5322 (and its predecessors) do not restrict these lengths in 'Addr-Spec Specification' (and RFCs referenced from there). This does not enable dotless domains [2]; if justified, they should be enabled separately. [1] https://en.wikipedia.org/wiki/Single-letter_second-level_domain [2] https://en.wikipedia.org/wiki/Top-level_domain#Dotless_domains Change-Id: I03cc26a90c08b94b9c1f70e0a0f1746192cb7afe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132482 Tested-by: Jenkins Reviewed-by: Mike Kaganski (cherry picked from commit 1ea95f05ee8ec496c628bd11750d23cc012c7fe4) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132382 Reviewed-by: Xisco Fauli diff --git a/sw/source/uibase/dbui/mailmergehelper.cxx b/sw/source/uibase/dbui/mailmergehelper.cxx index 5e802b8a6efc..888a1394fc3a 100644 --- a/sw/source/uibase/dbui/mailmergehelper.cxx +++ b/sw/source/uibase/dbui/mailmergehelper.cxx @@ -73,8 +73,9 @@ OUString CallSaveAsDialog(weld::Window* pParent, OUString& rFilter) /* simple address check: check for '@' -for at least one '.' after the '@' -and for at least two characters before and after the dot +for at least one '.' after the '@', +for at least one character before the dot +and for at least two characters after the dot */ bool CheckMailAddress( const OUString& rMailAddress ) { @@ -82,7 +83,7 @@ bool CheckMailAddress( const OUString& rMailAddress ) if (nPosAt<0 || rMailAddress.lastIndexOf('@')!=nPosAt) return false; const sal_Int32 nPosDot = rMailAddress.indexOf('.', nPosAt); -return !(nPosDot<0 || nPosDot-nPosAt<3 || rMailAddress.getLength()-nPosDot<3); +return !(nPosDot<0 || nPosDot-nPosAt<2 || rMailAddress.getLength()-nPosDot<3); } uno::Reference< mail::XSmtpService > ConnectToSmtpServer(
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/layout/layact.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit e672a8351df5e9fcbdafa34857a16f2bd547ebd6 Author: Caolán McNamara AuthorDate: Fri Mar 25 12:10:32 2022 + Commit: Michael Stahl CommitDate: Tue Mar 29 11:38:54 2022 +0200 forcepoint#89 don't remove page with footnote continuation frame in browse/html/web mode Change-Id: Ic821dd7f2cc1f47305b5fe2ced16d5168aedc0b9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132045 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index 33a990a15a5a..da6e7c938f6b 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -295,7 +295,8 @@ bool SwLayAction::RemoveEmptyBrowserPages() do { if ( (pPage->GetSortedObjs() && pPage->GetSortedObjs()->size()) || - pPage->ContainsContent() ) + pPage->ContainsContent() || + pPage->FindFootnoteCont() ) pPage = static_cast(pPage->GetNext()); else {
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/filter/ww8/rtfattributeoutput.cxx |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) New commits: commit 0c1894acda828c02c76c97c25149187cb04ae91f Author: Mark Hung AuthorDate: Sat Mar 19 21:18:54 2022 +0800 Commit: Xisco Fauli CommitDate: Mon Mar 28 20:53:46 2022 +0200 tdf#141671 fix destroyed pargraph style in exported RTF in MSO. Do not call MoveCharacterProperties() in RtfAttributeOutput ::EndParagraphProperties(). RtfAttributeOutput::ParagraphStyle() has emited run associated properties defined in paragraph style. Calling MoveCharacterProperties() again overwrites them. As this bug is only visible in MS Word, no unit test case is added. Change-Id: I6e5bfd12e8afa7dc286ca54448c1ff022aade31d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131848 Tested-by: Jenkins Reviewed-by: Mark Hung (cherry picked from commit 882045b934a3416cc48da2c4e30648892a419577) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132175 Reviewed-by: Xisco Fauli diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index cc7d61c80d75..ca43274da2c7 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -384,7 +384,9 @@ void RtfAttributeOutput::EndParagraphProperties( const SwRedlineData* /*pRedlineParagraphMarkerDeleted*/, const SwRedlineData* /*pRedlineParagraphMarkerInserted*/) { -const OString aProperties = MoveCharacterProperties(true); +// Do not call MoveCharacterProperties(), +// Otherwise associate properties in the paragraph style are ruined. +const OString aProperties = m_aStyles.makeStringAndClear(); m_rExport.Strm().WriteOString(aProperties); }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/text/itratr.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 88df06e5268ddfe3e0961d8fdbf4aaad1bfa3674 Author: Caolán McNamara AuthorDate: Thu Mar 24 14:32:22 2022 + Commit: Xisco Fauli CommitDate: Mon Mar 28 10:18:13 2022 +0200 forcepoint#86 RES_TXTATR_UNKNOWN_CONTAINER item put at invalid index RES_CHRATR_BEGIN is 1, presumably RES_TXTATR_UNKNOWN_CONTAINER should be stored in the last index Change-Id: Id37fff41cbbccbc26fe5ccce6027014af7362729 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132039 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx index f76f15254e9f..95f7929a0e14 100644 --- a/sw/source/core/text/itratr.cxx +++ b/sw/source/core/text/itratr.cxx @@ -444,7 +444,7 @@ static void InsertCharAttrs(SfxPoolItem const** pAttrs, SfxItemSet const& rItems } else if (nWhich == RES_TXTATR_UNKNOWN_CONTAINER) { -pAttrs[RES_CHRATR_END] = pItem; +pAttrs[RES_CHRATR_END - RES_CHRATR_BEGIN] = pItem; } } }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/ui/config/optpage.cxx |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) New commits: commit cd39085292b3c43d6e437957109fde63fbcb15d4 Author: Noel Grandin AuthorDate: Wed Mar 23 16:49:05 2022 +0200 Commit: Adolfo Jayme Barrientos CommitDate: Thu Mar 24 04:21:56 2022 +0100 tdf#147641 default font size for captions always reset regression from commit 65d2d2647ead42e5bbb7800f14c047f383fe450b Author: Noel Grandin Date: Thu Nov 8 16:10:51 2018 +0200 loplugin:singlevalfields in sw where I incorrectly reduced a boolean expression Change-Id: I7f3b4552dc27dcd5e118233b5c0ca75e4eb06fc5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131980 Tested-by: Jenkins Reviewed-by: Noel Grandin (cherry picked from commit 323ff2749b6be5f6ef98c6250afce4fa89e3aa1c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131994 Reviewed-by: Adolfo Jayme Barrientos diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx index 30a3c4cac6e4..7d0b0d8ce393 100644 --- a/sw/source/ui/config/optpage.cxx +++ b/sw/source/ui/config/optpage.cxx @@ -607,9 +607,9 @@ bool SwStdFontTabPage::FillItemSet( SfxItemSet* ) bool bStandardHeightChanged = m_xStandardHeightLB->get_value_changed_from_saved(); bool bTitleHeightChanged = m_xTitleHeightLB->get_value_changed_from_saved(); -bool bListHeightChanged = m_xListHeightLB->get_value_changed_from_saved() && !m_bListHeightDefault; -bool bLabelHeightChanged = m_xLabelHeightLB->get_value_changed_from_saved() && !m_bLabelHeightDefault; -bool bIndexHeightChanged = m_xIndexHeightLB->get_value_changed_from_saved() && !m_bIndexHeightDefault; +bool bListHeightChanged = m_xListHeightLB->get_value_changed_from_saved(); +bool bLabelHeightChanged = m_xLabelHeightLB->get_value_changed_from_saved(); +bool bIndexHeightChanged = m_xIndexHeightLB->get_value_changed_from_saved(); m_pFontConfig->SetFontStandard(sStandard, m_nFontGroup); m_pFontConfig->SetFontOutline(sTitle, m_nFontGroup);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/uibase/shells/annotsh.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 50f231d061e614f1127894a58cbeae8d9486f2ec Author: Xisco Fauli AuthorDate: Mon Mar 14 11:26:52 2022 +0100 Commit: Adolfo Jayme Barrientos CommitDate: Mon Mar 14 13:57:44 2022 +0100 sw: fix bug id in comment Change-Id: I510a48765b2ad286ddc194f6ca1a96211bcb05f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131528 Tested-by: Jenkins Reviewed-by: Xisco Fauli (cherry picked from commit 01ec377c04c8dfaebdeb1002fd2d9a0e8f135b8c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131475 Tested-by: Adolfo Jayme Barrientos Reviewed-by: Adolfo Jayme Barrientos diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx index 4647656a0226..d7fb25861c92 100644 --- a/sw/source/uibase/shells/annotsh.cxx +++ b/sw/source/uibase/shells/annotsh.cxx @@ -1505,7 +1505,7 @@ void SwAnnotationShell::ExecUndo(SfxRequest ) SwWrtShell = m_rView.GetWrtShell(); SwUndoId nUndoId(SwUndoId::EMPTY); -// tdf#147929 get these before "undo" which may delete this SwAnnotationShell +// tdf#147928 get these before "undo" which may delete this SwAnnotationShell SwPostItMgr* pPostItMgr = m_rView.GetPostItMgr(); SfxBindings& rBindings = m_rView.GetViewFrame()->GetBindings();
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/filter/ww8/sprmids.hxx |1 + sw/source/filter/ww8/ww8par2.cxx |8 sw/source/filter/ww8/ww8scan.cxx | 21 +++-- 3 files changed, 8 insertions(+), 22 deletions(-) New commits: commit 475be6f24ec3190ed3476319371efc815cfbe2dd Author: Caolán McNamara AuthorDate: Fri Mar 11 17:03:41 2022 + Commit: Michael Stahl CommitDate: Mon Mar 14 12:50:06 2022 +0100 ofz#45488 get WW8+ calculation of sprmTDefTable length right we have the calculation correct for WW7- which is what the special L_VAR2 case is for, but for the WW8+ variant that wasn't understood. Change-Id: Ic9dde07223386df796f57dd1f33e69d16d3abf21 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131395 Tested-by: Jenkins Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara (cherry picked from commit 13f2e8ab8d1d8b33f3208f82d21d61250f81057d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131360 Reviewed-by: Michael Stahl diff --git a/sw/source/filter/ww8/sprmids.hxx b/sw/source/filter/ww8/sprmids.hxx index ac1d33cf8a80..1d023c3424a9 100644 --- a/sw/source/filter/ww8/sprmids.hxx +++ b/sw/source/filter/ww8/sprmids.hxx @@ -66,6 +66,7 @@ const sal_uInt16 LN_SGprfIhdt = 0x3014; const sal_uInt16 LN_SBCustomize = 0x301e; const sal_uInt16 LN_SPropRMark = 0xd227; const sal_uInt16 LN_SFFacingCol = 0x3229; +const sal_uInt16 LN_TDefTable = 0xd608; const sal_uInt16 LN_TDefTable10 = 0xd606; const sal_uInt16 LN_THTMLProps = 0x740c; const sal_uInt16 LN_TSetBrc10 = 0xd626; diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index 52ad77c6c6ec..3f3c3adfb74f 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -1141,14 +1141,6 @@ WW8TabBandDesc::WW8TabBandDesc( WW8TabBandDesc const & rBand ) // ReadDef reads the cell position and the borders of a band void WW8TabBandDesc::ReadDef(bool bVer67, const sal_uInt8* pS, short nLen) { -if (!bVer67) -{ -//the ww8 version of this is unusual in masquerading as a srpm with a -//single byte len arg while it really has a word len arg, after this -//increment nLen is correct to describe the remaining amount of data -pS++; -} - --nLen; //reduce len by expected nCols arg if (nLen < 0) return; diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index cf81cc434560..71c424bf4546 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -704,7 +704,7 @@ const wwSprmSearcher *wwSprmParser::GetWW8SprmSearcher() {NS_sprm::LN_TDefTable10, { 0, L_VAR} }, // "sprmTDefTable10" tap.rgdxaCenter, // tap.rgtc;complex InfoRow(), // tap.dyaRowHeight;dya;word; -InfoRow(), // tap.rgtc;complex +{NS_sprm::LN_TDefTable, { 0, L_VAR2} }, // "sprmTDefTable" tap.rgtc;complex InfoRow(), // tap.rgshd;complex InfoRow(), // tap.tlp;TLP;4 bytes; InfoRow(), // ;;; @@ -8413,18 +8413,6 @@ sal_uInt16 wwSprmParser::GetSprmTailLen(sal_uInt16 nId, const sal_uInt8* pSprm, nL = 2 + 4 * nDel + 3 * nIns; } break; -case 0xD608: -{ -sal_uInt8 nIndex = 1 + mnDelta; -if (nIndex + 1 >= nRemLen) -{ -SAL_WARN("sw.ww8", "sprm longer than remaining bytes, doc or parser is wrong"); -nL = 0; -} -else -nL = SVBT16ToUInt16([nIndex]); -break; -} default: switch (aSprm.nVari) { @@ -8448,8 +8436,13 @@ sal_uInt16 wwSprmParser::GetSprmTailLen(sal_uInt16 nId, const sal_uInt8* pSprm, nCount = 0; } else +{ nCount = SVBT16ToUInt16([nIndex]); -nL = static_cast< sal_uInt16 >(nCount + aSprm.nLen - 1); +SAL_WARN_IF(nCount < 1, "sw.ww8", "length should have been at least 1"); +if (nCount) +--nCount; +} +nL = static_cast(nCount + aSprm.nLen); break; } default:
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/edit/autofmt.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit bcd3275a8c2088308970e012cf39c4753f5e582a Author: Noel Grandin AuthorDate: Sun Mar 13 19:15:20 2022 +0200 Commit: Noel Grandin CommitDate: Mon Mar 14 08:27:23 2022 +0100 tdf#147961 Crash Typing "++" and press Enter (AutoCorrect Create Table) regression from commit 7cd5b35caa8d4fa9d0ba2b2c6ce4b88726ed2be6 Author: Noel Grandin Date: Fri Sep 24 13:21:35 2021 +0200 return SwCursor from IShellCursorSupplier Change-Id: I6a4e3f90653dc96a91091be1372f27c6303ba346 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131505 Tested-by: Jenkins Reviewed-by: Noel Grandin (cherry picked from commit 7c7f00a89a675dad541d32ea60695a7b11210102) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131470 diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx index 6df314ae55c2..5b41af36d30c 100644 --- a/sw/source/core/edit/autofmt.cxx +++ b/sw/source/core/edit/autofmt.cxx @@ -2374,7 +2374,7 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFormatFlags const & { //JP 30.09.96: DoTable() builds on PopCursor and MoveCursor after AutoFormat! pEdShell->Pop(SwCursorShell::PopMode::DeleteCurrent); -*pEdShell->GetCursor() = static_cast(m_aDelPam); +static_cast(*pEdShell->GetCursor()) = m_aDelPam; pEdShell->Push(); eStat = IS_END;
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/uibase/shells/annotsh.cxx | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) New commits: commit 15fb24db540dc29883346d7e8e37d96e4fe8dfb1 Author: Caolán McNamara AuthorDate: Sat Mar 12 20:24:45 2022 + Commit: Adolfo Jayme Barrientos CommitDate: Sun Mar 13 12:50:00 2022 +0100 tdf#147928 "undo" may delete the current SwAnnotationShell Change-Id: I69fb7e65e28743aa73e943e02d5029654b5543cb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131366 Reviewed-by: Adolfo Jayme Barrientos Tested-by: Adolfo Jayme Barrientos diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx index b05fedf7c5ae..4647656a0226 100644 --- a/sw/source/uibase/shells/annotsh.cxx +++ b/sw/source/uibase/shells/annotsh.cxx @@ -1505,8 +1505,12 @@ void SwAnnotationShell::ExecUndo(SfxRequest ) SwWrtShell = m_rView.GetWrtShell(); SwUndoId nUndoId(SwUndoId::EMPTY); -tools::Long aOldHeight = m_rView.GetPostItMgr()->HasActiveSidebarWin() - ? m_rView.GetPostItMgr()->GetActiveSidebarWin()->GetPostItTextHeight() +// tdf#147929 get these before "undo" which may delete this SwAnnotationShell +SwPostItMgr* pPostItMgr = m_rView.GetPostItMgr(); +SfxBindings& rBindings = m_rView.GetViewFrame()->GetBindings(); + +tools::Long aOldHeight = pPostItMgr->HasActiveSidebarWin() + ? pPostItMgr->GetActiveSidebarWin()->GetPostItTextHeight() : 0; sal_uInt16 nId = rReq.GetSlot(); @@ -1579,10 +1583,10 @@ void SwAnnotationShell::ExecUndo(SfxRequest ) } } -m_rView.GetViewFrame()->GetBindings().InvalidateAll(false); +rBindings.InvalidateAll(false); -if (m_rView.GetPostItMgr()->HasActiveSidebarWin()) - m_rView.GetPostItMgr()->GetActiveSidebarWin()->ResizeIfNecessary(aOldHeight,m_rView.GetPostItMgr()->GetActiveSidebarWin()->GetPostItTextHeight()); +if (pPostItMgr->HasActiveSidebarWin()) +pPostItMgr->GetActiveSidebarWin()->ResizeIfNecessary(aOldHeight, pPostItMgr->GetActiveSidebarWin()->GetPostItTextHeight()); } void SwAnnotationShell::StateUndo(SfxItemSet )
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/uibase/docvw/edtwin.cxx | 18 ++ 1 file changed, 6 insertions(+), 12 deletions(-) New commits: commit 08690fe5c4e5028ccaebc80145be650caf62ea76 Author: Michael Stahl AuthorDate: Fri Mar 4 20:05:03 2022 +0100 Commit: Thorsten Behrens CommitDate: Sat Mar 12 11:17:45 2022 +0100 sw_redlinehide: fix crashes in SwEditWin Surrounding functions These foolish functions write into the shell cursor! But the shell cursor's node isn't necessarily the same as before with merged paragraphs, so could crash with out of bounds indexes. Better use Push()/Pop(). Change-Id: I4fd0e2aa915b6c5448772a2c766848607bbf5aaa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131041 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit aac9bd235e65b27faf63e64bba3ecd94837381d6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131127 Reviewed-by: Thorsten Behrens diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 59af6a581a6b..31f4c69e162e 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -6435,9 +6435,7 @@ OUString SwEditWin::GetSurroundingText() const { bool bUnLockView = !rSh.IsViewLocked(); rSh.LockView(true); - -SwPosition *pPos = rSh.GetCursor()->GetPoint(); -const sal_Int32 nPos = pPos->nContent.GetIndex(); +rSh.Push(); // get the sentence around the cursor rSh.HideCursor(); @@ -6446,8 +6444,7 @@ OUString SwEditWin::GetSurroundingText() const rSh.GoEndSentence(); rSh.GetSelectedText( sReturn, ParaBreakType::ToOnlyCR ); -pPos->nContent = nPos; -rSh.ClearMark(); +rSh.Pop(SwCursorShell::PopMode::DeleteCurrent); rSh.HideCursor(); if (bUnLockView) @@ -6479,13 +6476,13 @@ Selection SwEditWin::GetSurroundingTextSelection() const // around the visible cursor. SwPosition *pPos = rSh.GetCursor()->GetPoint(); const sal_Int32 nPos = pPos->nContent.GetIndex(); +rSh.Push(); rSh.HideCursor(); rSh.GoStartSentence(); const sal_Int32 nStartPos = rSh.GetCursor()->GetPoint()->nContent.GetIndex(); -pPos->nContent = nPos; -rSh.ClearMark(); +rSh.Pop(SwCursorShell::PopMode::DeleteCurrent); rSh.ShowCursor(); if (bUnLockView) @@ -6507,14 +6504,11 @@ bool SwEditWin::DeleteSurroundingText(const Selection& rSelection) // rSelection is relative to the start of the sentence, so find that and // adjust the range by it -SwPosition *pPos = rSh.GetCursor()->GetPoint(); -const sal_Int32 nPos = pPos->nContent.GetIndex(); - +rSh.Push(); rSh.HideCursor(); rSh.GoStartSentence(); const sal_Int32 nStartPos = rSh.GetCursor()->GetPoint()->nContent.GetIndex(); -pPos->nContent = nPos; -rSh.ClearMark(); +rSh.Pop(SwCursorShell::PopMode::DeleteCurrent); rSh.ShowCursor(); if (rSh.SelectText(nStartPos + rSelection.Min(), nStartPos + rSelection.Max()))
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/doc/DocumentRedlineManager.cxx |9 + 1 file changed, 5 insertions(+), 4 deletions(-) New commits: commit 9ba141c6d7ff112c6eb7b98f5a7b505d91b04508 Author: Michael Stahl AuthorDate: Tue Mar 8 13:48:03 2022 +0100 Commit: Thorsten Behrens CommitDate: Sat Mar 12 11:16:50 2022 +0100 sw: fix merging of format redlines in AppendRedline() This can cause: soffice.bin: sw/source/core/undo/undobj.cxx:1486: static void SwUndo::SetSaveData(SwDoc&, SwRedlineSaveDatas&): Assertion `rSData.empty() || rSData[0].m_bRedlineMoved || (rSData[0].m_nRedlineCount == rDoc.getIDocumentRedlineAccess().GetRedlineTable().size())' failed. When one character in middle of Format redline is deleted, then Undo. The condition is quite odd and apparently from initial CVS import; try to copy condition for merging Insert redlines instead. Change-Id: Ib56e12914269b878c16813b9e95b2f0df3330bbe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131208 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 53560aa06462f1cf04d69acafed20da971bc5c27) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131196 Reviewed-by: Thorsten Behrens diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx index 2c2f4a1b080b..c2ddb046ef8b 100644 --- a/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/sw/source/core/doc/DocumentRedlineManager.cxx @@ -2156,8 +2156,8 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall case SwComparePosition::CollideEnd: if( pRedl->IsOwnRedline( *pNewRedl ) && -pRedl->CanCombine( *pNewRedl ) && n && -*maRedlineTable[ n-1 ]->End() < *pStt ) +pRedl->CanCombine( *pNewRedl ) && +(n == 0 || *maRedlineTable[ n-1 ]->End() < *pStt)) { // If that's the case we can merge it, meaning // the new one covers this well @@ -2169,8 +2169,9 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall case SwComparePosition::CollideStart: if( pRedl->IsOwnRedline( *pNewRedl ) && pRedl->CanCombine( *pNewRedl ) && -n+1 < maRedlineTable.size() && -*maRedlineTable[ n+1 ]->Start() < *pEnd ) +(n+1 >= maRedlineTable.size() || + (*maRedlineTable[ n+1 ]->Start() >= *pEnd && + *maRedlineTable[ n+1 ]->Start() != *pREnd))) { // If that's the case we can merge it, meaning // the new one covers this well
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/edit/edlingu.cxx | 19 +++ 1 file changed, 15 insertions(+), 4 deletions(-) New commits: commit c29caa41f826e0f3f7850d6276407a937c512957 Author: Michael Stahl AuthorDate: Tue Mar 8 13:58:28 2022 +0100 Commit: Thorsten Behrens CommitDate: Sat Mar 12 11:16:27 2022 +0100 tdf#147416 sw_redlinehide: fix spell checking popup The problem is that SwEditShell::GetCorrection() uses the SwTextNode text without filtering redlines. Using ExpandMode::ReplaceMode should work as it will replace CH_TXTATR_INWORD with nothing and CH_TXTATR_BREAKWORD with ZWSP. Unfortunately there isn't yet a mode that can handle fieldmarks as they are displayed in the layout. Change-Id: Ia243d90309fdd7b6ca159c5df2f4d98725400c5c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131210 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit e07b9c5142af838648a4d03a0bdce76612cf7535) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131198 Reviewed-by: Thorsten Behrens diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx index a393afdb225c..03e230f11d2f 100644 --- a/sw/source/core/edit/edlingu.cxx +++ b/sw/source/core/edit/edlingu.cxx @@ -839,11 +839,16 @@ void SwEditShell::HandleCorrectionError(const OUString& aText, SwPosition aPos, SwRect& rSelectRect) { // save the start and end positions of the line and the starting point +SwNode const& rNode(GetCursor()->GetPoint()->nNode.GetNode()); Push(); LeftMargin(); -const sal_Int32 nLineStart = GetCursor()->GetPoint()->nContent.GetIndex(); +const sal_Int32 nLineStart = == ()->GetPoint()->nNode.GetNode() +? GetCursor()->GetPoint()->nContent.GetIndex() +: 0; RightMargin(); -const sal_Int32 nLineEnd = GetCursor()->GetPoint()->nContent.GetIndex(); +const sal_Int32 nLineEnd = == ()->GetPoint()->nNode.GetNode() +? GetCursor()->GetPoint()->nContent.GetIndex() +: rNode.GetTextNode()->Len(); Pop(PopMode::DeleteCurrent); // make sure the selection build later from the data below does @@ -926,8 +931,14 @@ uno::Reference< XSpellAlternatives > if (pWrong->InWrongWord(nBegin, nLen) && !pNode->IsSymbolAt(nBegin)) { const OUString aText(pNode->GetText().copy(nBegin, nLen)); -OUString aWord = aText.replaceAll(OUStringChar(CH_TXTATR_BREAKWORD), "") - .replaceAll(OUStringChar(CH_TXTATR_INWORD), ""); +// TODO: this doesn't handle fieldmarks properly +ModelToViewHelper const aConversionMap(*pNode, GetLayout(), +ExpandMode::ExpandFields | ExpandMode::ExpandFootnote | ExpandMode::ReplaceMode +| (GetLayout()->IsHideRedlines() ? ExpandMode::HideDeletions : ExpandMode(0)) +| (GetViewOptions()->IsShowHiddenChar() ? ExpandMode(0) : ExpandMode::HideInvisible)); +auto const nBeginView(aConversionMap.ConvertToViewPosition(nBegin)); +OUString const aWord(aConversionMap.getViewText().copy(nBeginView, +aConversionMap.ConvertToViewPosition(nBegin+nLen) - nBeginView)); uno::Reference< XSpellChecker1 > xSpell( ::GetSpellChecker() ); if( xSpell.is() )
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/uibase/uiview/viewling.cxx |9 - 1 file changed, 8 insertions(+), 1 deletion(-) New commits: commit 23a6c041560f583fe62ff2669eecd81d37689f39 Author: Michael Stahl AuthorDate: Tue Mar 8 13:54:08 2022 +0100 Commit: Thorsten Behrens CommitDate: Sat Mar 12 11:15:54 2022 +0100 sw_redlinehide: get text from shell, not node in ExecSpellPopup() Change-Id: I0160c4927a2f5e71f5025c2162a103f67ed03723 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131209 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit d814941b31b4f9cc8b6e9bd4ddc5188015529707) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131197 Reviewed-by: Thorsten Behrens diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx index ba3f2df868bf..ad7e9e697d04 100644 --- a/sw/source/uibase/uiview/viewling.cxx +++ b/sw/source/uibase/uiview/viewling.cxx @@ -692,7 +692,14 @@ bool SwView::ExecSpellPopup(const Point& rPt) // get paragraph text OUString aParaText; if (pNode) -aParaText = pNode->GetText();// this may include hidden text but that should be Ok +{ +pCursorShell->Push(); +pCursorShell->MovePara(GoCurrPara, fnParaStart); +pCursorShell->SetMark(); +pCursorShell->MovePara(GoCurrPara, fnParaEnd); +aParaText = pCursorShell->GetSelText(); +pCursorShell->Pop(SwCursorShell::PopMode::DeleteCurrent); +} else { OSL_FAIL("text node expected but not found" );
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/layout/ftnfrm.cxx | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) New commits: commit 3d8533cb894614394f1ecf05b3d6dc60f3bf6dd6 Author: Michael Stahl AuthorDate: Tue Mar 8 17:36:41 2022 +0100 Commit: Thorsten Behrens CommitDate: Sat Mar 12 11:15:35 2022 +0100 tdf#139687 sw: invalidate text frame in footnote when moving it The problem (which only reproduces here on copy/paste with SAL_USE_VCLPLUGIN=kf5, not with gtk3) is that on SwTextFrame 2638 in a footnote on page 19 containing "Saeed, 100–101." there should be a top margin of 0 but it's actually 144. The footnote was initially created on a previous page with another footnote with SwTextFrame 2635 before it, that's how it got this top margin. Invalidate the print area in SwFootnoteFrame::Paste(), which is called when the footnote is moved to a different container. (somehow regression from commit 723728cd358693b8f4bc9d913541aa4479f2bd48) Change-Id: I7346fd03fccad3eddccbbcd56c4b50127a337b24 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131217 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 86081afc3021fa0ae6c2b32d11b4b20cc8a190a3) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131201 Reviewed-by: Thorsten Behrens diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx index 1a11bbb5dfdf..c41b315ad685 100644 --- a/sw/source/core/layout/ftnfrm.cxx +++ b/sw/source/core/layout/ftnfrm.cxx @@ -605,10 +605,20 @@ void SwFootnoteFrame::Paste( SwFrame* pParent, SwFrame* pSibling ) if( aRectFnSet.GetWidth(getFrameArea())!=aRectFnSet.GetWidth(pParent->getFramePrintArea()) ) InvalidateSize_(); InvalidatePos_(); +if (SwFrame *const pContent = ContainsContent()) +{ // tdf#139687 invalidate possibly stale top margin (computed from previous frame) +pContent->InvalidatePrt_(); +} SwPageFrame *pPage = FindPageFrame(); InvalidatePage( pPage ); -if ( GetNext() ) -GetNext()->InvalidatePos_(); +if (SwFootnoteFrame *const pNext = static_cast(GetNext())) +{ +pNext->InvalidatePos_(); +if (SwFrame *const pContent = pNext->ContainsContent()) +{ // tdf#139687 invalidate possibly stale top margin (computed from previous frame) +pContent->InvalidatePrt_(); +} +} if( aRectFnSet.GetHeight(getFrameArea()) ) pParent->Grow( aRectFnSet.GetHeight(getFrameArea()) );
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/ui/index/cnttab.cxx |8 ++-- sw/source/uibase/inc/swuicnttab.hxx |1 + 2 files changed, 7 insertions(+), 2 deletions(-) New commits: commit d9f852786aa3d54eb201fae674990bec8a10ed5e Author: Caolán McNamara AuthorDate: Mon Mar 7 11:30:40 2022 + Commit: Adolfo Jayme Barrientos CommitDate: Mon Mar 7 15:00:28 2022 +0100 tdf#146562 let toc default size and pos on first launch so only use resize_to_request when the user toggles the checkbutton Change-Id: Ib5fdac56da0441fae482bc9f2120d1d3ce173fe8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131023 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index 80d3bb3d27ca..c57f47278f2f 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -276,7 +276,7 @@ SwMultiTOXTabDialog::SwMultiTOXTabDialog(weld::Widget* pParent, const SfxItemSet m_xShowExampleCB->connect_toggled(LINK(this, SwMultiTOXTabDialog, ShowPreviewHdl)); m_xShowExampleCB->set_active(SW_MOD()->GetModuleConfig()->IsShowIndexPreview()); -ShowPreviewHdl(*m_xShowExampleCB); +ShowPreview(); } SwMultiTOXTabDialog::~SwMultiTOXTabDialog() @@ -408,7 +408,7 @@ std::unique_ptr SwMultiTOXTabDialog::CreateTOXDescFromTOXBase( return pDesc; } -IMPL_LINK_NOARG(SwMultiTOXTabDialog, ShowPreviewHdl, weld::Toggleable&, void) +void SwMultiTOXTabDialog::ShowPreview() { if (m_xShowExampleCB->get_active()) { @@ -448,7 +448,11 @@ IMPL_LINK_NOARG(SwMultiTOXTabDialog, ShowPreviewHdl, weld::Toggleable&, void) else m_xExampleFrame->Hide(); } +} +IMPL_LINK_NOARG(SwMultiTOXTabDialog, ShowPreviewHdl, weld::Toggleable&, void) +{ +ShowPreview(); m_xDialog->resize_to_request(); } diff --git a/sw/source/uibase/inc/swuicnttab.hxx b/sw/source/uibase/inc/swuicnttab.hxx index 8d3fc168da2f..11a34b91ff5e 100644 --- a/sw/source/uibase/inc/swuicnttab.hxx +++ b/sw/source/uibase/inc/swuicnttab.hxx @@ -82,6 +82,7 @@ class SwMultiTOXTabDialog final : public SfxTabDialogController virtual short Ok() override; std::unique_ptr CreateTOXDescFromTOXBase(const SwTOXBase*pCurTOX); +void ShowPreview(); DECL_LINK(CreateExample_Hdl, SwOneExampleFrame&, void); DECL_LINK(ShowPreviewHdl, weld::Toggleable&, void);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/inc/ftnboss.hxx |1 + sw/source/core/layout/ftnfrm.cxx |1 + 2 files changed, 2 insertions(+) New commits: commit c838925bb414f94a63abc0fa0073c5cd71a7972d Author: Caolán McNamara AuthorDate: Wed Mar 2 20:16:37 2022 + Commit: Xisco Fauli CommitDate: Thu Mar 3 17:15:31 2022 +0100 add a SwFrameDeleteGuard to SwSaveFootnoteHeight Change-Id: Ic4f0bb7c26cc021119b09682075a05d5207b48a7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130897 Tested-by: Jenkins Reviewed-by: Stephan Bergmann (cherry picked from commit ac605821ecf3ea263d4812ebec352314a2dbff42) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130852 Reviewed-by: Michael Stahl diff --git a/sw/source/core/inc/ftnboss.hxx b/sw/source/core/inc/ftnboss.hxx index 3ee7859bf8f3..e60ff97de1a9 100644 --- a/sw/source/core/inc/ftnboss.hxx +++ b/sw/source/core/inc/ftnboss.hxx @@ -31,6 +31,7 @@ class SwTextFootnote; // Restoration of the old value in DTor. Implementation in ftnfrm.cxx class SwSaveFootnoteHeight { +SwFrameDeleteGuard aGuard; SwFootnoteBossFrame *pBoss; const SwTwips nOldHeight; SwTwips nNewHeight; diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx index ce7bc0b7c073..1a11bbb5dfdf 100644 --- a/sw/source/core/layout/ftnfrm.cxx +++ b/sw/source/core/layout/ftnfrm.cxx @@ -2865,6 +2865,7 @@ bool SwContentFrame::MoveFootnoteCntFwd( bool bMakePage, SwFootnoteBossFrame *pO } SwSaveFootnoteHeight::SwSaveFootnoteHeight( SwFootnoteBossFrame *pBs, const SwTwips nDeadLine ) : +aGuard(pBs), pBoss( pBs ), nOldHeight( pBs->GetMaxFootnoteHeight() ) {
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/layout/tabfrm.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit 8dff1bd93a2f1db463002fc660f98388f69484a0 Author: Caolán McNamara AuthorDate: Tue Mar 1 11:45:23 2022 + Commit: Adolfo Jayme Barrientos CommitDate: Wed Mar 2 06:30:39 2022 +0100 protect frame from triggering deleting itself LIBREOFFICE-N4LA0OHZ Change-Id: I0d24277665a317f047b286fe0f0878b3814ded65 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130788 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index f0ad11a0653a..7786f3aec4fc 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -2114,6 +2114,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) } SwFootnoteBossFrame *pOldBoss = bFootnotesInDoc ? FindFootnoteBossFrame( true ) : nullptr; bool bReformat; +SwFrameDeleteGuard g(this); if ( MoveBwd( bReformat ) ) { aRectFnSet.Refresh(this);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/ui/misc/outline.cxx | 12 1 file changed, 8 insertions(+), 4 deletions(-) New commits: commit a0ad72cb1404544ae0a3c3062431ed22edb7fa21 Author: Heiko Tietze AuthorDate: Fri Feb 18 11:29:26 2022 +0100 Commit: Adolfo Jayme Barrientos CommitDate: Wed Mar 2 06:29:50 2022 +0100 Resolves tdf#137381 - Use app colors on chapter numbering preview Change-Id: I8e5edec1ad6f4b6f44855014ce91a642efbd75f9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130133 Tested-by: Jenkins Reviewed-by: Heiko Tietze (cherry picked from commit 87aeb7be943921942f791cd182122e8e073ce804) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130154 Reviewed-by: Adolfo Jayme Barrientos diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx index c7fa599c9bfa..3c1345f308ae 100644 --- a/sw/source/ui/misc/outline.cxx +++ b/sw/source/ui/misc/outline.cxx @@ -42,6 +42,7 @@ #include #include #include +#include #include @@ -875,8 +876,8 @@ void NumberingPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Re pVDev->SetOutputSize(aSize); // #101524# OJ - pVDev->SetFillColor(rRenderContext.GetSettings().GetStyleSettings().GetWindowColor()); - pVDev->SetLineColor(rRenderContext.GetSettings().GetStyleSettings().GetButtonTextColor()); +pVDev->SetFillColor(SwViewOption::GetDocColor()); +pVDev->SetLineColor(SwViewOption::GetDocBoundariesColor()); pVDev->DrawRect(tools::Rectangle(Point(0,0), aSize)); if (pActNum) @@ -897,8 +898,11 @@ void NumberingPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Re tools::Long nYStart = 4; aStdFont = OutputDevice::GetDefaultFont(DefaultFontType::UI_SANS, GetAppLanguage(), GetDefaultFontFlags::OnlyOne, ); -// #101524# OJ -aStdFont.SetColor(SwViewOption::GetFontColor()); + +if (svtools::ColorConfig().GetColorValue(svtools::FONTCOLOR, false).nColor == COL_AUTO) +aStdFont.SetColor( SwViewOption::GetDocColor().IsDark() ? COL_WHITE : COL_BLACK ); +else +aStdFont.SetColor( SwViewOption::GetFontColor() ); const tools::Long nFontHeight = nYStep * ( bPosition ? 15 : 6 ) / 10; aStdFont.SetFontSize(Size( 0, nFontHeight ));
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/doc/DocumentStylePoolManager.cxx |9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) New commits: commit a25c88daab20f1b7fc82b54171f260c4f20b9ba0 Author: Heiko Tietze AuthorDate: Thu Feb 24 10:11:18 2022 +0100 Commit: Michael Stahl CommitDate: Fri Feb 25 11:44:07 2022 +0100 Resolves tdf#142423 - Use absolute values for Writer styles Avoid rounding trouble when converting to DOCX Change-Id: Ie30f66671654b64b0b2596b14dc89d6f9befa8d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130475 Tested-by: Jenkins Reviewed-by: Heiko Tietze (cherry picked from commit 3c94c670fa3c3a4e00e88de7463c5e35f32b866e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130455 Reviewed-by: Michael Stahl diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx b/sw/source/core/doc/DocumentStylePoolManager.cxx index f5d2aa7918df..42e05e0a9aad 100644 --- a/sw/source/core/doc/DocumentStylePoolManager.cxx +++ b/sw/source/core/doc/DocumentStylePoolManager.cxx @@ -88,8 +88,10 @@ namespace const sal_uInt16 PT_3 = 3 * 20; // 3 pt const sal_uInt16 PT_6 = 6 * 20; // 6 pt const sal_uInt16 PT_7 = 7 * 20; // 7 pt +const sal_uInt16 PT_9 = 9 * 20; // 9 pt const sal_uInt16 PT_10 = 10 * 20; // 10 pt const sal_uInt16 PT_12 = 12 * 20; // 12 pt +const sal_uInt16 PT_13 = 13 * 20; // 13 pt const sal_uInt16 PT_14 = 14 * 20; // 14 pt const sal_uInt16 PT_16 = 16 * 20; // 16 pt const sal_uInt16 PT_18 = 18 * 20; // 18 pt @@ -100,8 +102,9 @@ namespace const sal_uInt16 aHeadlineSizes[ 2 * MAXLEVEL ] = { // we do everything percentual now: -130, 115, 101, 95, 85, -85, 80, 80, 75, 75, // normal +PT_18, PT_16, PT_14, PT_13, PT_12, +PT_12, PT_10, PT_10, PT_9, PT_9, // normal + PT_24, PT_18, PT_14, PT_12, PT_10, PT_7, PT_7, PT_7, PT_7, PT_7// HTML mode }; @@ -180,7 +183,7 @@ namespace if( bHTMLMode ) aHItem.SetHeight( aHeadlineSizes[ MAXLEVEL + nLevel ] ); else -aHItem.SetHeight( PT_14, aHeadlineSizes[ nLevel ] ); +aHItem.SetHeight( aHeadlineSizes[ nLevel ] ); SetAllScriptItem( rSet, aHItem ); if( bItalic && !bHTMLMode )
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/layout/fly.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit ec21d93f5b649353439d7498d9e0fb9136a5fb6b Author: Caolán McNamara AuthorDate: Mon Feb 21 12:02:33 2022 + Commit: Michael Stahl CommitDate: Tue Feb 22 13:09:24 2022 +0100 cid#1500612 Dereference after null check otherwise this doesn't make sense Change-Id: I321a86cf8f9f05639b686a4c15b2e8fca2e10955 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130255 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index 8a6cad12ecfc..1a0a93e5fc01 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -1909,7 +1909,7 @@ void SwFlyFrame::ActiveUnfloatButton(SwWrtShell* pWrtSh) SwEditWin& rEditWin = pWrtSh->GetView().GetEditWin(); SwFrameControlsManager& rMngr = rEditWin.GetFrameControlsManager(); SwFrameControlPtr pControl = rMngr.GetControl(FrameControlType::FloatingTable, this); -if (pControl || pControl->GetWindow()) +if (pControl && pControl->GetWindow()) { pControl->GetWindow()->MouseButtonDown(MouseEvent()); }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/uibase/docvw/edtwin.cxx | 31 ++- sw/source/uibase/inc/edtwin.hxx |1 - sw/source/uibase/uiview/view1.cxx |3 +-- 3 files changed, 19 insertions(+), 16 deletions(-) New commits: commit cb040adc86fa237c17d8800c9bda4757de230ebf Author: Luboš Luňák AuthorDate: Thu Feb 17 16:50:22 2022 +0100 Commit: Adolfo Jayme Barrientos CommitDate: Mon Feb 21 13:05:23 2022 +0100 fix Writer key event delayed compression (tdf#145963) SwEditWin::KeyInput() was stopping the flush timer on every invocation, which means that as long as key events kept coming the timer would be started again and again and would not time out, and so the input buffer would not be actually processed. It seems that AnyInput(KEYBOARD) there actually does not normally manage to return true ... except for Win11 where it seems that now GetQueueStatus() detects even key-up events even though it didn't before (I've not debugged this enough to be certain). I think it still makes sense to have the compression in case Writer get overloaded to help it process the pending input events, so fix this (but if there are problems, I think an easy solution is simply to drop it, it doesn't seem to be that necessary). Also decrease the timeout from 200 to 20ms, as 200ms is a very visible delay. Change-Id: I760ad9c4f58726a80bd6a9fbf93f2771f10cbdb9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130083 Tested-by: Jenkins Reviewed-by: Luboš Luňák Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130122 Reviewed-by: Adolfo Jayme Barrientos diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index e4791daff6a0..59af6a581a6b 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -29,6 +29,8 @@ #include #include +#include + #include #include #include @@ -163,7 +165,6 @@ bool g_bFrameDrag = false; static bool g_bValidCursorPos = false; static bool g_bModePushed = false; bool g_bDDTimerStarted= false; -bool g_bFlushCharBuffer = false; bool g_bDDINetAttr= false; static SdrHdlKind g_eSdrMoveHdl = SdrHdlKind::User; @@ -871,6 +872,9 @@ static sal_uInt16 lcl_isNonDefaultLanguage(LanguageType eBufferLanguage, SwView */ void SwEditWin::FlushInBuffer() { +if ( m_aKeyInputFlushTimer.IsActive()) +m_aKeyInputFlushTimer.Stop(); + if ( m_aInBuffer.isEmpty() ) return; @@ -999,8 +1003,6 @@ void SwEditWin::FlushInBuffer() rSh.Insert( m_aInBuffer ); m_eBufferLanguage = LANGUAGE_DONTKNOW; m_aInBuffer.clear(); -g_bFlushCharBuffer = false; - } #define MOVE_LEFT_SMALL 0 @@ -1389,7 +1391,9 @@ void SwEditWin::KeyInput(const KeyEvent ) return; m_pShadCursor.reset(); -m_aKeyInputFlushTimer.Stop(); +// Do not reset the timer here, otherwise when flooded with events it would never time out +// if every key event stopped and started it again. +comphelper::ScopeGuard keyInputFlushTimerStop([this]() { m_aKeyInputFlushTimer.Stop(); }); bool bIsDocReadOnly = m_rView.GetDocShell()->IsReadOnly() && rSh.IsCursorReadonly(); @@ -2455,10 +2459,15 @@ KEYINPUT_CHECKTABLE_INSDEL: comphelper::string::padToLength(aBuf, m_aInBuffer.getLength() + aKeyEvent.GetRepeat() + 1, aCh); m_aInBuffer = aBuf.makeStringAndClear(); -g_bFlushCharBuffer = Application::AnyInput( VclInputFlags::KEYBOARD ); -bFlushBuffer = !g_bFlushCharBuffer; -if( g_bFlushCharBuffer ) -m_aKeyInputFlushTimer.Start(); +bool delayFlush = Application::AnyInput( VclInputFlags::KEYBOARD ); +bFlushBuffer = !delayFlush; +if( delayFlush ) +{ +// Start the timer, make sure to not restart it. +keyInputFlushTimerStop.dismiss(); +if( !m_aKeyInputFlushTimer.IsActive()) +m_aKeyInputFlushTimer.Start(); +} } eKeyState = SwKeyState::End; } @@ -2674,11 +2683,7 @@ KEYINPUT_CHECKTABLE_INSDEL: // in case the buffered characters are inserted if( bFlushBuffer && !m_aInBuffer.isEmpty() ) { -// bFlushCharBuffer was not reset here -// why not? -bool bSave = g_bFlushCharBuffer; FlushInBuffer(); -g_bFlushCharBuffer = bSave; // maybe show Tip-Help if (bNormalChar) @@ -5187,7 +5192,7 @@ SwEditWin::SwEditWin(vcl::Window *pParent, SwView ): SetPointer( PointerStyle::Text ); m_aTimer.SetInvokeHandler(LINK(this, SwEditWin, TimerHandler)); -
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/txtnode/atrfld.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit c543106985abbaafeae08b7ced11422144f053e4 Author: Michael Stahl AuthorDate: Mon Feb 14 16:18:37 2022 +0100 Commit: Xisco Fauli CommitDate: Tue Feb 15 12:54:05 2022 +0100 tdf#146848 sw: fix assert about input field in undo nodes These should not be updated. soffice.bin: sw/source/core/txtnode/atrfld.cxx:713: void SwTextInputField::UpdateTextNodeContent(const rtl::OUString&): Assertion `IsFieldInDoc() && " - misusage as Input Field is not in document content."' failed. 3 SwTextInputField::UpdateTextNodeContent(rtl::OUString const&) 4 SwTextInputField::NotifyContentChange(SwFormatField&) at sw/source/core/txtnode/atrfld.cxx:669 5 SwTextField::ExpandTextField(bool) const 6 SwFormatField::UpdateTextNode(SfxPoolItem const*, SfxPoolItem const*) at sw/source/core/txtnode/atrfld.cxx:407 7 SwFormatField::SwClientNotify(SwModify const&, SfxHint const&) 10 SwFieldType::UpdateFields() (this=0x7f7ff2d654b0) at sw/source/core/fields/fldbas.cxx:220 11 sw::DocumentFieldsManager::UpdateFields(bool) 12 SwFEShell::Paste(SwDoc&, bool) at sw/source/core/frmedt/fecopy.cxx:1117 Somehow this causes testTdf139843 to go from 7 to 6 pages, but opening the bugdoc shows it as 6 pages too, not sure what's going on there. Change-Id: Ie25b2b2c4d8fd262850da31cbade5e121e9ec361 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129919 Tested-by: Michael Stahl Reviewed-by: Michael Stahl (cherry picked from commit 71e8a947753d359bd5b4d1174f4d6332eaf4a309) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129933 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx index c9ced5ea7a1d..079c8a4b1226 100644 --- a/sw/source/core/txtnode/atrfld.cxx +++ b/sw/source/core/txtnode/atrfld.cxx @@ -299,7 +299,7 @@ void SwFormatField::UpdateTextNode(const SfxPoolItem* pOld, const SfxPoolItem* p return; } -if( !mpTextField ) +if (!IsFieldInDoc()) return; // don't do anything, especially not expand!
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/layout/tabfrm.cxx |7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) New commits: commit 60811f97c753360393f52aa747837db15a722162 Author: Michael Stahl AuthorDate: Thu Feb 10 19:43:08 2022 +0100 Commit: Xisco Fauli CommitDate: Fri Feb 11 20:22:17 2022 +0100 sw: fix layout loop on soffice --convert-to pdf ooo95698-1.odt For unknown reasons, this loops since commit 32902f66e7749b2d06d13f50416be5323a0c0ea9a "sw_redlinehide: make layout based Show/Hide mode the default" The problem is that when page 1 is layouted for the first time, it splits into 6 pages, and then the SwTabFrame 47 decides that it wants to move its follow flow line because it fits onto page 1. Then splitting the SwTabFrame again fails, but for this RemoveFollowFlowLine() was called a 2nd time and removed the one on page 3. The result is a layout with content on page 1, nothing on page 2, 3 and again content on page 4. This seems to reoccur every time page 1 is formatted. But the first RemoveFollowFlowLine() was wrong because CalcHeightOfFirstContentLine() returns 0 because lcl_CalcHeightOfFirstContentLine() didn't handle the case of SwSectionFrame containing SwTabFrame. This is similar to commit e024cad7c1365da6a198656c3ca0c32b28938e87 doing the same thing for text frames in section. Change-Id: I23fb4d1d56622039f461bb2d357a9c88db140605 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129800 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit b4271e028686d729189afc5e42a9c310f81144f3) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129828 Reviewed-by: Xisco Fauli diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index 95388db5c9ac..f0ad11a0653a 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -5833,9 +5833,12 @@ static SwTwips lcl_CalcHeightOfFirstContentLine( const SwRowFrame& rSourceLine ) const SwRowFrame* pTmpSourceRow = static_cast(pCurrSourceCell->Lower()); nTmpHeight = lcl_CalcHeightOfFirstContentLine( *pTmpSourceRow ); } -else if ( pTmp->IsTabFrame() ) +else if (pTmp->IsTabFrame() || (pTmp->IsSctFrame() && pTmp->GetLower() && pTmp->GetLower()->IsTabFrame())) { -nTmpHeight = static_cast(pTmp)->CalcHeightOfFirstContentLine(); +SwTabFrame const*const pTabFrame(pTmp->IsTabFrame() +? static_cast(pTmp) +: static_cast(pTmp->GetLower())); +nTmpHeight = pTabFrame->CalcHeightOfFirstContentLine(); } else if (pTmp->IsTextFrame() || (pTmp->IsSctFrame() && pTmp->GetLower() && pTmp->GetLower()->IsTextFrame())) {
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/filter/ww8/wrtw8sty.cxx | 28 ++-- sw/source/filter/ww8/wrtww8.hxx |4 ++-- 2 files changed, 16 insertions(+), 16 deletions(-) New commits: commit 1a2f1b25e6d228dd586706584cf1c1f1d1ff069f Author: Caolán McNamara AuthorDate: Thu Feb 10 10:53:27 2022 + Commit: Michael Stahl CommitDate: Fri Feb 11 14:32:55 2022 +0100 limit style export to words max style count and use std::vector LIBREOFFICE-U78X8I5G Change-Id: I436b4c13a4ce07f5e9e5d374163bc4de55cd2cde Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129804 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index 72c171bacdff..9f103627d576 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -151,13 +151,13 @@ MSWordStyles::MSWordStyles( MSWordExportBase& rExport, bool bListStyles ) m_rExport.m_rDoc.GetFootnoteInfo().GetAnchorCharFormat( m_rExport.m_rDoc ); m_rExport.m_rDoc.GetFootnoteInfo().GetCharFormat( m_rExport.m_rDoc ); } -sal_uInt16 nAlloc = WW8_RESERVED_SLOTS + m_rExport.m_rDoc.GetCharFormats()->size() - 1 + +sal_uInt32 nAlloc = WW8_RESERVED_SLOTS + m_rExport.m_rDoc.GetCharFormats()->size() - 1 + m_rExport.m_rDoc.GetTextFormatColls()->size() - 1 + (bListStyles ? m_rExport.m_rDoc.GetNumRuleTable().size() - 1 : 0); +nAlloc = std::min(nAlloc, MSWORD_MAX_STYLES_LIMIT); // somewhat generous ( free for up to 15 ) -m_pFormatA.reset( new SwFormat*[ nAlloc ] ); -memset( m_pFormatA.get(), 0, nAlloc * sizeof( SwFormat* ) ); +m_aFormatA.resize(nAlloc, nullptr); memset( m_aHeadingParagraphStyles, -1 , MAXLEVEL * sizeof( sal_uInt16)); BuildStylesTable(); @@ -173,7 +173,7 @@ sal_uInt16 MSWordStyles::GetSlot( const SwFormat* pFormat ) const { sal_uInt16 n; for ( n = 0; n < m_nUsedSlots; n++ ) -if ( m_pFormatA[n] == pFormat ) +if ( m_aFormatA[n] == pFormat ) return n; return 0xfff; // 0xfff: WW: zero } @@ -283,19 +283,19 @@ void MSWordStyles::BuildStylesTable() const SwCharFormats& rArr = *m_rExport.m_rDoc.GetCharFormats(); // first CharFormat // the default character style ( 0 ) will not be outputted ! -for( size_t n = 1; n < rArr.size(); n++ ) +for( size_t n = 1; n < rArr.size() && m_nUsedSlots < MSWORD_MAX_STYLES_LIMIT; n++ ) { SwCharFormat* pFormat = rArr[n]; -m_pFormatA[ BuildGetSlot( *pFormat ) ] = pFormat; +m_aFormatA[ BuildGetSlot( *pFormat ) ] = pFormat; } const SwTextFormatColls& rArr2 = *m_rExport.m_rDoc.GetTextFormatColls(); // then TextFormatColls // the default character style ( 0 ) will not be outputted ! -for( size_t n = 1; n < rArr2.size(); n++ ) +for( size_t n = 1; n < rArr2.size() && m_nUsedSlots < MSWORD_MAX_STYLES_LIMIT; n++ ) { SwTextFormatColl* pFormat = rArr2[n]; sal_uInt16 nId = BuildGetSlot( *pFormat ) ; -m_pFormatA[ nId ] = pFormat; +m_aFormatA[ nId ] = pFormat; if ( pFormat->IsAssignedToListLevelOfOutlineStyle() ) { int nLvl = pFormat->GetAssignedOutlineStyleLevel() ; @@ -308,7 +308,7 @@ void MSWordStyles::BuildStylesTable() return; const SwNumRuleTable& rNumRuleTable = m_rExport.m_rDoc.GetNumRuleTable(); -for (size_t i = 0; i < rNumRuleTable.size(); ++i) +for (size_t i = 0; i < rNumRuleTable.size() && m_nUsedSlots < MSWORD_MAX_STYLES_LIMIT; ++i) { const SwNumRule* pNumRule = rNumRuleTable[i]; if (pNumRule->IsAutoRule() || pNumRule->GetName().startsWith("WWNum")) @@ -348,8 +348,8 @@ void MSWordStyles::BuildStyleIds() for (sal_uInt16 n = 1; n < m_nUsedSlots; ++n) { OUString aName; -if(m_pFormatA[n]) -aName = m_pFormatA[n]->GetName(); +if (m_aFormatA[n]) +aName = m_aFormatA[n]->GetName(); else if (m_aNumRules.find(n) != m_aNumRules.end()) aName = m_aNumRules[n]->GetName(); @@ -628,8 +628,8 @@ void MSWordStyles::OutputStyle( SwFormat* pFormat, sal_uInt16 nPos ) for ( int nSuffix = 0; ; ++nSuffix ) { bool clash=false; for ( sal_uInt16 n = 1; n < m_nUsedSlots; ++n ) -if ( m_pFormatA[n] && - m_pFormatA[n]->GetName().equalsIgnoreAsciiCase(aName) ) +if ( m_aFormatA[n] && + m_aFormatA[n]->GetName().equalsIgnoreAsciiCase(aName) ) { clash = true; break; @@ -718,7 +718,7 @@ void MSWordStyles::OutputStylesTable() if (m_aNumRules.find(n) != m_aNumRules.end()) OutputStyle(m_aNumRules[n], n);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/ui/frmdlg/frmpage.cxx | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) New commits: commit 27b03993c49b3c8a3bafa736db9ca25e834a2195 Author: Caolán McNamara AuthorDate: Wed Feb 9 13:54:42 2022 + Commit: Adolfo Jayme Barrientos CommitDate: Thu Feb 10 03:51:27 2022 +0100 Resolves: tdf#132591 set property if Fixed Ratio checkbox was toggled Change-Id: I10a2085e91bb592a8ccea7a50b7188250288e74a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129756 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx index 5e5629495687..c9b119521850 100644 --- a/sw/source/ui/frmdlg/frmpage.cxx +++ b/sw/source/ui/frmdlg/frmpage.cxx @@ -1159,7 +1159,8 @@ bool SwFramePage::FillItemSet(SfxItemSet *rSet) bool bValueModified = m_xWidthED->get_value_changed_from_saved() || m_xHeightED->get_value_changed_from_saved(); bool bCheckChanged = m_xRelWidthCB->get_state_changed_from_saved() || - m_xRelHeightCB->get_state_changed_from_saved(); + m_xRelHeightCB->get_state_changed_from_saved() || + m_xFixedRatioCB->get_state_changed_from_saved(); bool bLegalValue = !(!rOldSize.GetWidth () && !rOldSize.GetHeight() && m_xWidthED->get_value() == m_xWidthED->get_min() && @@ -1191,6 +1192,7 @@ bool SwFramePage::FillItemSet(SfxItemSet *rSet) aSz.SetWidthPercent(SwFormatFrameSize::SYNCED); } } + if( !IsInGraficMode() ) { if (m_xAutoHeightCB->get_state_changed_from_saved()) @@ -2190,11 +2192,8 @@ void SwFramePage::Init(const SfxItemSet& rSet) m_nUpperBorder = rUL.GetUpper(); m_nLowerBorder = rUL.GetLower(); -if(SfxItemState::SET == rSet.GetItemState(FN_KEEP_ASPECT_RATIO)) -{ +if (SfxItemState::SET == rSet.GetItemState(FN_KEEP_ASPECT_RATIO)) m_xFixedRatioCB->set_active(static_cast(rSet.Get(FN_KEEP_ASPECT_RATIO)).GetValue()); -m_xFixedRatioCB->save_state(); -} // columns SwFormatCol aCol( rSet.Get(RES_COL) ); @@ -2253,6 +2252,7 @@ void SwFramePage::Init(const SfxItemSet& rSet) if (rSize.GetWidthPercent() == SwFormatFrameSize::SYNCED || rSize.GetHeightPercent() == SwFormatFrameSize::SYNCED) m_xFixedRatioCB->set_active(true); +m_xFixedRatioCB->save_state(); if (rSize.GetWidthPercent() && rSize.GetWidthPercent() != SwFormatFrameSize::SYNCED && !m_xRelWidthCB->get_active()) {
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/doc/DocumentRedlineManager.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 522160397ad5b4cb802fcef0b10294e84a612723 Author: Caolán McNamara AuthorDate: Mon Feb 7 12:45:33 2022 + Commit: Andras Timar CommitDate: Mon Feb 7 22:46:08 2022 +0100 ofz#44471 crash in isMoved if re-insert of invalid range failed Change-Id: I21a3a3e544c016205d65d7e81889ebfddc7e322d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129563 Tested-by: Jenkins Reviewed-by: Andras Timar diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx index a3de2c9143fb..2c2f4a1b080b 100644 --- a/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/sw/source/core/doc/DocumentRedlineManager.cxx @@ -1429,7 +1429,8 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall bCompress = true; // set IsMoved checking nearby redlines -maRedlineTable.isMoved(n); +if (n < maRedlineTable.size()) // in case above 're-insert' failed +maRedlineTable.isMoved(n); } } else if( SwComparePosition::Inside == eCmpPos )
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/uibase/shells/drwbassh.cxx | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) New commits: commit fbd98d923e75c90e750bd5d5a6cca80a75ed1ca9 Author: Julien Nabet AuthorDate: Wed Feb 2 21:14:30 2022 +0100 Commit: Xisco Fauli CommitDate: Fri Feb 4 14:47:57 2022 +0100 tdf#147144: Writer crash after adding rectangle, add link and delete it bt: 0 SdrMark::GetMarkedSdrObj() const (this=0x0) at include/svx/svdmark.hxx:68 1 0x7f958c31555c in SwDrawBaseShell::GetState(SfxItemSet&) (this=0x6bbcd70, rSet= SfxItemSet of pool 0x2dc5730 with parent 0x0 and Which ranges: [(5678, 5678), ... = {...}) at sw/source/uibase/shells/drwbassh.cxx:899 2 0x7f958c3148bd in SfxStubSwDrawBaseShellGetState(SfxShell*, SfxItemSet&) (pShell=0x6bbcd70, rSet=SfxItemSet of pool 0x2dc5730 with parent 0x0 and Which ranges: [(5678, 5678),...] = {...}) at workdir/SdiTarget/sw/sdi/swslots.hxx:8315 3 0x7f95a6025de1 in SfxDispatcher::FillState_(SfxSlotServer const&, SfxItemSet&, SfxSlot const*) (this=0x65acbe0, rSvr=..., rState=SfxItemSet of pool 0x2dc5730 with parent 0x0 and Which ranges: [(5678, 5678), (5713, 5713),...] = {...}, pRealSlot=0x7f958d1eb190 ) at sfx2/source/control/dispatch.cxx:1658 4 0x7f95a6004fe9 in SfxBindings::Update_Impl(SfxStateCache&) (this=0x65863c0, rCache=...) at sfx2/source/control/bindings.cxx:259 Change-Id: I910429103f505e855d88b7efe9a5ca771d5fc92e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129388 Tested-by: Julien Nabet Reviewed-by: Julien Nabet (cherry picked from commit 91fd537a4517409da87229fd7c0f21d269973d43) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129344 Reviewed-by: Samuel Mehrbrodt Reviewed-by: Xisco Fauli Tested-by: Jenkins diff --git a/sw/source/uibase/shells/drwbassh.cxx b/sw/source/uibase/shells/drwbassh.cxx index ff8579368812..f18d63b10ff3 100644 --- a/sw/source/uibase/shells/drwbassh.cxx +++ b/sw/source/uibase/shells/drwbassh.cxx @@ -896,11 +896,14 @@ void SwDrawBaseShell::GetState(SfxItemSet& rSet) case SID_HYPERLINK_GETLINK: { const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList(); -SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); -OUString sHyperLink = pObj->getHyperlink(); -SvxHyperlinkItem aHLinkItem; -aHLinkItem.SetURL(sHyperLink); -rSet.Put(aHLinkItem); +if (rMarkList.GetMark(0) != nullptr) +{ +SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); +OUString sHyperLink = pObj->getHyperlink(); +SvxHyperlinkItem aHLinkItem; +aHLinkItem.SetURL(sHyperLink); +rSet.Put(aHLinkItem); +} } break; }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/uibase/utlui/content.cxx |8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) New commits: commit c6c343db72a97bb027ccb493cef6fa7f1025f119 Author: Jim Raykowski AuthorDate: Fri Jan 28 17:34:48 2022 -0900 Commit: Adolfo Jayme Barrientos CommitDate: Mon Jan 31 03:47:35 2022 +0100 tdf#147041 Always show navigated heading at top of visible view area Revert to pre commit 1df2581cfffc87386c6de7614793b2d664244e5a behavior Change-Id: I06fe630bf0c0e611351e0e9a56361a3028f207d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129129 Tested-by: Jenkins Reviewed-by: Jim Raykowski (cherry picked from commit b0434f62c17b69e10caf05ad85a60f1bffdb5238) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129080 Reviewed-by: Adolfo Jayme Barrientos diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 01c0b005f8ff..d3c2bc2b2b81 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -5286,9 +5286,11 @@ void SwContentTree::GotoContent(const SwContent* pCnt) rView.GetPostItMgr()->SetActiveSidebarWin(nullptr); rView.GetEditWin().GrabFocus(); -// assure visible view area is at cursor position -if (!m_pActiveShell->IsCursorVisible() && !m_pActiveShell->IsFrameSelected() && -!m_pActiveShell->IsObjSelected()) +// Assure cursor is in visible view area. +// (tdf#147041) Always show the navigated outline at the top of the visible view area. +if (pCnt->GetParent()->GetType() == ContentTypeId::OUTLINE || +(!m_pActiveShell->IsCursorVisible() && !m_pActiveShell->IsFrameSelected() && +!m_pActiveShell->IsObjSelected())) { Point rPoint = m_pActiveShell->GetCursorDocPos(); rPoint.setX(0);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/doc/docredln.cxx | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) New commits: commit 6a3f8d893d4456f86a3c213d04baad2ed9c6bbcd Author: László Németh AuthorDate: Sat Jan 22 11:23:34 2022 +0100 Commit: László Németh CommitDate: Wed Jan 26 13:51:02 2022 +0100 tdf#146857 sw change tracking: fix freezing during Undo Re-insertion of hundreds of redlines during Undo resulted freezing, because of the unnecessary call of isMoved() in SwRedlineTable::Insert(), multiplying the slow Undo by ~40 extra redline checkings around each redline to find tracked text movings. Stop unnecessary call of isMoved() during Undo in SwRedlineTable::Insert(). The state of isMoved bit i.e. the green/double strikethrough/underline redline formatting is preserved anyway. Regression from commit f51fa7534421a195a58b4a737a2e836d8c25ba81 "tdf#145718 sw, DOCX import: complete tracked text moving". Change-Id: Ib7901c7b4fefd87633c49ef252750b84dcdb73dc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128762 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit b15638440d692dd8cce55c0e936fbb82d24f8414) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128953 diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index 0d0b7fa621e2..cb6fb4f3302c 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -411,8 +411,15 @@ bool SwRedlineTable::Insert(SwRangeRedline*& p) size_type nP = rv.first - begin(); LOKRedlineNotification(RedlineNotification::Add, p); -// set IsMoved checking nearby redlines -isMoved(nP); +// detect text moving by checking nearby redlines, except during Undo +// (apply isMoved() during OpenDocument and DOCX import, too, to fix +// missing text moving handling in ODF and e.g. web version of MSO) +if ( p->GetDoc().GetIDocumentUndoRedo().DoesUndo() || + p->GetDoc().IsInWriterfilterImport() || + p->GetDoc().IsInXMLImport() ) +{ +isMoved(nP); +} p->CallDisplayFunc(nP); if (rv.second)
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/uibase/utlui/content.cxx |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) New commits: commit 3b7f42c033478a4faec15baf92f6fa61cd09eba6 Author: Jim Raykowski AuthorDate: Mon Jan 17 20:20:18 2022 -0900 Commit: Caolán McNamara CommitDate: Mon Jan 24 20:40:14 2022 +0100 SwNavigator: disallow tracking update when content tree has focus When document layout has not finished and there is no content to track at the cursor position, e.g. the cursor position is at the start of a document having text before the first heading paragraph, a selection made in the Navigator content tree can automatically unselect. This is not only annoying but causes a crash when action of a choice from the Navigator context menu is dependent on entry selection, e.g. 'Delete', 'Edit', 'Rename'. This patch prevents this annoyance and crash by disallowing content tracking when the content tree or the content tree context menu has focus. Change-Id: I2b0fd1ac4f53571e30ce1efa2934a70de2aad819 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128520 Tested-by: Jenkins Reviewed-by: Jim Raykowski (cherry picked from commit 0e7e8bb7ed30cdb1dee7ca72748c742657b19dab) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128531 Reviewed-by: Caolán McNamara diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 093a502da84f..01c0b005f8ff 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -3682,6 +3682,10 @@ void SwContentTree::UpdateTracking() if (State::HIDDEN == m_eState || !m_pActiveShell) return; +// only when treeview or treeview context menu does not have focus +if (m_xTreeView->has_focus() || m_xTreeView->has_child_focus()) +return; + // m_bIgnoreDocChange is set on delete and outline visibility toggle if (m_bIgnoreDocChange) { @@ -4491,7 +4495,7 @@ void SwContentTree::ExecuteContextMenuAction(const OString& rSelectedPopupEntry) std::unique_ptr xFirst(m_xTreeView->make_iterator()); if (!m_xTreeView->get_selected(xFirst.get())) -xFirst.reset(); +return; // this shouldn't happen, but better to be safe than ... auto nSelectedPopupEntry = rSelectedPopupEntry.toUInt32(); switch (nSelectedPopupEntry)
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/ui/chrdlg/numpara.cxx | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) New commits: commit da3931fac6388716de4ac7cd402f635dc0b377e9 Author: Caolán McNamara AuthorDate: Fri Jan 21 16:26:38 2022 + Commit: Adolfo Jayme Barrientos CommitDate: Sat Jan 22 04:48:09 2022 +0100 tdf#146891 there is a case where "chapter numbering" can be changed where "Chapter Numbering" is present but the list is editable, so we can't be sure that just adding "Chapter Numbering" for display purposes is safe enough, so add a specific id for the "pseudo" list style and check for that id (instead of the name) to determine the additional case where "Edit" button cannot be enabled Related: tdf#145804 show "Chapter Numbering" as (uneditable) list style Change-Id: I35d852523314c985ea5b7217e9394ac3e9c6e331 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128679 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos diff --git a/sw/source/ui/chrdlg/numpara.cxx b/sw/source/ui/chrdlg/numpara.cxx index 00e9a3b607bd..205bcacadb6f 100644 --- a/sw/source/ui/chrdlg/numpara.cxx +++ b/sw/source/ui/chrdlg/numpara.cxx @@ -184,10 +184,12 @@ void SwParagraphNumTabPage::Reset(const SfxItemSet* rSet) if( aStyle == "Outline") { -// tdf#145804 show "Chapter Numbering" -assert(!m_xNumberStyleBX->get_sensitive() && "pseudo entry shouldn't be editable"); -m_xNumberStyleLB->append_text(msOutlineNumbering); -m_xNumberStyleLB->set_active_text(msOutlineNumbering); +if (m_xNumberStyleLB->find_id("pseudo") == -1) +{ +// tdf#145804 show "Chapter Numbering" +m_xNumberStyleLB->append("pseudo", msOutlineNumbering); +} +m_xNumberStyleLB->set_active_id("pseudo"); m_xNumberStyleLB->save_value(); } else @@ -291,8 +293,8 @@ IMPL_LINK_NOARG(SwParagraphNumTabPage, LineCountHdl_Impl, weld::Toggleable&, voi IMPL_LINK_NOARG(SwParagraphNumTabPage, EditNumStyleSelectHdl_Impl, weld::ComboBox&, void) { int numSelectPos = m_xNumberStyleLB->get_active(); -// 0 is "None" and -1 is unselected state -if (numSelectPos == 0 || numSelectPos == -1) +// 0 is "None" and -1 is unselected state and a "pseudo" is uneditable "Chapter Numbering" +if (numSelectPos == 0 || numSelectPos == -1 || m_xNumberStyleLB->get_active_id() == "pseudo") m_xEditNumStyleBtn->set_sensitive(false); else m_xEditNumStyleBtn->set_sensitive(true);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/txtnode/modeltoviewhelper.cxx | 95 +++ 1 file changed, 95 insertions(+) New commits: commit ded965e82b11f527376bb9c2e7157288cbd08499 Author: Michael Stahl AuthorDate: Wed Jan 19 12:10:35 2022 +0100 Commit: Xisco Fauli CommitDate: Wed Jan 19 20:19:43 2022 +0100 tdf#139638 sw_fieldmarkhide: hide fieldmark command in ModelToViewHelper The crash happened because the generated ToX text contained CH_TXTATR but the fieldmarks themselves were not copied. Just filter everything except the result of the fieldmark. Change-Id: I349e7793987624e64f5afe08dfa2ca977368156b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128605 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit ab6176e88f78d0b3aa2490fbc7858304c2d4a437) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128537 Reviewed-by: Xisco Fauli diff --git a/sw/source/core/txtnode/modeltoviewhelper.cxx b/sw/source/core/txtnode/modeltoviewhelper.cxx index c8c6095726cb..a5ae25962862 100644 --- a/sw/source/core/txtnode/modeltoviewhelper.cxx +++ b/sw/source/core/txtnode/modeltoviewhelper.cxx @@ -31,7 +31,9 @@ #include #include #include +#include #include +#include #include namespace { @@ -104,6 +106,99 @@ ModelToViewHelper::ModelToViewHelper(const SwTextNode , if (eMode & ExpandMode::HideDeletions) SwScriptInfo::selectRedLineDeleted(rNode, aHiddenMulti); +if (eMode & ExpandMode::ExpandFields) +{ +// hide fieldmark commands +IDocumentMarkAccess const& rIDMA(*rNode.GetDoc().getIDocumentMarkAccess()); +::std::deque<::std::pair> startedFields; +SwPaM cursor(rNode, 0); +while (true) +{ +sw::mark::IFieldmark const* pFieldMark(nullptr); +while (true) // loop to skip NonTextFieldmarks, those are handled later +{ +pFieldMark = rIDMA.getFieldmarkFor(*cursor.GetPoint()); +if (pFieldMark == nullptr +|| pFieldMark->GetMarkStart().nNode.GetNode().GetTextNode()->GetText()[ +pFieldMark->GetMarkStart().nContent.GetIndex()] +!= CH_TXT_ATR_FORMELEMENT) +{ +break; +} +pFieldMark = nullptr; +if (!cursor.Move(fnMoveBackward, GoInContent)) +{ +break; +} +} +if (!pFieldMark) +{ +break; +} + assert(pFieldMark->GetMarkStart().nNode.GetNode().GetTextNode()->GetText()[pFieldMark->GetMarkStart().nContent.GetIndex()] != CH_TXT_ATR_FORMELEMENT); +// getFieldmarkFor may also return one that starts at rNode,0 - +// skip it, must be handled in loop below +if (pFieldMark->GetMarkStart().nNode < rNode) +{ +SwPosition const sepPos(::sw::mark::FindFieldSep(*pFieldMark)); +startedFields.emplace_front(pFieldMark, sepPos.nNode < rNode); +*cursor.GetPoint() = pFieldMark->GetMarkStart(); +} +if (!cursor.Move(fnMoveBackward, GoInContent)) +{ +break; +} +} +::std::optional oStartHidden; +if (!::std::all_of(startedFields.begin(), startedFields.end(), +[](auto const& it) { return it.second; })) +{ +oStartHidden.emplace(0); // node starts out hidden as field command +} +for (sal_Int32 i = 0; i < rNode.GetText().getLength(); ++i) +{ +switch (rNode.GetText()[i]) +{ +case CH_TXT_ATR_FIELDSTART: +{ +auto const pFieldMark(rIDMA.getFieldmarkAt(SwPosition(const_cast(rNode), i))); +assert(pFieldMark); +startedFields.emplace_back(pFieldMark, false); +if (!oStartHidden) +{ +oStartHidden.emplace(i); +} +break; +} +case CH_TXT_ATR_FIELDSEP: +{ + assert(startedFields.back().first->IsCoveringPosition(SwPosition(const_cast(rNode), i))); +startedFields.back().second = true; +assert(oStartHidden); +if (::std::all_of(startedFields.begin(), startedFields.end(), +[](auto const& it) { return it.second; })) +{ +// i is still hidden but the Range end is oddly "-1" +aHiddenMulti.Select({*oStartHidden, i}, true); +oStartHidden.reset(); +} +break; +} +case CH_TXT_ATR_FIELDEND: +
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/filter/xml/swxml.cxx |5 - 1 file changed, 4 insertions(+), 1 deletion(-) New commits: commit f830bc1a8d06fc9f5c9015846ad3a87a6cda9784 Author: Michael Stahl AuthorDate: Tue Jan 18 14:11:34 2022 +0100 Commit: Xisco Fauli CommitDate: Wed Jan 19 20:19:23 2022 +0100 sw_fieldmarkhide: disable layout cache if there are fieldmarks ... similar to the "ShowChanges" check that is already done. This prevents a crash in SwLayoutCache::CompareLayout() on fdo38619-2.ott Change-Id: I1a90c45f041ae18beacd3fbd4dcbdae5ba86c317 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128556 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 3170fba5dff3ea5cc67ea94f51a0dd5458f01edd) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128536 Reviewed-by: Xisco Fauli diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx index 8b4ae9b031f3..5b74af04e794 100644 --- a/sw/source/filter/xml/swxml.cxx +++ b/sw/source/filter/xml/swxml.cxx @@ -845,7 +845,10 @@ ErrCode XMLReader::Read( SwDoc , const OUString& rBaseURL, SwPaM , con if( !IsOrganizerMode() && !IsBlockMode() && !m_bInsertMode && !m_aOption.IsFormatsOnly() && // sw_redlinehide: disable layout cache for now - *o3tl::doAccess(xInfoSet->getPropertyValue(sShowChanges))) + *o3tl::doAccess(xInfoSet->getPropertyValue(sShowChanges)) && +// sw_fieldmarkhide: also disable if there is a fieldmark + rDoc.getIDocumentMarkAccess()->getFieldmarksBegin() + == rDoc.getIDocumentMarkAccess()->getFieldmarksEnd()) { try {