[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2023-04-24 Thread Miklos Vajna (via logerrit)
 sw/source/filter/html/htmlfldw.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 95d11ae3925111c05d14ed3abb6457b89129cb6e
Author: Miklos Vajna 
AuthorDate: Wed Apr 19 09:17:21 2023 +0200
Commit: Xisco Fauli 
CommitDate: Mon Apr 24 15:43:23 2023 +0200

sw: fix crash in OutHTML_SwFormatField()

Crashreport signature:

program/libswlo.so
SwDocShell::GetView()
sw/inc/docsh.hxx:222
program/libswlo.so
OutHTML_SwFormatField(Writer&, SfxPoolItem const&)
sw/source/filter/html/htmlfldw.cxx:549
...
program/libswlo.so
SwTransferable::WriteObject(tools::SvRef&, void*, 
unsigned int, com::sun::star::datatransfer::DataFlavor const&)
sw/source/uibase/dochdl/swdtflvr.cxx:?

I.e. clipboard documents don't have a doc shell, handle that.

Change-Id: I48b22087f759a11b4aa46b83b310f4a661e1fbc4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150897
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
(cherry picked from commit 5951e37eb24e09d3c24cb4cab4b0f3da41e3dfff)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150914
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/filter/html/htmlfldw.cxx 
b/sw/source/filter/html/htmlfldw.cxx
index 222ac3e96589..beb309e5121f 100644
--- a/sw/source/filter/html/htmlfldw.cxx
+++ b/sw/source/filter/html/htmlfldw.cxx
@@ -537,7 +537,7 @@ Writer& OutHTML_SwFormatField( Writer& rWrt, const 
SfxPoolItem& rHt )
 {
 const SwTextField *pTextField = rField.GetTextField();
 OSL_ENSURE( pTextField, "Where is the txt fld?" );
-if( pTextField )
+if( pTextField && rWrt.m_pDoc->GetDocShell() )
 {
 // ReqIF-XHTML doesn't allow specifying a background color.
 bool bFieldShadings = SwViewOption::IsFieldShadings() && 
!rHTMLWrt.mbReqIF;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2023-04-21 Thread Caolán McNamara (via logerrit)
 sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx |   18 ++
 sw/source/uibase/sidebar/WriterInspectorTextPanel.hxx |5 -
 2 files changed, 22 insertions(+), 1 deletion(-)

New commits:
commit 1915e355c63efa4ebce3bb12ca2ece3ce504934b
Author: Caolán McNamara 
AuthorDate: Thu Apr 6 12:17:10 2023 +0100
Commit: Xisco Fauli 
CommitDate: Fri Apr 21 10:55:51 2023 +0200

tdf#154629 inspector sidebar panel use-after-free on switch to print preview

Change-Id: I5489cd18213d82ae4174ca8d9d00f1da5aa1091d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150078
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150691
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx 
b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
index 1a3df50c27e8..2f9e305f1110 100644
--- a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
+++ b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
@@ -70,6 +70,10 @@ 
WriterInspectorTextPanel::WriterInspectorTextPanel(weld::Widget* pParent)
 {
 m_oldLink = m_pShell->GetChgLnk();
 m_pShell->SetChgLnk(LINK(this, WriterInspectorTextPanel, 
AttrChangedNotify));
+
+// tdf#154629 listen to know if the shell destructs before this panel 
does,
+// which can happen on entering print preview
+m_pShell->Add(this);
 }
 
 // Update panel on start
@@ -80,10 +84,24 @@ 
WriterInspectorTextPanel::WriterInspectorTextPanel(weld::Widget* pParent)
 updateEntries(aStore, m_nParIdx);
 }
 
+void WriterInspectorTextPanel::SwClientNotify(const SwModify& rModify, const 
SfxHint& rHint)
+{
+if (rHint.GetId() == SfxHintId::SwLegacyModify)
+{
+const sw::LegacyModifyHint& rLegacy = static_cast(rHint);
+if (rLegacy.GetWhich() == RES_OBJECTDYING)
+m_pShell = nullptr;
+}
+SwClient::SwClientNotify(rModify, rHint);
+}
+
 WriterInspectorTextPanel::~WriterInspectorTextPanel()
 {
 if (m_pShell)
+{
 m_pShell->SetChgLnk(m_oldLink);
+m_pShell->Remove(this);
+}
 }
 
 static OUString PropertyNametoRID(const OUString& rName)
diff --git a/sw/source/uibase/sidebar/WriterInspectorTextPanel.hxx 
b/sw/source/uibase/sidebar/WriterInspectorTextPanel.hxx
index fae619018851..2c2df34a9400 100644
--- a/sw/source/uibase/sidebar/WriterInspectorTextPanel.hxx
+++ b/sw/source/uibase/sidebar/WriterInspectorTextPanel.hxx
@@ -19,12 +19,13 @@
 #pragma once
 
 #include 
+#include 
 
 class SwWrtShell;
 
 namespace sw::sidebar
 {
-class WriterInspectorTextPanel final : public svx::sidebar::InspectorTextPanel
+class WriterInspectorTextPanel final : public 
svx::sidebar::InspectorTextPanel, public SwClient
 {
 public:
 static std::unique_ptr Create(weld::Widget* pParent);
@@ -40,6 +41,8 @@ private:
 
 // attributes have changed
 DECL_LINK(AttrChangedNotify, LinkParamNone*, void);
+
+virtual void SwClientNotify(const SwModify&, const SfxHint& rHint) 
override;
 };
 
 } // end of namespace svx::sidebar


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2023-04-19 Thread Caolán McNamara (via logerrit)
 sw/source/uibase/sidebar/PageMarginControl.cxx |   42 +++--
 1 file changed, 19 insertions(+), 23 deletions(-)

New commits:
commit 803221accbab3e3e9e5d22f0bcd14bcc3783680d
Author: Caolán McNamara 
AuthorDate: Wed Apr 19 11:25:49 2023 +0100
Commit: Xisco Fauli 
CommitDate: Wed Apr 19 13:29:20 2023 +0200

backport writer sidebar "check SfxViewFrame::Current()"

for crash seen in the wild as:

https://crashreport.libreoffice.org/stats/crash_details/0f7afb28-ef99-4182-a260-98d8a5653890

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

diff --git a/sw/source/uibase/sidebar/PageMarginControl.cxx 
b/sw/source/uibase/sidebar/PageMarginControl.cxx
index 632e94140e4f..638d55ce32e3 100644
--- a/sw/source/uibase/sidebar/PageMarginControl.cxx
+++ b/sw/source/uibase/sidebar/PageMarginControl.cxx
@@ -53,19 +53,14 @@ namespace
 {
 FieldUnit lcl_GetFieldUnit()
 {
-FieldUnit eUnit = FieldUnit::INCH;
-const SfxUInt16Item* pItem = nullptr;
-SfxItemState eState = 
SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState( 
SID_ATTR_METRIC, pItem );
-if ( pItem && eState >= SfxItemState::DEFAULT )
+if (SfxViewFrame* pViewFrm = SfxViewFrame::Current())
 {
-eUnit = static_cast(pItem->GetValue());
+const SfxUInt16Item* pItem = nullptr;
+SfxItemState eState = 
pViewFrm->GetBindings().GetDispatcher()->QueryState(SID_ATTR_METRIC, pItem);
+if (pItem && eState >= SfxItemState::DEFAULT)
+return static_cast(pItem->GetValue());
 }
-else
-{
-return SfxModule::GetCurrentFieldUnit();
-}
-
-return eUnit;
+return SfxModule::GetCurrentFieldUnit();
 }
 
 MapUnit lcl_GetUnit()
@@ -130,15 +125,15 @@ PageMarginControl::PageMarginControl(PageMarginPopup* 
pControl, weld::Widget* pP
 const SvxSizeItem* pSize = nullptr;
 const SvxLongLRSpaceItem* pLRItem = nullptr;
 const SvxLongULSpaceItem* pULItem = nullptr;
-if ( SfxViewFrame::Current() )
+if (SfxViewFrame* pViewFrm = SfxViewFrame::Current())
 {
 const SvxPageItem* pPageItem;
-SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState( 
SID_ATTR_PAGE, pPageItem );
+pViewFrm->GetBindings().GetDispatcher()->QueryState( SID_ATTR_PAGE, 
pPageItem );
 bLandscape = pPageItem->IsLandscape();
 m_bMirrored = pPageItem->GetPageUsage() == SvxPageUsage::Mirror;
-SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState( 
SID_ATTR_PAGE_SIZE, pSize );
-SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState( 
SID_ATTR_PAGE_LRSPACE, pLRItem );
-SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState( 
SID_ATTR_PAGE_ULSPACE, pULItem );
+pViewFrm->GetBindings().GetDispatcher()->QueryState( 
SID_ATTR_PAGE_SIZE, pSize );
+pViewFrm->GetBindings().GetDispatcher()->QueryState( 
SID_ATTR_PAGE_LRSPACE, pLRItem );
+pViewFrm->GetBindings().GetDispatcher()->QueryState( 
SID_ATTR_PAGE_ULSPACE, pULItem );
 }
 
 if ( pLRItem )
@@ -395,7 +390,8 @@ IMPL_LINK( PageMarginControl, SelectMarginHdl, 
weld::Button&, rControl, void )
 if ( !bApplyNewPageMargins )
 return;
 
-const css::uno::Reference< css::document::XUndoManager > xUndoManager( 
getUndoManager( SfxViewFrame::Current()->GetFrame().GetFrameInterface() ) );
+SfxViewFrame* pViewFrm = SfxViewFrame::Current();
+const css::uno::Reference 
xUndoManager(pViewFrm ? 
getUndoManager(pViewFrm->GetFrame().GetFrameInterface()) : nullptr);
 if ( xUndoManager.is() )
 xUndoManager->enterUndoContext( "" );
 
@@ -418,12 +414,12 @@ void PageMarginControl::ExecuteMarginLRChange(
 const tools::Long nPageLeftMargin,
 const tools::Long nPageRightMargin )
 {
-if ( SfxViewFrame::Current() )
+if (SfxViewFrame* pViewFrm = SfxViewFrame::Current())
 {
 SvxLongLRSpaceItem aPageLRMarginItem( 0, 0, SID_ATTR_PAGE_LRSPACE );
 aPageLRMarginItem.SetLeft( nPageLeftMargin );
 aPageLRMarginItem.SetRight( nPageRightMargin );
-SfxViewFrame::Current()->GetBindings().GetDispatcher()->ExecuteList( 
SID_ATTR_PAGE_LRSPACE,
+pViewFrm->GetBindings().GetDispatcher()->ExecuteList( 
SID_ATTR_PAGE_LRSPACE,
 SfxCallMode::RECORD, {  } );
 }
 }
@@ -432,23 +428,23 @@ void PageMarginControl::ExecuteMarginULChange(
 const tools::Long nPageTopMargin,
 const tools::Long nPageBottomMargin )
 {
-if ( SfxViewFrame::Current() )
+if (SfxViewFrame* pViewFrm = SfxViewFrame::Current())
 {
 SvxLongULSpaceItem aPageULMarginItem( 0, 0, SID_ATTR_PAGE_ULSPACE );
 aPageULMarginItem.SetUpper( nPageTopMargin );
 aPageULMarginItem.SetLower( nPageBottomMargin );
-  

[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2023-04-19 Thread Xisco Fauli (via logerrit)
 sw/source/core/layout/fly.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit a23922ecc0072aa52bd2143113ad971b6aef467a
Author: Xisco Fauli 
AuthorDate: Tue Apr 18 15:50:24 2023 +0200
Commit: Michael Stahl 
CommitDate: Wed Apr 19 12:14:16 2023 +0200

sw: fix divide by 0 in SwFlyFrame::CalcRel

https: 
//crashreport.libreoffice.org/stats/signature/SwFlyFrame::CalcRel(SwFormatFrameSize%20const%20&)
Change-Id: If7a1919a2829bbec3292b3aa5f7f719c5ba0beef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150579
Tested-by: Jenkins
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 
(cherry picked from commit 6f36e44f248c8e3705779d6692daaf79865a1378)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150567
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 9c61e5590e0a..99f976eab6d7 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -2578,12 +2578,12 @@ Size SwFlyFrame::CalcRel( const SwFormatFrameSize  
) const
 if ( rSz.GetHeightPercent() && rSz.GetHeightPercent() != 
SwFormatFrameSize::SYNCED )
 aRet.setHeight( nRelHeight * rSz.GetHeightPercent() / 100 );
 
-if ( rSz.GetWidthPercent() == SwFormatFrameSize::SYNCED )
+if ( rSz.GetHeight() && rSz.GetWidthPercent() == 
SwFormatFrameSize::SYNCED )
 {
 aRet.setWidth( aRet.Width() * ( aRet.Height()) );
 aRet.setWidth( aRet.Width() / ( rSz.GetHeight()) );
 }
-else if ( rSz.GetHeightPercent() == SwFormatFrameSize::SYNCED )
+else if ( rSz.GetWidth() && rSz.GetHeightPercent() == 
SwFormatFrameSize::SYNCED )
 {
 aRet.setHeight( aRet.Height() * ( aRet.Width()) );
 aRet.setHeight( aRet.Height() / ( rSz.GetWidth()) );


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2023-04-19 Thread Xisco Fauli (via logerrit)
 sw/source/uibase/wrtsh/wrtsh1.cxx |9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 99f43923b66a98b75c78a50577f19293aa480998
Author: Xisco Fauli 
AuthorDate: Tue Apr 18 14:37:32 2023 +0200
Commit: Michael Stahl 
CommitDate: Wed Apr 19 12:12:37 2023 +0200

sw: fix divide by 0

See 
https://crashreport.libreoffice.org/stats/signature/operator/(Fraction%20const%20&,Fraction%20const%20&)

Change-Id: Ia93e2969d6eb0bde71c8419f2aa90bb7aa231f61
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150553
Reviewed-by: Caolán McNamara 
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 
(cherry picked from commit d01dae0cbabc27f2ff2a242316206067cff73cf8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150563
Reviewed-by: Michael Stahl 

diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx 
b/sw/source/uibase/wrtsh/wrtsh1.cxx
index 6a17c6e80458..fdf3f6082587 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -900,8 +900,13 @@ void SwWrtShell::CalcAndSetScale( svt::EmbeddedObjectRef& 
xObj,
 }
 else
 {
-aArea.Width ( tools::Long( aArea.Width()  / pCli->GetScaleWidth() ) );
-aArea.Height( tools::Long( aArea.Height() / pCli->GetScaleHeight() ) );
+tools::Long nWidth(pCli->GetScaleWidth());
+tools::Long nHeight(pCli->GetScaleHeight());
+if (nWidth && nHeight)
+{
+aArea.Width ( aArea.Width()  / nWidth );
+aArea.Height( aArea.Height() / nHeight );
+}
 }
 
 pCli->SetObjAreaAndScale( aArea.SVRect(), aScaleWidth, aScaleHeight );


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2023-04-17 Thread Caolán McNamara (via logerrit)
 sw/source/uibase/shells/textfld.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit c59204ebc40950147926cc241c3292321abbf444
Author: Caolán McNamara 
AuthorDate: Sat Apr 15 20:44:48 2023 +0100
Commit: Xisco Fauli 
CommitDate: Mon Apr 17 13:18:33 2023 +0200

tdf#137542 don't crash at least

doesn't address the underlying issue though

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

diff --git a/sw/source/uibase/shells/textfld.cxx 
b/sw/source/uibase/shells/textfld.cxx
index 42ca39769015..6f9e3aadbed2 100644
--- a/sw/source/uibase/shells/textfld.cxx
+++ b/sw/source/uibase/shells/textfld.cxx
@@ -184,9 +184,9 @@ void SwTextShell::ExecField(SfxRequest )
 SwCursorShell::StartOfInputFieldAtPos( 
*(rSh.GetCursor()->Start()) ) + 1,
 SwCursorShell::EndOfInputFieldAtPos( 
*(rSh.GetCursor()->Start()) ) - 1 );
 }
-else
+else if (SwField* pCurrentField = rSh.GetCurField(true))
 {
-rSh.StartInputFieldDlg(rSh.GetCurField(true), false, 
false, GetView().GetFrameWeld());
+rSh.StartInputFieldDlg(pCurrentField, false, false, 
GetView().GetFrameWeld());
 }
 bRet = true;
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2023-04-17 Thread Caolán McNamara (via logerrit)
 sw/source/core/unocore/unofield.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit d9cf8459ef49f3011de3003538b503d0be06dc17
Author: Caolán McNamara 
AuthorDate: Thu Apr 13 15:50:25 2023 +0100
Commit: Xisco Fauli 
CommitDate: Mon Apr 17 13:03:08 2023 +0200

Resolves: tdf#152619 crash inspecting uninserted XFieldMaster

Change-Id: I765dd5d7e1ed2c1749841491a50216a6afe903c1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150351
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit 5464a1dad69c52d011b194baf7d543ce8dd27748)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150321
Reviewed-by: Michael Stahl 
(cherry picked from commit 71c7c3dddb1291e262b1f8132b75e95fc6f9fa02)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150333
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/core/unocore/unofield.cxx 
b/sw/source/core/unocore/unofield.cxx
index abe754f62b4f..e6320e9d248b 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -1325,6 +1325,8 @@ SwXTextField::getTextFieldMaster()
 SolarMutexGuard aGuard;
 
 SwFieldType* pType = m_pImpl->GetFieldType();
+if (!pType && !m_pImpl->m_pDoc) // tdf#152619
+return nullptr;
 uno::Reference const xRet(
 SwXFieldMaster::CreateXFieldMaster(m_pImpl->m_pDoc, pType));
 return xRet;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2023-03-25 Thread Xisco Fauli (via logerrit)
 sw/source/ui/chrdlg/chardlg.cxx|   13 ++-
 sw/source/ui/chrdlg/drpcps.cxx |   64 ++--
 sw/source/ui/chrdlg/swuiccoll.cxx  |   16 +++-
 sw/source/ui/dbui/mmresultdialogs.cxx  |   40 +++---
 sw/source/ui/dialog/wordcountdialog.cxx|   25 +++---
 sw/source/ui/fldui/fldpage.cxx |3 
 sw/source/ui/fldui/fldtdlg.cxx |3 
 sw/source/ui/fmtui/tmpdlg.cxx  |   27 +++
 sw/source/ui/misc/pggrid.cxx   |6 -
 sw/source/ui/misc/titlepage.cxx|   81 -
 sw/source/uibase/app/apphdl.cxx|   19 +++-
 sw/source/uibase/app/swmodul1.cxx  |3 
 sw/source/uibase/dbui/mailmergetoolbarcontrols.cxx |   12 +--
 sw/source/uibase/envelp/syncbtn.cxx|3 
 sw/source/uibase/fldui/fldmgr.cxx  |4 -
 sw/source/uibase/fldui/xfldui.cxx  |   12 ++-
 sw/source/uibase/inc/drpcps.hxx|4 -
 sw/source/uibase/inc/swuiccoll.hxx |1 
 sw/source/uibase/inc/titlepage.hxx |2 
 sw/source/uibase/misc/redlndlg.cxx |   57 ++
 sw/source/uibase/ribbar/inputwin.cxx   |   16 ++--
 sw/source/uibase/ribbar/workctrl.cxx   |   17 ++--
 sw/source/uibase/shells/tabsh.cxx  |3 
 sw/source/uibase/shells/textsh.cxx |   26 +++---
 sw/source/uibase/table/chartins.cxx|   19 +++-
 sw/source/uibase/utlui/content.cxx |2 
 sw/source/uibase/utlui/gloslst.cxx |4 -
 sw/source/uibase/utlui/navipi.cxx  |7 +
 sw/source/uibase/utlui/numfmtlb.cxx|6 -
 29 files changed, 297 insertions(+), 198 deletions(-)

New commits:
commit 7f2155e6a20d9a3de8d3d3d53661f6891aebda67
Author: Xisco Fauli 
AuthorDate: Tue Mar 21 16:55:59 2023 +0100
Commit: Caolán McNamara 
CommitDate: Sat Mar 25 19:58:05 2023 +

sw: check GetActiveView()

See 
https://crashreport.libreoffice.org/stats/signature/SwView::GetDocShell()

Change-Id: I90ebbff5082f1f9cae7fa3b940cbb9796d6c6dd3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149223
Reviewed-by: Caolán McNamara 
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149320
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149503

diff --git a/sw/source/ui/chrdlg/chardlg.cxx b/sw/source/ui/chrdlg/chardlg.cxx
index b7564dc414a9..b91076230e71 100644
--- a/sw/source/ui/chrdlg/chardlg.cxx
+++ b/sw/source/ui/chrdlg/chardlg.cxx
@@ -170,9 +170,11 @@ SwCharURLPage::SwCharURLPage(weld::Container* pPage, 
weld::DialogController* pCo
 m_xURLPB->connect_clicked(LINK( this, SwCharURLPage, InsertFileHdl));
 m_xEventPB->connect_clicked(LINK( this, SwCharURLPage, EventHdl));
 
-SwView *pView = ::GetActiveView();
-::FillCharStyleListBox(*m_xVisitedLB, pView->GetDocShell());
-::FillCharStyleListBox(*m_xNotVisitedLB, pView->GetDocShell());
+if (SwView* pView = GetActiveView())
+{
+::FillCharStyleListBox(*m_xVisitedLB, pView->GetDocShell());
+::FillCharStyleListBox(*m_xNotVisitedLB, pView->GetDocShell());
+}
 m_xVisitedLB->set_active_id(OUString::number(RES_POOLCHR_INET_VISIT));
 m_xVisitedLB->save_value();
 m_xNotVisitedLB->set_active_id(OUString::number(RES_POOLCHR_INET_NORMAL));
@@ -302,8 +304,9 @@ IMPL_LINK_NOARG(SwCharURLPage, InsertFileHdl, 
weld::Button&, void)
 
 IMPL_LINK_NOARG(SwCharURLPage, EventHdl, weld::Button&, void)
 {
-bModified |= SwMacroAssignDlg::INetFormatDlg(GetFrameWeld(),
-::GetActiveView()->GetWrtShell(), m_oINetMacroTable);
+if (SwView* pView = GetActiveView())
+bModified |= SwMacroAssignDlg::INetFormatDlg(GetFrameWeld(),
+pView->GetWrtShell(), m_oINetMacroTable);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/chrdlg/drpcps.cxx b/sw/source/ui/chrdlg/drpcps.cxx
index 1ecb6cefeddc..32509c5018ca 100644
--- a/sw/source/ui/chrdlg/drpcps.cxx
+++ b/sw/source/ui/chrdlg/drpcps.cxx
@@ -169,10 +169,15 @@ bool SwDropCapsPict::GetNextScriptSegment(size_t , 
sal_Int32 , sal_In
 #define LINES  10
 #define BORDER  2
 
-void SwDropCapsPict::GetFontSettings( const SwDropCapsPage& _rPage, vcl::Font& 
_rFont, sal_uInt16 _nWhich )
+void SwDropCapsPict::GetFontSettings( vcl::Font& _rFont, sal_uInt16 _nWhich )
 {
-SfxItemSet aSet( _rPage.rSh.GetAttrPool(), _nWhich, _nWhich);
-_rPage.rSh.GetCurAttr(aSet);
+SwView* pView = GetActiveView();
+if (!pView)
+return;
+SwWrtShell& rWrtShell = pView->GetWrtShell();
+SfxItemSet aSet( rWrtShell.GetAttrPool(), _nWhich, _nWhich);
+

[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2023-03-18 Thread Xisco Fauli (via logerrit)
 sw/source/uibase/app/docsh2.cxx |   11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

New commits:
commit 1b93a30a113e45cbf67b0683e233568e40446deb
Author: Xisco Fauli 
AuthorDate: Thu Mar 16 16:26:17 2023 +0100
Commit: Caolán McNamara 
CommitDate: Sat Mar 18 21:55:36 2023 +

sw: fix null dereference

See 
https://crashreport.libreoffice.org/stats/signature/SfxDispatcher::ExecuteList(unsigned%20short,SfxCallMode,std::initializer_list%3CSfxPoolItem%20const%20*%3E,std::initializer_list%3CSfxPoolItem%20const%20*%3E)

Change-Id: I7f5471f003798f260d9d015782bd2a798baa22d2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148999
Reviewed-by: Caolán McNamara 
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 
(cherry picked from commit 11ce7e810ef5ba540afe676d58575fabf4ab386d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149019

diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index e5b7b63c43d0..83ea01b75b91 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -1185,11 +1185,12 @@ void SwDocShell::Execute(SfxRequest& rReq)
 // Ok.  I did my best.
 break;
 
-SfxStringItem aApp(SID_DOC_SERVICE, 
"com.sun.star.text.TextDocument");
-SfxStringItem aTarget(SID_TARGETNAME, "_blank");
-pViewShell->GetDispatcher()->ExecuteList(SID_OPENDOC,
-SfxCallMode::API|SfxCallMode::SYNCHRON,
-{ ,  });
+if (SfxDispatcher* pDispatch = pViewShell->GetDispatcher())
+{
+SfxStringItem aApp(SID_DOC_SERVICE, 
"com.sun.star.text.TextDocument");
+SfxStringItem aTarget(SID_TARGETNAME, "_blank");
+pDispatch->ExecuteList(SID_OPENDOC, 
SfxCallMode::API|SfxCallMode::SYNCHRON, { ,  });
+}
 }
 break;
 case SID_CLASSIFICATION_APPLY:


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2023-03-08 Thread Miklos Vajna (via logerrit)
 sw/source/core/layout/flowfrm.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 1ec152e4f725207f9e06b49ed689e5f1b8ec
Author: Miklos Vajna 
AuthorDate: Tue Mar 7 08:42:42 2023 +0100
Commit: Xisco Fauli 
CommitDate: Wed Mar 8 10:54:14 2023 +

sw: fix crash in GetUpperSpaceAmountConsideredForPrevFrameAndPageGrid()

Crashreport signature:

program/libswlo.so
  SwFlowFrame::GetUpperSpaceAmountConsideredForPrevFrameAndPageGrid() 
const
  sw/source/core/layout/flowfrm.cxx:1741
program/libswlo.so
  objectpositioning::SwAnchoredObjectPosition::GetTopForObjPos(SwFrame 
const&, SwRectFnCollection* const&, bool) const
  include/svl/itemset.hxx:101
program/libswlo.so
  objectpositioning::SwToContentAnchoredObjectPosition::CalcPosition()
  
sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx:1020
program/libswlo.so
  SwAnchoredDrawObject::MakeObjPosAnchoredAtPara()
  sw/source/core/layout/anchoreddrawobject.cxx:424

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

diff --git a/sw/source/core/layout/flowfrm.cxx 
b/sw/source/core/layout/flowfrm.cxx
index 891ff1574bb6..78c3a34ca09b 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -1737,6 +1737,11 @@ SwTwips 
SwFlowFrame::GetUpperSpaceAmountConsideredForPrevFrameAndPageGrid() cons
 {
 SwTwips nUpperSpaceAmountConsideredForPrevFrameAndPageGrid = 0;
 
+if (!m_rThis.GetUpper() || !m_rThis.GetUpper()->GetFormat())
+{
+return nUpperSpaceAmountConsideredForPrevFrameAndPageGrid;
+}
+
 if ( 
!m_rThis.GetUpper()->GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::USE_FORMER_OBJECT_POS)
 )
 {
 nUpperSpaceAmountConsideredForPrevFrameAndPageGrid =


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2023-02-27 Thread Caolán McNamara (via logerrit)
 sw/source/filter/html/swhtml.cxx |   24 
 1 file changed, 12 insertions(+), 12 deletions(-)

New commits:
commit 0dec4da8a3441353afa65de81f30d316e6500606
Author: Caolán McNamara 
AuthorDate: Sat Feb 25 21:54:46 2023 +
Commit: Xisco Fauli 
CommitDate: Mon Feb 27 11:30:31 2023 +

RES_LR_SPACE should fall through to default not RES_BACKGROUND

due to

commit 29dfcc7521311e547fc069466cc3edc9fcbdbe03
Date:   Mon Nov 23 16:17:37 2015 +0100

tdf#94088 add import of HTML inline graphics

splitting the condition that used to fall through to default handling
with an unrelated RES_BACKGROUND case instead

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

diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index c5b33a847560..4fb2f1184356 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -2953,18 +2953,6 @@ void SwHTMLParser::SetAttr_( bool bChkEnd, bool 
bBeforeTable,
 pAttr = pPrev;
 continue;
 
-case RES_LR_SPACE:
-if( aAttrPam.GetPoint()->nNode.GetIndex() ==
-aAttrPam.GetMark()->nNode.GetIndex())
-{
-// because of numbering set this attribute directly at 
node
-pCNd->SetAttr( *pAttr->m_pItem );
-break;
-}
-OSL_ENSURE( false,
-"LRSpace set over multiple paragraphs!" );
-[[fallthrough]]; // (shouldn't reach this point anyway)
-
 // tdf#94088 expand RES_BACKGROUND to the new fill attribute
 // definitions in the range [XATTR_FILL_FIRST .. 
XATTR_FILL_LAST].
 // This is the right place in the future if the adapted fill 
attributes
@@ -2978,6 +2966,18 @@ void SwHTMLParser::SetAttr_( bool bChkEnd, bool 
bBeforeTable,
 
m_xDoc->getIDocumentContentOperations().InsertItemSet(aAttrPam, aNewSet, 
SetAttrMode::DONTREPLACE);
 break;
 }
+
+case RES_LR_SPACE:
+if( aAttrPam.GetPoint()->nNode.GetIndex() ==
+aAttrPam.GetMark()->nNode.GetIndex())
+{
+// because of numbering set this attribute directly at 
node
+pCNd->SetAttr( *pAttr->m_pItem );
+break;
+}
+OSL_ENSURE( false,
+"LRSpace set over multiple paragraphs!" );
+[[fallthrough]]; // (shouldn't reach this point anyway)
 default:
 
 // maybe jump to a bookmark


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2023-02-17 Thread Xisco Fauli (via logerrit)
 sw/source/ui/config/optload.cxx |9 -
 sw/source/ui/fldui/flddb.cxx|   25 -
 sw/source/ui/fldui/fldfunc.cxx  |2 +-
 sw/source/ui/fldui/fldref.cxx   |   17 +
 sw/source/ui/fmtui/tmpdlg.cxx   |   34 --
 sw/source/ui/frmdlg/frmpage.cxx |   30 +-
 sw/source/ui/frmdlg/wrap.cxx|4 ++--
 sw/source/uibase/app/appopt.cxx |   25 +++--
 sw/source/uibase/utlui/content.cxx  |   11 +++
 sw/source/uibase/utlui/glbltree.cxx |   17 ++---
 10 files changed, 101 insertions(+), 73 deletions(-)

New commits:
commit e790bcace8109cbcce618f92e12afcb7dbc629f9
Author: Xisco Fauli 
AuthorDate: Thu Feb 16 12:38:55 2023 +0100
Commit: Caolán McNamara 
CommitDate: Fri Feb 17 12:10:21 2023 +

check GetActiveWrtShell() and CheckAndGetWrtShell()

See 
https://crashreport.libreoffice.org/stats/signature/SwModule::ApplyItemSet(unsigned%20short,SfxItemSet%20const%20&)
Change-Id: I7c719c5fe4cda9f6571592c30f39bd440053dbe9

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

diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx
index 1885c06ecf9d..af62e10f7fdf 100644
--- a/sw/source/ui/config/optload.cxx
+++ b/sw/source/ui/config/optload.cxx
@@ -464,10 +464,11 @@ SwCaptionOptPage::SwCaptionOptPage(weld::Container* 
pPage, weld::DialogControlle
 SwStyleNameMapper::FillUIName(RES_POOLCOLL_LABEL_FRAME, m_sText);
 SwStyleNameMapper::FillUIName(RES_POOLCOLL_LABEL_DRAWING, m_sDrawing);
 
-SwWrtShell* pSh = ::GetActiveWrtShell();
 
 // m_xFormatBox
 sal_uInt16 nSelFormat = SVX_NUM_ARABIC;
+SwWrtShell* pSh = ::GetActiveWrtShell();
+
 if (pSh)
 {
 for ( auto i = pMgr->GetFieldTypeCount(); i; )
@@ -663,13 +664,12 @@ void SwCaptionOptPage::UpdateEntry(int nSelEntry)
 m_xCategory->set_sensitive(bChecked);
 m_xPreview->set_sensitive(bChecked);
 
-SwWrtShell *pSh = ::GetActiveWrtShell();
 
 InsCaptionOpt* pOpt = 
weld::fromId(m_xCheckLB->get_id(nSelEntry));
 
 m_xCategoryBox->clear();
 m_xCategoryBox->append_text(m_sNone);
-if (pSh)
+if (::GetActiveWrtShell())
 {
 const size_t nCount = pMgr->GetFieldTypeCount();
 
@@ -867,8 +867,7 @@ void SwCaptionOptPage::InvalidatePreview()
 aStr += m_xCategoryBox->get_active_text() + " ";
 }
 
-SwWrtShell *pSh = ::GetActiveWrtShell();
-if (pSh)
+if (SwWrtShell *pSh = ::GetActiveWrtShell())
 {
 SwSetExpFieldType* pFieldType = 
static_cast(pMgr->GetFieldType(
 SwFieldIds::SetExp, 
m_xCategoryBox->get_active_text() ));
diff --git a/sw/source/ui/fldui/flddb.cxx b/sw/source/ui/fldui/flddb.cxx
index 3293a6bc670d..62dd538f01e0 100644
--- a/sw/source/ui/fldui/flddb.cxx
+++ b/sw/source/ui/fldui/flddb.cxx
@@ -73,7 +73,7 @@ SwFieldDBPage::SwFieldDBPage(weld::Container* pPage, 
weld::DialogController* pCo
 SwFieldDBPage::~SwFieldDBPage()
 {
 // If we have no stored SwWrtShell, it means we didn't do anything useful 
- no need to revoke.
-if (SwWrtShell* pSh = GetWrtShell())
+if (SwWrtShell* pSh = CheckAndGetWrtShell())
 {
 // This would cleanup in the case of cancelled dialog
 SwDBManager* pDbManager = pSh->GetDoc()->GetDBManager();
@@ -140,8 +140,7 @@ void SwFieldDBPage::Reset(const SfxItemSet*)
 }
 else
 {
-SwWrtShell *pSh = CheckAndGetWrtShell();
-if(pSh)
+if (SwWrtShell *pSh = CheckAndGetWrtShell())
 {
 SwDBData aTmp(pSh->GetDBData());
 m_xDatabaseTLB->Select(aTmp.sDataSource, aTmp.sCommand, u"");
@@ -197,15 +196,16 @@ bool SwFieldDBPage::FillItemSet(SfxItemSet* )
 aData.sDataSource = m_xDatabaseTLB->GetDBName(sTableName, sColumnName, 
);
 aData.sCommand = sTableName;
 aData.nCommandType = bIsTable ? 0 : 1;
-SwWrtShell *pSh = CheckAndGetWrtShell();
-assert(pSh);
 
-SwDBManager* pDbManager = pSh->GetDoc()->GetDBManager();
-if (pDbManager)
-pDbManager->CommitLastRegistrations();
+if (SwWrtShell *pSh = CheckAndGetWrtShell())
+{
+SwDBManager* pDbManager = pSh->GetDoc()->GetDBManager();
+if (pDbManager)
+pDbManager->CommitLastRegistrations();
 
-if (aData.sDataSource.isEmpty())
-aData = pSh->GetDBData();
+if (aData.sDataSource.isEmpty())
+aData = pSh->GetDBData();
+}
 
 if(!aData.sDataSource.isEmpty())   // without database no new field 
command
 {
@@ -292,8 +292,6 @@ void SwFieldDBPage::TypeHdl(const weld::TreeView* pBox)
 if (nOld == 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2023-02-16 Thread Xisco Fauli (via logerrit)
 sw/source/core/access/accselectionhelper.cxx |   13 +
 sw/source/core/doc/tblrwcl.cxx   |6 --
 sw/source/core/docnode/ndtbl.cxx |   22 +++---
 sw/source/core/undo/untbl.cxx|3 ++-
 sw/source/core/unocore/unotbl.cxx|3 ++-
 sw/source/ui/vba/vbadocumentproperties.cxx   |5 +
 sw/source/ui/vba/vbaselection.cxx|5 +
 sw/source/uibase/app/docst.cxx   |7 +--
 sw/source/uibase/shells/textsh1.cxx  |3 ++-
 9 files changed, 37 insertions(+), 30 deletions(-)

New commits:
commit 8a0be96c7ccbd433b5cba5d9d814178cf8a5d026
Author: Xisco Fauli 
AuthorDate: Wed Feb 15 17:06:33 2023 +0100
Commit: Caolán McNamara 
CommitDate: Thu Feb 16 10:11:52 2023 +

check GetFEShell()

Similar to 24889135773204c6e3002dcb417c75ff1a99ccd0
"check GetEditShell()"

These two crash reports might be related:
- https://crashreport.libreoffice.org/stats/signature/SwView::GetDocShell()
- 
https://crashreport.libreoffice.org/stats/signature/SwFEShell::UpdateTableStyleFormatting(SwTableNode%20*,bool,rtl::OUString%20const%20*)

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

diff --git a/sw/source/core/access/accselectionhelper.cxx 
b/sw/source/core/access/accselectionhelper.cxx
index 3372f434c5a1..96a622ece9f7 100644
--- a/sw/source/core/access/accselectionhelper.cxx
+++ b/sw/source/core/access/accselectionhelper.cxx
@@ -87,8 +87,7 @@ void SwAccessibleSelectionHelper::selectAccessibleChild(
 
 // we can only select fly frames, so we ignore (should: return
 // false) all other attempts at child selection
-SwFEShell* pFEShell = GetFEShell();
-if( pFEShell != nullptr )
+if (GetFEShell())
 {
 const SdrObject *pObj = aChild.GetDrawObject();
 if( pObj )
@@ -141,8 +140,7 @@ bool SwAccessibleSelectionHelper::isAccessibleChildSelected(
 
 // ... and compare to the currently selected frame
 bool bRet = false;
-const SwFEShell* pFEShell = GetFEShell();
-if( pFEShell )
+if (const SwFEShell* pFEShell = GetFEShell())
 {
 if ( aChild.GetSwFrame() != nullptr )
 {
@@ -171,7 +169,7 @@ void 
SwAccessibleSelectionHelper::selectAllAccessibleChildren(  )
 // the first we can select, and select it.
 
 SwFEShell* pFEShell = GetFEShell();
-if( !pFEShell )
+if (!pFEShell)
 return;
 
 std::list< SwAccessibleChild > aChildren;
@@ -197,8 +195,7 @@ sal_Int32 
SwAccessibleSelectionHelper::getSelectedAccessibleChildCount(  )
 sal_Int32 nCount = 0;
 // Only one frame can be selected at a time, and we only frames
 // for selectable children.
-const SwFEShell* pFEShell = GetFEShell();
-if( pFEShell != nullptr )
+if (const SwFEShell* pFEShell = GetFEShell())
 {
 const SwFlyFrame* pFlyFrame = pFEShell->GetSelectedFlyFrame();
 if( pFlyFrame )
@@ -250,7 +247,7 @@ Reference 
SwAccessibleSelectionHelper::getSelectedAccessibleChild(
 // be 0, and a selection must exist, otherwise we have to throw an
 // lang::IndexOutOfBoundsException
 SwFEShell* pFEShell = GetFEShell();
-if( nullptr == pFEShell )
+if (!pFEShell)
 throwIndexOutOfBoundsException();
 
 SwAccessibleChild aChild;
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index 4dde7b3e6192..b169b9d8391b 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -506,7 +506,8 @@ bool SwTable::InsertCol( SwDoc& rDoc, const SwSelBoxes& 
rBoxes, sal_uInt16 nCnt,
 pPCD->AddRowCols( *this, rBoxes, nCnt, bBehind );
 rDoc.UpdateCharts( GetFrameFormat()->GetName() );
 
-rDoc.GetDocShell()->GetFEShell()->UpdateTableStyleFormatting();
+if (SwFEShell* pFEShell = rDoc.GetDocShell()->GetFEShell())
+pFEShell->UpdateTableStyleFormatting();
 
 return bRes;
 }
@@ -625,7 +626,8 @@ bool SwTable::InsertRow_( SwDoc* pDoc, const SwSelBoxes& 
rBoxes,
 pPCD->AddRowCols( *this, rBoxes, nCnt, bBehind );
 pDoc->UpdateCharts( GetFrameFormat()->GetName() );
 
-pDoc->GetDocShell()->GetFEShell()->UpdateTableStyleFormatting(pTableNd);
+if (SwFEShell* pFEShell = pDoc->GetDocShell()->GetFEShell())
+pFEShell->UpdateTableStyleFormatting(pTableNd);
 
 return true;
 }
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 4a6ee962f65a..edeb5b7cb2ba 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -2101,7 +2101,8 @@ bool SwDoc::DeleteRowCol(const SwSelBoxes& rBoxes, 
RowColMode const eMode)
 getIDocumentContentOperations().DeleteSection( pTableNd );
 }
 
-GetDocShell()->GetFEShell()->UpdateTableStyleFormatting();
+if (SwFEShell* pFEShell = 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2023-02-15 Thread Miklos Vajna (via logerrit)
 sw/source/uibase/uiview/view.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 68f7599f6e7a8a8d1f209bc44e4cf28c7672825b
Author: Miklos Vajna 
AuthorDate: Wed Feb 8 09:04:14 2023 +0100
Commit: Christian Lohmaier 
CommitDate: Wed Feb 15 17:02:20 2023 +

sw: fix crash in SwView::AttrChangedNotify()

Crashreport signature:

program/../program/libswlo.so
SwView::AttrChangedNotify(LinkParamNone*)
sw/source/uibase/uiview/view.cxx:507
program/../program/libswlo.so
SwWrtShell::DrawSelChanged()
sw/source/uibase/wrtsh/wrtsh3.cxx:261
program/../program/libswlo.so
SwDrawView::MarkListHasChanged()
sw/source/core/draw/dview.cxx:767
program/libmergedlo.so
SdrMarkView::MarkObj(SdrObject*, SdrPageView*, bool, bool, 
std::vector >&&)
svx/source/svdraw/svdmrkv.cxx:2196
program/../program/libswlo.so
SwDrawContact::DisconnectFromLayout(bool)

/opt/rh/devtoolset-10/root/usr/include/c++/10/bits/stl_vector.h:336

This seems to happen when the SwDrawContent delete is in progress, so
we no longer have the shells at hand that are usually present.

Change-Id: Iba0601654c946b85e7c2de33fe76d99b26a20eae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147052
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins
(cherry picked from commit dab3de66e057f8d6794c427fb38cb2e333dfc93f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147060
Reviewed-by: Christian Lohmaier 

diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx
index 03085bcfc248..0808b37a71f8 100644
--- a/sw/source/uibase/uiview/view.cxx
+++ b/sw/source/uibase/uiview/view.cxx
@@ -528,6 +528,11 @@ IMPL_LINK_NOARG(SwView, AttrChangedNotify, LinkParamNone*, 
void)
 if ( GetEditWin().IsChainMode() )
 GetEditWin().SetChainMode( false );
 
+if (!m_pWrtShell || !GetDocShell())
+{
+return;
+}
+
 //Opt: Not if PaintLocked. During unlock a notify will be once more 
triggered.
 if( !m_pWrtShell->IsPaintLocked() && !g_bNoInterrupt &&
 GetDocShell()->IsReadOnly() )


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2023-02-15 Thread Michael Stahl (via logerrit)
 sw/source/core/inc/cntfrm.hxx  |2 -
 sw/source/core/inc/txtfrm.hxx  |2 -
 sw/source/core/layout/calcmove.cxx |8 +++---
 sw/source/core/layout/unusedf.cxx  |2 -
 sw/source/core/text/itrform2.cxx   |   47 ++---
 sw/source/core/text/itrform2.hxx   |2 -
 sw/source/core/text/txtfrm.cxx |   43 ++---
 sw/source/core/text/widorp.cxx |   29 --
 sw/source/core/text/widorp.hxx |2 -
 9 files changed, 118 insertions(+), 19 deletions(-)

New commits:
commit d31b30a6bb044bedd4e296c4cbb3e0fc9c2cb7b6
Author: Michael Stahl 
AuthorDate: Fri Oct 14 16:59:42 2022 +0200
Commit: Xisco Fauli 
CommitDate: Wed Feb 15 11:40:56 2023 +

tdf#146500 sw: try to fix some layout loops caused by fly in table cell

Reportedly regression from commit 1cb7e4899b5ada902e99a0c964ee047950c07044
but reverting that on master doesn't seem to help.

Inserting paragraphs with single letters into the first cell on page 2,
once we get to "s" and press Enter, the infinite loop happens as text
frame 56 is split at index 0 (where a fly is anchored), the new follow
moves to page 3, and very quickly frame 56 is formatted again and all
text in the follow moves back to page 2, where it doesn't fit with its
anchored fly.

The problem here is that the (Word format) file sets the
ConsiderObjWrapInfluenceOnObjPos mode, which disables any use of the
SwLayouter::FrameMovedFwdByObjPos() etc. functions.

Oddly enough the spec obj-pos-without-wrapping.sxw claims that in this
mode, "If a paragraph respectively one of the anchor characters moves to
the next page during its format in step (2) or (4), the process is
re-started with this paragraph, the complete paragraph is moved to the
next page and it is assured that the paragraph doesn't move back again."

What happens instead is that when a fly position is changed, its
mbRestartLayoutProcess flag is set.

So let's try to check this flag during SwTextFrame::Format(): stop at a
position where a fly is anchored in a follow frame that has the flag
set, via rInf.SetStop(true).

This is similar to a check in SwFlowFrame::MoveBwd() that prevents a
frame from moving back if it has an anchored fly with this flag set.

Now we get a different loop, where the text frame moves forward, then
back and then splits again.

This is because ShouldBwdMoved() sees that the first line of the text
frame fits into the cell of the previous page - but the first line
consists only of a SwFlyPortion and a SwMarginPortion, for the fly
anchored in the same text frame.

So change WidowsAndOrphans::WouldFit() to continue until the first line
that doesn't consist entirely of flys.

Then there's another loop where the follow flow row is joined and then
splits again - this is very similar to the previous problem, change
SwTextFrame::FirstLineHeight() (which is only called from table code) to
continue until a non-fly line as well.

Unforunately this is all not so clear because we can't actually tell
which text frame contains the anchor of a SwFlyPortion, so let's see
what's going to break with these changes.

Change-Id: Ia6e80f86f6ca3d2e3d91651b6a403c050d74ebfa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141383
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 8c32cc17ce914188ea6783b0f79e19c5ddbf0b8d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146698
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/core/inc/cntfrm.hxx b/sw/source/core/inc/cntfrm.hxx
index cf47396eb4d9..b972a7aaafd8 100644
--- a/sw/source/core/inc/cntfrm.hxx
+++ b/sw/source/core/inc/cntfrm.hxx
@@ -106,7 +106,7 @@ public:
 // nMaxHeight is the required height
 // bSplit indicates that the paragraph has to be split
 // bTst indicates that we are currently doing a test formatting
-virtual bool WouldFit( SwTwips , bool , bool bTst );
+virtual bool WouldFit(SwTwips , bool , bool bTst, bool);
 
 bool MoveFootnoteCntFwd( bool, SwFootnoteBossFrame* ); // called by 
MoveFwd if content
 
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index 1ba2c832081d..0ff2321bc375 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -483,7 +483,7 @@ public:
  * bSplit indicates, that the paragraph has to be split
  * bTst indicates, that we are currently doing a test formatting
  */
-virtual bool WouldFit( SwTwips , bool , bool bTst ) 
override;
+virtual bool WouldFit(SwTwips , bool , bool bTst, bool 
bMoveBwd) override;
 
 /**
  * The WouldFit equivalent for temporarily rewired TextFrames
diff --git a/sw/source/core/layout/calcmove.cxx 
b/sw/source/core/layout/calcmove.cxx
index 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2023-02-14 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/fields/docufld.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 77f447190396ca9b1bd77e3cf3b99f24116049ef
Author: Bjoern Michaelsen 
AuthorDate: Sat Feb 11 23:52:01 2023 +0100
Commit: Michael Stahl 
CommitDate: Tue Feb 14 14:49:21 2023 +

tdf#134283: MakeSetList should iterate Setters, not Getters

Change-Id: I811a3b562ead942c98705da29774b77c593eabc4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146828
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 75a863ee7fea133ae6bcd010d1aac46815fa49e2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146978

diff --git a/sw/source/core/fields/docufld.cxx 
b/sw/source/core/fields/docufld.cxx
index 289061a283e5..45793b4928bf 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -2227,7 +2227,7 @@ bool SwRefPageGetFieldType::MakeSetList(SetGetExpFields& 
rTmpLst,
 {
 IDocumentRedlineAccess const& rIDRA(m_rDoc.getIDocumentRedlineAccess());
 std::vector vFields;
-GatherFields(vFields);
+
m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::RefPageSet)->GatherFields(vFields);
 for(auto pFormatField: vFields)
 {
 // update only the GetRef fields


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2023-02-10 Thread Xisco Fauli (via logerrit)
 sw/source/uibase/app/applab.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 72e99627fedc65084ff0aff29b0b54a224a77fab
Author: Xisco Fauli 
AuthorDate: Thu Feb 9 14:36:51 2023 +0100
Commit: Xisco Fauli 
CommitDate: Fri Feb 10 10:54:25 2023 +

sw: fix crash in SwModule::InsertLab

Seen in 
https://crashreport.libreoffice.org/stats/crash_details/e17357e9-d5e2-4eee-868e-ecf72e04dc41

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

diff --git a/sw/source/uibase/app/applab.cxx b/sw/source/uibase/app/applab.cxx
index 1ea666ccdf61..7ee421ed5ee7 100644
--- a/sw/source/uibase/app/applab.cxx
+++ b/sw/source/uibase/app/applab.cxx
@@ -181,6 +181,8 @@ void SwModule::InsertLab(SfxRequest& rReq, bool bLabel)
 }
 
 SfxViewFrame* pViewFrame = SfxViewFrame::DisplayNewDocument( *xDocSh, rReq 
);
+if (!pViewFrame)
+return;
 
 SwView  *pNewView = static_cast( pViewFrame->GetViewShell());
 pNewView->AttrChangedNotify(nullptr);// So that SelectShell is being 
called.


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2023-02-09 Thread Caolán McNamara (via logerrit)
 sw/source/core/layout/ftnfrm.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 59d37768321e2975efa2c8be5513d178de899eba
Author: Caolán McNamara 
AuthorDate: Mon Feb 6 21:04:23 2023 +
Commit: Michael Stahl 
CommitDate: Thu Feb 9 10:59:17 2023 +

Related: tdf#153319 don't destroy frame with IsDeleteForbidden set

not sufficient on its own to fix this crash.

Change-Id: Ibd8b68d7e007d8a22770b3d73f0d17a1869cf279
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146598
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit df2ad816288a4729c9cea8d14b7d590ac271d18b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146627
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx
index db4c4f9213d9..652436eb4548 100644
--- a/sw/source/core/layout/ftnfrm.cxx
+++ b/sw/source/core/layout/ftnfrm.cxx
@@ -2420,7 +2420,8 @@ void SwFootnoteBossFrame::RearrangeFootnotes( const 
SwTwips nDeadLine, const boo
 if ( !bLock && bUnlockLastFootnoteFrame &&
  !pLastFootnoteFrame->GetLower() &&
  !pLastFootnoteFrame->IsColLocked() &&
- !pLastFootnoteFrame->IsBackMoveLocked() )
+ !pLastFootnoteFrame->IsBackMoveLocked() &&
+ !pLastFootnoteFrame->IsDeleteForbidden() )
 {
 pLastFootnoteFrame->Cut();
 SwFrame::DestroyFrame(pLastFootnoteFrame);


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2023-02-02 Thread Michael Stahl (via logerrit)
 sw/source/core/inc/flyfrms.hxx   |2 ++
 sw/source/core/layout/flylay.cxx |   13 +
 2 files changed, 15 insertions(+)

New commits:
commit 88a5c26334f392fcddfc5a1e62c3a482fbf72fe6
Author: Michael Stahl 
AuthorDate: Tue Dec 20 21:04:05 2022 +0100
Commit: Caolán McNamara 
CommitDate: Thu Feb 2 09:49:28 2023 +

tdf#146875 sw: move also at-frame flys off SwPageFrame

The bugdoc contains an at-frame anchored fly on page 77, which is
anchored to an at-page anchored fly.

While layouting page 74, the fly is moved to page 77, and the content on
page 74 invalidated.

Unexpectedly, calling RegisterAtPage on a SwFlyLayFrame does absolutely
nothing, as it calls the base class SwFlyFrame, so the fly stays on page
74.

Thus, page 74 never actually becomes valid, and later pages are never
layouted.

(regression from commit eb85de8e6b61fb3fcb6c03ae0145f7fe5478bccf)

Change-Id: I4fcbed4daf83f9e554de5a877a40b2c2419c0f2f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144631
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit abef9ea8aa99561e6f84451acf387abde4ec14ab)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144658
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/inc/flyfrms.hxx b/sw/source/core/inc/flyfrms.hxx
index 1f346a9d90e4..cf79bf2fe92b 100644
--- a/sw/source/core/inc/flyfrms.hxx
+++ b/sw/source/core/inc/flyfrms.hxx
@@ -150,6 +150,8 @@ public:
 // #i28701#
 
 SwFlyLayFrame( SwFlyFrameFormat*, SwFrame*, SwFrame *pAnchor );
+
+virtual void RegisterAtPage(SwPageFrame &) override;
 virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
 };
 
diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx
index 48b95e15060e..209ca1fcfbf0 100644
--- a/sw/source/core/layout/flylay.cxx
+++ b/sw/source/core/layout/flylay.cxx
@@ -720,6 +720,19 @@ SwFlyLayFrame::SwFlyLayFrame( SwFlyFrameFormat *pFormat, 
SwFrame* pSib, SwFrame
 m_bLayout = true;
 }
 
+void SwFlyLayFrame::RegisterAtPage(SwPageFrame & rPageFrame)
+{
+assert(GetPageFrame() != );
+if (GetPageFrame())
+{
+GetPageFrame()->MoveFly( this,  );
+}
+else
+{
+rPageFrame.AppendFlyToPage( this );
+}
+}
+
 // #i28701#
 
 void SwFlyLayFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2023-01-27 Thread Caolán McNamara (via logerrit)
 sw/source/core/inc/SwUndoPageDesc.hxx  |2 ++
 sw/source/core/undo/SwUndoPageDesc.cxx |   12 
 2 files changed, 14 insertions(+)

New commits:
commit b39c4353fecc168c6752aacd74e2b483ce05
Author: Caolán McNamara 
AuthorDate: Thu Jan 26 15:05:36 2023 +
Commit: Xisco Fauli 
CommitDate: Fri Jan 27 08:38:30 2023 +

tdf#153220 exit header/footer edit mode, if active, on undo header/footer

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

diff --git a/sw/source/core/inc/SwUndoPageDesc.hxx 
b/sw/source/core/inc/SwUndoPageDesc.hxx
index c8d88f6cbd04..ab90a3a65b5f 100644
--- a/sw/source/core/inc/SwUndoPageDesc.hxx
+++ b/sw/source/core/inc/SwUndoPageDesc.hxx
@@ -34,6 +34,8 @@ class SwUndoPageDesc final : public SwUndo
 // To avoid duplication of (header/footer)content nodes for simple page 
desc changes
 void ExchangeContentNodes( SwPageDesc& rSource, SwPageDesc  );
 
+// tdf#153220 use to Exit HeaderFooter EditMode
+void ExitHeaderFooterEdit();
 public:
 SwUndoPageDesc(const SwPageDesc & aOld, const SwPageDesc & aNew,
SwDoc * pDoc);
diff --git a/sw/source/core/undo/SwUndoPageDesc.cxx 
b/sw/source/core/undo/SwUndoPageDesc.cxx
index 0ec97951ed85..eec1300d5e67 100644
--- a/sw/source/core/undo/SwUndoPageDesc.cxx
+++ b/sw/source/core/undo/SwUndoPageDesc.cxx
@@ -18,6 +18,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -216,12 +217,22 @@ void SwUndoPageDesc::ExchangeContentNodes( SwPageDesc& 
rSource, SwPageDesc 
 pNewFormat->SetFormatAttr( SwFormatContent() );
 }
 
+void SwUndoPageDesc::ExitHeaderFooterEdit()
+{
+SwEditShell* pESh = m_pDoc->GetEditShell();
+if (!pESh)
+return;
+if (pESh->IsHeaderFooterEdit())
+pESh->ToggleHeaderFooterEdit();
+}
+
 void SwUndoPageDesc::UndoImpl(::sw::UndoRedoContext &)
 {
 // Move (header/footer)content node responsibility from new page 
descriptor to old one again.
 if( m_bExchange )
 ExchangeContentNodes( m_aNew.m_PageDesc, m_aOld.m_PageDesc );
 m_pDoc->ChgPageDesc(m_aOld.GetName(), m_aOld);
+ExitHeaderFooterEdit();
 }
 
 void SwUndoPageDesc::RedoImpl(::sw::UndoRedoContext &)
@@ -230,6 +241,7 @@ void SwUndoPageDesc::RedoImpl(::sw::UndoRedoContext &)
 if( m_bExchange )
 ExchangeContentNodes( m_aOld.m_PageDesc, m_aNew.m_PageDesc );
 m_pDoc->ChgPageDesc(m_aNew.GetName(), m_aNew);
+ExitHeaderFooterEdit();
 }
 
 SwRewriter SwUndoPageDesc::GetRewriter() const


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2023-01-23 Thread Caolán McNamara (via logerrit)
 sw/source/core/access/accpara.cxx |   19 +++
 1 file changed, 11 insertions(+), 8 deletions(-)

New commits:
commit 9c86a3f4378b1421b8970a426ba66bc62e82750c
Author: Caolán McNamara 
AuthorDate: Sat Jan 21 16:20:29 2023 +
Commit: Xisco Fauli 
CommitDate: Mon Jan 23 09:58:44 2023 +

rhbz#2162862 null pFrame during teardown

Change-Id: Iad2de93f0400b0ec49dae4c3d6979957784114f4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145935
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 
(cherry picked from commit 2e3b1a683f490384bedd925cb57dc9bc9f5c6cf1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145944

diff --git a/sw/source/core/access/accpara.cxx 
b/sw/source/core/access/accpara.cxx
index 94a1df603c4a..f3b0d90709dc 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -433,15 +433,18 @@ bool SwAccessibleParagraph::HasCursor()
 void SwAccessibleParagraph::UpdatePortionData()
 {
 // obtain the text frame
-OSL_ENSURE( GetFrame() != nullptr, "The text frame has vanished!" );
-OSL_ENSURE( GetFrame()->IsTextFrame(), "The text frame has mutated!" );
 const SwTextFrame* pFrame = static_cast( GetFrame() );
-
-// build new portion data
-m_pPortionData.reset( new SwAccessiblePortionData(
-pFrame, GetMap()->GetShell()->GetViewOptions()) );
-pFrame->VisitPortions( *m_pPortionData );
-
+OSL_ENSURE( pFrame != nullptr, "The text frame has vanished!" );
+if (!pFrame)
+ClearPortionData();
+else
+{
+OSL_ENSURE( pFrame->IsTextFrame(), "The text frame has mutated!" );
+// build new portion data
+m_pPortionData.reset( new SwAccessiblePortionData(
+pFrame, GetMap()->GetShell()->GetViewOptions()) );
+pFrame->VisitPortions( *m_pPortionData );
+}
 OSL_ENSURE( m_pPortionData != nullptr, "UpdatePortionData() failed" );
 }
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2023-01-20 Thread Michael Stahl (via logerrit)
 sw/source/core/crsr/bookmark.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit a725379632dd9ebf9308b76ca76aeaebb96a8e46
Author: Michael Stahl 
AuthorDate: Thu Jan 19 18:45:39 2023 +0100
Commit: Miklos Vajna 
CommitDate: Fri Jan 20 14:44:15 2023 +

sw: crashtesting forum-mso-en-12641.docx, fix assert in FindFieldSep

The fieldmark may overlap a section; at the start was considered here,
but at the end was not and so the assertion wrongly fired.

Change-Id: I118bc36c2d9c4ca7028a583278d0f193537c4cb2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145826
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 959f64dbb85d1785dbea5a4d2a41519c98769a7c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145802
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/core/crsr/bookmark.cxx b/sw/source/core/crsr/bookmark.cxx
index a33cb1c1eab0..af2dc2bad387 100644
--- a/sw/source/core/crsr/bookmark.cxx
+++ b/sw/source/core/crsr/bookmark.cxx
@@ -111,7 +111,8 @@ namespace sw::mark
 }
 else
 {
-assert(pNode->IsNoTextNode() || pNode->IsSectionNode());
+assert(pNode->IsNoTextNode() || pNode->IsSectionNode()
+|| (pNode->IsEndNode() && 
pNode->StartOfSectionNode()->IsSectionNode()));
 }
 }
 assert(ret); // must have found it


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2023-01-20 Thread Caolán McNamara (via logerrit)
 sw/source/core/crsr/crsrsh.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit a8d70435eeeadf73b24dbb9fa035935b9da7ad4e
Author: Caolán McNamara 
AuthorDate: Fri Jan 20 09:21:46 2023 +
Commit: Caolán McNamara 
CommitDate: Fri Jan 20 12:39:45 2023 +

Resolves: tdf#153116 null-ptr-deref in get-surrounding-text

 #0  SwFrame::IsTextFrame() const (this=0x0) at 
sw/source/core/inc/frame.hxx:1236
 #1  0x7fffa8dcb865 in sw::FrameContainsNode(SwContentFrame const&, 
o3tl::strong_int) (rFrame=..., nNodeIndex=...) at 
sw/source/core/text/txtfrm.cxx:292
 #2  0x7fffa82c9fd4 in SwCursorShell::GetSelText() const 
(this=0x5509470) at sw/source/core/crsr/crsrsh.cxx:2565
 #3  0x7fffa89017f0 in SwEditShell::GetSelectedText(rtl::OUString&, 
ParaBreakType) (this=0x5509470, rBuf="", nHndlParaBrk=ParaBreakType::ToOnlyCR)
 at sw/source/core/edit/edglss.cxx:264
 #4  0x7fffa97e19a7 in SwEditWin::GetSurroundingText() const 
(this=0x4f1a9f0) at sw/source/uibase/docvw/edtwin.cxx:6628
 #5  0x7fffee27cf02 in ImplHandleSurroundingTextRequest(vcl::Window*, 
rtl::OUString&, Selection&) (pWindow=0x1fe43f0, rText="", rSelRange=...) at 
vcl/source/window/winproc.cxx:2544
 #6  0x7fffee27adf7 in 
ImplHandleSalSurroundingTextRequest(vcl::Window*, 
SalSurroundingTextRequestEvent*) (pWindow=0x1fe43f0, pEvt=0x7fffb970)
 at vcl/source/window/winproc.cxx:2555
 #7  0x7fffee276ed6 in ImplWindowFrameProc(vcl::Window*, SalEvent, void 
const*) (_pWindow=0x1fe43f0, nEvent=SalEvent::SurroundingTextRequest, 
pEvent=0x7fffb970)
 at vcl/source/window/winproc.cxx:2884
 #8  0x7fffe6ee3080 in SalFrame::CallCallback(SalEvent, void const*) 
const (this=0x1898310, nEvent=SalEvent::SurroundingTextRequest, 
pEvent=0x7fffb970) at vcl/inc/salframe.hxx:306

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

diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index a2abb6a6e5e9..4817c422a51c 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -2562,7 +2562,7 @@ OUString SwCursorShell::GetSelText() const
 if (GetLayout()->HasMergedParas())
 {
 SwContentFrame const*const pFrame(GetCurrFrame(false));
-if (FrameContainsNode(*pFrame, 
m_pCurrentCursor->GetMark()->nNode.GetIndex()))
+if (pFrame && FrameContainsNode(*pFrame, 
m_pCurrentCursor->GetMark()->nNode.GetIndex()))
 {
 OUStringBuffer buf;
 SwPosition const*const pStart(m_pCurrentCursor->Start());


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2023-01-17 Thread Caolán McNamara (via logerrit)
 sw/source/uibase/docvw/HeaderFooterWin.cxx |9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit cd0ea49d95fcb3af5b7408c9bbea553480a12f92
Author: Caolán McNamara 
AuthorDate: Tue Jan 17 10:25:54 2023 +
Commit: Xisco Fauli 
CommitDate: Tue Jan 17 20:35:45 2023 +

Resolves: tdf#153059 after ChangeHeaderOrFooter the control can be disposed

If the cursor is still on page one then when a header, via a control on
another page, is added it jumps back to that page, so the widget on the
now hidden page is removed, but the click handler hasn't completed so
the follow up action to change it from a "plus" button to a dropdown
menubutton was on a disposed widget.

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

diff --git a/sw/source/uibase/docvw/HeaderFooterWin.cxx 
b/sw/source/uibase/docvw/HeaderFooterWin.cxx
index 07ce07197846..6c184c6fecff 100644
--- a/sw/source/uibase/docvw/HeaderFooterWin.cxx
+++ b/sw/source/uibase/docvw/HeaderFooterWin.cxx
@@ -549,8 +549,13 @@ IMPL_LINK_NOARG(SwHeaderFooterWin, ClickHdl, 
weld::Button&, void)
 
 const SwPageFrame* pPageFrame = 
SwFrameMenuButtonBase::GetPageFrame(m_pFrame);
 const OUString& rStyleName = pPageFrame->GetPageDesc()->GetName();
-rSh.ChangeHeaderOrFooter( rStyleName, m_bIsHeader, true, false );
-
+{
+VclPtr xThis(this);
+rSh.ChangeHeaderOrFooter( rStyleName, m_bIsHeader, true, false );
+//tdf#153059 after ChangeHeaderOrFooter is it possible that "this" is 
disposed
+if (xThis->isDisposed())
+return;
+}
 m_xPushButton->hide();
 m_xMenuButton->show();
 PaintButton();


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2023-01-17 Thread Michael Stahl (via logerrit)
 sw/source/core/doc/DocumentRedlineManager.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit bdef7bbcd9e51f1272b006962c17ca0b2493205a
Author: Michael Stahl 
AuthorDate: Tue Dec 20 14:52:40 2022 +0100
Commit: Caolán McNamara 
CommitDate: Tue Jan 17 13:53:56 2023 +

tdf#150823 sw: merge delete redlines in same paragraph

The problematic merge was with a redline that spanned multiple nodes.

(regression from commit 7d730cd580e957ab06b0c7f020ac37dd0c337aa2)

Change-Id: Ie3fd23d102056b45833314143ec6381c1e9ef373
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144615
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 5cd8ea4d8a4fa8c5ac8e28be8fbc240caf070ff4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144624
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx 
b/sw/source/core/doc/DocumentRedlineManager.cxx
index 0a1076db29f4..caa1e97b0297 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -1679,7 +1679,8 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* 
pNewRedl, bool const bCall
 break;
 
 case SwComparePosition::CollideEnd:
-if (pRStt->nContent != 0)
+if (pRStt->nContent != 0
+&& pRStt->nNode != pREnd->nNode)
 {   // tdf#147466 HACK: don't combine in this case to 
avoid the tdf#119571 code from *undeleting* section nodes
 break;
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source xmloff/source

2023-01-08 Thread Michael Stahl (via logerrit)
 sw/source/core/doc/DocumentContentOperationsManager.cxx |   22 +---
 sw/source/core/doc/doccorr.cxx  |7 +++--
 sw/source/filter/xml/XMLRedlineImportHelper.cxx |5 +--
 xmloff/source/text/XMLChangedRegionImportContext.cxx|   11 +---
 xmloff/source/text/txtparai.cxx |   17 +---
 5 files changed, 47 insertions(+), 15 deletions(-)

New commits:
commit 94246148b215b10062e1d425fec8f1647ff3ffea
Author: Michael Stahl 
AuthorDate: Thu Jan 5 12:32:09 2023 +0100
Commit: Caolán McNamara 
CommitDate: Sun Jan 8 20:31:00 2023 +

tdf#152710 sw: invalidate SwUnoCursors properly in DeleteRangeImpl()

This crashes with:

 list.cxx:44: corrupt document structure, bailing out of infinite loop
 ndtxt.cxx:5437: void SwTextNode::TriggerNodeUpdate(const 
sw::LegacyModifyHint&): Assertion `dynamic_cast(static_cast(pOldValue)->pChangedFormat)' failed.

Because the redline from 7 to 9 is deleted, but then some cursor ends up
on node 10 which is invalid as it is an end node.

[   6] 0x60666a0StartNode ,
[   7]  0x61195e0   StartNode ,
[   8]   0x61197a8   TextNode "tainment",
[   9]  0x6119670 EndNode ,
[  10] 0x6066730  EndNode ,

The first problem is that DeleteRangeImpl() uses the point node as the
target position for PaMCorrAbs(), but in this case the point node will
be deleted.

PaMCorrAbs() has a check to invalidate SwUnoCursors that would be moved
out of their parent sections, but due to the first problem it can't
check it, and the second problem is that lcl_FindUnoCursorSection()
doesn't work on redline sections, as those have node type
SwNormalStartNode.

After fixing the invalidation, subsequent access to the SwXTextCursor
throws exceptions and importing the file fails.

(regression from commit 477e489e71b4a96ff10d9f2d2b802d91dec3e319)

Thanks to Dave Gilbert for identifying the problematic DeleteRange()
call.

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145077
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 8e05bdd26f21fc304978ff3b454cf355841ec75f)

tdf#152710 sw: call and fix DeleteSection() instead

Turns out there's a function to delete a complete nodes array section -
and it has the same problem?  Why does it move indexes only from
startnode + 1?  Let's try to fix it to be more consistent.

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145078
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 475e59d29b7a6cc7f058af8ff863b3bb1a2a84a5)

tdf#152710 xmloff: ignore exception in XMLChangedRegionImportContext

The xOldCursor must be restored in all cases.

Also XMLParaContext triggers an exception which ends up aborting the
import.

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145094
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit e5b5d9c8d33b1dd87e5a50856ad02f21df59dc5b)

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

diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 962cea631e5f..4b4404f4550e 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -2094,6 +2094,18 @@ DocumentContentOperationsManager::CopyRange( SwPaM& 
rPam, SwPosition& rPos,
 return bRet;
 }
 
+static auto GetCorrPosition(SwPaM const& rPam) -> SwPosition
+{
+// tdf#152710 target position must be on node that survives deletion
+// so that PaMCorrAbs can invalidate SwUnoCursors properly
+return rPam.GetPoint()->nNode.GetNode().IsContentNode()
+? *rPam.GetPoint()
+: rPam.GetMark()->nNode.GetNode().IsContentNode()
+? *rPam.GetMark()
+// this would be the result in SwNodes::RemoveNode()
+: SwPosition(SwNodeIndex(rPam.End()->nNode.GetNode(), 
SwNodeOffset(+1)));
+}
+
 /// Delete a full Section of the NodeArray.
 /// The passed Node is located somewhere in the designated Section.
 void DocumentContentOperationsManager::DeleteSection( SwNode *pNode )
@@ -2111,8 +2123,9 @@ void DocumentContentOperationsManager::DeleteSection( 
SwNode *pNode )
 
 {
 // move all Cursor/StackCursor/UnoCursor out of the to-be-deleted area
-SwNodeIndex aMvStt( aSttIdx, 1 );
-SwDoc::CorrAbs( aMvStt, aEndIdx, SwPosition( aSttIdx ), true );
+SwPaM const range(aSttIdx, aEndIdx);
+SwPosition const pos(GetCorrPosition(range));
+::PaMCorrAbs(range, pos);
 }
 
 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-12-23 Thread Caolán McNamara (via logerrit)
 sw/source/core/crsr/pam.cxx   |9 +++--
 sw/source/core/crsr/swcrsr.cxx|   11 --
 sw/source/core/doc/CntntIdxStore.cxx  |2 -
 sw/source/core/doc/DocumentTimerManager.cxx   |4 +-
 sw/source/core/doc/doccorr.cxx|6 +--
 sw/source/core/doc/docdesc.cxx|2 -
 sw/source/core/doc/tblafmt.cxx|6 +--
 sw/source/core/docnode/ndtbl.cxx  |8 +---
 sw/source/core/edit/edfcol.cxx|   10 +++---
 sw/source/core/fields/ddefld.cxx  |3 -
 sw/source/core/frmedt/fetab.cxx   |7 ++--
 sw/source/core/layout/frmtool.cxx |   13 +--
 sw/source/core/sw3io/swacorr.cxx  |8 +++-
 sw/source/core/txtnode/txtedt.cxx |   22 +++--
 sw/source/core/undo/docundo.cxx   |3 -
 sw/source/core/undo/unsect.cxx|3 -
 sw/source/core/undo/untbl.cxx |9 -
 sw/source/core/unocore/unoframe.cxx   |3 -
 sw/source/uibase/app/docstyle.cxx |9 +
 sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx |   30 +-
 sw/source/uibase/uno/SwXDocumentSettings.cxx  |3 -
 21 files changed, 93 insertions(+), 78 deletions(-)

New commits:
commit 14e8be9b2dd46f5514128f384865ab3a49b96324
Author: Caolán McNamara 
AuthorDate: Thu Dec 22 15:40:46 2022 +
Commit: Xisco Fauli 
CommitDate: Fri Dec 23 12:44:24 2022 +

check GetEditShell()

Change-Id: I975c7dca9ea569e326fc5d8670a078959ab9f093
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144730
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144782

diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index 0a2b1f087844..78bdbe36571d 100644
--- a/sw/source/core/crsr/pam.cxx
+++ b/sw/source/core/crsr/pam.cxx
@@ -762,19 +762,20 @@ bool SwPaM::HasReadonlySel( bool bFormView ) const
 // Allow editing when the cursor/selection is fully inside of a legacy 
form field.
 bRet = !( pA != nullptr && !bAtStartA && !bAtStartB && pA == pB );
 
-if (bRet && rDoc.GetEditShell() && 
rDoc.GetEditShell()->CursorInsideContentControl())
+if (bRet)
 {
 // Also allow editing inside content controls in general, similar 
to form fields.
 // Specific types will be disabled below.
-bRet = false;
+if (const SwEditShell* pEditShell = rDoc.GetEditShell())
+bRet = !pEditShell->CursorInsideContentControl();
 }
 }
 
 if (!bRet)
 {
 // Paragraph Signatures and Classification fields are read-only.
-if (rDoc.GetEditShell())
-bRet = rDoc.GetEditShell()->IsCursorInParagraphMetadataField();
+if (const SwEditShell* pEditShell = rDoc.GetEditShell())
+bRet = pEditShell->IsCursorInParagraphMetadataField();
 }
 
 if (!bRet &&
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index 4456909334ca..6a3c8aa21119 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -1794,9 +1794,10 @@ bool SwCursor::LeftRight( bool bLeft, sal_uInt16 nCnt, 
sal_uInt16 nMode,
 
 if ( !Move( fnMove, fnGo ) )
 {
-SwEditShell* rSh = GetDoc().GetEditShell();
-if (rSh && rSh->GetViewOptions() &&
-
rSh->GetViewOptions()->IsShowOutlineContentVisibilityButton())
+const SwEditShell* pSh = GetDoc().GetEditShell();
+const SwViewOption* pViewOptions = pSh ? pSh->GetViewOptions() : 
nullptr;
+if (pViewOptions && 
pViewOptions->IsShowOutlineContentVisibilityButton())
+{
 // Fixes crash that occurs in documents with outline content 
folded at the end of
 // the document. When the cursor is at the end of the visible 
document and
 // right arrow key is pressed Move fails after moving the 
cursor to the
@@ -1804,6 +1805,7 @@ bool SwCursor::LeftRight( bool bLeft, sal_uInt16 nCnt, 
sal_uInt16 nMode,
 // weird numbers to be displayed in the statusbar page number 
count. Left
 // arrow, when in this state, causes a crash without 
RestoredSavePos() added here.
 RestoreSavePos();
+}
 break;
 }
 
@@ -2116,7 +2118,8 @@ bool SwCursor::UpDown( bool bUp, sal_uInt16 nCnt,
 //Update cursor to change nUpDownX.
 if ( aOldPos.nContent.GetIndex() == nOffset )
 {
-GetDoc().GetEditShell()->UpdateCursor();
+if (SwEditShell* pSh = GetDoc().GetEditShell())
+

[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-12-22 Thread Xisco Fauli (via logerrit)
 sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 2c2398d234ddd6afae44af1ca92c3e43f7e7bfb3
Author: Xisco Fauli 
AuthorDate: Thu Dec 22 13:28:14 2022 +0100
Commit: Caolán McNamara 
CommitDate: Thu Dec 22 20:39:21 2022 +

sw: check for nullptr in WriterInspectorTextPanel

GetEditShell() in sw/source/core/doc/doccorr.cxx
might return nullptr

See 
https://crashreport.libreoffice.org/stats/crash_details/75a28cf5-cf45-4d36-a1aa-471a0ad9251a

Change-Id: I3de2dec461d590841d4ea3b7d98f384ee27ad4ad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144757
Tested-by: Jenkins
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 
(cherry picked from commit 37ca1154f392dd9eefad8250509652b845434793)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144723
Reviewed-by: Xisco Fauli 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144772

diff --git a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx 
b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
index dd28cc195c4c..8f92235f01fb 100644
--- a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
+++ b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
@@ -74,7 +74,8 @@ 
WriterInspectorTextPanel::WriterInspectorTextPanel(weld::Widget* pParent)
 
 // Update panel on start
 std::vector aStore;
-if (pDocSh && 
pDocSh->GetDoc()->GetEditShell()->GetCursor()->GetNode().GetTextNode())
+if (pDocSh && pDocSh->GetDoc()->GetEditShell()
+&& 
pDocSh->GetDoc()->GetEditShell()->GetCursor()->GetNode().GetTextNode())
 UpdateTree(pDocSh, aStore, m_nParIdx);
 updateEntries(aStore, m_nParIdx);
 }
@@ -737,7 +738,8 @@ IMPL_LINK(WriterInspectorTextPanel, AttrChangedNotify, 
LinkParamNone*, pLink, vo
 SwDocShell* pDocSh = m_pShell->GetDoc()->GetDocShell();
 std::vector aStore;
 
-if (pDocSh && 
pDocSh->GetDoc()->GetEditShell()->GetCursor()->GetNode().GetTextNode())
+if (pDocSh && pDocSh->GetDoc()->GetEditShell()
+&& 
pDocSh->GetDoc()->GetEditShell()->GetCursor()->GetNode().GetTextNode())
 UpdateTree(pDocSh, aStore, m_nParIdx);
 
 updateEntries(aStore, m_nParIdx);


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-12-22 Thread Xisco Fauli (via logerrit)
 sw/source/core/crsr/pam.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 7e989325f4f95f46110fc826d146f1e5dd544701
Author: Xisco Fauli 
AuthorDate: Thu Dec 22 12:47:56 2022 +0100
Commit: Xisco Fauli 
CommitDate: Thu Dec 22 19:23:07 2022 +

sw: check for nullptr

GetEditShell() in sw/source/core/doc/doccorr.cxx
might return nullptr

Introduced in 7cb6be3e866bad39a37844802d49b1f5c7031910
"tdf#151190 sw content controls: make them read-write in protected
sections"

See 
https://crashreport.libreoffice.org/stats/crash_details/5d1da2eb-b0e9-4974-b726-c7837c47cc63

Change-Id: Ia133c5d7a680c3bdfabe1c43c538cb5f54e7df73
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144756
Tested-by: Jenkins
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 
(cherry picked from commit 4c8517e7d89f7b87eeb36b2758a01d9dac515d5a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144725
Reviewed-by: Xisco Fauli 
(cherry picked from commit 88cb29a51ac3556301d02921c573b57d6218bc04)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144726

diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index 6dc26d2ac074..0a2b1f087844 100644
--- a/sw/source/core/crsr/pam.cxx
+++ b/sw/source/core/crsr/pam.cxx
@@ -762,7 +762,7 @@ bool SwPaM::HasReadonlySel( bool bFormView ) const
 // Allow editing when the cursor/selection is fully inside of a legacy 
form field.
 bRet = !( pA != nullptr && !bAtStartA && !bAtStartB && pA == pB );
 
-if (bRet && rDoc.GetEditShell()->CursorInsideContentControl())
+if (bRet && rDoc.GetEditShell() && 
rDoc.GetEditShell()->CursorInsideContentControl())
 {
 // Also allow editing inside content controls in general, similar 
to form fields.
 // Specific types will be disabled below.


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-12-22 Thread Caolán McNamara (via logerrit)
 sw/source/core/unocore/unofield.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 3293a3a78491d86cd799e741d212299df280db2c
Author: Caolán McNamara 
AuthorDate: Mon Jun 27 21:29:11 2022 +0100
Commit: Michael Stahl 
CommitDate: Thu Dec 22 09:05:34 2022 +

crashtesting: failure on load of forum-en-7529.odt

==324198== Invalid read of size 8
==324198==at 0x2D840D75: std::__uniq_ptr_impl >::_M_ptr() const (unique_ptr.h:191)
==324198==by 0x2D840D54: std::unique_ptr >::get() const (unique_ptr.h:462)
==324198==by 0x2D932B9B: SwFormatField::GetField() (fmtfld.hxx:122)
==324198==by 0x2E740E7B: SwXTextField::Impl::GetField() const 
(unofield.cxx:2634)
==324198==by 0x2E7487EB: SwXTextField::setPropertyValue(rtl::OUString 
const&, com::sun::star::uno::Any const&) (unofield.cxx:2150)
==324198==by 0x1100C123: 
XMLPropertyBackpatcher::ResolveId(rtl::OUString const&, short) 
(XMLPropertyBackpatcher.cxx:73)
==324198==by 0x1100BB0F: 
XMLTextImportHelper::InsertFootnoteID(rtl::OUString const&, short) 
(XMLPropertyBackpatcher.cxx:180)
==324198==by 0x10FF7E71: 
XMLFootnoteImportContext::startFastElement(int, 
com::sun::star::uno::Reference 
const&) (XMLFootnoteImportContext.cxx:99)
==324198==by 0x10C40361: SvXMLImport::startFastElement(int, 
com::sun::star::uno::Reference 
const&) (xmlimp.cxx:812)
==324198==by 0x28FBFE71: (anonymous 
namespace)::Entity::startElement((anonymous namespace)::Event const*) 
(fastparser.cxx:470)
==324198==by 0x28FBED4E: 
sax_fastparser::FastSaxParserImpl::callbackStartElement(unsigned char const*, 
unsigned char const*, unsigned char const*, int, unsigned char const**, int, 
unsigned char const**) (fastparser.cxx:1304)
==324198==by 0x28FBCCAF: (anonymous 
namespace)::call_callbackStartElement(void*, unsigned char const*, unsigned 
char const*, unsigned char const*, int, unsigned char const**, int, int, 
unsigned char const**) (fastparser.cxx:333)
==324198==  Address 0x259e2b68 is 328 bytes inside a block of size 344 
free'd
==324198==at 0x4848669: operator delete(void*) (vg_replace_malloc.c:923)
==324198==by 0x2E4EC2B1: SwFormatField::~SwFormatField() 
(atrfld.cxx:132)
==324198==by 0x8635DA2: SfxItemPool::Remove(SfxPoolItem const&) 
(itempool.cxx:802)
==324198==by 0x2E5BB014: SwTextAttr::Destroy(SwTextAttr*, SfxItemPool&) 
(txatbase.cxx:63)
==324198==by 0x2E594EE2: SwTextNode::DestroyAttr(SwTextAttr*) 
(thints.cxx:1302)
==324198==by 0x2E55C4EC: SwTextNode::~SwTextNode() (ndtxt.cxx:238)
==324198==by 0x2E55CB38: SwTextNode::~SwTextNode() (ndtxt.cxx:227)
==324198==by 0x2DEE048F: SwNodes::RemoveNode(o3tl::strong_int, o3tl::strong_int, bool) 
(nodes.cxx:2325)
==324198==by 0x2DEE50C2: SwNodes::DelNodes(SwNodeIndex const&, 
o3tl::strong_int) (nodes.cxx:1384)
==324198==by 0x2DC87B02: 
sw::DocumentContentOperationsManager::DeleteSection(SwNode*) 
(DocumentContentOperationsManager.cxx:2118)
==324198==by 0x2DD2BB66: 
sw::DocumentLayoutManager::DelLayoutFormat(SwFrameFormat*) 
(DocumentLayoutManager.cxx:285)
==324198==by 0x2DB0900E: DelFlyInRange(SwNodeIndex const&, SwNodeIndex 
const&, SwIndex const*, SwIndex const*) (docedt.cxx:254)

maybe this is a problem since the various changes associated with:

commit 2c9298e4f667a5dd7606d79890fcedfff0f66e26
Date:   Fri Apr 5 23:14:47 2019 +0200

SwXTextField::Impl FieldTypeClient: SwClient no more

commit e18359445fabad9ba1a704600e9ee327112cc6ae
Date:   Sun Apr 14 13:33:35 2019 +0200

[API CHANGE] SwXTextField: no more SwModify/SwClient

Change-Id: I52aa0a70604ea5ce96d2b55a9a2ad363a889f58e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136515
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit ad387d5b984c906505d25685065f710ed55d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144670
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/unocore/unofield.cxx 
b/sw/source/core/unocore/unofield.cxx
index 945ee2dca67d..abe754f62b4f 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -1967,6 +1967,7 @@ void SAL_CALL SwXTextField::attach(
 if (!pTextAttr)
 throw uno::RuntimeException("no SwTextAttr inserted?");  // could 
theoretically happen, if paragraph is full
 
+m_pImpl->ClearFieldType();
 const SwFormatField& rField = pTextAttr->GetFormatField();
 m_pImpl->SetFormatField(const_cast(), pDoc);
 
@@ -1990,7 +1991,6 @@ void SAL_CALL SwXTextField::attach(
 m_pImpl->GetFormatField()->SetXTextField(this);
 m_pImpl->m_wThis = *this;
 m_pImpl->m_bIsDescriptor = false;
-m_pImpl->ClearFieldType();
 m_pImpl->m_pProps.reset();
 if (m_pImpl->m_bCallUpdate)
 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-12-20 Thread Michael Stahl (via logerrit)
 sw/source/core/table/swnewtable.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit d1be953521e84465ea2665adc703e53068ac8971
Author: Michael Stahl 
AuthorDate: Tue Dec 20 17:44:49 2022 +0100
Commit: Caolán McNamara 
CommitDate: Tue Dec 20 20:33:27 2022 +

sw: ODF import: fix assert in SwTable::ConvertSubtableBox()

Assert in swnewtable.cxx:2179 fires:

For ooo98643-1.odt the conversion is not possible, the default for row
height is "variable" which wasn't handled.

For ooo27428-1.sxw the conversion is possible so remove the assert;
the sum of the inner row fixed height is just smaller than the outer
row's but unsurprisingly the subtables is layouted such that the last
row gets the extra space, same as the conversion does.

(regression from commit 4757dfc2a520f63fba0b27cc161fe732231dbd0e)

Change-Id: I2635179f350c8b5b84016dc82625b73364df92a2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144622
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit a8c7e5ea607fbc5451a167ada35c6dff9c89abf6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144610
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/table/swnewtable.cxx 
b/sw/source/core/table/swnewtable.cxx
index c632f86b693b..36607971fc24 100644
--- a/sw/source/core/table/swnewtable.cxx
+++ b/sw/source/core/table/swnewtable.cxx
@@ -2176,7 +2176,6 @@ void SwTable::ConvertSubtableBox(sal_uInt16 const nRow, 
sal_uInt16 const nBox)
 && outerSize.GetHeightSizeType() != SwFrameSize::Variable
 && minHeights < outerSize.GetHeight())
 {
-assert(false); // this should be impossible currently, such 
subtable isn't converted because layout is needed to determine how much space 
is taken up by variable height rows
 SwFormatFrameSize 
lastSize(pNewLine->GetFrameFormat()->GetFrameSize());
 lastSize.SetHeight(lastSize.GetHeight() + outerSize.GetHeight() - 
minHeights);
 if (lastSize.GetHeightSizeType() == SwFrameSize::Variable)
@@ -2326,6 +2325,10 @@ bool SwTable::CanConvertSubtables() const
 haveNonFixedInnerLine = true;
 }
 }
+else
+{
+haveNonFixedInnerLine = true; // default
+}
 for (SwTableBox const*const pInnerBox : 
pInnerLine->GetTabBoxes())
 {
 if (!pInnerBox->GetTabLines().empty())


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-12-20 Thread Caolán McNamara (via logerrit)
 sw/source/core/unocore/unofield.cxx |   11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

New commits:
commit d109630ec481b826ab5df728191694e9a67ce7a4
Author: Caolán McNamara 
AuthorDate: Sun Dec 18 21:12:24 2022 +
Commit: Xisco Fauli 
CommitDate: Tue Dec 20 08:51:29 2022 +

crashtesting: related to failure on load of forum-en-7529.odt

save SwDoc* before calling DeleteAndJoin, so SetFormatField doesn't
use m_pImpl->m_pDoc potentially cleared by it

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

diff --git a/sw/source/core/unocore/unofield.cxx 
b/sw/source/core/unocore/unofield.cxx
index 53eb083e8156..945ee2dca67d 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -1999,7 +1999,8 @@ void SAL_CALL SwXTextField::attach(
   && m_pImpl->m_pDoc != nullptr
   && m_pImpl->m_nServiceId == SwServiceType::FieldTypeAnnotation )
 {
-SwUnoInternalPaM aIntPam( *m_pImpl->m_pDoc );
+SwDoc* pDoc = m_pImpl->m_pDoc;
+SwUnoInternalPaM aIntPam( *pDoc );
 if ( !::sw::XTextRangeToSwPaM( aIntPam, xTextRange ) )
 throw lang::IllegalArgumentException();
 
@@ -2007,13 +2008,13 @@ void SAL_CALL SwXTextField::attach(
 // value.
 if (!aIntPam.HasMark() || *aIntPam.Start() != *aIntPam.End())
 {
-UnoActionContext aCont( m_pImpl->m_pDoc );
+UnoActionContext aCont( pDoc );
 // insert copy of annotation at new text range
 std::unique_ptr pPostItField(static_cast< 
SwPostItField* >(m_pImpl->GetFormatField()->GetField()->CopyField().release()));
 SwFormatField aFormatField( *pPostItField );
 pPostItField.reset();
 SwPaM aEnd( *aIntPam.End(), *aIntPam.End() );
-m_pImpl->m_pDoc->getIDocumentContentOperations().InsertPoolItem( 
aEnd, aFormatField );
+pDoc->getIDocumentContentOperations().InsertPoolItem( aEnd, 
aFormatField );
 // delete former annotation
 {
 const SwTextField* pTextField = 
m_pImpl->GetFormatField()->GetTextField();
@@ -2021,14 +2022,14 @@ void SAL_CALL SwXTextField::attach(
 SwPaM aPam( rTextNode, pTextField->GetStart() );
 aPam.SetMark();
 aPam.Move();
-
m_pImpl->m_pDoc->getIDocumentContentOperations().DeleteAndJoin(aPam);
+pDoc->getIDocumentContentOperations().DeleteAndJoin(aPam);
 }
 // keep inserted annotation
 {
 SwTextField* pTextAttr = 
aEnd.GetNode().GetTextNode()->GetFieldTextAttrAt( 
aEnd.End()->nContent.GetIndex()-1, true );
 if ( pTextAttr != nullptr )
 {
-
m_pImpl->SetFormatField(const_cast(>GetFormatField()),
 m_pImpl->m_pDoc);
+
m_pImpl->SetFormatField(const_cast(>GetFormatField()),
 pDoc);
 
 if ( *aIntPam.GetPoint() != *aIntPam.GetMark() )
 {


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-12-15 Thread Caolán McNamara (via logerrit)
 sw/source/ui/fldui/fldtdlg.cxx  |7 -
 sw/source/ui/index/swuiidxmrk.cxx   |   15 
 sw/source/uibase/app/docst.cxx  |3 +-
 sw/source/uibase/envelp/syncbtn.cxx |3 +-
 sw/source/uibase/ribbar/workctrl.cxx|   14 +++
 sw/source/uibase/sidebar/PageOrientationControl.cxx |   25 +++-
 6 files changed, 43 insertions(+), 24 deletions(-)

New commits:
commit 30d73367f40c375121609a9878b1c9717429eae1
Author: Caolán McNamara 
AuthorDate: Thu Dec 15 16:48:09 2022 +
Commit: Caolán McNamara 
CommitDate: Thu Dec 15 21:05:17 2022 +

sw: check SfxViewFrame::Current()

these ones looks potentially worth backporting

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

diff --git a/sw/source/ui/fldui/fldtdlg.cxx b/sw/source/ui/fldui/fldtdlg.cxx
index 53e5a51c6eaf..f2d0768d34c2 100644
--- a/sw/source/ui/fldui/fldtdlg.cxx
+++ b/sw/source/ui/fldui/fldtdlg.cxx
@@ -180,8 +180,11 @@ void SwFieldDlg::ReInitDlg()
 
 if (bNewMode != m_bHtmlMode)
 {
-SfxViewFrame::Current()->GetDispatcher()->
-Execute(FN_INSERT_FIELD, 
SfxCallMode::ASYNCHRON|SfxCallMode::RECORD);
+if (SfxViewFrame* pViewFrm = SfxViewFrame::Current())
+{
+pViewFrm->GetDispatcher()->
+Execute(FN_INSERT_FIELD, 
SfxCallMode::ASYNCHRON|SfxCallMode::RECORD);
+}
 Close();
 }
 
diff --git a/sw/source/ui/index/swuiidxmrk.cxx 
b/sw/source/ui/index/swuiidxmrk.cxx
index 442dbed88f8b..1075d75f4d2b 100644
--- a/sw/source/ui/index/swuiidxmrk.cxx
+++ b/sw/source/ui/index/swuiidxmrk.cxx
@@ -685,8 +685,11 @@ IMPL_LINK_NOARG(SwIndexMarkPane, CloseHdl, weld::Button&, 
void)
 {
 if (m_bNewMark)
 {
-
SfxViewFrame::Current()->GetDispatcher()->Execute(FN_INSERT_IDX_ENTRY_DLG,
-SfxCallMode::ASYNCHRON|SfxCallMode::RECORD);
+if (SfxViewFrame* pViewFrm = SfxViewFrame::Current())
+{
+pViewFrm->GetDispatcher()->Execute(FN_INSERT_IDX_ENTRY_DLG,
+SfxCallMode::ASYNCHRON|SfxCallMode::RECORD);
+}
 }
 else
 {
@@ -818,7 +821,8 @@ IMPL_LINK_NOARG(SwIndexMarkPane, DelHdl, weld::Button&, 
void)
 else
 {
 CloseHdl(*m_xCloseBT);
-
SfxViewFrame::Current()->GetBindings().Invalidate(FN_EDIT_IDX_ENTRY_DLG);
+if (SfxViewFrame* pViewFrm = SfxViewFrame::Current())
+pViewFrm->GetBindings().Invalidate(FN_EDIT_IDX_ENTRY_DLG);
 }
 }
 
@@ -1217,8 +1221,11 @@ IMPL_LINK_NOARG(SwAuthorMarkPane, CloseHdl, 
weld::Button&, void)
 {
 if(bNewEntry)
 {
-
SfxViewFrame::Current()->GetDispatcher()->Execute(FN_INSERT_AUTH_ENTRY_DLG,
+if (SfxViewFrame* pViewFrm = SfxViewFrame::Current())
+{
+pViewFrm->GetDispatcher()->Execute(FN_INSERT_AUTH_ENTRY_DLG,
 SfxCallMode::ASYNCHRON|SfxCallMode::RECORD);
+}
 }
 else
 {
diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx
index 2d34c0e51e3a..6ab7e659ae92 100644
--- a/sw/source/uibase/app/docst.cxx
+++ b/sw/source/uibase/app/docst.cxx
@@ -1180,7 +1180,8 @@ SfxStyleFamily SwDocShell::ApplyStyles(const OUString 
, SfxStyleFamily nFa
 const SwNumRule* pNumRule = pStyle->GetNumRule();
 if (pNumRule->GetName() == SwResId(STR_POOLNUMRULE_NOLIST))
 {
-
SfxViewFrame::Current()->GetDispatcher()->Execute(FN_NUM_BULLET_OFF);
+if (SfxViewFrame* pViewFrm = SfxViewFrame::Current())
+pViewFrm->GetDispatcher()->Execute(FN_NUM_BULLET_OFF);
 break;
 }
 const OUString sListIdForStyle =pNumRule->GetDefaultListId();
diff --git a/sw/source/uibase/envelp/syncbtn.cxx 
b/sw/source/uibase/envelp/syncbtn.cxx
index 009525d02ce5..d00ff4913cbe 100644
--- a/sw/source/uibase/envelp/syncbtn.cxx
+++ b/sw/source/uibase/envelp/syncbtn.cxx
@@ -81,7 +81,8 @@ SwSyncBtnDlg::~SwSyncBtnDlg()
 
 IMPL_STATIC_LINK_NOARG(SwSyncBtnDlg, BtnHdl, weld::Button&, void)
 {
-SfxViewFrame::Current()->GetDispatcher()->Execute(FN_UPDATE_ALL_LINKS, 
SfxCallMode::ASYNCHRON);
+if (SfxViewFrame* pViewFrm = SfxViewFrame::Current())
+pViewFrm->GetDispatcher()->Execute(FN_UPDATE_ALL_LINKS, 
SfxCallMode::ASYNCHRON);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/ribbar/workctrl.cxx 
b/sw/source/uibase/ribbar/workctrl.cxx
index e65a376f7592..da64e0df90ac 100644
--- a/sw/source/uibase/ribbar/workctrl.cxx
+++ b/sw/source/uibase/ribbar/workctrl.cxx
@@ -419,10 +419,11 @@ void SwZoomBox_Impl::Select()
 m_xWidget->set_entry_text(m_xWidget->get_saved_value());
 }
 
-SfxObjectShell* 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-12-15 Thread Caolán McNamara (via logerrit)
 sw/source/uibase/uiview/viewsrch.cxx |   10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 3fe2c0a1864bb775c2e35166eb0019ab18e9c661
Author: Caolán McNamara 
AuthorDate: Thu Dec 15 16:20:31 2022 +
Commit: Xisco Fauli 
CommitDate: Thu Dec 15 20:12:21 2022 +

likely fix for frequent SfxViewFrame::GetChildWindow() crash

crash report id: 58e9a91e-9feb-4eb4-a28e-27921d3e1b99

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

diff --git a/sw/source/uibase/uiview/viewsrch.cxx 
b/sw/source/uibase/uiview/viewsrch.cxx
index 04831dfccac9..118116423e45 100644
--- a/sw/source/uibase/uiview/viewsrch.cxx
+++ b/sw/source/uibase/uiview/viewsrch.cxx
@@ -821,9 +821,13 @@ SvxSearchDialog* SwView::GetSearchDialog()
 {
 #if HAVE_FEATURE_DESKTOP
 const sal_uInt16 nId = SvxSearchDialogWrapper::GetChildWindowId();
-SvxSearchDialogWrapper *pWrp = static_cast( 
SfxViewFrame::Current()->GetChildWindow(nId) );
-auto pSrchDlg = pWrp ? pWrp->getDialog() : nullptr;
-return pSrchDlg;
+SfxViewFrame* pFrame = SfxViewFrame::Current();
+if (!pFrame)
+return nullptr;
+SvxSearchDialogWrapper *pWrp = 
static_cast(pFrame->GetChildWindow(nId));
+if (!pWrp)
+return nullptr;
+return pWrp->getDialog();
 #else
 return nullptr;
 #endif


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-12-14 Thread Caolán McNamara (via logerrit)
 sw/source/core/unocore/unochart.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 65e5486f6db884a5ef6e30abc41a6dc06d1cfb1a
Author: Caolán McNamara 
AuthorDate: Wed Dec 14 11:10:33 2022 +
Commit: Xisco Fauli 
CommitDate: Wed Dec 14 15:41:31 2022 +

Resolves: tdf#151753 'revert coverity#1212509 Logically dead code'

revert 0d6f45377592a62ff4ee510d5fbd3bdd9e20160a:

coverity#1212509 Logically dead code

Change-Id: I8eb7355a94ce2c93faa18c77be63de41bccd3a99
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144159
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit 6880d32d851783a56c977872df5fbf11b507876a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144129
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/core/unocore/unochart.cxx 
b/sw/source/core/unocore/unochart.cxx
index e1b8e14e33f5..c8c282c1d50d 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -753,9 +753,9 @@ uno::Reference< chart2::data::XDataSource > 
SwChartDataProvider::Impl_createData
 {
 sal_Int32 nFirstSeqLen = 0;
 sal_Int32 nFirstSeqLabelIdx = -1;
-bool bFirstFound = false;
 for (oi = 0; oi < oiEnd; ++oi)
 {
+bool bFirstFound = false;
 // row/col used at all?
 if (aDataStartIdx[oi] != -1 &&
 (!bFirstIsLabel || aLabelIdx[oi] != -1))


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-12-08 Thread Khaled Hosny (via logerrit)
 sw/source/core/text/itrform2.cxx |2 --
 1 file changed, 2 deletions(-)

New commits:
commit c1553cf97e54baecb98c805b19e2913d776a33a7
Author: Khaled Hosny 
AuthorDate: Wed Dec 7 22:21:09 2022 +0200
Commit: Caolán McNamara 
CommitDate: Thu Dec 8 10:32:50 2022 +

tdf#152413: Revert "tdf#67669 - Make narrow no-break space visible by 
drawing

... a gray background"

This is breaking text layout involving Narrow No-Break Space because now
it goes into a portion of its own and gets laid out independent of the
surrounding text.

Lets revert this until we have a way to highlight text without breaking
text layout (e.g. tdf#61444).

This reverts:

commit bbb57e8198863ee7bdadd3f2aac4420c08da94a3
Author: Andreas Heinisch 
Date:   Wed Jul 27 08:53:11 2022 +0200

tdf#67669 - Make narrow no-break space visible by drawing a gray 
background

and its followup commit:

commit 01e3c998e63fbf456e7f624adb1cae3d89ed7bb2
Author: Andreas Heinisch 
Date:   Mon Aug 22 23:02:48 2022 +0200

tdf#67669 - Make narrow no-break space visible by drawing a gray 
background

Change-Id: I040a4f17d51cfea4f1e9bdcd3bc14a3bfc56b245
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143802
Tested-by: Jenkins
Reviewed-by: خالد حسني 
(cherry picked from commit f6935ce552ed625281104a10695de977a131b477)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143720
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index e86c8079c8d2..563ddd5c4c02 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -1503,8 +1503,6 @@ SwLinePortion *SwTextFormatter::NewPortion( 
SwTextFormatInfo  )
 case CHAR_SOFTHYPHEN:   // soft hyphen
 pPor = new SwSoftHyphPortion; break;
 
-// tdf#67669 - make narrow no-break space visible by drawing a 
gray background
-case CHAR_NNBSP:// narrow no-break space
 case CHAR_HARDBLANK:// no-break space
 // Please check tdf#115067 if you want to edit the char
 pPor = new SwBlankPortion( cChar ); break;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source vcl/source

2022-12-03 Thread Michael Stahl (via logerrit)
 sw/source/core/text/EnhancedPDFExportHelper.cxx |1 +
 vcl/source/gdi/pdfwriter_impl.cxx   |1 +
 2 files changed, 2 insertions(+)

New commits:
commit 8b11ca9243ca73a8234872a8f3b96701bf9f05a4
Author: Michael Stahl 
AuthorDate: Thu Nov 24 14:07:31 2022 +0100
Commit: Caolán McNamara 
CommitDate: Sat Dec 3 21:02:37 2022 +

vcl,sw: PDF/UA export: add BBox to text frames too

Change-Id: I6d6663520c3946eabb9bbb184899b0c4420732d1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143248
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 7fffb4b80c7279e96385086f068e9426579c916b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143293
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx 
b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 9f0b028258f4..007d4a846d1f 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -598,6 +598,7 @@ void SwTaggedPDFHelper::SetAttributes( 
vcl::PDFWriter::StructElement eType )
 if (pFrame->IsFlyFrame()) // this can be something else too
 {
 bAltText = true;
+bBox = true;
 }
 break;
 
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 41149167030d..501fee55f933 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -10789,6 +10789,7 @@ void PDFWriterImpl::setStructureBoundingBox( const 
tools::Rectangle& rRect )
 if( eType == PDFWriter::Figure  ||
 eType == PDFWriter::Formula ||
 eType == PDFWriter::Form||
+eType == PDFWriter::Division||
 eType == PDFWriter::Table )
 {
 m_aStructure[ m_nCurrentStructElement ].m_aBBox = rRect;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source vcl/qa

2022-12-03 Thread Michael Stahl (via logerrit)
 sw/source/core/text/EnhancedPDFExportHelper.cxx|   32 ++-
 vcl/qa/cppunit/pdfexport/data/Description PDF Export test .odt |binary
 vcl/qa/cppunit/pdfexport/pdfexport.cxx |  102 
++
 3 files changed, 131 insertions(+), 3 deletions(-)

New commits:
commit 0d59eebe858d0d3e5d2260691f245940757deacd
Author: Michael Stahl 
AuthorDate: Thu Nov 24 13:17:56 2022 +0100
Commit: Caolán McNamara 
CommitDate: Sat Dec 3 21:02:13 2022 +

tdf#57423 sw: PDF/UA export: Alt texts for SwNoTextNode

* Specification: ISO 14289-1:2014, Clause: 7.3, Test number: 1
Figure tags shall include an alternative representation or replacement
text that represents the contents marked with the Figure tag as noted in
ISO 32000-1:2008, 14.7.2, Table 323

This was broken by the previous commit, which tied ObjectInfoPrimitive2D
evaluation to StructureTagPrimitive2D, and is restored now, perhaps
less elegantly.

* Specification: ISO 14289-1:2014, Clause: 7.7, Test number: 1
All mathematical expressions shall be enclosed within a Formula tag as
detailed in ISO 32000-1:2008, 14.8.4.5 and shall have Alt or ActualText
attributes

Haven't checked but it's possible that this worked before commit
2840352ba56a212d191cc16e08378c87672d7b73 - for SwOLENode embedded
objects, no ObjectInfoPrimitive2D is created apparently.

Change-Id: Ia0077199601f39f666012d31883f63cff115716f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143247
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 122b4264d23df8b11419839ba700b88c4f936a6c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143292
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx 
b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 6afa8648947c..9f0b028258f4 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -526,6 +526,7 @@ void SwTaggedPDFHelper::SetAttributes( 
vcl::PDFWriter::StructElement eType )
 bool bHeight = false;
 bool bBox = false;
 bool bRowSpan = false;
+bool bAltText = false;
 
 // Check which attributes to set:
 
@@ -586,11 +587,20 @@ void SwTaggedPDFHelper::SetAttributes( 
vcl::PDFWriter::StructElement eType )
 
 case vcl::PDFWriter::Formula :
 case vcl::PDFWriter::Figure :
+bAltText =
 bPlacement =
 bWidth =
 bHeight =
 bBox = true;
 break;
+
+case vcl::PDFWriter::Division:
+if (pFrame->IsFlyFrame()) // this can be something else too
+{
+bAltText = true;
+}
+break;
+
 default :
 break;
 }
@@ -676,9 +686,25 @@ void SwTaggedPDFHelper::SetAttributes( 
vcl::PDFWriter::StructElement eType )
 }
 }
 
-// Formerly here bAlternateText was triggered for PDF export, but this
-// was moved for more general use to primitives and usage in
-// VclMetafileProcessor2D (see processGraphicPrimitive2D).
+// ISO 14289-1:2014, Clause: 7.3
+// ISO 14289-1:2014, Clause: 7.7
+// For images (but not embedded objects), an ObjectInfoPrimitive2D is
+// created, but it's not evaluated by VclMetafileProcessor2D any more;
+// that would require producing StructureTagPrimitive2D here but that
+// looks impossible so instead duplicate the code that sets the Alt
+// text here again.
+if (bAltText)
+{
+SwFlyFrameFormat const& rFly(*static_cast(pFrame)->GetFormat());
+OUString const sep(
+(rFly.GetObjTitle().isEmpty() || 
rFly.GetObjDescription().isEmpty())
+? OUString() : OUString(" - "));
+OUString const altText(rFly.GetObjTitle() + sep + 
rFly.GetObjDescription());
+if (!altText.isEmpty())
+{
+mpPDFExtOutDevData->SetAlternateText(altText);
+}
+}
 
 if ( bWidth )
 {
diff --git a/vcl/qa/cppunit/pdfexport/data/Description PDF Export test .odt 
b/vcl/qa/cppunit/pdfexport/data/Description PDF Export test .odt
new file mode 100644
index ..78f05b09e9e9
Binary files /dev/null and b/vcl/qa/cppunit/pdfexport/data/Description PDF 
Export test .odt differ
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx 
b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index 6b0f90a0581f..461bb937f81d 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -3241,6 +3241,108 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf135638)
 CPPUNIT_ASSERT_EQUAL(int(2), nFigure);
 }
 
+CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf57423)
+{
+

[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-12-01 Thread Caolán McNamara (via logerrit)
 sw/source/ui/config/optload.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 05776b4304485490760fb5213066a094c6e9600a
Author: Caolán McNamara 
AuthorDate: Thu Dec 1 09:14:48 2022 +
Commit: Adolfo Jayme Barrientos 
CommitDate: Thu Dec 1 12:48:37 2022 +0100

Resolves: tdf#152329 Caption preview font is black when using OS dark mode

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

diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx
index 9f0531b77a67..1885c06ecf9d 100644
--- a/sw/source/ui/config/optload.cxx
+++ b/sw/source/ui/config/optload.cxx
@@ -375,10 +375,12 @@ SwCaptionPreview::SwCaptionPreview()
 
 void SwCaptionPreview::ApplySettings(vcl::RenderContext& rRenderContext)
 {
-Wallpaper 
aBack(rRenderContext.GetSettings().GetStyleSettings().GetWindowColor());
+const StyleSettings& rSettings = 
rRenderContext.GetSettings().GetStyleSettings();
+Wallpaper aBack(rSettings.GetWindowColor());
 rRenderContext.SetBackground(aBack);
 rRenderContext.SetFillColor(aBack.GetColor());
 rRenderContext.SetLineColor(aBack.GetColor());
+rRenderContext.SetTextColor(rSettings.GetWindowTextColor());
 
 if (!mbFontInitialized)
 {


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-11-29 Thread Caolán McNamara (via logerrit)
 sw/source/ui/dbui/mmaddressblockpage.cxx |   12 
 sw/source/ui/dbui/mmaddressblockpage.hxx |1 +
 2 files changed, 13 insertions(+)

New commits:
commit dff9366b7b516700cac75df911176daa67a0f7a5
Author: Caolán McNamara 
AuthorDate: Mon Nov 28 16:50:01 2022 +
Commit: Adolfo Jayme Barrientos 
CommitDate: Tue Nov 29 15:59:55 2022 +0100

Resolves: tdf#152128 consider input engine events as well as keystrokes

Change-Id: I2884c6feb388050dd962fba5ef85117da2a039d3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143411
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143454
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx 
b/sw/source/ui/dbui/mmaddressblockpage.cxx
index 04cc0a84d0e9..53e4165d188e 100644
--- a/sw/source/ui/dbui/mmaddressblockpage.cxx
+++ b/sw/source/ui/dbui/mmaddressblockpage.cxx
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1099,6 +1100,17 @@ bool AddressMultiLineEdit::KeyInput(const KeyEvent& 
rKEvt)
 return WeldEditView::KeyInput(rKEvt);
 }
 
+bool AddressMultiLineEdit::Command(const CommandEvent& rCEvt)
+{
+if (rCEvt.GetCommand() == CommandEventId::StartExtTextInput ||
+rCEvt.GetCommand() == CommandEventId::EndExtTextInput ||
+rCEvt.GetCommand() == CommandEventId::ExtTextInput)
+{
+return true;
+}
+return WeldEditView::Command(rCEvt);
+}
+
 bool AddressMultiLineEdit::MouseButtonDown(const MouseEvent& rMEvt)
 {
 if (rMEvt.GetClicks() >= 2)
diff --git a/sw/source/ui/dbui/mmaddressblockpage.hxx 
b/sw/source/ui/dbui/mmaddressblockpage.hxx
index 65071c11d7a6..c32ad571339b 100644
--- a/sw/source/ui/dbui/mmaddressblockpage.hxx
+++ b/sw/source/ui/dbui/mmaddressblockpage.hxx
@@ -144,6 +144,7 @@ class AddressMultiLineEdit : public WeldEditView
 virtual css::uno::Reference 
GetDropTarget() override;
 
 virtual bool KeyInput(const KeyEvent& rKEvt) override;
+virtual bool Command(const CommandEvent& rCEvt) override;
 virtual bool MouseButtonDown(const MouseEvent& rMEvt) override;
 
 public:


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-11-28 Thread Caolán McNamara (via logerrit)
 sw/source/ui/misc/glosbib.cxx |5 -
 1 file changed, 5 deletions(-)

New commits:
commit 93dfe334529dac5fa4d44eac88e467db200bd14f
Author: Caolán McNamara 
AuthorDate: Mon Nov 28 10:45:05 2022 +
Commit: Caolán McNamara 
CommitDate: Mon Nov 28 12:56:52 2022 +0100

stray left over debugging fprintfs

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

diff --git a/sw/source/ui/misc/glosbib.cxx b/sw/source/ui/misc/glosbib.cxx
index 703b31b3a810..934cd47fb8f0 100644
--- a/sw/source/ui/misc/glosbib.cxx
+++ b/sw/source/ui/misc/glosbib.cxx
@@ -202,14 +202,10 @@ IMPL_LINK_NOARG( SwGlossaryGroupDlg, SelectHdl, 
weld::TreeView&, void )
 if (nPos != -1)
 {
 GlosBibUserData* pFoundData = 
weld::fromId(m_xGroupTLB->get_id(nPos));
-fprintf(stderr, "comparing %s and %s\n",
-OUStringToOString(pFoundData->sGroupName, 
RTL_TEXTENCODING_UTF8).getStr(),
-OUStringToOString(sEntry, RTL_TEXTENCODING_UTF8).getStr());
 bExists = pFoundData->sGroupName == sEntry;
 }
 
 m_xRenamePB->set_sensitive(!bExists && !sName.isEmpty());
-fprintf(stderr, "one rename %d\n", !bExists && !sName.isEmpty());
 m_xDelPB->set_sensitive(IsDeleteAllowed(sEntry));
 }
 
@@ -383,7 +379,6 @@ IMPL_LINK_NOARG(SwGlossaryGroupDlg, ModifyHdl, 
weld::Entry&, void)
 m_xDelPB->set_sensitive(bEnableDel);
 m_xNewPB->set_sensitive(bEnableNew);
 m_xRenamePB->set_sensitive(bEnableNew && nEntry != -1);
-fprintf(stderr, "two rename %d\n", bEnableNew && nEntry != -1);
 }
 
 bool SwGlossaryGroupDlg::IsDeleteAllowed(const OUString )


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-11-16 Thread Kevin Suo (via logerrit)
 sw/source/ui/misc/pggrid.cxx |   52 ---
 1 file changed, 39 insertions(+), 13 deletions(-)

New commits:
commit b9534138d604a30e9c73d0819a0dacee0b3178b9
Author: Kevin Suo 
AuthorDate: Thu Nov 10 16:07:41 2022 +0800
Commit: Caolán McNamara 
CommitDate: Wed Nov 16 20:34:41 2022 +0100

tdf#151988: Enable "Characters per line" and "Character width" when 
switch...

... back to grid type "lines and characters".

Also enable "Snap to characters" for grid type "lines and characters" and 
disbale it
for grid types "lines only" and "no grid".

Change-Id: I101c8d80a79798fc6c992da766c658c3ba8802dd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142513
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
(cherry picked from commit f4fbd3ca939fbf70eee110e4c601a5e7eeade714)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142621
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx
index 263009f26290..18f66cc08c1a 100644
--- a/sw/source/ui/misc/pggrid.cxx
+++ b/sw/source/ui/misc/pggrid.cxx
@@ -468,20 +468,43 @@ IMPL_LINK(SwTextGridPage, GridTypeHdl, weld::Toggleable&, 
rButton, void)
 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 (!bNoGrid)
+if (m_xNoGridRB.get() == )
+{
+// GRID_NONE mode:
+//   "Layout" and "Display" sections should all be disabled.
+m_xLayoutFL->set_sensitive(false);
+m_xDisplayFL->set_sensitive(false);
+}
+else
+{
+// GRID_LINES_ONLY or GRID_LINES_CHARS mode:
+//   "Layout" and "Display" sections should all be enabled;
+//   DisplayGridHdl should be executed;
+m_xLayoutFL->set_sensitive(true);
+m_xDisplayFL->set_sensitive(true);
 DisplayGridHdl(*m_xDisplayCB);
+}
 
-bool bEnable = m_xCharsGridRB.get() == 
-m_xSnapToCharsCB->set_sensitive(bEnable);
-
-bEnable = m_xLinesGridRB.get() == 
-if (bEnable && !m_bSquaredMode)
+if (m_xCharsGridRB.get() == )
+{
+// GRID_LINES_CHARS mode:
+//   "Snap to character" should be enabled;
+//   "Characters per line" should be enabled;
+//   "Characters range" should be enabled;
+m_xSnapToCharsCB->set_sensitive(true);
+m_xCharsPerLineFT->set_sensitive(true);
+m_xCharsPerLineNF->set_sensitive(true);
+m_xCharsRangeFT->set_sensitive(true);
+m_xCharWidthFT->set_sensitive(true);
+m_xCharWidthMF->set_sensitive(true);
+}
+else
 {
+// GRID_NONE or GRID_LINES_ONLY mode:
+//   "Snap to character" should be disabled;
+//   "Characters per line" should be disabled;
+//   "Characters range" should be disabled;
+m_xSnapToCharsCB->set_sensitive(false);
 m_xCharsPerLineFT->set_sensitive(false);
 m_xCharsPerLineNF->set_sensitive(false);
 m_xCharsRangeFT->set_sensitive(false);
@@ -489,9 +512,12 @@ IMPL_LINK(SwTextGridPage, GridTypeHdl, weld::Toggleable&, 
rButton, void)
 m_xCharWidthMF->set_sensitive(false);
 }
 
-//recalc which dependencies are sensitive
-if (!bNoGrid)
+if (m_xNoGridRB.get() != )
+{
+// GRID_LINES_ONLY or GRID_LINES_CHARS mode: (additionally)
+//   TextSizeChangedHdl should be executed to recalculate which 
dependencies are sensitive.
 TextSizeChangedHdl(*m_xTextSizeMF);
+}
 
 GridModifyHdl();
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-11-16 Thread Caolán McNamara (via logerrit)
 sw/source/uibase/docvw/FrameControlsManager.cxx |4 
 sw/source/uibase/docvw/HeaderFooterWin.cxx  |  135 
 sw/source/uibase/inc/HeaderFooterWin.hxx|   48 ++--
 3 files changed, 133 insertions(+), 54 deletions(-)

New commits:
commit 27ed81d01c9d7cb55506f86fc24268ca3589e935
Author: Caolán McNamara 
AuthorDate: Mon Nov 14 13:14:01 2022 +
Commit: Michael Stahl 
CommitDate: Wed Nov 16 14:23:12 2022 +0100

Resolves: tdf#147802 don't create a header/footer control for every page

just create a cheaper SwHeaderFooterDashedLine and only create the
"expensive" control on-demand if it becomes visible on-screen and
destroy it immediately if it goes off-screen.

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

diff --git a/sw/source/uibase/docvw/FrameControlsManager.cxx 
b/sw/source/uibase/docvw/FrameControlsManager.cxx
index bb2733aa60a3..03252faa1283 100644
--- a/sw/source/uibase/docvw/FrameControlsManager.cxx
+++ b/sw/source/uibase/docvw/FrameControlsManager.cxx
@@ -93,7 +93,7 @@ void SwFrameControlsManager::SetHeaderFooterControl( const 
SwPageFrame* pPageFra
 else
 {
 SwFrameControlPtr pNewControl =
-std::make_shared( 
VclPtr::Create(
+std::make_shared( 
VclPtr::Create(
 m_pEditWin, pPageFrame, bHeader 
).get() );
 const SwViewOption* pViewOpt = 
m_pEditWin->GetView().GetWrtShell().GetViewOptions();
 pNewControl->SetReadonly( pViewOpt->IsReadonly() );
@@ -103,7 +103,7 @@ void SwFrameControlsManager::SetHeaderFooterControl( const 
SwPageFrame* pPageFra
 
 tools::Rectangle aPageRect = m_pEditWin->LogicToPixel( 
pPageFrame->getFrameArea().SVRect() );
 
-SwHeaderFooterWin* pWin = dynamic_cast(pControl->GetWindow());
+SwHeaderFooterDashedLine* pWin = 
dynamic_cast(pControl->GetWindow());
 assert( pWin != nullptr) ;
 assert( pWin->IsHeader() == bHeader );
 pWin->SetOffset( aOffset, aPageRect.Left(), aPageRect.Right() );
diff --git a/sw/source/uibase/docvw/HeaderFooterWin.cxx 
b/sw/source/uibase/docvw/HeaderFooterWin.cxx
index 24f41021e832..07ce07197846 100644
--- a/sw/source/uibase/docvw/HeaderFooterWin.cxx
+++ b/sw/source/uibase/docvw/HeaderFooterWin.cxx
@@ -160,26 +160,89 @@ void 
SwFrameButtonPainter::PaintButton(drawinglayer::primitive2d::Primitive2DCon
 new 
drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aPolygon, aLineColor)));
 }
 
-SwHeaderFooterWin::SwHeaderFooterWin( SwEditWin* pEditWin, const SwFrame 
*pFrame, bool bHeader ) :
-SwFrameMenuButtonBase(pEditWin, pFrame, 
"modules/swriter/ui/hfmenubutton.ui", "HFMenuButton"),
+SwHeaderFooterDashedLine::SwHeaderFooterDashedLine(SwEditWin* pEditWin, const 
SwFrame *pFrame, bool bHeader)
+: SwDashedLine(pEditWin, ::GetHeaderFooterMarkColor)
+, m_pEditWin(pEditWin)
+, m_pFrame(pFrame)
+, m_bIsHeader(bHeader)
+{
+}
+
+bool SwHeaderFooterDashedLine::IsOnScreen()
+{
+tools::Rectangle aBounds(GetPosPixel(), GetSizePixel());
+tools::Rectangle aVisArea = 
GetEditWin()->LogicToPixel(GetEditWin()->GetView().GetVisArea());
+return aBounds.Overlaps(aVisArea);
+}
+
+void SwHeaderFooterDashedLine::EnsureWin()
+{
+if (!m_pWin)
+{
+m_pWin = VclPtr::Create(m_pEditWin, m_pFrame, 
m_bIsHeader);
+m_pWin->SetZOrder(this, ZOrderFlags::Before);
+}
+}
+
+void SwHeaderFooterDashedLine::ShowAll(bool bShow)
+{
+Show(bShow);
+if (!m_pWin && IsOnScreen())
+EnsureWin();
+if (m_pWin)
+m_pWin->ShowAll(bShow);
+}
+
+void SwHeaderFooterDashedLine::SetReadonly(bool bReadonly)
+{
+ShowAll(!bReadonly);
+}
+
+bool SwHeaderFooterDashedLine::Contains(const Point ) const
+{
+if (m_pWin && m_pWin->Contains(rDocPt))
+return true;
+
+::tools::Rectangle aLineRect(GetPosPixel(), GetSizePixel());
+return aLineRect.Contains(rDocPt);
+}
+
+void SwHeaderFooterDashedLine::SetOffset(Point aOffset, tools::Long 
nXLineStart, tools::Long nXLineEnd)
+{
+Point aLinePos(nXLineStart, aOffset.Y());
+Size aLineSize(nXLineEnd - nXLineStart, 1);
+SetPosSizePixel(aLinePos, aLineSize);
+
+bool bOnScreen = IsOnScreen();
+if (!m_pWin && bOnScreen)
+{
+EnsureWin();
+m_pWin->ShowAll(true);
+}
+else if (m_pWin && !bOnScreen)
+m_pWin.disposeAndClear();
+
+if (m_pWin)
+m_pWin->SetOffset(aOffset);
+}
+
+SwHeaderFooterWin::SwHeaderFooterWin(SwEditWin* pEditWin, const SwFrame 
*pFrame, bool bHeader ) :
+InterimItemWindow(pEditWin, "modules/swriter/ui/hfmenubutton.ui", 
"HFMenuButton"),
 m_xMenuButton(m_xBuilder->weld_menu_button("menubutton")),
 m_xPushButton(m_xBuilder->weld_button("button")),
+m_pEditWin(pEditWin),
+m_pFrame(pFrame),
 m_bIsHeader( bHeader ),
-m_pLine( nullptr ),

[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-11-13 Thread Caolán McNamara (via logerrit)
 sw/source/uibase/docvw/AnnotationWin2.cxx|1 -
 sw/source/uibase/docvw/SidebarTxtControl.cxx |3 ++-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit aec60c6d1b4bdd24bfbd55d1b6890e9c7042b489
Author: Caolán McNamara 
AuthorDate: Fri Nov 11 20:27:55 2022 +
Commit: Adolfo Jayme Barrientos 
CommitDate: Mon Nov 14 06:30:12 2022 +0100

Resolves: tdf#145648 use the same reference device for comments as document

so we get the same text measurements and so positioning matches.

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

diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx 
b/sw/source/uibase/docvw/AnnotationWin2.cxx
index 7872d02b38e7..fb414a4f1ebe 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -501,7 +501,6 @@ void SwAnnotationWin::Rescale()
 
 MapMode aMode = GetParent()->GetMapMode();
 aMode.SetOrigin( Point() );
-mpOutliner->SetRefMapMode( aMode );
 SetMapMode( aMode );
 mxSidebarTextControl->SetMapMode( aMode );
 const Fraction& rFraction = 
mrView.GetWrtShellPtr()->GetOut()->GetMapMode().GetScaleY();
diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx 
b/sw/source/uibase/docvw/SidebarTxtControl.cxx
index 789e6289b49d..7b7002b7fbfe 100644
--- a/sw/source/uibase/docvw/SidebarTxtControl.cxx
+++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx
@@ -54,6 +54,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -116,7 +117,7 @@ void SidebarTextControl::SetDrawingArea(weld::DrawingArea* 
pDrawingArea)
 // for layout in the sidebar.
 Size aPaperSize(mrPostItMgr.GetSidebarWidth(), 
pEditEngine->GetPaperSize().Height());
 pEditEngine->SetPaperSize(aPaperSize);
-pEditEngine->SetRefDevice();
+
pEditEngine->SetRefDevice(mrDocView.GetWrtShell().getIDocumentDeviceAccess().getReferenceDevice(false));
 
 pEditView->SetOutputArea(tools::Rectangle(Point(0, 0), aOutputSize));
 pEditView->SetBackgroundColor(aBgColor);


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-11-12 Thread Kevin Suo (via logerrit)
 sw/source/ui/misc/pggrid.cxx |   13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

New commits:
commit ea8a74ae6881f5ecacc6743b18c03ce3e759779a
Author: Kevin Suo 
AuthorDate: Thu Nov 10 10:19:08 2022 +0800
Commit: Caolán McNamara 
CommitDate: Sat Nov 12 12:04:49 2022 +0100

tdf#151979: fix crash in Text Grid dialog when switching active view

GetActiveView() may return a nullptr when previously we are in Calc
window and then click the controls on the writer dialog.

Change-Id: Ia4dcd58b19c40a3e6cd0a791b7645d5fd2dcb9f4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142508
Reviewed-by: Mike Kaganski 
Tested-by: Jenkins
(cherry picked from commit 9b80b2d6140d1aad240f10755105e49d678b98f1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142529
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx
index f849f6dcc48a..263009f26290 100644
--- a/sw/source/ui/misc/pggrid.cxx
+++ b/sw/source/ui/misc/pggrid.cxx
@@ -152,10 +152,13 @@ bool SwTextGridPage::FillItemSet(SfxItemSet *rSet)
 
 // draw ticks of ruler
 SwView * pView = ::GetActiveView();
-if ( m_bHRulerChanged )
-pView->GetHRuler().DrawTicks();
-if ( m_bVRulerChanged )
-pView->GetVRuler().DrawTicks();
+if (pView)
+{
+if ( m_bHRulerChanged )
+pView->GetHRuler().DrawTicks();
+if ( m_bVRulerChanged )
+pView->GetVRuler().DrawTicks();
+}
 return bRet;
 }
 
@@ -247,7 +250,7 @@ void SwTextGridPage::PutGridItem(SfxItemSet& rSet)
 rSet.Put(aGridItem);
 
 SwView * pView = ::GetActiveView();
-if ( aGridItem.GetGridType() != GRID_NONE )
+if (pView && aGridItem.GetGridType() != GRID_NONE)
 {
 if ( aGridItem.GetGridType() == GRID_LINES_CHARS )
 {


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-11-10 Thread Kevin Suo (via logerrit)
 sw/source/ui/misc/pggrid.cxx |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit e6b070d3da4a3be84fa84d0b8c447d58be6d8923
Author: Kevin Suo 
AuthorDate: Thu Nov 3 23:26:28 2022 +0800
Commit: Caolán McNamara 
CommitDate: Thu Nov 10 20:53:39 2022 +0100

tdf#151544: Page grid: ruby height should be zero when not in square page 
mode

Ruby height is used to show the ruby line in square page mode only (e.g. to 
show the
Pinyin etc above or below base line). When not in square page mode (i.e., 
when in
normal mode), the ruby height should be zero.

The code was trying to set the ruby height to zero by using the following:
m_xRubySizeMF->set_value(0, FieldUnit::TWIP);
and then pass this to aGridItem.SetRubyHeight in 
SwTextGridPage::PutGridItem.
However, there seems to be always a conversion loss, thus each line will 
have a tiny
ruby height, which makes the vertical space not enough to hold the desired 
number
of lines on the page.

Fix this by setting ruby height to zero directly in 
SwTextGridPage::PutGridItem if
we are not in square page mode.

Change-Id: I24a74b96c12eb58e46e163e2a9c73b540023ab39
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142243
Tested-by: Jenkins
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 
(cherry picked from commit 875c27dc7975de9b007a215fe1d6f171b4ef090e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142514

diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx
index db3ade6edb6b..f849f6dcc48a 100644
--- a/sw/source/ui/misc/pggrid.cxx
+++ b/sw/source/ui/misc/pggrid.cxx
@@ -232,7 +232,12 @@ void SwTextGridPage::PutGridItem(SfxItemSet& rSet)
 aGridItem.SetBaseHeight( static_cast< sal_uInt16 >(
 m_bRubyUserValue ? m_nRubyUserValue :
 
m_xTextSizeMF->denormalize(m_xTextSizeMF->get_value(FieldUnit::TWIP))) );
-aGridItem.SetRubyHeight( static_cast< sal_uInt16 
>(m_xRubySizeMF->denormalize(m_xRubySizeMF->get_value(FieldUnit::TWIP))) );
+// Tdf#151544: set ruby height from the value get from UI only when in 
square page mode.
+// When in normal mode, the ruby height should be zero.
+if (m_bSquaredMode)
+
aGridItem.SetRubyHeight(static_cast(m_xRubySizeMF->denormalize(m_xRubySizeMF->get_value(FieldUnit::TWIP;
+else
+aGridItem.SetRubyHeight(0);
 aGridItem.SetBaseWidth( static_cast< sal_uInt16 
>(m_xCharWidthMF->denormalize(m_xCharWidthMF->get_value(FieldUnit::TWIP))) );
 aGridItem.SetRubyTextBelow(m_xRubyBelowCB->get_active());
 aGridItem.SetSquaredMode(m_bSquaredMode);
@@ -385,7 +390,6 @@ IMPL_LINK(SwTextGridPage, CharorLineChangedHdl, 
weld::SpinButton&, rField, void)
 assert(nValue && "div-by-zero");
 auto nHeight = m_aPageSize.Height() / nValue;
 m_xTextSizeMF->set_value(m_xTextSizeMF->normalize(nHeight), 
FieldUnit::TWIP);
-m_xRubySizeMF->set_value(0, FieldUnit::TWIP);
 SetLinesOrCharsRanges( *m_xLinesRangeFT , 
m_xLinesPerPageNF->get_max() );
 
 m_nRubyUserValue = nHeight;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-11-01 Thread Tünde Tóth (via logerrit)
 sw/source/filter/ww8/docxattributeoutput.cxx |   10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

New commits:
commit a04ed691ea3f4891c98e7dde0344d461cb9def18
Author: Tünde Tóth 
AuthorDate: Mon Oct 24 13:52:27 2022 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Wed Nov 2 03:02:18 2022 +0100

tdf#151384 DOCX export: lost hyperlink format in localized UI

Fix losing color and underline of hyperlinks in localized
builds, at least with Russian UI.

Regression from commit d57b4480903f700ad7c95e885b9dd0ace5883cfc
"tdf#127579 DOCX export: fix losing color and underline of ODT hyperlinks".

Change-Id: I1eebcf58a7071226e80df3f84ed1264c5a8baf31
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141761
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 2dfd9e3e00f6e57ab1b307cf57c01a0830da4b17)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142134
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 8020576cfcab..f62fb4440929 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -8527,9 +8527,13 @@ void DocxAttributeOutput::CharHighlight( const 
SvxBrushItem& rHighlight )
 
 void DocxAttributeOutput::TextINetFormat( const SwFormatINetFormat& rLink )
 {
-OString aStyleId = MSWordStyles::CreateStyleId(rLink.GetINetFormat());
-if (!aStyleId.isEmpty() && !aStyleId.equalsIgnoreAsciiCase("DefaultStyle"))
-m_pSerializer->singleElementNS(XML_w, XML_rStyle, FSNS(XML_w, 
XML_val), aStyleId);
+const SwCharFormat* pFormat = 
m_rExport.m_rDoc.FindCharFormatByName(rLink.GetINetFormat());
+if (pFormat)
+{
+OString 
aStyleId(m_rExport.m_pStyles->GetStyleId(m_rExport.GetId(pFormat)));
+if (!aStyleId.equalsIgnoreAsciiCase("DefaultStyle"))
+m_pSerializer->singleElementNS(XML_w, XML_rStyle, FSNS(XML_w, 
XML_val), aStyleId);
+}
 }
 
 void DocxAttributeOutput::TextCharFormat( const SwFormatCharFormat& 
rCharFormat )


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-11-01 Thread Andreas Heinisch (via logerrit)
 sw/source/core/doc/doctxm.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit c54b8c442473c59deacc89de4c1a13e108993063
Author: Andreas Heinisch 
AuthorDate: Thu Oct 13 22:11:35 2022 +0200
Commit: Xisco Fauli 
CommitDate: Tue Nov 1 21:54:20 2022 +0100

tdf#151462 - Search for outline node containing the current node

If the index lies within a special section, the position of the anchor of 
the corresponding section will used to search the node of the paragraph. This 
patch searches for the outline node of the found paragraph in order to find all 
the corresponding sub indexes.

Change-Id: I9be4bdc0768d5d0d5987d47d37e41acc5009cca8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141344
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch 
(cherry picked from commit ba58fc11723b7c9d370d6407385ea0e8829db099)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142136
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index 9665c3915714..ea4cf47a3dce 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -733,6 +733,8 @@ static const SwTextNode* lcl_FindChapterNode( const SwNode& 
rNd,
 SwPosition aPos( *pNd );
 pNd = GetBodyTextNode( pNd->GetDoc(), aPos, *pFrame );
 OSL_ENSURE( pNd, "Where's the paragraph?" );
+// tdf#151462 - search for outline node containing the current node
+return pNd->FindOutlineNodeOfLevel(pNd->GetSectionLevel() - 1, 
pLayout);
 }
 }
 return pNd ? pNd->FindOutlineNodeOfLevel(nLvl, pLayout) : nullptr;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-11-01 Thread Noel Grandin (via logerrit)
 sw/source/core/text/pormulti.cxx |   19 ++-
 1 file changed, 14 insertions(+), 5 deletions(-)

New commits:
commit 14f019827d73178b3bdf166c642720f49314a514
Author: Noel Grandin 
AuthorDate: Thu Oct 27 20:07:51 2022 +0200
Commit: Xisco Fauli 
CommitDate: Tue Nov 1 19:39:24 2022 +0100

tdf#151736 writer direct formatting crash

regression from
commit 9a44807ff3a11afa8f7ce9857ae6a6144a61d481
Author: Noel Grandin 
Date:   Wed Mar 2 17:58:31 2022 +0200
use SfxItemSet::GetItemIfSet in sw/source/core/txt

Change-Id: I9db016d608300c603d0b1386962b188dddc85125
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141943
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit 7d63176bcfbc80fc4045a0f0580c5bf9ccea7a89)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141928
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx
index 3fb6a3091ad0..518294e12d9b 100644
--- a/sw/source/core/text/pormulti.cxx
+++ b/sw/source/core/text/pormulti.cxx
@@ -1040,17 +1040,26 @@ std::optional 
SwTextSizeInfo::GetMultiCreator(TextFrameIndex 
 if (startPos.first->GetIndex() == pNode->GetIndex())
 {
 iterAtStartOfNode.Assign(iter);
-pNodeRotateItem = 
pNode->GetSwAttrSet().GetItemIfSet(RES_CHRATR_ROTATE);
-if (pNodeRotateItem && pNodeRotateItem->GetValue())
+if (SfxItemState::SET == pNode->GetSwAttrSet().GetItemState(
+RES_CHRATR_ROTATE, true, ) &&
+pNodeRotateItem->GetValue())
 {
 pActiveRotateItem = pNodeRotateItem;
 }
-pNodeTwoLinesItem = 
startPos.first->GetSwAttrSet().GetItemIfSet(
-RES_CHRATR_TWO_LINES);
-if (pNodeTwoLinesItem && pNodeTwoLinesItem->GetValue())
+else
+{
+pNodeRotateItem = nullptr;
+}
+if (SfxItemState::SET == 
startPos.first->GetSwAttrSet().GetItemState(
+RES_CHRATR_TWO_LINES, true, ) &&
+pNodeTwoLinesItem->GetValue())
 {
 pActiveTwoLinesItem = pNodeTwoLinesItem;
 }
+else
+{
+pNodeTwoLinesItem = nullptr;
+}
 }
 }
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-10-26 Thread Caolán McNamara (via logerrit)
 sw/source/ui/envelp/envfmt.cxx |   10 ++
 1 file changed, 10 insertions(+)

New commits:
commit 36b1e1c089c739f232c36ea0f9b0242b6fd578ac
Author: Caolán McNamara 
AuthorDate: Wed Oct 26 10:14:33 2022 +0100
Commit: Caolán McNamara 
CommitDate: Wed Oct 26 12:53:44 2022 +0200

crashreporting: crash in area tab page with insert, envelope

insert, envelope, format, addressee: format: edit: paragraph, area,
click on gradient, bitmap, etc.

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

diff --git a/sw/source/ui/envelp/envfmt.cxx b/sw/source/ui/envelp/envfmt.cxx
index 26cd00923873..5949c192254f 100644
--- a/sw/source/ui/envelp/envfmt.cxx
+++ b/sw/source/ui/envelp/envfmt.cxx
@@ -23,10 +23,13 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include "envfmt.hxx"
@@ -221,6 +224,13 @@ void SwEnvFormatPage::Edit(std::string_view rIdent, bool 
bSender)
 // set BoxInfo
 ::PrepareBoxInfo( aTmpSet, *pSh );
 
+SwDrawModel* pDrawModel = 
pSh->GetView().GetDocShell()->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel();
+aTmpSet.Put(SvxColorListItem(pDrawModel->GetColorList(), 
SID_COLOR_TABLE));
+aTmpSet.Put(SvxGradientListItem(pDrawModel->GetGradientList(), 
SID_GRADIENT_LIST));
+aTmpSet.Put(SvxHatchListItem(pDrawModel->GetHatchList(), 
SID_HATCH_LIST));
+aTmpSet.Put(SvxBitmapListItem(pDrawModel->GetBitmapList(), 
SID_BITMAP_LIST));
+aTmpSet.Put(SvxPatternListItem(pDrawModel->GetPatternList(), 
SID_PATTERN_LIST));
+
 const OUString sFormatStr = pColl->GetName();
 SwParaDlg aDlg(GetFrameWeld(), pSh->GetView(), aTmpSet, DLG_ENVELOP, 
);
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-10-24 Thread Caolán McNamara (via logerrit)
 sw/source/core/layout/paintfrm.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit df5ca3dfda0a82cf0434818a351e2385a136d397
Author: Caolán McNamara 
AuthorDate: Sat Oct 22 19:30:39 2022 +0100
Commit: Caolán McNamara 
CommitDate: Mon Oct 24 21:04:09 2022 +0200

cid#1516141 Dereference after null check

Change-Id: Id779ae022269906a17f4f7637d7f634d5d7102d2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141669
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 0c4aa1157bb1b992fa5f887920194d67f52df752)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141735

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 7cae991210d7..f168cbd5ad9d 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -4288,7 +4288,7 @@ void SwFlyFrame::PaintSwFrame(vcl::RenderContext& 
rRenderContext, SwRect const&
 Validate();
 
 {
-SwTaggedPDFHelper tag(nullptr, nullptr, nullptr, *pShell->GetOut());
+SwTaggedPDFHelper tag(nullptr, nullptr, nullptr, rRenderContext);
 // first paint lines added by fly frame paint
 // and then unlock other lines.
 gProp.pSLines->PaintLines( , gProp );


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source vcl/qa

2022-10-24 Thread Michael Stahl (via logerrit)
 sw/source/core/layout/paintfrm.cxx  |   15 ++--
 sw/source/core/text/EnhancedPDFExportHelper.cxx |8 +-
 vcl/qa/cppunit/pdfexport/data/tdf139736-1.odt   |binary
 vcl/qa/cppunit/pdfexport/pdfexport.cxx  |   86 
 4 files changed, 101 insertions(+), 8 deletions(-)

New commits:
commit f91da6e6063e0494559a015a0ec6ea38fcb30baa
Author: Michael Stahl 
AuthorDate: Wed Oct 19 16:38:02 2022 +0200
Commit: Caolán McNamara 
CommitDate: Mon Oct 24 21:03:50 2022 +0200

tdf#139736 sw: PDF/UA export: flys in header/footer are Artifacts

* flys anchored in header/footer cannot simply be ignored, they need to
  get NonStructElement tag which is translated to "/Artifact"
* borders of flys need to get "/Artifact" tag as well; this is also the
  case if they're anchored in the body as veraPDF complains

Change-Id: Id69f0d80c59c3ade295da46c4413a5f0e8d96d54
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141534
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 72b69b422d33308809070e98a6ea8daad93e16d2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141734
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index d470b1ae030f..7cae991210d7 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -4287,12 +4287,15 @@ void SwFlyFrame::PaintSwFrame(vcl::RenderContext& 
rRenderContext, SwRect const&
 
 Validate();
 
-// first paint lines added by fly frame paint
-// and then unlock other lines.
-gProp.pSLines->PaintLines( , gProp );
-gProp.pSLines->LockLines( false );
-// have to paint frame borders added in heaven layer here...
-ProcessPrimitives(gProp.pBLines->GetBorderLines_Clear());
+{
+SwTaggedPDFHelper tag(nullptr, nullptr, nullptr, *pShell->GetOut());
+// first paint lines added by fly frame paint
+// and then unlock other lines.
+gProp.pSLines->PaintLines( , gProp );
+gProp.pSLines->LockLines( false );
+// have to paint frame borders added in heaven layer here...
+ProcessPrimitives(gProp.pBLines->GetBorderLines_Clear());
+}
 
 PaintDecorators();
 
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx 
b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 30c1db446868..ccec950bb954 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -969,7 +969,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements()
 
 // Lowers of NonStructureElements should not be considered:
 
-if ( lcl_IsInNonStructEnv( *pFrame ) )
+if (lcl_IsInNonStructEnv(*pFrame) && !pFrame->IsFlyFrame())
 return;
 
 // Check if we have to reopen an existing structure element.
@@ -1258,7 +1258,11 @@ void SwTaggedPDFHelper::BeginBlockStructureElements()
 // fly in content or fly at page
 {
 const SwFlyFrame* pFly = static_cast(pFrame);
-if ( pFly->Lower() && pFly->Lower()->IsNoTextFrame() )
+if (pFly->GetAnchorFrame()->FindFooterOrHeader() != nullptr)
+{
+nPDFType = vcl::PDFWriter::NonStructElement;
+}
+else if (pFly->Lower() && pFly->Lower()->IsNoTextFrame())
 {
 bool bFormula = false;
 
diff --git a/vcl/qa/cppunit/pdfexport/data/tdf139736-1.odt 
b/vcl/qa/cppunit/pdfexport/data/tdf139736-1.odt
new file mode 100644
index ..f17f6037885c
Binary files /dev/null and b/vcl/qa/cppunit/pdfexport/data/tdf139736-1.odt 
differ
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx 
b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index fb821ae4..51d5e93b9529 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -2987,6 +2987,92 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testPdfUaMetadata)
 CPPUNIT_ASSERT_EQUAL(OString("1"), aPdfUaPart);
 }
 
+CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf139736)
+{
+aMediaDescriptor["FilterName"] <<= OUString("writer_pdf_Export");
+
+// Enable PDF/UA
+uno::Sequence aFilterData(
+comphelper::InitPropertySequence({ { "PDFUACompliance", uno::Any(true) 
} }));
+aMediaDescriptor["FilterData"] <<= aFilterData;
+saveAsPDF(u"tdf139736-1.odt");
+
+vcl::filter::PDFDocument aDocument;
+SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ);
+CPPUNIT_ASSERT(aDocument.Read(aStream));
+
+std::vector aPages = aDocument.GetPages();
+CPPUNIT_ASSERT_EQUAL(static_cast(1), aPages.size());
+
+vcl::filter::PDFObjectElement* pContents = 
aPages[0]->LookupObject("Contents");
+CPPUNIT_ASSERT(pContents);
+vcl::filter::PDFStreamElement* pStream = pContents->GetStream();
+CPPUNIT_ASSERT(pStream);
+SvMemoryStream& rObjectStream = 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-10-20 Thread Caolán McNamara (via logerrit)
 sw/source/uibase/docvw/edtwin.cxx |9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 4cbca5e5f5fc77c3208c4aabab69912d638ec6b4
Author: Caolán McNamara 
AuthorDate: Thu Oct 20 11:14:44 2022 +0100
Commit: Caolán McNamara 
CommitDate: Thu Oct 20 16:35:57 2022 +0200

Resolves: rhbz#2136050 crash on input method "retrieve-surrounding"

select the largest graphic on page 1 and press delete

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

diff --git a/sw/source/uibase/docvw/edtwin.cxx 
b/sw/source/uibase/docvw/edtwin.cxx
index 8cc812e17c6a..ef7070fd0245 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -6611,13 +6611,14 @@ Selection SwEditWin::GetSurroundingTextSelection() const
 if (rSh.HasDrawView() && rSh.GetDrawView()->IsTextEdit())
 return 
rSh.GetDrawView()->GetTextEditOutlinerView()->GetSurroundingTextSelection();
 
+Selection aSel(0, 0);
 if( rSh.HasSelection() )
 {
 OUString sReturn;
 rSh.GetSelectedText( sReturn, ParaBreakType::ToOnlyCR  );
-return Selection( 0, sReturn.getLength() );
+aSel = Selection( 0, sReturn.getLength() );
 }
-else
+else if (rSh.GetCursor()->GetPoint()->nNode.GetNode().GetTextNode())
 {
 bool bUnLockView = !rSh.IsViewLocked();
 rSh.LockView(true);
@@ -6645,8 +6646,10 @@ Selection SwEditWin::GetSurroundingTextSelection() const
 if (bUnLockView)
 rSh.LockView(false);
 
-return Selection(sal_Int32(nPos - nStartPos), sal_Int32(nPos - 
nStartPos));
+aSel = Selection(sal_Int32(nPos - nStartPos), sal_Int32(nPos - 
nStartPos));
 }
+
+return aSel;
 }
 
 bool SwEditWin::DeleteSurroundingText(const Selection& rSelection)


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-10-19 Thread Miklos Vajna (via logerrit)
 sw/source/core/access/accportions.cxx   |2 +-
 sw/source/core/inc/txttypes.hxx |3 ++-
 sw/source/core/text/EnhancedPDFExportHelper.cxx |2 +-
 sw/source/core/text/inftxt.cxx  |2 +-
 sw/source/core/text/txttab.cxx  |4 ++--
 sw/source/core/text/xmldump.cxx |4 ++--
 6 files changed, 9 insertions(+), 8 deletions(-)

New commits:
commit b00adbf04d0469a4a9606025ba99ba2a1e26cbf5
Author: Miklos Vajna 
AuthorDate: Fri Oct 14 17:22:14 2022 +0200
Commit: Xisco Fauli 
CommitDate: Wed Oct 19 08:32:19 2022 +0200

sw: tables have frames, not portions

Went wrong in commit 60b0526ea4929ce273de499f552a4d478a973d10 (convert
POR constants to scoped enum, 2019-01-17), which changed POR_TAB to
PortionType::Table.

Change-Id: I27131f2ab42f7c53310ee8e61b8481e07ed77da7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141379
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins
(cherry picked from commit 3565c3c94c6bdad5ab0913d979fd4e97547488e6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141404
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/core/access/accportions.cxx 
b/sw/source/core/access/accportions.cxx
index 9f43435a7dc4..186e6112494d 100644
--- a/sw/source/core/access/accportions.cxx
+++ b/sw/source/core/access/accportions.cxx
@@ -261,7 +261,7 @@ bool SwAccessiblePortionData::IsGrayPortionType( 
PortionType nType ) const
 bGray = !m_pViewOptions->IsPagePreview() &&
 !m_pViewOptions->IsReadonly() && 
SwViewOption::IsFieldShadings();
 break;
-case PortionType::Table:   bGray = m_pViewOptions->IsTab();
  break;
+case PortionType::Tab:   bGray = m_pViewOptions->IsTab();  
break;
 case PortionType::SoftHyphen:  bGray = m_pViewOptions->IsSoftHyph();   
  break;
 case PortionType::Blank: bGray = m_pViewOptions->IsHardBlank();
break;
 default:
diff --git a/sw/source/core/inc/txttypes.hxx b/sw/source/core/inc/txttypes.hxx
index d876b0f8e037..6b3124fb8bc6 100644
--- a/sw/source/core/inc/txttypes.hxx
+++ b/sw/source/core/inc/txttypes.hxx
@@ -80,7 +80,8 @@ enum class PortionType
 Fix = 0x06c0,
 Fly = 0x06c1,
 
-Table   = 0x0750,
+// Tabulator, not table
+Tab = 0x0750,
 
 TabRight= 0x07d0,
 TabCenter   = 0x07d1,
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx 
b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 1e9e74e33736..30c1db446868 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -1429,7 +1429,7 @@ void SwTaggedPDFHelper::BeginInlineStructureElements()
 }
 break;
 
-case PortionType::Table :
+case PortionType::Tab :
 case PortionType::TabRight :
 case PortionType::TabCenter :
 case PortionType::TabDecimal :
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index c3a5068b3cf9..38f665d687ca 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -1340,7 +1340,7 @@ void SwTextPaintInfo::DrawViewOpt( const SwLinePortion 
,
 bDraw = true;
 }
 break;
-case PortionType::Table:
+case PortionType::Tab:
 if ( GetOpt().IsTab() ) bDraw = true;
 break;
 case PortionType::SoftHyphen:
diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx
index 82f8e3129c97..afcd31217ea0 100644
--- a/sw/source/core/text/txttab.cxx
+++ b/sw/source/core/text/txttab.cxx
@@ -332,7 +332,7 @@ SwTabPortion::SwTabPortion( const sal_uInt16 nTabPosition, 
const sal_Unicode cFi
 {
 mnLineLength = TextFrameIndex(1);
 OSL_ENSURE(!IsFilled() || ' ' != m_cFill, "SwTabPortion::CTOR: blanks ?!");
-SetWhichPor( PortionType::Table );
+SetWhichPor( PortionType::Tab );
 }
 
 bool SwTabPortion::Format( SwTextFormatInfo  )
@@ -604,7 +604,7 @@ void SwTabPortion::Paint( const SwTextPaintInfo  ) 
const
 {
 // filled tabs are shaded in gray
 if( IsFilled() )
-rInf.DrawViewOpt( *this, PortionType::Table );
+rInf.DrawViewOpt( *this, PortionType::Tab );
 else
 rInf.DrawTab( *this );
 }
diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx
index fb45c0920f17..966ee8ac1eee 100644
--- a/sw/source/core/text/xmldump.cxx
+++ b/sw/source/core/text/xmldump.cxx
@@ -139,8 +139,8 @@ const char* sw::PortionTypeToString(PortionType nType)
 case PortionType::Fly:
 return "PortionType::Fly";
 
-case PortionType::Table:
-return "PortionType::Table";
+case PortionType::Tab:
+return "PortionType::Tab";
 
 case PortionType::TabRight:
 return "PortionType::TabRight";


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-10-15 Thread Khaled Hosny (via logerrit)
 sw/source/core/txtnode/fntcache.cxx |   41 +---
 1 file changed, 11 insertions(+), 30 deletions(-)

New commits:
commit b37764993f7e524dbe2cf79ca921d0b01e6fba97
Author: Khaled Hosny 
AuthorDate: Sun Sep 25 11:37:05 2022 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Sun Oct 16 01:53:03 2022 +0200

tdf#150726: Pass full string to DrawTextArray() when drawing bullet

When drawing bullets for spaces, we were passing a substring to
DrawTextArray() and even taking care of adding an extra character to
both sides to help with Arabic layout. This, however, does not work when
part of the text is in different color because the portion will cover
only that substring and we wouldn’t be passing enough context.

Copying the substring is unnecessary, though, and we can pass the full
string like we do in the non-bullet case. The bullet array (where we
replace spaces with bullets), can continue to be a substring as we are
only drawing the bullets in this case.

This probably also means we can re-use the glyph cache when switching
between bullet and non-bullet mode.

Change-Id: I256ae7b6d592b8c6670d66619e428f943714be57
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140568
Tested-by: Jenkins
Reviewed-by: خالد حسني 
(cherry picked from commit 092e37a284ea8b8bc1e8dabbbeb001c98012a996)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141398
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sw/source/core/txtnode/fntcache.cxx 
b/sw/source/core/txtnode/fntcache.cxx
index 12613bfd3b7f..f787c55ec654 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -1182,9 +1182,6 @@ void SwFntObj::DrawText( SwDrawTextInfo  )
 // set text render mode to suit use of resolution independent text 
layout
 rInf.GetOut().SetTextRenderModeForResolutionIndependentLayout(true);
 
-const OUString* pStr = ();
-
-OUString aStr;
 OUString aBulletOverlay;
 bool bBullet = rInf.GetBullet();
 if( m_bSymbol )
@@ -1278,19 +1275,10 @@ void SwFntObj::DrawText( SwDrawTextInfo  )
 
 if( bBullet )
 {
-// !!! HACK !!!
-// The Arabic layout engine requires some context of the string
-// which should be painted.
+// Copy the substring that will be painted, and replace spaces with
+// bullets, and everything else with space.
 sal_Int32 nCopyStart = sal_Int32(rInf.GetIdx());
-if ( nCopyStart )
---nCopyStart;
-
 sal_Int32 nCopyLen = sal_Int32(rInf.GetLen());
-if ( nCopyStart + nCopyLen < rInf.GetText().getLength() )
-++nCopyLen;
-
-aStr = rInf.GetText().copy( nCopyStart, nCopyLen );
-pStr = 
 
 aBulletOverlay = rInf.GetText().copy( nCopyStart, nCopyLen );
 
@@ -1341,8 +1329,8 @@ void SwFntObj::DrawText( SwDrawTextInfo  )
 rInf.GetOut().DrawTextArray( aTextOriginPos, rInf.GetText(),
  aKernArray, sal_Int32(rInf.GetIdx()), 1 );
 if( bBullet )
-rInf.GetOut().DrawTextArray( aTextOriginPos, *pStr, aKernArray,
- rInf.GetIdx() ? 1 : 0, 1 );
+rInf.GetOut().DrawTextArray( aTextOriginPos, rInf.GetText(), 
aKernArray,
+ sal_Int32(rInf.GetIdx()), 1 );
 }
 else
 {
@@ -1455,17 +1443,11 @@ void SwFntObj::DrawText( SwDrawTextInfo  )
 if ( bSwitchH2V )
 rInf.GetFrame()->SwitchHorizontalToVertical( 
aTextOriginPos );
 
-// If we paint bullets instead of spaces, we use a copy of
-// the paragraph string. For the layout engine, the copy
-// of the string has to be an environment of the range which
-// is painted
-sal_Int32 nTmpIdx = bBullet
-? (rInf.GetIdx() ? 1 : 0)
-: sal_Int32(rInf.GetIdx());
+sal_Int32 nIdx = sal_Int32(rInf.GetIdx());
 const SalLayoutGlyphs* pGlyphs = 
SalLayoutGlyphsCache::self()->GetLayoutGlyphs((),
- *pStr, nTmpIdx, nLen);
-rInf.GetOut().DrawTextArray( aTextOriginPos, *pStr, aKernArray,
- nTmpIdx , nLen, 
SalLayoutFlags::NONE, pGlyphs );
+ rInf.GetText(), nIdx, nLen);
+rInf.GetOut().DrawTextArray( aTextOriginPos, rInf.GetText(), 
aKernArray,
+ nIdx, nLen, SalLayoutFlags::NONE, 
pGlyphs );
 if (bBullet)
 {
 rInf.GetOut().Push();
@@ -1485,8 +1467,7 @@ void SwFntObj::DrawText( SwDrawTextInfo  )
 {
 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-10-12 Thread Caolán McNamara (via logerrit)
 sw/source/uibase/shells/drwtxtex.cxx |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

New commits:
commit 9cab1cc8d37b0116eec36d09738186f291af3766
Author: Caolán McNamara 
AuthorDate: Mon Oct 10 20:37:59 2022 +0100
Commit: Noel Grandin 
CommitDate: Wed Oct 12 10:12:39 2022 +0200

assert from SfxItemSet::CloneAsValue with SfxAllItemSet

in writer with insert, shape, add some text, change its
text color.

so like:

commit fe2ec505786bacc6f3baca3292367903644ac99b
Date:   Fri Feb 18 10:56:56 2022 +0200

improve the SfxItemSet::CloneAsValue check

to prevent object slicing.

revert the asserting hunk.

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

diff --git a/sw/source/uibase/shells/drwtxtex.cxx 
b/sw/source/uibase/shells/drwtxtex.cxx
index 1a5f3a8665d4..9f23ed7e6b7d 100644
--- a/sw/source/uibase/shells/drwtxtex.cxx
+++ b/sw/source/uibase/shells/drwtxtex.cxx
@@ -128,9 +128,7 @@ void SwDrawTextShell::Execute( SfxRequest  )
 const sal_uInt16 nSlot = rReq.GetSlot();
 
 const sal_uInt16 nWhich = GetPool().GetWhich(nSlot);
-std::optional pNewAttrs;
-if (rReq.GetArgs())
-pNewAttrs.emplace(rReq.GetArgs()->CloneAsValue());
+std::unique_ptr pNewAttrs(rReq.GetArgs() ? 
rReq.GetArgs()->Clone() : nullptr);
 
 bool bRestoreSelection = false;
 ESelection aOldSelection;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-10-11 Thread Aron Budea (via logerrit)
 sw/source/uibase/app/docst.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 8debd8b675bad760f9dbeb822cc80f0b91b5c89e
Author: Aron Budea 
AuthorDate: Sat Oct 8 00:58:12 2022 +0200
Commit: Xisco Fauli 
CommitDate: Tue Oct 11 18:26:22 2022 +0200

"No List" option in Styles Sidebar doesn't remove list in non-English UI

In a list, with Styles sidebar open and List Styles selected,
the No List option did not remove the list if the UI language
was other than English.

No List entry exists since
a56aa46fcc62227df7dc9a8fa04205e8ff5ed2a1 .

Change-Id: I5210c07c811d08489c1b9a199f6756273153e05d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141092
Tested-by: Jenkins
Reviewed-by: Aron Budea 
(cherry picked from commit 6a97ccad4a5d2a0d97bfe023aedf7a0146cd9782)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141066
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx
index a891a53daa90..2d34c0e51e3a 100644
--- a/sw/source/uibase/app/docst.cxx
+++ b/sw/source/uibase/app/docst.cxx
@@ -1178,7 +1178,7 @@ SfxStyleFamily SwDocShell::ApplyStyles(const OUString 
, SfxStyleFamily nFa
 // reset indent attribute on applying list style
 // continue list of list style
 const SwNumRule* pNumRule = pStyle->GetNumRule();
-if (pNumRule->GetName() == "No List")
+if (pNumRule->GetName() == SwResId(STR_POOLNUMRULE_NOLIST))
 {
 
SfxViewFrame::Current()->GetDispatcher()->Execute(FN_NUM_BULLET_OFF);
 break;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source vcl/unx

2022-10-10 Thread Jim Raykowski (via logerrit)
 sw/source/uibase/utlui/content.cxx |6 ++
 vcl/unx/gtk3/gtkinst.cxx   |2 ++
 2 files changed, 8 insertions(+)

New commits:
commit d19d64b6a3e697fdbf7c0d05a318afddbc349bd4
Author: Jim Raykowski 
AuthorDate: Fri Oct 7 02:18:05 2022 -0800
Commit: Caolán McNamara 
CommitDate: Mon Oct 10 20:46:44 2022 +0200

tdf#151387 Fix regression cause by tdf#149279

The gtk_tree_view_expand_to_path function not only expands all parent
rows of path as necessary but also expands the children of the row of
the path. This explains the difference seen between gtk3inst and
salinst when a collapsed row is scrolled to. gtk3inst expands the
collapsed row, salinst does not. The enhancement patch for tdf#149279
removed the gtk_tree_view_expand_to_path function from
gtk_tree_view_scroll_to_row. This caused a regression in the styles
tree. To fix the regression this patch reverts the removed
gtk_tree_view_expand_to_path functions. To make the enhancement patch
behave the same for gtk3 and sal, the scroll to row is collapsed
after scrolling if that was it's state before.

conflicts:
vcl/unx/gtk3/gtkinst.cxx

Change-Id: I3c3975a3f258c6c432eb866a1c712299e2faf5be
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141048
Tested-by: Jenkins
Reviewed-by: Jim Raykowski 
(cherry picked from commit 53d5f5e15c005d95fa8c9d24d98e26afd2ca2103)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141095
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index cf2c9eb569cc..851eb0f75dd0 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -3933,7 +3933,13 @@ void SwContentTree::UpdateTracking()
 while (!weld::IsEntryVisible(*m_xTreeView, *xIter))
 m_xTreeView->iter_parent(*xIter);
 }
+// Assure the scroll to row is collapsed after 
scrolling if it was collapsed
+// before. This is required here to make gtkinst 
scroll_to_row behave like
+// salinst.
+const bool bRowExpanded = 
m_xTreeView->get_row_expanded(*xIter);
 m_xTreeView->scroll_to_row(*xIter);
+if (!bRowExpanded)
+m_xTreeView->collapse_row(*xIter);
 }
 bRet = true;
 }
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 690f39a50208..cd9bb63ae4ce 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -14946,6 +14946,7 @@ public:
 assert(gtk_tree_view_get_model(m_pTreeView) && "don't select when 
frozen, select after thaw. Note selection doesn't survive a freeze");
 disable_notify_events();
 GtkTreePath* path = gtk_tree_path_new_from_indices(pos, -1);
+gtk_tree_view_expand_to_path(m_pTreeView, path);
 gtk_tree_view_scroll_to_cell(m_pTreeView, path, nullptr, false, 0, 0);
 gtk_tree_path_free(path);
 enable_notify_events();
@@ -15623,6 +15624,7 @@ public:
 disable_notify_events();
 const GtkInstanceTreeIter& rGtkIter = static_cast(rIter);
 GtkTreePath* path = gtk_tree_model_get_path(m_pTreeModel, 
const_cast());
+gtk_tree_view_expand_to_path(m_pTreeView, path);
 gtk_tree_view_scroll_to_cell(m_pTreeView, path, nullptr, false, 0, 0);
 gtk_tree_path_free(path);
 enable_notify_events();


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-10-10 Thread Michael Stahl (via logerrit)
 sw/source/core/table/swnewtable.cxx |   26 ++
 1 file changed, 26 insertions(+)

New commits:
commit 2f52d9abd5c08e0fb31faa25db20906349c17df1
Author: Michael Stahl 
AuthorDate: Fri Oct 7 16:13:05 2022 +0200
Commit: Caolán McNamara 
CommitDate: Mon Oct 10 14:34:58 2022 +0200

tdf#145871 sw: ODF import: don't convert subtables if outer row ...

... has fixed or min height.

The code had 2 obvious problems: the fixed height on the outer row
wasn't cleared if the inner row didn't have a fixed height, and the code
to set lastSize on the last row erroneously set the first row's height
as well due to sharing the row format.

But it turns out that this doesn't work anyway in case any of the inner
rows are variable sized, because without layout it's not possible to
determine the height of these rows, and so the lastSize is going to be
too large in many cases.

(regression from commit e366c928819c44b5c253c45dca6dae40b71c9808)

Change-Id: I42ac7c14236562f9cae228efc0e98dc2fa8c2a23
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141079
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 4757dfc2a520f63fba0b27cc161fe732231dbd0e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141061
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/table/swnewtable.cxx 
b/sw/source/core/table/swnewtable.cxx
index f3bcc71f48f9..c632f86b693b 100644
--- a/sw/source/core/table/swnewtable.cxx
+++ b/sw/source/core/table/swnewtable.cxx
@@ -2133,6 +2133,11 @@ void SwTable::ConvertSubtableBox(sal_uInt16 const nRow, 
sal_uInt16 const nBox)
 assert(!pSubTableBox->GetTabLines().empty());
 // are relative (%) heights possible? apparently not
 SwFormatFrameSize const 
outerSize(pSourceLine->GetFrameFormat()->GetFrameSize());
+if (outerSize.GetHeightSizeType() != SwFrameSize::Variable)
+{   // tdf#145871 clear fixed size in first row
+pSourceLine->ClaimFrameFormat();
+pSourceLine->GetFrameFormat()->ResetFormatAttr(RES_FRM_SIZE);
+}
 tools::Long minHeights(0);
 {
 SwFrameFormat const& 
rSubLineFormat(*pSubTableBox->GetTabLines()[0]->GetFrameFormat());
@@ -2171,12 +2176,14 @@ void SwTable::ConvertSubtableBox(sal_uInt16 const nRow, 
sal_uInt16 const nBox)
 && outerSize.GetHeightSizeType() != SwFrameSize::Variable
 && minHeights < outerSize.GetHeight())
 {
+assert(false); // this should be impossible currently, such 
subtable isn't converted because layout is needed to determine how much space 
is taken up by variable height rows
 SwFormatFrameSize 
lastSize(pNewLine->GetFrameFormat()->GetFrameSize());
 lastSize.SetHeight(lastSize.GetHeight() + outerSize.GetHeight() - 
minHeights);
 if (lastSize.GetHeightSizeType() == SwFrameSize::Variable)
 {
 lastSize.SetHeightSizeType(SwFrameSize::Minimum);
 }
+pNewLine->ClaimFrameFormat();
 pNewLine->GetFrameFormat()->SetFormatAttr(lastSize);
 }
 SfxPoolItem const* pRowBrush(nullptr);
@@ -2295,6 +2302,7 @@ bool SwTable::CanConvertSubtables() const
 return false;
 }
 haveSubtable = true;
+bool haveNonFixedInnerLine(false);
 for (SwTableLine const*const pInnerLine : pBox->GetTabLines())
 {
 // bitmap row background will look different
@@ -2311,6 +2319,13 @@ bool SwTable::CanConvertSubtables() const
 return false;
 }
 }
+if (SwFormatFrameSize const* pSize = 
rRowFormat.GetItemIfSet(RES_FRM_SIZE))
+{
+if (pSize->GetHeightSizeType() != SwFrameSize::Fixed)
+{
+haveNonFixedInnerLine = true;
+}
+}
 for (SwTableBox const*const pInnerBox : 
pInnerLine->GetTabBoxes())
 {
 if (!pInnerBox->GetTabLines().empty())
@@ -2319,6 +2334,17 @@ bool SwTable::CanConvertSubtables() const
 }
 }
 }
+if (haveNonFixedInnerLine)
+{
+if (SwFormatFrameSize const* pSize = 
pLine->GetFrameFormat()->GetItemIfSet(RES_FRM_SIZE))
+{
+if (pSize->GetHeightSizeType() != 
SwFrameSize::Variable)
+{
+// not possible to distribute fixed outer row 
height on rows without layout
+return false;
+}
+}
+}
 }
 }
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-10-08 Thread Michael Stahl (via logerrit)
 sw/source/core/table/swnewtable.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit dd93379cdfce856b73d767b9808f8a87f8c8ac29
Author: Michael Stahl 
AuthorDate: Fri Oct 7 16:21:27 2022 +0200
Commit: Caolán McNamara 
CommitDate: Sat Oct 8 17:37:10 2022 +0200

tdf#151375 sw: ODF import: delete any layout frames before ...

... converting subtables.

This avoids use-after-free by the frames or a11y code on deleted cells.

For file open, there is no layout at this point, but when inserting a
file the crash happens.

(regression from commit e366c928819c44b5c253c45dca6dae40b71c9808)

Change-Id: Ia2cbe548fd5cdce7ae2479bfc3dc993ebb3ce830
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141080
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit ac8717e861608031e50230015c90e64282a10ad0)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141062
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/table/swnewtable.cxx 
b/sw/source/core/table/swnewtable.cxx
index 48953db7c75c..f3bcc71f48f9 100644
--- a/sw/source/core/table/swnewtable.cxx
+++ b/sw/source/core/table/swnewtable.cxx
@@ -2356,6 +2356,8 @@ bool SwTable::CanConvertSubtables() const
 
 void SwTable::ConvertSubtables()
 {
+FndBox_ all(nullptr, nullptr);
+all.DelFrames(*this); // tdf#151375 avoid UAF by frames on deleted cells
 for (size_t i = 0; i < GetTabLines().size(); ++i)
 {
 SwTableLine *const pLine(GetTabLines()[i]);
@@ -2371,6 +2373,7 @@ void SwTable::ConvertSubtables()
 }
 GCLines();
 m_bNewModel = true;
+all.MakeFrames(*this);
 #if 0
 // note: outline nodes (and ordinary lists) are sorted by MoveNodes() 
itself
 //   (this could change order inside table of contents, but that's a


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-10-07 Thread Michael Stahl (via logerrit)
 sw/source/core/layout/frmtool.cxx |9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 0fb5f7e22b68fc045843af95ca3918c1d92a8656
Author: Michael Stahl 
AuthorDate: Thu Oct 6 19:22:51 2022 +0200
Commit: Caolán McNamara 
CommitDate: Fri Oct 7 20:27:39 2022 +0200

tdf#150500 sw_fieldmarkhide: fix duplicate text frame on paste

The problem is that in MakeFrames() after the 1st iteration the
SwNode2Layout::NextFrame() on node 10 returns a SwTextFrame that was
just created by the 1st iteration, due to a fieldmark merging the 2
SwTextNodes.

Only itreate the frames that are pre-existing.

(regression from commit 2f726fa41cbd249f2fb30222b29d5f30bce52e6e)

Change-Id: Iba684dfc903e1c72ca3e70a9aabf1aecf4baf32b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141032
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 21358e0502995238b85677d72a005f3f96d60f7f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141059
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/layout/frmtool.cxx 
b/sw/source/core/layout/frmtool.cxx
index ee50dcc7cd12..ecd69e9012ab 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -2026,9 +2026,14 @@ void MakeFrames( SwDoc *pDoc, const SwNodeIndex ,
 {
 bool bApres = aTmp < rSttIdx;
 SwNode2Layout aNode2Layout( *pNd, rSttIdx.GetIndex() );
-SwFrame* pFrame;
 sw::FrameMode eMode = sw::FrameMode::Existing;
-while( nullptr != (pFrame = aNode2Layout.NextFrame()) )
+::std::vector frames;
+while (SwFrame* pFrame = aNode2Layout.NextFrame())
+{   // tdf#150500 new frames may be created that end up merged on pNd
+// so copy the currently existing ones; they shouldn't get deleted
+frames.push_back(pFrame);
+}
+for (SwFrame *const pFrame : frames)
 {
 SwLayoutFrame *pUpper = pFrame->GetUpper();
 SwFootnoteFrame* pFootnoteFrame = pUpper->FindFootnoteFrame();


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-10-05 Thread Caolán McNamara (via logerrit)
 sw/source/ui/misc/pggrid.cxx |   17 -
 1 file changed, 12 insertions(+), 5 deletions(-)

New commits:
commit 159a117c2e6d7fe768c9f76be0bc9f792ace96eb
Author: Caolán McNamara 
AuthorDate: Wed Oct 5 09:49:17 2022 +0100
Commit: Xisco Fauli 
CommitDate: Wed Oct 5 13:22:31 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 

diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx
index 7f9b10cd447a..db3ade6edb6b 100644
--- a/sw/source/ui/misc/pggrid.cxx
+++ b/sw/source/ui/misc/pggrid.cxx
@@ -458,15 +458,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() == 
@@ -479,6 +482,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-4' - sw/source

2022-10-05 Thread Khaled Hosny (via logerrit)
 sw/source/core/doc/DocumentStylePoolManager.cxx |   15 ---
 1 file changed, 15 deletions(-)

New commits:
commit 7199097b1602f057129a12b3771220c1bc23fd1e
Author: Khaled Hosny 
AuthorDate: Mon Oct 3 13:06:19 2022 +0200
Commit: خالد حسني 
CommitDate: Wed Oct 5 09:13:08 2022 +0200

tdf#126657, tdf#145104: Don’t set language to none on defined styles

Language is used for more things than spell checking (localized digits,
accessibility, OpenType layout, and probably more).

A better way is needed to disable spell checking for parts of the
document by default while keeping the language alone, but right now I’m
reverting these changes because they are workarounds for essentially
cosmetic issues.

This reverts the following commits:

commit ca91beb9d983754a5cba9e3df1bf18295e6640a0
Author: Vladimir Glazounov 
Date:   Wed Jun 4 08:50:40 2008 +

INTEGRATION: CWS sw30bf04 (1.51.2); FILE MERGED
2008/05/13 07:20:17 fme 1.51.2.1: #i40133# rail: Set internet link 
style language to none to prevent spell checking

commit 137a1d5380e310a43d36932c643e1331a94fd70d
Author: Heiko Tietze 
Date:   Mon Jul 19 16:40:50 2021 +0200

Resolves tdf#143066 - Language set to None for indices

Change-Id: Idc9455f3f04e661bd00a9829dd0f0916844dc8eb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140902
Tested-by: Jenkins
Reviewed-by: خالد حسني 
(cherry picked from commit 2cca160f8bfc4597cf0ad3aaaf0017a5210ea0ec)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140958

diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx 
b/sw/source/core/doc/DocumentStylePoolManager.cxx
index a37365186330..cba46902bbb8 100644
--- a/sw/source/core/doc/DocumentStylePoolManager.cxx
+++ b/sw/source/core/doc/DocumentStylePoolManager.cxx
@@ -823,14 +823,6 @@ SwTextFormatColl* 
DocumentStylePoolManager::GetTextCollFromPool( sal_uInt16 nId,
 aSet.Put( SvxWidowsItem( 0, RES_PARATR_WIDOWS ) );
 aSet.Put( SvxOrphansItem( 0, RES_PARATR_ORPHANS ) );
 }
-// tdf#143066 : set language to 'none' to prevent spell 
checking for indices
-if (nId == RES_POOLCOLL_REGISTER_BASE)
-{
-aSet.Put( SvxLanguageItem( LANGUAGE_NONE, 
RES_CHRATR_LANGUAGE ) );
-aSet.Put( SvxLanguageItem( LANGUAGE_NONE, 
RES_CHRATR_CJK_LANGUAGE ) );
-aSet.Put( SvxLanguageItem( LANGUAGE_NONE, 
RES_CHRATR_CTL_LANGUAGE ) );
-}
-break;
 }
 break;
 
@@ -1559,19 +1551,12 @@ SwFormat* DocumentStylePoolManager::GetFormatFromPool( 
sal_uInt16 nId )
 {
 aSet.Put( SvxColorItem( COL_BLUE, RES_CHRATR_COLOR ) );
 aSet.Put( SvxUnderlineItem( LINESTYLE_SINGLE, RES_CHRATR_UNDERLINE 
) );
-// i40133: patch submitted by rail: set language to 'none' to 
prevent spell checking:
-aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_LANGUAGE ) );
-aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_CJK_LANGUAGE 
) );
-aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_CTL_LANGUAGE 
) );
 }
 break;
 case RES_POOLCHR_INET_VISIT:
 {
 aSet.Put( SvxColorItem( COL_RED, RES_CHRATR_COLOR ) );
 aSet.Put( SvxUnderlineItem( LINESTYLE_SINGLE, RES_CHRATR_UNDERLINE 
) );
-aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_LANGUAGE ) );
-aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_CJK_LANGUAGE 
) );
-aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_CTL_LANGUAGE 
) );
 }
 break;
 case RES_POOLCHR_JUMPEDIT:


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-10-03 Thread Xisco Fauli (via logerrit)
 sw/source/ui/chrdlg/numpara.cxx  |   14 --
 sw/source/uibase/inc/numpara.hxx |2 +-
 2 files changed, 9 insertions(+), 7 deletions(-)

New commits:
commit cf15a1fc143536c20c81faab5950ab829ec8df19
Author: Xisco Fauli 
AuthorDate: Mon Oct 3 19:00:35 2022 +0200
Commit: Caolán McNamara 
CommitDate: Mon Oct 3 22:04:57 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 

diff --git a/sw/source/ui/chrdlg/numpara.cxx b/sw/source/ui/chrdlg/numpara.cxx
index f67627b2dad0..42206a1b2edc 100644
--- a/sw/source/ui/chrdlg/numpara.cxx
+++ b/sw/source/ui/chrdlg/numpara.cxx
@@ -309,10 +309,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 ];
@@ -331,12 +336,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-4' - sw/source

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

New commits:
commit 9c101e46269db89e20989553c5f1824864a6f678
Author: Jim Raykowski 
AuthorDate: Mon Sep 12 15:27:11 2022 -0800
Commit: Caolán McNamara 
CommitDate: Mon Oct 3 10:06:28 2022 +0200

tdf#143547 SwNavigator: restore content tree scroll position

after promote, demote, and move chapter

Change-Id: Ie165fadf6154a019ad79a0fed489f63aa768c8f9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139823
Tested-by: Jenkins
Reviewed-by: Jim Raykowski 
(cherry picked from commit a33b8ec923b4e86a2ca2075f9541e79a729b2ed7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140875
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index 1461cd84a1b6..cf2c9eb569cc 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -3356,9 +3356,16 @@ void SwContentTree::ExecCommand(std::string_view rCmd, 
bool bOutlineWithChildren
 if (m_aActiveContentArr[ContentTypeId::OUTLINE])
 m_aActiveContentArr[ContentTypeId::OUTLINE]->Invalidate();
 
+// tdf#143547 LO Writer: navigator should stand still on promoting and 
demoting
+// In addition to m_bIgnoreDocChange being true, selections are 
cleared before the Display
+// call. Either of these conditions disable restore of scroll position 
happening in the
+// Display function so it needs to be done here.
+auto nOldScrollPos = m_xTreeView->vadjustment_get_value();
+
 // clear all selections to prevent the Display function from trying to 
reselect selected entries
 m_xTreeView->unselect_all();
 Display(true);
+m_xTreeView->vadjustment_set_value(nOldScrollPos);
 
 // reselect entries
 const SwOutlineNodes::size_type nCurrPos = 
pShell->GetOutlinePos(MAXLEVEL);


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-09-26 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/docnode/node.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit cb43334ee9938d7b8e250f9ddbdc81e53779f8d0
Author: Bjoern Michaelsen 
AuthorDate: Sun Sep 25 04:34:54 2022 +0200
Commit: Michael Stahl 
CommitDate: Mon Sep 26 15:16:22 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 

diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 444e6dda6613..d95b18ceeded 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -1257,7 +1257,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-4' - sw/source

2022-09-21 Thread Jim Raykowski (via logerrit)
 sw/source/uibase/utlui/content.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 0be24b5794656f159e02e52435a7226f530787d5
Author: Jim Raykowski 
AuthorDate: Mon Sep 5 23:47:42 2022 -0800
Commit: Christian Lohmaier 
CommitDate: Wed Sep 21 11:36:28 2022 +0200

tdf#150604 Writer Navigator: Make delete shortcut key delete Indexes

Change-Id: I651159794790972b430c9a420d6eaa1ed77e5718
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139550
Tested-by: Jenkins
Reviewed-by: Jim Raykowski 
(cherry picked from commit a8e4bf44012139adff7d1343f17edca13a70d0c5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139560
Reviewed-by: Christian Lohmaier 

diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index 9506827fa325..1461cd84a1b6 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -364,7 +364,7 @@ SwContentType::SwContentType(SwWrtShell* pShell, 
ContentTypeId nType, sal_uInt8
 break;
 case ContentTypeId::INDEX:
 m_bEdit = true;
-m_bDelete = false;
+m_bDelete = true;
 break;
 case ContentTypeId::REFERENCE:
 m_bEdit = false;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-09-16 Thread Mike Kaganski (via logerrit)
 sw/source/core/crsr/crsrsh.cxx |   13 +
 1 file changed, 13 insertions(+)

New commits:
commit 87f17803a907c29a121fcb84588da98a51cca543
Author: Mike Kaganski 
AuthorDate: Thu Sep 15 11:24:32 2022 +0300
Commit: Michael Stahl 
CommitDate: Fri Sep 16 14:30:08 2022 +0200

tdf#106959: use table's first content node for cursor cleanup

The problem was that when doing the SHELL mail merge with a document
starting with a table, the generated marks point to the first node on
the page, which is not a content node, but a table node. When getting
page numbers for such mark, cursor got cleaned up, meaning that it
looked for a content node as the cursor position. The lookup tried
to go to a previous content node first, and that gave a content node
on the previous page.

The cursor position cleanup was introduced for i#18014 in commit
468c7b8d3287712c6959cd531c71875f4d26bcbc
  Author Jens-Heiner Rechtien 
  Date   Fri Jan 04 12:19:29 2008 +
INTEGRATION: CWS sw8u10bf02 (1.66.92); FILE MERGED

The bug was incorrect restoration of cursor position after inserting
a row to a table, placing cursor there, and undoing.
I have checked that the mentioned scenario keeps the cursor inside the
table, not jumps to the beginning of the document, as it did before
the mentined commit.

Unfortunately, I don't see how to test this properly in
sw/qa/extras/mailmerge/mailmerge.cxx; FILE mailmerge tests there use
a different code path; and SHELL tests obviously do not perform the
post-processing from SwMMResultSaveDialog::SaveOutputHdl_Impl. Likely,
an UITest would be needed.

But why do we use this SHELL + post-processing here, instead of using
the same FILE mail merge that is performed from form letter dialog,
when SwDBManager::Merge is called from SwDBManager::ExecuteFormLetter
with properly constructed SwMergeDescriptor? That would also speed up
the merge, avoiding extra steps of generating full resulting document
in memory, saving it to a temporary file, just to split it to pieces
(TODO/LATER).

Change-Id: I269de4ae3407261c4f6df51cacd5fc72643fd29a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139973
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
(cherry picked from commit eb30df9b8e86f756ebc66be86ae2eb345fafc850)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139983
Reviewed-by: Michael Stahl 

diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 18199f2ebcd3..b24920da9b2f 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -3642,6 +3642,19 @@ void SwCursorShell::ClearUpCursors()
 pStartCursor->DeleteMark();
 bChanged = true;
 }
+if (pStartCursor->GetPoint()->nNode.GetNode().IsTableNode())
+{
+// tdf#106959: When cursor points to start of a table, the proper 
content
+// node is the first one inside the table, not the previous one
+SwNodes& aNodes = GetDoc()->GetNodes();
+SwNodeIndex aIdx(pStartCursor->GetPoint()->nNode);
+if (SwNode* pNode = aNodes.GoNext())
+{
+SwPaM aTmpPam(*pNode);
+*pStartCursor = aTmpPam;
+bChanged = true;
+}
+}
 if( !sw_PosOk( *pStartCursor->GetPoint() ) )
 {
 SwNodes & aNodes = GetDoc()->GetNodes();


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-09-13 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/unocore/unoportenum.cxx |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 51c558930a261a5bd63569965fe360f316b9f3f4
Author: Bjoern Michaelsen 
AuthorDate: Sun Sep 11 17:30:32 2022 +0200
Commit: Caolán McNamara 
CommitDate: Tue Sep 13 20:54:10 2022 +0200

tdf#129163: GC cursor table at the end of the life of an portion enumeration

Change-Id: I864c0ba9ec43a5b164bb9a118911e0507f2a538a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139778
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 2bb92469c9f6074f7d969ebe0323b623631dd3e8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139836
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/unocore/unoportenum.cxx 
b/sw/source/core/unocore/unoportenum.cxx
index 30a24721b031..be3ee4491e9e 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -337,7 +337,11 @@ SwXTextPortionEnumeration::SwXTextPortionEnumeration(
 SwXTextPortionEnumeration::~SwXTextPortionEnumeration()
 {
 SolarMutexGuard aGuard;
-m_pUnoCursor.reset(nullptr);
+if( m_pUnoCursor )
+{
+m_pUnoCursor->GetDoc().cleanupUnoCursorTable();
+m_pUnoCursor.reset(nullptr);
+}
 }
 
 sal_Bool SwXTextPortionEnumeration::hasMoreElements()


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-09-09 Thread Xisco Fauli (via logerrit)
 sw/source/core/docnode/ndtbl1.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 4a7b856c2b6b97b9538a6945cf2afa95e59a3031
Author: Xisco Fauli 
AuthorDate: Fri Sep 9 13:33:09 2022 +0200
Commit: Xisco Fauli 
CommitDate: Fri Sep 9 19:17:52 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

diff --git a/sw/source/core/docnode/ndtbl1.cxx 
b/sw/source/core/docnode/ndtbl1.cxx
index 59c9154f74ca..678861ca08e1 100644
--- a/sw/source/core/docnode/ndtbl1.cxx
+++ b/sw/source/core/docnode/ndtbl1.cxx
@@ -1670,7 +1670,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-4' - sw/source

2022-09-02 Thread Caolán McNamara (via logerrit)
 sw/source/core/unocore/unoframe.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit ff6a1a9e41914c4a9dfd00f986342277f9c669df
Author: Caolán McNamara 
AuthorDate: Tue Aug 30 16:46:18 2022 +0100
Commit: Eike Rathke 
CommitDate: Fri Sep 2 11:44:59 2022 +0200

crash inserting odt as embedded ole object

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

diff --git a/sw/source/core/unocore/unoframe.cxx 
b/sw/source/core/unocore/unoframe.cxx
index ba005ac284cf..ac51043ff058 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -2263,8 +2263,9 @@ uno::Any SwXFrame::getPropertyValue(const OUString& 
rPropertyName)
 }
 else if(WID_LAYOUT_SIZE == pEntry->nWID)
 {
-// format document completely in order to get correct value
-pFormat->GetDoc()->GetEditShell()->CalcLayout();
+// format document completely in order to get correct value (no 
EditShell for ole embedded case)
+if (SwEditShell* pEditShell = pFormat->GetDoc()->GetEditShell())
+pEditShell->CalcLayout();
 
 SwFrame* pTmpFrame = SwIterator( *pFormat 
).First();
 if ( pTmpFrame )


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-08-30 Thread Caolán McNamara (via logerrit)
 sw/source/uibase/docvw/PageBreakWin.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 5b7ceed80f2943cd85bb70d19bc482fd2e712386
Author: Caolán McNamara 
AuthorDate: Mon Aug 29 20:06:33 2022 +0100
Commit: Miklos Vajna 
CommitDate: Tue Aug 30 08:46:56 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/+/138975
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/uibase/docvw/PageBreakWin.cxx 
b/sw/source/uibase/docvw/PageBreakWin.cxx
index fe68dd1673a2..600d23a4489d 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-4' - sw/source

2022-08-27 Thread Andreas Heinisch (via logerrit)
 sw/source/core/doc/doctxm.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 5f03dc914d67725b4d8e949d4e2198c4e9b537ec
Author: Andreas Heinisch 
AuthorDate: Thu Aug 25 21:53:06 2022 +0200
Commit: Ilmari Lauhakangas 
CommitDate: Sat Aug 27 14:24:23 2022 +0200

tdf#150594 - Prevent crash while searching for the next outline node

Change-Id: Ia83968b26f0053815c0da9910aa00f9dde577246
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138850
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch 
(cherry picked from commit 33c6dcfaab35a70f8794a67d31fbec636cb485d5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138898
Reviewed-by: Ilmari Lauhakangas 

diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index 83310172e852..9665c3915714 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -804,8 +804,9 @@ static bool IsHeadingContained(const SwTextNode* pChptrNd, 
const SwNode& rNd)
 else
 {
 // Search for the next outline node which lies not within the 
current chapter node
-while (pChptrNd->GetAttrOutlineLevel()
-   < rONds[nPos]->GetTextNode()->GetAttrOutlineLevel())
+while (nPos > 0
+   && pChptrNd->GetAttrOutlineLevel()
+  < rONds[nPos]->GetTextNode()->GetAttrOutlineLevel())
 nPos--;
 bIsHeadingContained = pChptrNd == rONds[nPos]->GetTextNode();
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-08-26 Thread Caolán McNamara (via logerrit)
 sw/source/core/text/porfld.cxx |3 +++
 sw/source/core/text/porfld.hxx |2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 3895d4c574ac1b6bf02c493494a034bdc5d0a42e
Author: Caolán McNamara 
AuthorDate: Fri Aug 26 14:42:32 2022 +0100
Commit: Xisco Fauli 
CommitDate: Fri Aug 26 21:54:23 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/+/138827
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index 2affe7edd844..444313cc2533 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -1086,6 +1086,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 45a2027b4e74..84141a340448 100644
--- a/sw/source/core/text/porfld.hxx
+++ b/sw/source/core/text/porfld.hxx
@@ -213,7 +213,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-4' - sw/source

2022-08-24 Thread Michael Stahl (via logerrit)
 sw/source/core/text/porlay.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit da7833bf6f8990a8916e3d38090426cb430633a4
Author: Michael Stahl 
AuthorDate: Fri Aug 12 17:39:18 2022 +0200
Commit: Caolán McNamara 
CommitDate: Sun Aug 14 12:57:58 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/+/138129
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 8e61614a6ef1..d91edd87ca0b 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -1051,6 +1051,10 @@ static void InitBookmarks(
 break;
 }
 }
+if (iter == end)
+{
+break; // remaining marks are hidden
+}
 }
 }
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-08-19 Thread Xisco Fauli (via logerrit)
 sw/source/core/doc/extinput.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit ecc1568567d9e879ae861eaeb6c12a9a6c06a8d3
Author: Xisco Fauli 
AuthorDate: Thu Aug 18 13:56:22 2022 +0200
Commit: Xisco Fauli 
CommitDate: Fri Aug 19 11:33:00 2022 +0200

tdf#150331: update index only when text is inserted

other branches of the
if( m_bIsOverwriteCursor && !m_sOverwriteText.isEmpty() )
condition do the same

Regression introduced by 218acb48df79101392c2cc3a030ddb5dcee878c7
"tdf#146728 lok: IME: preset formatting in the new paragraph"

CppunitTest_sw_tiledrendering passes with this patch in place.
I plan to add a test in a follow-up commit

Change-Id: I0f63b2c802b1280d16afeb18ad0f1735891e6a33
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138485
Reviewed-by: Miklos Vajna 
Reviewed-by: Szymon Kłos 
Tested-by: Xisco Fauli 
(cherry picked from commit 2a00d621a13049af7a62783c29a458e68c6429e4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138430
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/core/doc/extinput.cxx b/sw/source/core/doc/extinput.cxx
index 305dddcd4caa..6ad02a0a4ee4 100644
--- a/sw/source/core/doc/extinput.cxx
+++ b/sw/source/core/doc/extinput.cxx
@@ -115,9 +115,10 @@ SwExtTextInput::~SwExtTextInput()
 sal_Int32 nLenghtOfOldString = nEndCnt - nSttCnt;
 
 if( m_bInsText )
+{
+rIdx = nSttCnt;
 rDoc.getIDocumentContentOperations().InsertString( *this, sText, 
SwInsertFlags::EMPTYEXPAND );
-
-rIdx = nEndCnt;
+}
 
 pTNd->EraseText( rIdx, nLenghtOfOldString );
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-08-19 Thread Justin Luth (via logerrit)
 sw/source/filter/ww8/ww8par.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit ef5a7ab81cdee4c1e861d49ea79b6924a01a8792
Author: Justin Luth 
AuthorDate: Mon Aug 15 07:33:50 2022 -0400
Commit: Michael Stahl 
CommitDate: Fri Aug 19 11:31:49 2022 +0200

fix tdf#77964 patch: don't change DefaultFormat

I was actually making a chnage to the default frameformat
instead of using a copy of it. Not at all intended.

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

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index dd8484a389a8..a48893e8cc7a 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -3715,10 +3715,12 @@ bool SwWW8ImplReader::ReadChar(tools::Long nPosCp, 
tools::Long nCpOfs)
 pResult = ImportOle();
 else if (m_bSpec)
 {
-SwFrameFormat* pAsCharFlyFormat = 
m_rDoc.GetDfltFrameFormat();
+SwFrameFormat* pAsCharFlyFormat =
+m_rDoc.MakeFrameFormat(OUString(), 
m_rDoc.GetDfltFrameFormat());
 SwFormatAnchor aAnchor(RndStdIds::FLY_AS_CHAR);
 pAsCharFlyFormat->SetFormatAttr(aAnchor);
 pResult = ImportGraf(nullptr, pAsCharFlyFormat);
+m_rDoc.DelFrameFormat(pAsCharFlyFormat);
 }
 
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-08-18 Thread Michael Stahl (via logerrit)
 sw/source/core/doc/DocumentRedlineManager.cxx |7 ++-
 sw/source/core/text/redlnitr.cxx  |2 +-
 2 files changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 18254a36dbdb68b3b4bbbcaed0d33ba0840539a9
Author: Michael Stahl 
AuthorDate: Wed Aug 17 10:43:04 2022 +0200
Commit: Thorsten Behrens 
CommitDate: Thu Aug 18 10:54:47 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/+/138416
Reviewed-by: Thorsten Behrens 

diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx 
b/sw/source/core/doc/DocumentRedlineManager.cxx
index b8598848b774..0a1076db29f4 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -1678,8 +1678,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 2a7a4b9309ac..352b642b294b 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-4' - sw/source

2022-08-18 Thread Michael Stahl (via logerrit)
 sw/source/core/doc/DocumentRedlineManager.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit fa5838b018a5f1e5b1616bbacbb242eb4fac998a
Author: Michael Stahl 
AuthorDate: Fri Jul 15 20:55:35 2022 +0200
Commit: Xisco Fauli 
CommitDate: Thu Aug 18 10:11:24 2022 +0200

tdf#149548 sw: don't rely on binary search in SplitRedline()

The problem is that for this bugdoc overlapping redlines are created by
writerfilter, and so this one survives the split in SwDoc::TextToTable()
when creating a cell on node 146 to 149:

$125 = (SwRangeRedline) {
   = SwPaM = {
point = SwPosition (node 155, offset 156),
mark = SwPosition (node 146, offset 0)
  },

It's not found in GetRedline(), as that relies on the redlines never
overlapping, so isn't split at end of 149.

Then when copying to the clipboard, all redlines are deleted and this
deletes cell start and end nodes, while the cell's SwTableBox is still
referenced elsewhere.

(reportedly somehow a regression from
commit c4cf85766453982f1aa94a7f2cb22af19ed100be)

Change-Id: I6466e6777cd83c7625381f7049f30c8a2f487af1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137110
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit de49e1c55dc10ce1b59345af5cc49fde3adf65b7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138286
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx 
b/sw/source/core/doc/DocumentRedlineManager.cxx
index b215170ee36f..b8598848b774 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -2492,7 +2492,7 @@ bool DocumentRedlineManager::SplitRedline( const SwPaM& 
rRange )
 SwRedlineTable::size_type n = 0;
 const SwPosition* pStt = rRange.Start();
 const SwPosition* pEnd = rRange.End();
-GetRedline( *pStt,  );
+//FIXME overlapping problem GetRedline( *pStt,  );
 for ( ; n < maRedlineTable.size(); ++n)
 {
 SwRangeRedline * pRedline = maRedlineTable[ n ];


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-08-17 Thread Liu Hao (via logerrit)
 sw/source/core/access/AccessibilityCheck.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 658cb77de90ec66abc6d0ed4aba614772ae482bd
Author: Liu Hao 
AuthorDate: Mon Aug 15 14:36:47 2022 +0800
Commit: Xisco Fauli 
CommitDate: Wed Aug 17 16:53:51 2022 +0200

tdf#149115 Trim the white sapce in title before emptiness check

Title that only contains white space should be treated as empty.

Change-Id: I7e4ec6aed206e01dd62fb3afc278fa90d84b7598
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138268
Tested-by: Jenkins
Reviewed-by: Heiko Tietze 
(cherry picked from commit af87ec3137c32ba098c072304595d8b590f3447c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138293
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/core/access/AccessibilityCheck.cxx 
b/sw/source/core/access/AccessibilityCheck.cxx
index 1d4c0f57897d..50a37dc00bef 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -836,7 +836,7 @@ public:
 const uno::Reference 
xDocumentProperties(
 xDPS->getDocumentProperties());
 OUString sTitle = xDocumentProperties->getTitle();
-if (sTitle.isEmpty())
+if (sTitle.trim().isEmpty())
 {
 lclAddIssue(m_rIssueCollection, SwResId(STR_DOCUMENT_TITLE),
 sfx::AccessibilityIssueID::DOCUMENT_TITLE);


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-08-17 Thread Caolán McNamara (via logerrit)
 sw/source/ui/frmdlg/frmpage.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 076dd358aafb749c8b9026da91abdcae07c45ca3
Author: Caolán McNamara 
AuthorDate: Mon Aug 15 12:43:09 2022 +0100
Commit: Michael Stahl 
CommitDate: Wed Aug 17 10:08:36 2022 +0200

don't try and select position 0 of combobox if combobox is empty

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

diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index 83cf98f49195..11955b5beb42 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -1397,7 +1397,7 @@ sal_Int32 SwFramePage::FillPosLB(const FrameMap* _pMap,
 if (_rLB.get_active() == -1)
 _rLB.set_active_text(sOldEntry);
 
-if (_rLB.get_active() == -1)
+if (_rLB.get_active() == -1 && _rLB.get_count())
 _rLB.set_active(0);
 
 PosHdl(_rLB);


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-08-12 Thread Michael Stahl (via logerrit)
 sw/source/core/txtnode/modeltoviewhelper.cxx |   12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

New commits:
commit c346971866a462c658d33fb1e1710783f131f1b8
Author: Michael Stahl 
AuthorDate: Mon Aug 8 16:12:14 2022 +0200
Commit: Caolán McNamara 
CommitDate: Fri Aug 12 10:29:01 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/+/138025
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/txtnode/modeltoviewhelper.cxx 
b/sw/source/core/txtnode/modeltoviewhelper.cxx
index e5aec1b510be..306f58c2b8db 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-4' - sw/source

2022-08-10 Thread Mike Kaganski (via logerrit)
 sw/source/uibase/app/docstyle.cxx |   18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

New commits:
commit ef6fb0eda1d875e1d7975152d966fba33f431c26
Author: Mike Kaganski 
AuthorDate: Wed Aug 3 09:47:40 2022 +0300
Commit: Xisco Fauli 
CommitDate: Wed Aug 10 09:09:15 2022 +0200

tdf#150241: a blind fix attempt

I can't repro it locally (the report misses clear repro steps), but
the three changed OUString assignment operators use rtl::str::assign
internally, and the unconditional dereference of the value returned
from SwDoc::GetDocPattern (that may return a nullptr) is suspicious,
especially compared to the checks made in SwDocStyleSheet::GetHelpId
later in the same file.

All four calls to GetDocPattern in the file were introduced in commit
7b0b5cdfeed656b279bc32cd929630d5fc25878b
  Author Jens-Heiner Rechtien 
  Date   Mon Sep 18 16:15:01 2000 +
initial import

Change-Id: If9d4cff921443e5af71b7d541b79d00ea77e853b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137734
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
(cherry picked from commit 4afb80eaa0df58b78e2bfad892f9e7ce5e1bce7a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137961
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/uibase/app/docstyle.cxx 
b/sw/source/uibase/app/docstyle.cxx
index efaf6853e0ad..fa53a595f2fd 100644
--- a/sw/source/uibase/app/docstyle.cxx
+++ b/sw/source/uibase/app/docstyle.cxx
@@ -1980,8 +1980,10 @@ bool SwDocStyleSheet::FillStyleSheet(
 {
 nPoolId = m_pDesc->GetPoolFormatId();
 nHelpId = m_pDesc->GetPoolHelpId();
-if( m_pDesc->GetPoolHlpFileId() != UCHAR_MAX )
-aHelpFile = *m_rDoc.GetDocPattern( m_pDesc->GetPoolHlpFileId() 
);
+if (const OUString* pattern = m_pDesc->GetPoolHlpFileId() != 
UCHAR_MAX
+  ? 
m_rDoc.GetDocPattern(m_pDesc->GetPoolHlpFileId())
+  : nullptr)
+aHelpFile = *pattern;
 else
 aHelpFile.clear();
 }
@@ -2009,8 +2011,10 @@ bool SwDocStyleSheet::FillStyleSheet(
 {
 nPoolId = m_pNumRule->GetPoolFormatId();
 nHelpId = m_pNumRule->GetPoolHelpId();
-if( m_pNumRule->GetPoolHlpFileId() != UCHAR_MAX )
-aHelpFile = *m_rDoc.GetDocPattern( 
m_pNumRule->GetPoolHlpFileId() );
+if (const OUString* pattern = m_pNumRule->GetPoolHlpFileId() != 
UCHAR_MAX
+  ? 
m_rDoc.GetDocPattern(m_pNumRule->GetPoolHlpFileId())
+  : nullptr)
+aHelpFile = *pattern;
 else
 aHelpFile.clear();
 }
@@ -2065,8 +2069,10 @@ bool SwDocStyleSheet::FillStyleSheet(
 OSL_ENSURE( m_bPhysical, "Format not found" );
 
 nHelpId = pFormat->GetPoolHelpId();
-if( pFormat->GetPoolHlpFileId() != UCHAR_MAX )
-aHelpFile = *m_rDoc.GetDocPattern( pFormat->GetPoolHlpFileId() 
);
+if (const OUString* pattern = pFormat->GetPoolHlpFileId() != 
UCHAR_MAX
+  ? 
m_rDoc.GetDocPattern(pFormat->GetPoolHlpFileId())
+  : nullptr)
+aHelpFile = *pattern;
 else
 aHelpFile.clear();
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-08-08 Thread Jim Raykowski (via logerrit)
 sw/source/uibase/utlui/content.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit e6b9fab8be5f4a8de5126d1f3be82e0c738af9a0
Author: Jim Raykowski 
AuthorDate: Sun Jul 31 18:34:51 2022 -0800
Commit: Xisco Fauli 
CommitDate: Mon Aug 8 19:30:49 2022 +0200

tdf#149916 follow up to include expand field text

in cross-reference entry text

Change-Id: Iaff06e02d272bbe41e63da5356e6c9a6f67c26f9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137665
Tested-by: Jenkins
Reviewed-by: Jim Raykowski 
(cherry picked from commit a0e09cf64eea663122043294b848ac1bb8f05ac9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137966
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index f0fe95f508f3..9506827fa325 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -695,7 +695,8 @@ void SwContentType::FillMemberList(bool* pbContentChanged)
 sExpandedTextOfReferencedTextNode = 
OUString::Concat(
 
sExpandedTextOfReferencedTextNode.subView(0, 80)) + u"...";
 }
-sText = pField->GetDescription() + u" - " + 
sExpandedTextOfReferencedTextNode;
+sText = pField->GetDescription() + u" - "
++ sExpandedTextOfReferencedTextNode + 
sExpandField;
 }
 else
 {


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-08-08 Thread Jim Raykowski (via logerrit)
 sw/source/uibase/config/viewopt.cxx |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

New commits:
commit f76184196f16f22a8c70d7400a3282f4ab6e4257
Author: Jim Raykowski 
AuthorDate: Wed Aug 3 21:19:09 2022 -0800
Commit: Xisco Fauli 
CommitDate: Mon Aug 8 13:50:51 2022 +0200

tdf#148240 follow up: Make Outline-Folding non-experimental

Change-Id: I147591c8088b1fad0575b2efe46f862573147fe9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137774
Reviewed-by: Julien Nabet 
Tested-by: Jenkins
Reviewed-by: Jim Raykowski 
(cherry picked from commit a9d225df2f8772e21435523ca20df1ece37390e4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137957
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/uibase/config/viewopt.cxx 
b/sw/source/uibase/config/viewopt.cxx
index 66ea4daa05f4..c5e6f3e56b9e 100644
--- a/sw/source/uibase/config/viewopt.cxx
+++ b/sw/source/uibase/config/viewopt.cxx
@@ -98,14 +98,12 @@ bool SwViewOption::IsEqualFlags( const SwViewOption  ) 
const
 
 bool SwViewOption::IsShowOutlineContentVisibilityButton() const
 {
-return officecfg::Office::Common::Misc::ExperimentalMode::get() &&
-(m_nCoreOptions & ViewOptFlags1::ShowOutlineContentVisibilityButton);
+return static_cast(m_nCoreOptions & 
ViewOptFlags1::ShowOutlineContentVisibilityButton);
 }
 
 bool SwViewOption::IsTreatSubOutlineLevelsAsContent() const
 {
-return officecfg::Office::Common::Misc::ExperimentalMode::get() &&
-(m_nCoreOptions & ViewOptFlags1::TreatSubOutlineLevelsAsContent);
+return static_cast(m_nCoreOptions & 
ViewOptFlags1::TreatSubOutlineLevelsAsContent);
 }
 
 void SwViewOption::DrawRect( OutputDevice *pOut,


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-08-03 Thread Michael Stahl (via logerrit)
 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 ea753b9c35616efa203dd6eddc524b54b198768a
Author: Michael Stahl 
AuthorDate: Fri Jul 29 17:00:14 2022 +0200
Commit: Thorsten Behrens 
CommitDate: Wed Aug 3 21:53:16 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/+/137761
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 60e650e48e72..f98e4ae3fb28 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 3989fb59b7cd..a8fbc712ac90 100644
--- a/sw/source/filter/xml/xmliteme.cxx
+++ b/sw/source/filter/xml/xmliteme.cxx
@@ -240,7 +240,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-4' - sw/source

2022-08-02 Thread Jim Raykowski (via logerrit)
 sw/source/core/txtnode/txtatr2.cxx |   15 +++
 1 file changed, 3 insertions(+), 12 deletions(-)

New commits:
commit 22112cab00fc791607939becfe3d9416d3ff9d8a
Author: Jim Raykowski 
AuthorDate: Mon Jun 13 08:31:33 2022 -0800
Commit: Caolán McNamara 
CommitDate: Tue Aug 2 12:55:54 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-4' - sw/source

2022-07-30 Thread Gülşah Köse (via logerrit)
 sw/source/uibase/dbui/dbmgr.cxx |   37 ++---
 1 file changed, 18 insertions(+), 19 deletions(-)

New commits:
commit 7369cef79ba7580bc30e48cec4d1a6fdcc8444f6
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:17 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/+/137427
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 0d526bab42c3..c5aa73a0a2f4 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;
@@ -2759,21 +2773,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-4' - sw/source

2022-07-27 Thread Michael Stahl (via logerrit)
 sw/source/core/unocore/unobkm.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 38333796522ab53aff69a2e2228ec1fad6abb866
Author: Michael Stahl 
AuthorDate: Wed Jul 27 16:06:05 2022 +0200
Commit: Xisco Fauli 
CommitDate: Wed Jul 27 22:56:18 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/+/137517
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/core/unocore/unobkm.cxx 
b/sw/source/core/unocore/unobkm.cxx
index 456325d5f575..567cf8a20872 100644
--- a/sw/source/core/unocore/unobkm.cxx
+++ b/sw/source/core/unocore/unobkm.cxx
@@ -406,6 +406,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-4' - sw/source

2022-07-27 Thread Andreas Heinisch (via logerrit)
 sw/source/core/text/itrform2.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit fb63d0a090b049c16993054f1804e440adeba5d7
Author: Andreas Heinisch 
AuthorDate: Wed Jul 27 08:53:11 2022 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Wed Jul 27 22:37:42 2022 +0200

tdf#67669 - Make narrow no-break space visible by drawing a gray background

Make narrow no-break space visible by drawing a gray background like for 
non-breaking spaces.

Change-Id: I3f2b4374a08ea8305c8c84eb497bc362866ad352
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137490
Tested-by: Andreas Heinisch 
Reviewed-by: Andreas Heinisch 
(cherry picked from commit bbb57e8198863ee7bdadd3f2aac4420c08da94a3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137432
Reviewed-by: Adolfo Jayme Barrientos 
Tested-by: Jenkins

diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 563ddd5c4c02..e86c8079c8d2 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -1503,6 +1503,8 @@ SwLinePortion *SwTextFormatter::NewPortion( 
SwTextFormatInfo  )
 case CHAR_SOFTHYPHEN:   // soft hyphen
 pPor = new SwSoftHyphPortion; break;
 
+// tdf#67669 - make narrow no-break space visible by drawing a 
gray background
+case CHAR_NNBSP:// narrow no-break space
 case CHAR_HARDBLANK:// no-break space
 // Please check tdf#115067 if you want to edit the char
 pPor = new SwBlankPortion( cChar ); break;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-07-27 Thread Jim Raykowski (via logerrit)
 sw/source/uibase/utlui/content.cxx |   35 ++-
 1 file changed, 26 insertions(+), 9 deletions(-)

New commits:
commit e503ff11a79a2fc229c5fd679573c0227f3f9a73
Author: Jim Raykowski 
AuthorDate: Mon Jul 25 19:12:13 2022 -0800
Commit: Xisco Fauli 
CommitDate: Wed Jul 27 17:49:40 2022 +0200

tdf#149916 revert to showing text of referenced text node

reverts cross-ref field listings in the Navigator to pre commit
21b5d6e0dce7c2034aded96d1499da27094e2781

A static_cast is used in place of a dynamic_cast which should provide
for reduced time to fill the fields members list for documents with
cross reference fields which was the main purpose for commit
21b5d6e0dce7c2034aded96d1499da27094e2781

Change-Id: If2734386de463a1280d835cab54f95e8bd7fab5c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137444
Tested-by: Jenkins
Reviewed-by: Jim Raykowski 
(cherry picked from commit b8ac21a3981b9d6fd94aa74c4da9026e580f44eb)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137433
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index d23fbe63b849..f0fe95f508f3 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -683,16 +683,33 @@ void SwContentType::FillMemberList(bool* pbContentChanged)
 }
 else if (pField->GetTypeId() == SwFieldTypesEnum::GetRef)
 {
-OUString sFieldSubTypeOrName;
-auto nSubType = pField->GetSubType();
-if (nSubType == REF_FOOTNOTE)
-sFieldSubTypeOrName = SwResId(STR_FLDREF_FOOTNOTE);
-else if (nSubType == REF_ENDNOTE)
-sFieldSubTypeOrName = SwResId(STR_FLDREF_ENDNOTE);
+const SwGetRefField* pRefField(static_cast(pField));
+if (pRefField->IsRefToHeadingCrossRefBookmark() ||
+pRefField->IsRefToNumItemCrossRefBookmark())
+{
+OUString sExpandedTextOfReferencedTextNode =
+pRefField->GetExpandedTextOfReferencedTextNode(
+*m_pWrtShell->GetLayout());
+if (sExpandedTextOfReferencedTextNode.getLength() > 80)
+{
+sExpandedTextOfReferencedTextNode = 
OUString::Concat(
+
sExpandedTextOfReferencedTextNode.subView(0, 80)) + u"...";
+}
+sText = pField->GetDescription() + u" - " + 
sExpandedTextOfReferencedTextNode;
+}
 else
-sFieldSubTypeOrName = pField->GetFieldName();
-sText = pField->GetDescription() + u" - " + 
sFieldSubTypeOrName
-+ sExpandField;
+{
+OUString sFieldSubTypeOrName;
+auto nSubType = pField->GetSubType();
+if (nSubType == REF_FOOTNOTE)
+sFieldSubTypeOrName = SwResId(STR_FLDREF_FOOTNOTE);
+else if (nSubType == REF_ENDNOTE)
+sFieldSubTypeOrName = SwResId(STR_FLDREF_ENDNOTE);
+else
+sFieldSubTypeOrName = pField->GetFieldName();
+sText = pField->GetDescription() + u" - " + 
sFieldSubTypeOrName
++ sExpandField;
+}
 }
 else
 sText = pField->GetDescription() + u" - " + 
pField->GetFieldName()


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-07-26 Thread Luboš Luňák (via logerrit)
 sw/source/core/layout/layact.cxx |   11 +--
 1 file changed, 1 insertion(+), 10 deletions(-)

New commits:
commit fc435d88f6d700aeb5e5f43f41ff659b98df0a95
Author: Luboš Luňák 
AuthorDate: Thu Jul 21 13:31:17 2022 +0200
Commit: Xisco Fauli 
CommitDate: Tue Jul 26 11:57:08 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/+/137314
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 4a9ca92f52a2..6cdfcfce09ce 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -2276,16 +2276,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-4' - sw/source sw/uiconfig

2022-07-23 Thread Caolán McNamara (via logerrit)
 sw/source/ui/index/cnttab.cxx|   25 +
 sw/uiconfig/swriter/ui/assignstylesdialog.ui |3 +--
 2 files changed, 26 insertions(+), 2 deletions(-)

New commits:
commit 47e9c7d433e7f23019ea4ae68e08d82ae9c7e3e3
Author: Caolán McNamara 
AuthorDate: Thu Jul 21 09:06:19 2022 +0100
Commit: Adolfo Jayme Barrientos 
CommitDate: Sat Jul 23 14:11:43 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/+/137192
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 1aac737639b9..f73c234784f0 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -485,6 +485,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[]);
@@ -508,6 +509,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
 {
@@ -579,11 +581,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 f3d53261511b..a5a412c35c86 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-4' - sw/source

2022-07-22 Thread Luboš Luňák (via logerrit)
 sw/source/core/view/viewsh.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c5e2611cff9ab0e436b66c39330c8d994e746cb0
Author: Luboš Luňák 
AuthorDate: Thu Jul 21 13:27:45 2022 +0200
Commit: Caolán McNamara 
CommitDate: Fri Jul 22 12:45:28 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/+/137193
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 3358043a2b8d..057b69878e10 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -485,7 +485,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-4' - sw/source

2022-07-18 Thread Miklos Vajna (via logerrit)
 sw/source/uibase/shells/textsh1.cxx |9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit aab33f804929c4823f9ac085b357859b68a4028a
Author: Miklos Vajna 
AuthorDate: Mon Jul 18 08:21:43 2022 +0200
Commit: Caolán McNamara 
CommitDate: Mon Jul 18 17:56:49 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/+/137175
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/uibase/shells/textsh1.cxx 
b/sw/source/uibase/shells/textsh1.cxx
index 4531da1486f3..4c5e42bc5d59 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -1538,9 +1538,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-4' - sw/source

2022-07-12 Thread Luboš Luňák (via logerrit)
 sw/source/filter/html/htmlplug.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 7463cbbc70fe52496c638165b8b5833c80bd3dc2
Author: Luboš Luňák 
AuthorDate: Mon Jul 11 18:38:18 2022 +0200
Commit: Xisco Fauli 
CommitDate: Tue Jul 12 13:51:30 2022 +0200

close object tag if writing out the preview(?) fails

When writing out OLE frame, if a picture of it (or is it preview?)
is not available, the code bails out, but that leaves the object
tag unclosed. Since it sets only a warning and so it appears to
be non-fatal, close the tag properly before bailing out.

Change-Id: Ib8a6d692b0c3b4cb9ff5bcfe3c964efdaed3dab0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136962
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 
(cherry picked from commit 3dd03090ecee3ab9c3c406de0e8013ee2f3cd364)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136980
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/filter/html/htmlplug.cxx 
b/sw/source/filter/html/htmlplug.cxx
index ace6570e332b..c6a939646f3a 100644
--- a/sw/source/filter/html/htmlplug.cxx
+++ b/sw/source/filter/html/htmlplug.cxx
@@ -1658,6 +1658,9 @@ Writer& OutHTML_FrameFormatOLENodeGrf( Writer& rWrt, 
const SwFrameFormat& rFrame
 if( nErr )  // error, don't write anything
 {
 rHTMLWrt.m_nWarn = WARN_SWG_POOR_LOAD;
+if (bObjectOpened) // Still at least close the tag.
+rWrt.Strm().WriteOString(OStringConcatenation(""));
 return rWrt;
 }
 aGraphicURL = URIHelper::SmartRel2Abs(


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-07-12 Thread Luboš Luňák (via logerrit)
 sw/source/filter/html/htmlflywriter.cxx |6 --
 sw/source/filter/html/htmltabw.cxx  |2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

New commits:
commit 298d46a8efb7ff212938749fcfe06f926b8fe66d
Author: Luboš Luňák 
AuthorDate: Thu Jul 7 17:35:56 2022 +0200
Commit: Xisco Fauli 
CommitDate: Tue Jul 12 11:06:15 2022 +0200

do not write vspace/hspace attributes to reqif

These are not valid for the ReqIF-XHTML subset.

Change-Id: Ie68560c49ba43b0f728c6e51eeb33b4829bded93
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136887
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 
(cherry picked from commit 1f201d76d6e2fcc9d8af6504c38bd98c46e0798e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136868
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/filter/html/htmlflywriter.cxx 
b/sw/source/filter/html/htmlflywriter.cxx
index f8ff5c851024..0e27a89d8516 100644
--- a/sw/source/filter/html/htmlflywriter.cxx
+++ b/sw/source/filter/html/htmlflywriter.cxx
@@ -613,7 +613,8 @@ OString SwHTMLWriter::OutFrameFormatOptions( const 
SwFrameFormat ,
 
 if( (nFrameOpts & HtmlFrmOpts::Space) &&
 (aTwipSpc.Width() || aTwipSpc.Height()) &&
-Application::GetDefaultDevice() )
+Application::GetDefaultDevice() &&
+!mbReqIF )
 {
 Size aPixelSpc =
 Application::GetDefaultDevice()->LogicToPixel( aTwipSpc,
@@ -877,7 +878,8 @@ void SwHTMLWriter::writeFrameFormatOptions(HtmlWriter& 
aHtml, const SwFrameForma
 
 if( (nFrameOptions & HtmlFrmOpts::Space) &&
 (aTwipSpc.Width() || aTwipSpc.Height()) &&
-Application::GetDefaultDevice() )
+Application::GetDefaultDevice() &&
+!mbReqIF )
 {
 Size aPixelSpc =
 Application::GetDefaultDevice()->LogicToPixel( aTwipSpc,
diff --git a/sw/source/filter/html/htmltabw.cxx 
b/sw/source/filter/html/htmltabw.cxx
index b8aac9aed9ba..6849cbb3244a 100644
--- a/sw/source/filter/html/htmltabw.cxx
+++ b/sw/source/filter/html/htmltabw.cxx
@@ -664,7 +664,7 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 
eAlign,
 sOut.append("\"");
 }
 
-if( (nHSpace || nVSpace) && Application::GetDefaultDevice())
+if( (nHSpace || nVSpace) && Application::GetDefaultDevice() && 
!rWrt.mbReqIF)
 {
 Size aPixelSpc =
 Application::GetDefaultDevice()->LogicToPixel( 
Size(nHSpace,nVSpace),


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-07-11 Thread Luboš Luňák (via logerrit)
 sw/source/filter/html/wrthtml.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 6e23b10bba885a6ee766c5e1ad458c95d2087ad4
Author: Luboš Luňák 
AuthorDate: Fri Jul 8 13:12:43 2022 +0200
Commit: Michael Stahl 
CommitDate: Mon Jul 11 13:23:52 2022 +0200

include namespace when writing  tag in Writer HTML export

Change-Id: I5ae6cea44b1bff8dc55162e2f9cd6f034fe2857d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136897
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 
(cherry picked from commit e7cc4ceca48c263270c01e9178ac3d68869f0050)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136927
Reviewed-by: Michael Stahl 

diff --git a/sw/source/filter/html/wrthtml.cxx 
b/sw/source/filter/html/wrthtml.cxx
index 2c0186c22b1f..d216e0d51cb7 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -700,7 +700,7 @@ static void lcl_html_OutSectionStartTag( SwHTMLWriter& 
rHTMLWrt,
 rHTMLWrt.OutNewLine();
 
 OStringBuffer sOut;
-sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_division);
+sOut.append("<" + rHTMLWrt.GetNamespace() + 
OOO_STRING_SVTOOLS_HTML_division);
 
 const OUString& rName = rSection.GetSectionName();
 if( !rName.isEmpty() && !bContinued )


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source

2022-07-11 Thread Michael Stahl (via logerrit)
 sw/source/core/unocore/unotext.cxx |   60 +
 1 file changed, 60 insertions(+)

New commits:
commit 6f3953236070c186bc9356053d8b368d1c28372d
Author: Michael Stahl 
AuthorDate: Fri Jul 8 17:32:49 2022 +0200
Commit: Xisco Fauli 
CommitDate: Mon Jul 11 10:30:55 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 3d48adc6f9bbec0b7a169466273636961ffbb6bf)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136920
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/core/unocore/unotext.cxx 
b/sw/source/core/unocore/unotext.cxx
index a837d42d71c2..c34319e28db2 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 
@@ -2008,6 +2009,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-4' - sw/source

2022-07-08 Thread Tünde Tóth (via logerrit)
 sw/source/core/unocore/unocrsrhelper.cxx |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 2b53b81a660899312d94479ad37d522b9f029c30
Author: Tünde Tóth 
AuthorDate: Wed Jun 29 13:22:59 2022 +0200
Commit: László Németh 
CommitDate: Fri Jul 8 12:07:37 2022 +0200

tdf#149747 DOCX import: use UI style name for tracked changes

instead of the programmatic style name, because rejection
of tracked paragraph style changes was incorrect
with an other UI than English UI.

Follow-up to commit 0ad5d133bd75ccd3a04505aaac7ad3f2f9105f76
"tdf#132781 DOCX: export interoperable hyperlink style names"
and commit 4248d759744f83a68d334a8b347124719a2886a8
"tdf#126243 DOCX: export/reject tracked paragraph style change".

Change-Id: I3b3b163b2538732b2470162888083de0609895fc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136624
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 28dc21cc05adf62a8fe637d1e82ab885c1159478)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136869
Tested-by: Jenkins

diff --git a/sw/source/core/unocore/unocrsrhelper.cxx 
b/sw/source/core/unocore/unocrsrhelper.cxx
index 04b93de0d003..b176138a0d2a 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -1342,7 +1342,7 @@ void makeRedline( SwPaM const & rPaM,
 if (!aWhichPairs.empty())
 {
 sal_uInt16 nStylePoolId = USHRT_MAX;
-OUString sParaStyleName;
+OUString sParaStyleName, sUIStyle;
 SfxItemSet aItemSet(rDoc.GetAttrPool(), aWhichPairs);
 
 for (size_t i = 0; i < aEntries.size(); ++i)
@@ -1374,7 +1374,11 @@ void makeRedline( SwPaM const & rPaM,
 if (eType == RedlineType::ParagraphFormat && 
sParaStyleName.isEmpty())
 nStylePoolId = RES_POOLCOLL_STANDARD;
 
-xRedlineExtraData.reset(new SwRedlineExtraData_FormatColl( 
sParaStyleName, nStylePoolId,  ));
+// tdf#149747 Get UI style name from programmatic style name
+SwStyleNameMapper::FillUIName(sParaStyleName, sUIStyle,
+  SwGetPoolIdFromName::TxtColl);
+xRedlineExtraData.reset(new SwRedlineExtraData_FormatColl(
+sUIStyle.isEmpty() ? sParaStyleName : sUIStyle, 
nStylePoolId, ));
 }
 else if (eType == RedlineType::ParagraphFormat)
 xRedlineExtraData.reset(new SwRedlineExtraData_FormatColl( "", 
RES_POOLCOLL_STANDARD, nullptr ));


  1   2   >