core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-09-03 Thread Gökay Şatır (via logerrit)
 sw/source/core/edit/edlingu.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit d9890cc6b9bb5e94fe42ba0216dd5b7e92d11b13
Author: Gökay Şatır 
AuthorDate: Mon Sep 2 17:26:49 2024 +0300
Commit: Mike Kaganski 
CommitDate: Tue Sep 3 15:26:23 2024 +0200

tdf#160127: revert 7697ef9d8fbbed7afba10c00ff9f5362d0540cdd

* https://gerrit.libreoffice.org/c/core/+/158832

And the regression that reverted commit caused:
* https://bugs.documentfoundation.org/show_bug.cgi?id=160127

Signed-off-by: Gökay Şatır 
Change-Id: I5bf5414470dad735e5d973fa0d80f7e1c6a4c191
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172743
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Mike Kaganski 

diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx
index 5731d2b2be49..e1f6d631139d 100644
--- a/sw/source/core/edit/edlingu.cxx
+++ b/sw/source/core/edit/edlingu.cxx
@@ -1031,8 +1031,7 @@ bool SwEditShell::GetGrammarCorrection(
 auto pError = std::find_if(std::cbegin(rResult.aErrors), 
std::cend(rResult.aErrors),
 [rErrorPosInText, nLen](const 
linguistic2::SingleProofreadingError &rError) {
 return rError.nErrorStart <= rErrorPosInText
-&& rErrorPosInText + nLen <= rError.nErrorStart + 
rError.nErrorLength
-&& rError.aSuggestions.size() > 0; });
+&& rErrorPosInText + nLen <= rError.nErrorStart + 
rError.nErrorLength; });
 if (pError != std::cend(rResult.aErrors))
 {
 rSuggestions = pError->aSuggestions;


core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-08-30 Thread Miklos Vajna (via logerrit)
 sw/source/core/text/frmform.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c513d0785dccfb55dd0cf818dcf682b1d752ed52
Author: Miklos Vajna 
AuthorDate: Thu Aug 29 10:13:51 2024 +0200
Commit: Caolán McNamara 
CommitDate: Fri Aug 30 11:03:48 2024 +0200

sw: call HasFullPageFly() later in SwTextFrame::FormatAdjust()

Suggested at

,
the other conditions are trivial to check, so best if we do the
expensive condition only at the end.

(cherry picked from commit 710fa4e68cc134d9970a6d0c034a84c3419be14a)

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

diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index cbf6945e16e8..482f964bce45 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -1259,7 +1259,7 @@ void SwTextFrame::FormatAdjust( SwTextFormatter &rLine,
 }
 }
 
-if (nNew && HasFullPageFly(this) && nEnd == TextFrameIndex(0) && 
!bEmptyWithSplitFly)
+if (nNew && nEnd == TextFrameIndex(0) && !bEmptyWithSplitFly && 
HasFullPageFly(this))
 {
 // We intended to split at start, due to an anchored object which 
would use all space on the
 // current page. It makes no sense to split & move all text of the 
frame forward: the


core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-08-26 Thread Caolán McNamara (via logerrit)
 sw/source/uibase/uno/loktxdoc.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c2a2ed2b9a50dd54be2c18bf0cc3128b1fc57136
Author: Caolán McNamara 
AuthorDate: Mon Aug 26 15:53:47 2024 +0100
Commit: Caolán McNamara 
CommitDate: Mon Aug 26 20:53:28 2024 +0200

‘bShowingPlaceHolder’ may be used uninitialized [-Wmaybe-uninitialized]

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

diff --git a/sw/source/uibase/uno/loktxdoc.cxx 
b/sw/source/uibase/uno/loktxdoc.cxx
index 4da4f2ad72ab..2d76e6110cd6 100644
--- a/sw/source/uibase/uno/loktxdoc.cxx
+++ b/sw/source/uibase/uno/loktxdoc.cxx
@@ -432,7 +432,7 @@ void GetDocStructure(tools::JsonWriter& rJsonWriter, 
SwDocShell* /*pDocShell*/,
 xContentControlProps->getPropertyValue(UNO_NAME_CONTENT_CONTROL_TYPE) 
>>= iType;
 SwContentControlType aType = static_cast(iType);
 
-bool bShowingPlaceHolder;
+bool bShowingPlaceHolder = false;
 xContentControlProps->getPropertyValue(UNO_NAME_SHOWING_PLACE_HOLDER)
 >>= bShowingPlaceHolder;
 OUString aContent;


core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-08-26 Thread Noel Grandin (via logerrit)
 sw/source/core/doc/docbm.cxx |   36 ++--
 1 file changed, 30 insertions(+), 6 deletions(-)

New commits:
commit 1cb43ae6b3737367fdc7d9465bb084604da59778
Author: Noel Grandin 
AuthorDate: Mon Aug 5 14:01:09 2024 +0200
Commit: Noel Grandin 
CommitDate: Mon Aug 26 17:54:24 2024 +0200

reduce use of dynamic_cast in marks

which is hit quite hard during import of documents with lots of marks,
mostly because of the resorting that occurs in
ContentIdxStoreImpl::Restore

Change-Id: I1e5e3d8cfc0e65f9bf74449df8e048cd061022ec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171522
Reviewed-by: Noel Grandin 
Tested-by: Jenkins
(cherry picked from commit 900af9c53788d5d274900f796e3aee14926abf2d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171529
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 755317b27c44..5ce1a6307d27 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -183,6 +183,8 @@ bool IDocumentMarkAccess::iterator::operator>=(iterator 
const& rOther) const
 return *m_pIter >= *rOther.m_pIter;
 }
 
+static bool IsAnnotationMark(const sw::mark::MarkBase& rBkmk);
+static bool IsCrossRefBookmark(const sw::mark::MarkBase& rBkmk);
 
 namespace
 {
@@ -231,13 +233,13 @@ namespace
 {   // consistency with SwPosition::operator<
 return pSecondNode != nullptr;
 }
-auto *const pCRFirst (dynamic_cast<::sw::mark::CrossRefBookmark 
const*>(pFirst));
-auto *const pCRSecond(dynamic_cast<::sw::mark::CrossRefBookmark 
const*>(pSecond));
-if ((pCRFirst == nullptr) == (pCRSecond == nullptr))
+bool const bCRFirst (IsCrossRefBookmark(*pFirst));
+bool const bCRSecond(IsCrossRefBookmark(*pSecond));
+if (bCRFirst == bCRSecond)
 {
 return false; // equal
 }
-return pCRFirst != nullptr; // cross-ref sorts *before*
+return bCRFirst; // cross-ref sorts *before*
 }
 
 bool lcl_MarkOrderingByEnd(const ::sw::mark::MarkBase *const pFirst,
@@ -385,7 +387,7 @@ namespace
 const bool bChangedOPos,
 MarkBase* io_pMark )
 {
-if ( IDocumentMarkAccess::GetType(*io_pMark) == 
IDocumentMarkAccess::MarkType::ANNOTATIONMARK )
+if ( IsAnnotationMark(*io_pMark) )
 {
 // annotation marks are allowed to span a table cell range.
 // but trigger sorting to be save
@@ -506,6 +508,28 @@ namespace
 };
 }
 
+static bool IsNavigatorReminder(const MarkBase& rBkmk)
+{
+const std::type_info* const pMarkTypeInfo = &typeid(rBkmk);
+// not using dynamic_cast<> here for performance
+return (*pMarkTypeInfo == typeid(NavigatorReminder));
+}
+
+static bool IsCrossRefBookmark(const sw::mark::MarkBase& rBkmk)
+{
+// not using dynamic_cast<> here for performance
+const std::type_info* const pMarkTypeInfo = &typeid(rBkmk);
+return (*pMarkTypeInfo == typeid(CrossRefHeadingBookmark))
+|| (*pMarkTypeInfo == typeid(CrossRefNumItemBookmark));
+}
+
+static bool IsAnnotationMark(const sw::mark::MarkBase& rBkmk)
+{
+// not using dynamic_cast<> here for performance
+const std::type_info* const pMarkTypeInfo = &typeid(rBkmk);
+return (*pMarkTypeInfo == typeid(AnnotationMark));
+}
+
 IDocumentMarkAccess::MarkType IDocumentMarkAccess::GetType(const IMark& rBkmk)
 {
 const std::type_info* const pMarkTypeInfo = &typeid(rBkmk);
@@ -1017,7 +1041,7 @@ namespace sw::mark
 assert(pMark);
 // navigator marks should not be moved
 // TODO: Check if this might make them invalid
-if (IDocumentMarkAccess::GetType(*pMark) == 
IDocumentMarkAccess::MarkType::NAVIGATOR_REMINDER)
+if (IsNavigatorReminder(*pMark))
 {
 return false;
 }


core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-08-23 Thread Caolán McNamara (via logerrit)
 sw/source/core/text/guess.cxx |   26 +-
 1 file changed, 21 insertions(+), 5 deletions(-)

New commits:
commit 43c46151a74264ee2424f766c1c809760b6a4871
Author: Caolán McNamara 
AuthorDate: Thu Aug 22 17:45:12 2024 +0100
Commit: Mike Kaganski 
CommitDate: Fri Aug 23 10:40:09 2024 +0200

crashtesting: crash on hyphenation of ooo56629-9.odt

a problem I think since:

commit b5e275f47a54bd7fee39dad516a433fde5be872d
CommitDate: Fri Jan 19 17:37:41 2024 +0100

tdf#106733 sw: implement CharNoHyphenation

Change-Id: Ic49c136019e93f79818bec7811317bb4f37d6ac1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172287
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit c06eee519d8a235385b4910d9ec96e5492dd0e9b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172267
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Mike Kaganski 

diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx
index c4f74de7cef7..3c8a3512b327 100644
--- a/sw/source/core/text/guess.cxx
+++ b/sw/source/core/text/guess.cxx
@@ -582,12 +582,28 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, 
SwTextFormatInfo &rInf,
 
 m_nBreakStart = m_nBreakPos;
 
-bHyph = BreakType::HYPHENATION == aResult.breakType &&
+bHyph = BreakType::HYPHENATION == aResult.breakType;
+if (bHyph)
+{
+LanguageType aNoHyphLang;
+if (rPor.InFieldGrp())
+{
+// If we are inside a field portion, we use a temporary string 
which
+// differs from the string at the textnode. Therefore we are 
not allowed
+// to call the GetLangOfChar function.
+aNoHyphLang = LANGUAGE_DONTKNOW;
+}
+else
+{
 // allow hyphenation of the word only if it's not disabled by 
character formatting
-LANGUAGE_NONE != rInf.GetTextFrame()->GetLangOfChar(
-TextFrameIndex( sal_Int32(m_nBreakPos) +
-aResult.rHyphenatedWord->getHyphenationPos() ),
-1, true, /*bNoneIfNoHyphenation=*/true );
+aNoHyphLang = rInf.GetTextFrame()->GetLangOfChar(
+  TextFrameIndex( sal_Int32(m_nBreakPos) +
+
aResult.rHyphenatedWord->getHyphenationPos() ),
+1, true, /*bNoneIfNoHyphenation=*/true );
+}
+// allow hyphenation of the word only if it's not disabled by 
character formatting
+bHyph = aNoHyphLang != LANGUAGE_NONE;
+}
 
 if (bHyph && m_nBreakPos != TextFrameIndex(COMPLETE_STRING))
 {


core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-08-14 Thread Bjoern Michaelsen (via logerrit)
 sw/source/core/doc/docbm.cxx |   58 ++-
 1 file changed, 41 insertions(+), 17 deletions(-)

New commits:
commit a1ba79bd29d63489877c73232b034d4a2a447ad7
Author: Bjoern Michaelsen 
AuthorDate: Sat Aug 3 02:31:03 2024 +0200
Commit: Caolán McNamara 
CommitDate: Wed Aug 14 16:24:47 2024 +0200

speed up getInnerFieldmarkFor some more with bisectional and reverse search

prerequisites:
- the fieldmark vector is sorted by field start
- a fieldmark start and end either have to both be in any other
  fieldmark, or both be outside of it

strategy:
- first we find the last fieldmark before our position (those behind it
  will never cover the position)
- then iterate backwards to find the first that ends behind the position
  (and thus covers it)
- the innermost fieldmark is now either the fieldmark found, or another
  fieldmark starting at the same position:
  * fieldmarks starting before the one we found will not be the innermost
  * thus we only need to iterate check to the first fieldmark starting
earlier

There are further optimizations, that likely arent worth it, e.g.:
- sort the fieldmarks with the same start position by length or end
  position (longest first), this would remove the need for the last step

Change-Id: I49164697a44ff0a5e11809dfba82029c160c5d2a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171442
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen 
(cherry picked from commit 5850b22e04a7a055e5b4c6b23a1d32d74270506d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171419
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 730da32625d4..755317b27c44 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -324,6 +324,13 @@ namespace
 }
 };
 
+struct CompareIMarkStartsAfterReverse
+{
+bool operator()(const sw::mark::IMark* pMark, SwPosition const& rPos)
+{
+return pMark->GetMarkStart() > rPos;
+}
+};
 
 IMark* lcl_getMarkAfter(const MarkManager::container_t& rMarks, const 
SwPosition& rPos,
 bool bLoop)
@@ -1475,27 +1482,44 @@ namespace sw::mark
 
 IFieldmark* MarkManager::getInnerFieldmarkFor(const SwPosition& rPos) const
 {
-auto itFieldmark = find_if(
-m_vFieldmarks.begin(),
-m_vFieldmarks.end(),
-[&rPos] (const ::sw::mark::MarkBase *const pMark) { return 
pMark->IsCoveringPosition(rPos); } );
-if (itFieldmark == m_vFieldmarks.end())
+// find the first mark starting on or before the position in reverse 
order
+// (as we are reverse searching, this is the one closest to the 
position)
+// m_vFieldmarks should be ordered by mark start, so we can bisect 
with lower_bound
+auto itEnd = m_vFieldmarks.rend();
+auto itStart = lower_bound(
+m_vFieldmarks.rbegin(),
+itEnd,
+rPos,
+CompareIMarkStartsAfterReverse());
+// now continue a linear search for the first (still in reverse order) 
ending behind the position
+auto itCurrent = find_if(
+itStart,
+itEnd,
+[&rPos](const sw::mark::MarkBase* const pMark) { return rPos < 
pMark->GetMarkEnd(); });
+// if we reached the end (in reverse order) there is no match
+if(itCurrent == itEnd)
 return nullptr;
-auto pFieldmark(*itFieldmark);
-
-// See if any fieldmarks after the first hit are closer to rPos.
-++itFieldmark;
-for ( ; itFieldmark != m_vFieldmarks.end()
-&& (**itFieldmark).GetMarkStart() <= rPos; ++itFieldmark)
-{   // find the innermost fieldmark
-if (rPos < (**itFieldmark).GetMarkEnd()
-&& (pFieldmark->GetMarkStart() < (**itFieldmark).GetMarkStart()
-|| (**itFieldmark).GetMarkEnd() < 
pFieldmark->GetMarkEnd()))
+// we found our first candidate covering the position ...
+auto pMark = *itCurrent;
+const auto aMarkStart = pMark->GetMarkStart();
+auto aMarkEnd = pMark->GetMarkEnd();
+// ... however we still need to check if there is a smaller/'more 
inner' one with the same start position
+for(++itCurrent; itCurrent != itEnd; ++itCurrent)
+{
+if((*itCurrent)->GetMarkStart() < aMarkStart)
+// any following mark (in reverse order) will have an earlier
+// start and thus can not be more 'inner' than our previous
+// match, so we are done.
+break;
+auto aCurrentMarkEnd = (*itCurrent)->GetMarkEnd();
+if(rPos < aCurrentMarkEnd && aCurrentMarkEnd <= aMarkEnd)
 {
-pFieldma

core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-08-14 Thread Caolán McNamara (via logerrit)
 sw/source/uibase/app/docst.cxx |   28 +++-
 1 file changed, 19 insertions(+), 9 deletions(-)

New commits:
commit 7c8c96a073d18198d6146d81889bc3438924ca12
Author: Caolán McNamara 
AuthorDate: Tue Aug 13 13:07:10 2024 +0100
Commit: Miklos Vajna 
CommitDate: Wed Aug 14 15:49:08 2024 +0200

fix null deref on fetching postit outliner

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

diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx
index ba6c850a86d0..4690cebd5306 100644
--- a/sw/source/uibase/app/docst.cxx
+++ b/sw/source/uibase/app/docst.cxx
@@ -88,6 +88,17 @@
 
 using namespace ::com::sun::star;
 
+static OutlinerView* lcl_GetPostItOutlinerView(SwWrtShell& rShell)
+{
+SwPostItMgr* pPostItMgr = rShell.GetPostItMgr();
+if (!pPostItMgr)
+return nullptr;
+sw::annotation::SwAnnotationWin* pWin = pPostItMgr->GetActiveSidebarWin();
+if (!pWin)
+return nullptr;
+return pWin->GetOutlinerView();
+}
+
 void  SwDocShell::StateStyleSheet(SfxItemSet& rSet, SwWrtShell* pSh)
 {
 SfxWhichIter aIter(rSet);
@@ -133,8 +144,8 @@ void  SwDocShell::StateStyleSheet(SfxItemSet& rSet, 
SwWrtShell* pSh)
 }
 else if (pShell->GetSelectionType() == SelectionType::PostIt)
 {
-auto pStyle = 
pShell->GetPostItMgr()->GetActiveSidebarWin()->GetOutlinerView()->GetStyleSheet();
-if (pStyle)
+OutlinerView *pOLV = lcl_GetPostItOutlinerView(*pShell);
+if (SfxStyleSheetBase* pStyle = pOLV ? 
pOLV->GetStyleSheet() : nullptr)
 aName = pStyle->GetName();
 }
 else
@@ -164,7 +175,8 @@ void  SwDocShell::StateStyleSheet(SfxItemSet& rSet, 
SwWrtShell* pSh)
 OUString aProgName;
 if (pShell->GetSelectionType() == SelectionType::PostIt)
 {
-if (auto pStyle = 
pShell->GetPostItMgr()->GetActiveSidebarWin()->GetOutlinerView()->GetStyleSheet())
+OutlinerView *pOLV = 
lcl_GetPostItOutlinerView(*pShell);
+if (SfxStyleSheetBase* pStyle = pOLV ? 
pOLV->GetStyleSheet() : nullptr)
 {
 aName = pStyle->GetName();
 aProgName = SwStyleNameMapper::GetProgName(aName, 
SwGetPoolIdFromName::TxtColl);
@@ -410,8 +422,8 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq )
 {
 if (GetWrtShell()->GetSelectionType() == 
SelectionType::PostIt)
 {
-auto pOLV = 
GetWrtShell()->GetPostItMgr()->GetActiveSidebarWin()->GetOutlinerView();
-if (auto pStyle = pOLV->GetStyleSheet())
+OutlinerView *pOLV = 
lcl_GetPostItOutlinerView(*GetWrtShell());
+if (SfxStyleSheetBase* pStyle = pOLV ? 
pOLV->GetStyleSheet() : nullptr)
 aParam = pStyle->GetName();
 }
 else if (auto pColl = 
GetWrtShell()->GetCurTextFormatColl())
@@ -1185,10 +1197,8 @@ SfxStyleFamily SwDocShell::ApplyStyles(const OUString 
&rName, SfxStyleFamily nFa
 }
 case SfxStyleFamily::Para:
 {
-if (pSh->GetPostItMgr() && 
pSh->GetPostItMgr()->HasActiveSidebarWin())
-{
-
pSh->GetPostItMgr()->GetActiveSidebarWin()->GetOutlinerView()->SetStyleSheet(rName);
-}
+if (OutlinerView *pOLV = lcl_GetPostItOutlinerView(*pSh))
+pOLV->SetStyleSheet(rName);
 else
 {
 // When outline-folding is enabled, 
MakeAllOutlineContentTemporarilyVisible makes


core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-07-30 Thread Skyler Grey (via logerrit)
 sw/source/core/layout/paintfrm.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit facdda16ad14d321c5675874f838a3cd5f6cdd6f
Author: Skyler Grey 
AuthorDate: Mon Jul 29 08:00:47 2024 +
Commit: Skyler Grey 
CommitDate: Tue Jul 30 09:24:09 2024 +0200

fix: Skip invalidation if it won't go through

On Android, we often hit this condition where we should get an
invalidation. Unfortunately, the invalidation is skipped due to being in
LOK Tiled Painting, leaving us to deal with whatever tile was rendered
on this go-around...

...Also because of this condition, the tile rendered here is broken.
pFrame->PaintSwFrame is never called, leading to a tile which renders
without things like its text. Normally, this wouldn't be a problem as
it's about to get invalidated, and is more of a nice performance
optimization...

...However given we don't invalidate it, we really see that tile without
any text. Similar workarounds were considered (such as skipping the
condition in another case that appears to be true on Android or
rendering the tile anyway, even if we're about to invalidate it) but
this seems to be the safest bet to avoid something like this happening
on other platforms...

...The true solution is still elusive. It probably includes figuring out
why this happens on Android without happening on other platforms, and
fixing that, as well as perhaps figuring out what to do about this
condition if we *do* genuinely trigger it on Android - as the previous
solution of invalidating everything nearby won't work

Change-Id: Id58f5bae8ae357d116c5f2345e88ec3364cb2172
Fixes: https://github.com/CollaboraOnline/online/issues/9654
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170853
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index b96c378185c7..60edc56aafb5 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -3765,6 +3765,7 @@ void SwLayoutFrame::PaintSwFrame(vcl::RenderContext& 
rRenderContext, SwRect cons
 if ( rRect.Overlaps( aPaintRect ) )
 {
 if ( bCnt && pFrame->IsCompletePaint() &&
+ !(comphelper::LibreOfficeKit::isActive() && 
comphelper::LibreOfficeKit::isTiledPainting()) &&
  !rRect.Contains( aPaintRect ) && Application::AnyInput( 
VclInputFlags::KEYBOARD ) )
 {
 //fix(8104): It may happen, that the processing wasn't complete


core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-07-22 Thread Noel Grandin (via logerrit)
 sw/source/core/doc/textboxhelper.cxx |   70 +++
 1 file changed, 38 insertions(+), 32 deletions(-)

New commits:
commit 6e05c4ae0daa175f098760dd317e18452cd310ea
Author: Noel Grandin 
AuthorDate: Mon Jul 22 12:27:08 2024 +0200
Commit: Caolán McNamara 
CommitDate: Mon Jul 22 20:52:58 2024 +0200

crashtesting tdf135164-3.docx

./instdir/program/soffice --headless --convert-to odt
~/Downloads/tdf135164-3.docx

fails after
commit f98f684d22e6323185104ca9c082241c53dfc2b3
Author: Noel Grandin 
Date:   Sat Jul 13 18:50:34 2024 +0200
remove RecalcObjOrdNums in DoTextBoxZOrderCorrection

add a check to catch this case and flatten the method to make it more
readable

Change-Id: I7827807c77f51b28f16b1042b77b8211ab5416ec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170839
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit f08fdf3e81e63469609eaafaf790cb3fea6b27c4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170866
Reviewed-by: Caolán McNamara 
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/source/core/doc/textboxhelper.cxx 
b/sw/source/core/doc/textboxhelper.cxx
index 9cf8ca06759f..74de839f22bf 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -1513,42 +1513,48 @@ bool 
SwTextBoxHelper::DoTextBoxZOrderCorrection(SwFrameFormat* pShape, const Sdr
 
 pShpObj = pShape->FindRealSdrObject();
 
-if (pShpObj)
+if (!pShpObj)
 {
-auto pTextBox = getOtherTextBoxFormat(pShape, RES_DRAWFRMFMT, pObj);
-if (!pTextBox)
-return false;
-SdrObject* pFrmObj = pTextBox->FindRealSdrObject();
-if (!pFrmObj)
-{
-// During loading there is no ready SdrObj for z-ordering, so 
create and cache it here
-pFrmObj
-= 
SwXTextFrame::GetOrCreateSdrObject(*dynamic_cast(pTextBox));
-}
-if (pFrmObj)
-{
-// Get the draw model from the doc
-SwDrawModel* pDrawModel
-= 
pShape->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel();
-if (pDrawModel)
-{
-// Not really sure this will work on all pages, but it seems 
it will.
-// If the shape is behind the frame, is good, but if there are 
some objects
-// between of them that is wrong so put the frame exactly one 
level higher
-// than the shape.
-pFrmObj->ensureSortedImmediatelyAfter(*pShpObj);
-return true; // Success
-}
-SAL_WARN("sw.core", "SwTextBoxHelper::DoTextBoxZOrderCorrection(): 
"
-"No Valid Draw model for SdrObject for the 
shape!");
-}
 SAL_WARN("sw.core", "SwTextBoxHelper::DoTextBoxZOrderCorrection(): "
-"No Valid SdrObject for the frame!");
+"No Valid SdrObject for the shape!");
+return false;
 }
-SAL_WARN("sw.core", "SwTextBoxHelper::DoTextBoxZOrderCorrection(): "
-"No Valid SdrObject for the shape!");
 
-return false;
+auto pTextBox = getOtherTextBoxFormat(pShape, RES_DRAWFRMFMT, pObj);
+if (!pTextBox)
+return false;
+SdrObject* pFrmObj = pTextBox->FindRealSdrObject();
+if (!pFrmObj)
+{
+// During loading there is no ready SdrObj for z-ordering, so create 
and cache it here
+pFrmObj = 
SwXTextFrame::GetOrCreateSdrObject(*dynamic_cast(pTextBox));
+}
+if (!pFrmObj)
+{
+SAL_WARN("sw.core", "SwTextBoxHelper::DoTextBoxZOrderCorrection(): "
+"No Valid SdrObject for the frame!");
+return false;
+}
+// Get the draw model from the doc
+SwDrawModel* pDrawModel = 
pShape->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel();
+if (!pDrawModel)
+{
+SAL_WARN("sw.core", "SwTextBoxHelper::DoTextBoxZOrderCorrection(): "
+"No Valid Draw model for SdrObject for the 
shape!");
+return false;
+}
+if (!pFrmObj->getParentSdrObjListFromSdrObject())
+{
+SAL_WARN("sw.core", "SwTextBoxHelper::DoTextBoxZOrderCorrection(): "
+"Frame object is not inserted into any parent");
+return false;
+}
+// Not really sure this will work on all pages, but it seems it will.
+// If the shape is behind the frame, is good, but if there are some objects
+// between of them that is wrong so put the frame exactly one level higher
+// than the shape.
+pFrmObj->ensureSortedImmediatelyAfter(*pShpObj);
+return true; // Success
 }
 
 void SwTextBoxHelper::synchronizeGroupTextBoxProperty(bool 
pFunc(SwFrameFormat*, SdrObject*),


core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-07-17 Thread Attila Szűcs (via logerrit)
 sw/source/uibase/shells/textsh1.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 3dcf0f9008da3bcc6f7adabc60dd413852c59574
Author: Attila Szűcs 
AuthorDate: Wed Jul 17 10:56:41 2024 +0200
Commit: Caolán McNamara 
CommitDate: Wed Jul 17 17:23:22 2024 +0200

SW: fix warning ‘iType’ may be used uninitialized

added default value: iType = 0;

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

diff --git a/sw/source/uibase/shells/textsh1.cxx 
b/sw/source/uibase/shells/textsh1.cxx
index 14225b4cb745..ed93f3b14a0a 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -2281,7 +2281,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
 xContentControlText->setString(
 OStringToOUString(aContent, 
RTL_TEXTENCODING_UTF8));
 
-sal_Int32 iType;
+sal_Int32 iType = 0;
 
xContentControlProps->getPropertyValue(
 UNO_NAME_CONTENT_CONTROL_TYPE)
 >>= iType;


core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-07-16 Thread Attila Szűcs (via logerrit)
 sw/source/uibase/shells/textsh1.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 57dd4b32f12918949067c4276bda8b4cca61a895
Author: Attila Szűcs 
AuthorDate: Mon Jul 15 17:52:50 2024 +0200
Commit: Caolán McNamara 
CommitDate: Tue Jul 16 09:23:37 2024 +0200

SW: fix EOL in transform Document Structure

Changed the transform parameter to uri decoded string, and
encode it here.

This way special characters will survive the transfering.

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

diff --git a/sw/source/uibase/shells/textsh1.cxx 
b/sw/source/uibase/shells/textsh1.cxx
index d9e96e4bd638..14225b4cb745 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -128,6 +128,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace ::com::sun::star;
 using namespace com::sun::star::beans;
@@ -2156,6 +2157,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
 if (pDataJson)
 {
 aDataJson = pDataJson->GetValue();
+aDataJson = rtl::Uri::decode(aDataJson, rtl_UriDecodeStrict, 
RTL_TEXTENCODING_UTF8);
 }
 
 // parse the JSON got prom parameter


core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-06-26 Thread Skyler Grey (via logerrit)
 sw/source/uibase/app/apphdl.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 174dd0d8565b2e8e26bc1ea4ddfba4c4e343c0aa
Author: Skyler Grey 
AuthorDate: Wed Jun 26 08:53:46 2024 +
Commit: Szymon Kłos 
CommitDate: Wed Jun 26 19:02:53 2024 +0200

fix(writer): send document bg color on new theme

In Ic025e542417da004c1c4a2bfd58a858deb4caa58, we intended to start
sending the document background color to kit after a configuration
change, which is useful when we change the document theme.

Unfortunately, we mistakenly sent the *application* background color
instead, which is normally darker/lighter than the document background
color, causing color flashes if you tried to use the document color as a
background before tiles were sent

Change-Id: I27c8409a6fcb771d741b07d77c5598c87e178f3b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169540
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Szymon Kłos 

diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index bca9d20dbd59..253117c5bf9b 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -1000,7 +1000,7 @@ void 
SwModule::ConfigurationChanged(utl::ConfigurationBroadcaster* pBrdCst, Conf
 
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_APPLICATION_BACKGROUND_COLOR,
 
aViewColors.m_aAppBackgroundColor.AsRGBHexString().toUtf8());
 
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_BACKGROUND_COLOR,
-
aViewColors.m_aAppBackgroundColor.AsRGBHexString().toUtf8());
+aViewColors.m_aDocColor.AsRGBHexString().toUtf8());
 }
 
 // if nothing changed, and the hint was 
OnlyCurrentDocumentColorScheme we can skip invalidate


core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-06-26 Thread Miklos Vajna (via logerrit)
 sw/source/core/crsr/viscrs.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 7fb545b10c5de583b93ea089ff4a1797eb220047
Author: Miklos Vajna 
AuthorDate: Wed Jun 26 10:11:08 2024 +0200
Commit: Mike Kaganski 
CommitDate: Wed Jun 26 11:51:36 2024 +0200

sw: simplify SwShellCursor::Show()

If we carefully dereference the shell and its sfx view shell, then no
need to do this again, as pointed out at

.

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

diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index d8cca3cfa1b8..3224893d81bb 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -1001,7 +1001,7 @@ void SwShellCursor::Show(SfxViewShell const * pViewShell)
 }
 
 pSfxViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, 
sRect);
-SfxLokHelper::notifyOtherViews(GetShell()->GetSfxViewShell(), 
LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", sRect);
+SfxLokHelper::notifyOtherViews(pSfxViewShell, 
LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", sRect);
 }
 }
 


core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-06-25 Thread Miklos Vajna (via logerrit)
 sw/source/core/crsr/viscrs.cxx |   14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

New commits:
commit cefe556b9198b5dba18256d30ddcfcfda03f18c8
Author: Miklos Vajna 
AuthorDate: Tue Jun 25 10:17:52 2024 +0200
Commit: Mike Kaganski 
CommitDate: Tue Jun 25 20:13:35 2024 +0200

sw: fix crash in SwShellCursor::Show()

Crashreport signature:

> Fatal signal received: SIGSEGV code: 1 for address: 0x0
> program/libswlo.so
>   SwShellCursor::Show(SfxViewShell const*)
>   sw/source/core/crsr/viscrs.cxx:991
> program/libswlo.so
>   SwCursorShell::ShowCursors(bool)
>   sw/source/core/crsr/crsrsh.cxx:2769
> program/libswlo.so
>   SwViewShell::ImplEndAction(bool)
>   sw/source/core/view/viewsh.cxx:?
> program/libswlo.so
>   SwViewShell::EndAction(bool)
>   sw/inc/viewsh.hxx:638

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

diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index 090d0eb70421..d8cca3cfa1b8 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -988,7 +988,19 @@ void SwShellCursor::Show(SfxViewShell const * pViewShell)
 }
 else
 {
-
GetShell()->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION,
 sRect);
+const SwCursorShell* pShell = GetShell();
+if (!pShell)
+{
+return;
+}
+
+SfxViewShell* pSfxViewShell = pShell->GetSfxViewShell();
+if (!pSfxViewShell)
+{
+return;
+}
+
+pSfxViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, 
sRect);
 SfxLokHelper::notifyOtherViews(GetShell()->GetSfxViewShell(), 
LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", sRect);
 }
 }


core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-06-24 Thread Darshan-upadhyay1110 (via logerrit)
 sw/source/uibase/wrtsh/wrtsh1.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 964f2e5457cb6654e3ffefbecbfaf1782f133ab8
Author: Darshan-upadhyay1110 
AuthorDate: Fri Jun 21 09:49:56 2024 +0530
Commit: Miklos Vajna 
CommitDate: Mon Jun 24 09:51:36 2024 +0200

Fix insert comment not working after document load.

- In document with comments present insert comment not working document 
after load.
- remove this condition for insertposIT to work for onload
- this patch wil fix this issue

Change-Id: I6128053b23678e61548d04979e3b199678a6b708
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169311
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Szymon Kłos 
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx 
b/sw/source/uibase/wrtsh/wrtsh1.cxx
index 1e3b12b614ce..07ebe418bef8 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -2216,8 +2216,7 @@ void SwWrtShell::SetShowHeaderFooterSeparator( 
FrameControlType eControl, bool b
 void SwWrtShell::InsertPostIt(SwFieldMgr& rFieldMgr, const SfxRequest& rReq)
 {
 SwPostItField* pPostIt = 
dynamic_cast(rFieldMgr.GetCurField());
-bool bNew = !(pPostIt && pPostIt->GetTyp()->Which() == SwFieldIds::Postit);
-if (bNew || GetView().GetPostItMgr()->IsAnswer())
+
 {
 const SvxPostItAuthorItem* pAuthorItem = 
rReq.GetArg(SID_ATTR_POSTIT_AUTHOR);
 OUString sAuthor;


core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-06-21 Thread Miklos Vajna (via logerrit)
 sw/source/uibase/uiview/viewtab.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit f344daa0b8b2c7ff75ae086966fc1ac1894ce1cc
Author: Miklos Vajna 
AuthorDate: Fri Jun 21 08:26:52 2024 +0200
Commit: Mike Kaganski 
CommitDate: Fri Jun 21 16:03:41 2024 +0200

sw: fix assertion failure in SwView::ExecTabWin()

Crashreport signature:

> /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_algo.h:3623: 
constexpr const _Tp& std::clamp(const _Tp&, const _Tp&, const _Tp&) [with _Tp = 
long int]: Assertion '!(__hi < __lo)' failed.
> program/libswlo.so
>   long const& std::clamp(long const&, long const&, long const&)
>   ??:?
> program/libswlo.so
>   SwView::ExecTabWin(SfxRequest const&)
>   sw/source/uibase/uiview/viewtab.cxx:1139
> program/libmergedlo.so
>   SfxDispatcher::Call_Impl(SfxShell&, SfxSlot const&, SfxRequest&, 
bool)
>   sfx2/source/control/dispatch.cxx:257

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

diff --git a/sw/source/uibase/uiview/viewtab.cxx 
b/sw/source/uibase/uiview/viewtab.cxx
index 1bf1e27a2a66..77405745259d 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -1136,7 +1136,10 @@ void SwView::ExecTabWin( SfxRequest const & rReq )
 {
 auto & rEntry = aTabCols.GetEntry(nIndex);
 tools::Long nNewPosition = rEntry.nPos + nOffset;
-nNewPosition = std::clamp(nNewPosition, rEntry.nMin, 
rEntry.nMax - constDistanceOffset);
+tools::Long nMax = rEntry.nMax - constDistanceOffset;
+if (nMax < rEntry.nMin)
+nMax = rEntry.nMin;
+nNewPosition = std::clamp(nNewPosition, rEntry.nMin, 
nMax);
 rEntry.nPos = nNewPosition;
 }
 


core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-06-12 Thread Henry Castro (via logerrit)
 sw/source/core/crsr/crsrsh.cxx  |   16 
 sw/source/uibase/wrtsh/move.cxx |   10 +-
 2 files changed, 25 insertions(+), 1 deletion(-)

New commits:
commit ddb454bb80622a2fd625bc09af8a66b025b0739f
Author: Henry Castro 
AuthorDate: Mon Jun 10 14:41:13 2024 -0400
Commit: Caolán McNamara 
CommitDate: Wed Jun 12 16:53:53 2024 +0200

lok: sw: fix PageDown position when cursor is not visible

If PageDown key is pressed and the cursor is not visible,
in the PageDown increment the new cursor position will not update,
cause the Visible area is the full document.

Signed-off-by: Henry Castro 
Change-Id: I57b9ae1e80cb878867ee215d7e80de990aff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168646
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 51f675adc9dd..20e32e66c255 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -78,6 +78,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace com::sun::star;
 using namespace util;
@@ -1790,6 +1791,21 @@ void SwCursorShell::VisPortChgd( const SwRect & rRect )
 if( m_bSVCursorVis && bVis ) // show SV cursor again
 m_pVisibleCursor->Show();
 
+if( comphelper::LibreOfficeKit::isActive() && !rRect.Overlaps( m_aCharRect 
))
+{
+boost::property_tree::ptree aParams;
+tools::Rectangle aRect(rRect.TopLeft(), Size(1, 1));
+
+aParams.put("rectangle", aRect.toString());
+aParams.put("scroll", true);
+aParams.put("hyperlink", "");
+
+SfxLokHelper::notifyOtherView(GetSfxViewShell(),
+  GetSfxViewShell(),
+  LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR,
+  aParams);
+}
+
 if( m_nCursorMove )
 m_bInCMvVisportChgd = true;
 
diff --git a/sw/source/uibase/wrtsh/move.cxx b/sw/source/uibase/wrtsh/move.cxx
index cda2b32112ce..7bdef4e7bed4 100644
--- a/sw/source/uibase/wrtsh/move.cxx
+++ b/sw/source/uibase/wrtsh/move.cxx
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /**
Always:
@@ -454,7 +455,14 @@ bool SwWrtShell::PushCursor(SwTwips lOffset, bool bSelect)
 {
 Point aPt( aOldRect.Center() );
 
-if( !IsCursorVisible() )
+if( comphelper::LibreOfficeKit::isActive() )
+{
+SfxViewShell* pView = GetSfxViewShell();
+SwRect aLOKVis(pView->getLOKVisibleArea());
+if (!aLOKVis.Overlaps(aOldRect))
+aPt.setY( aLOKVis.Top() + aLOKVis.Height() / 2 );
+}
+else if( !IsCursorVisible() )
 // set CursorPos to top-/bottom left pos. So the pagescroll is not
 // be dependent on the current cursor, but on the visarea.
 aPt.setY( aTmpArea.Top() + aTmpArea.Height() / 2 );


core.git: Branch 'distro/collabora/co-24.04' - sw/source writerfilter/qa writerfilter/source

2024-06-12 Thread Miklos Vajna (via logerrit)
 sw/source/core/unocore/unotext.cxx 
|   24 +++
 writerfilter/qa/cppunittests/dmapper/DomainMapperTableHandler.cxx  
|   24 +++
 writerfilter/qa/cppunittests/dmapper/data/table-style-para-border-spacing.docx 
|binary
 writerfilter/source/dmapper/DomainMapper.cxx   
|   67 +++---
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx   
|   48 ++-
 writerfilter/source/dmapper/PropertyIds.cxx
|   27 ++--
 writerfilter/source/dmapper/PropertyIds.hxx
|   12 +
 7 files changed, 171 insertions(+), 31 deletions(-)

New commits:
commit dded9c034bd1be2fdac41923ec0724e52505d40b
Author: Miklos Vajna 
AuthorDate: Tue Jun 11 10:49:29 2024 +0200
Commit: Caolán McNamara 
CommitDate: Wed Jun 12 10:35:08 2024 +0200

tdf#161443 DOCX import, table style: handle para border in table cell paras

Open the bugdoc, the in-table paragraphs have some top and bottom
paragraph borders in Word, not in Writer -- because the cell and
paragraph UNO object both have a property named TopBorder as mentioned
in commit 39c54c0ef837e0e23a676a4d1fa5da667e18939c (tdf#161443 DOCX
import, table style: fix para border leaking into cell border,
2024-06-07).

The previous fix avoided the problem that the unwanted border affects,
the cell, but re-routing the property to affect the in-table paragraph
were not done.

Fix the problem by adding 3 new meta-properties with a "Para" prefix for
all 4 border locations (top/left/bottom/right), this way the paragraph
borders defined in a table style can affect the in-table paragraphs, but
not the table cells.

Apart from the border itself, this also affected the border spacing,
which means that the position of all text inside and below the table is
now also correct. Unfortunately this also means we need to move away
from the constexpr frozen container that is only suitable for a limited
number of items:
sw/source/writerfilter/dmapper/PropertyIds.cxx:394:6: error: ‘constexpr’ 
evaluation operation count exceeds limit of 33554432 (use 
‘-fconstexpr-ops-limit=’ to increase the limit)
Returning to std::unordered_map is good enough for our needs.

(cherry picked from commit 013300c751d7a9ede12c1bf1c784254d1c6c5433)

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

diff --git a/sw/source/core/unocore/unotext.cxx 
b/sw/source/core/unocore/unotext.cxx
index 3f720e452f15..30b89a06e0c4 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -2113,6 +2113,18 @@ lcl_ApplyCellProperties(
 {
 static const std::initializer_list 
vDenylist = {
 u"LeftMargin",
+u"ParaTopBorder",
+u"ParaTopBorderDistance",
+u"ParaTopBorderComplexColor",
+u"ParaLeftBorder",
+u"ParaLeftBorderDistance",
+u"ParaLeftBorderComplexColor",
+u"ParaBottomBorder",
+u"ParaBottomBorderDistance",
+u"ParaBottomBorderComplexColor",
+u"ParaRightBorder",
+u"ParaRightBorderDistance",
+u"ParaRightBorderComplexColor",
 };
 if (std::find(vDenylist.begin(), vDenylist.end(), rName) == 
vDenylist.end())
 {
@@ -2251,6 +2263,18 @@ SwXText::convertToTable(
 u"RightBorder",
 u"TopBorder",
 u"VerticalBorder",
+u"ParaTopBorder",
+u"ParaTopBorderDistance",
+u"ParaTopBorderComplexColor",
+u"ParaLeftBorder",
+u"ParaLeftBorderDistance",
+u"ParaLeftBorderComplexColor",
+u"ParaBottomBorder",
+u"ParaBottomBorderDistance",
+u"ParaBottomBorderComplexColor",
+u"ParaRightBorder",
+u"ParaRightBorderDistance",
+u"ParaRightBorderComplexColor",
 };
 if (std::find(vDenylist.begin(), vDenylist.end(), 
rTableProperty.Name) == vDenylist.end())
 {
diff --git a/writerfilter/qa/cppunittests/dmapper/DomainMapperTableHandler.cxx 
b/writerfilter/qa/cppunittests/dmapper/DomainMapperTableHandler.cxx
index 5924fb90bc2a..7f7cfd9b008b 100644
--- a/writerfilter/qa/cppunittests/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/qa/cppunittests/dmapper/DomainMapperTableHandler.cxx
@@ -229,6 +229,30 @@ CPPUNIT_TEST_FIXTURE(Test, 
testDOCXFloatingTabl

core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-06-11 Thread Caolán McNamara (via logerrit)
 sw/source/core/text/guess.cxx |   34 +++---
 sw/source/core/text/guess.hxx |4 +++-
 2 files changed, 18 insertions(+), 20 deletions(-)

New commits:
commit 179831344c4162d01f299d2bcc041e356a0e30f4
Author: Caolán McNamara 
AuthorDate: Tue Jun 11 11:29:44 2024 +0100
Commit: Caolán McNamara 
CommitDate: Tue Jun 11 15:28:57 2024 +0200

more stale hyphenation data after skipping blanks

m_xHyphWord is stale if m_nBreakStart changes

turn maybeAdjustPositionsForBlockAdjust into a member
to make it easier to discard m_xHyphWord on change
to m_nBreakStart

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

diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx
index c199bbfcfa97..c4f74de7cef7 100644
--- a/sw/source/core/text/guess.cxx
+++ b/sw/source/core/text/guess.cxx
@@ -71,15 +71,14 @@ bool hasBlanksInLine(const SwTextFormatInfo& rInf, 
TextFrameIndex end)
 return false;
 }
 
+}
+
 // Called for the last text run in a line; if it is block-adjusted, or center 
/ right-adjusted
 // with Word compatibility option set, and it has trailing spaces, then the 
function sets the
 // values, and returns 'false' value that SwTextGuess::Guess should return, to 
create a
 // trailing SwHolePortion.
-bool maybeAdjustPositionsForBlockAdjust(TextFrameIndex& rCutPos, 
TextFrameIndex& rBreakPos,
-TextFrameIndex& rBreakStart, 
sal_uInt16& rBreakWidth,
-sal_uInt16& rExtraBlankWidth, 
sal_uInt16& rMaxSizeDiff,
-const SwTextFormatInfo& rInf, const 
SwScriptInfo& rSI,
-sal_uInt16 maxComp)
+bool SwTextGuess::maybeAdjustPositionsForBlockAdjust(sal_uInt16& rMaxSizeDiff, 
const SwTextFormatInfo& rInf,
+ const SwScriptInfo& rSI, 
sal_uInt16 maxComp)
 {
 const auto& adjObj = 
rInf.GetTextFrame()->GetTextNodeForParaProps()->GetSwAttrSet().GetAdjust();
 const SvxAdjust& adjust = adjObj.GetAdjust();
@@ -98,7 +97,7 @@ bool maybeAdjustPositionsForBlockAdjust(TextFrameIndex& 
rCutPos, TextFrameIndex&
 if (rInf.GetTextFrame()->IsRightToLeft())
 return true;
 }
-if (auto ch = rInf.GetChar(rCutPos); !ch) // end of paragraph - last line
+if (auto ch = rInf.GetChar(m_nCutPos); !ch) // end of paragraph - last line
 {
 if (adjust == SvxAdjust::Block)
 {
@@ -123,7 +122,7 @@ bool maybeAdjustPositionsForBlockAdjust(TextFrameIndex& 
rCutPos, TextFrameIndex&
 // tdf#57187: block-adjusted line shorter than full width, terminated by 
manual
 // line break, must not use trailing spaces for adjustment
 TextFrameIndex breakPos;
-TextFrameIndex newCutPos = AdjustCutPos(rCutPos, breakPos, rInf);
+TextFrameIndex newCutPos = AdjustCutPos(m_nCutPos, breakPos, rInf);
 
 if (auto ch = rInf.GetChar(newCutPos); ch && ch != CH_BREAK)
 return true; // next is neither line break nor paragraph end
@@ -135,19 +134,19 @@ bool maybeAdjustPositionsForBlockAdjust(TextFrameIndex& 
rCutPos, TextFrameIndex&
 
 // Some trailing spaces actually found, and in case of block adjustment, 
the text portion
 // itself has spaces to be able to block-adjust, or single word is allowed 
to adjust
-rBreakStart = rCutPos = newCutPos;
-rBreakPos = breakPos;
+m_nBreakStart = m_nCutPos = newCutPos;
+m_nBreakPos = breakPos;
+// throw away old m_xHyphWord because the current break pos is now between 
words
+m_xHyphWord = nullptr;
 
-rInf.GetTextSize(&rSI, rInf.GetIdx(), breakPos - rInf.GetIdx(), maxComp, 
rBreakWidth,
+rInf.GetTextSize(&rSI, rInf.GetIdx(), breakPos - rInf.GetIdx(), maxComp, 
m_nBreakWidth,
  rMaxSizeDiff, rInf.GetCachedVclData().get());
-rInf.GetTextSize(&rSI, breakPos, rBreakStart - breakPos, maxComp, 
rExtraBlankWidth,
+rInf.GetTextSize(&rSI, breakPos, m_nBreakStart - breakPos, maxComp, 
m_nExtraBlankWidth,
  rMaxSizeDiff, rInf.GetCachedVclData().get());
 
 return false; // require SwHolePortion creation
 }
 
-}
-
 // provides information for line break calculation
 // returns true if no line break has to be performed
 // otherwise possible break or hyphenation position is determined
@@ -254,9 +253,7 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, 
SwTextFormatInfo &rInf,
 // portion fits to line
 m_nCutPos = rInf.GetIdx() + nMaxLen;
 bool bRet = rPor.InFieldGrp()
-|| maybeAdjustPositionsForBlockAdjust(m_nCutPos, 
m_nBreakPos, m_nBreakStart,
-  m_nBreakWidth, 
m_nExtraBlankWidth,
- 

core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-06-08 Thread Caolán McNamara (via logerrit)
 sw/source/core/text/guess.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 12c8d404f47c6fc0c36f4319a68dee5f02d2f8e8
Author: Caolán McNamara 
AuthorDate: Fri Jun 7 20:14:15 2024 +0100
Commit: Caolán McNamara 
CommitDate: Sat Jun 8 20:51:10 2024 +0200

stale hyphenation data after skipping blanks

what I see is that after skipping blanks that the m_xHyphWord remains
describing the word at the original m_nBreakStart, but we have changed
that m_nBreakStart and m_nBreakStart is now at the next word, so the
contents of m_xHyphWord bear no relationship to the current break
position.

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

diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx
index c3a94187a7ea..c199bbfcfa97 100644
--- a/sw/source/core/text/guess.cxx
+++ b/sw/source/core/text/guess.cxx
@@ -443,6 +443,7 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, 
SwTextFormatInfo &rInf,
 {
 m_nCutPos = m_nBreakStart = AdjustCutPos(m_nCutPos, m_nBreakPos, rInf);
 nPorLen = m_nBreakPos - rInf.GetIdx();
+m_xHyphWord = nullptr;
 }
 else
 {


core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-06-05 Thread Jaume Pujantell (via logerrit)
 sw/source/ui/table/instable.cxx |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit a17e087e26774c4e33d371322fbef426cd387639
Author: Jaume Pujantell 
AuthorDate: Wed May 29 12:00:27 2024 +0200
Commit: Miklos Vajna 
CommitDate: Wed Jun 5 09:21:07 2024 +0200

lok: sw: do not add a table style on insert dialog

This brings the default beahivour of the insert table dialog closer
to the behaviour of the uno command, where a table is inserted
without a table style and with visible borders.

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

diff --git a/sw/source/ui/table/instable.cxx b/sw/source/ui/table/instable.cxx
index a5aa4cd83853..03cdadacc678 100644
--- a/sw/source/ui/table/instable.cxx
+++ b/sw/source/ui/table/instable.cxx
@@ -31,6 +31,8 @@ void SwInsTableDlg::GetValues( OUString& rName, sal_uInt16& 
rRow, sal_uInt16& rC
 std::unique_ptr& prTAFormat 
)
 {
 SwInsertTableFlags nInsMode = SwInsertTableFlags::NONE;
+if (comphelper::LibreOfficeKit::isActive())
+nInsMode = SwInsertTableFlags::DefaultBorder;
 rName = m_xNameEdit->get_text();
 rRow = m_xRowSpinButton->get_value();
 rCol = m_xColSpinButton->get_value();
@@ -43,7 +45,7 @@ void SwInsTableDlg::GetValues( OUString& rName, sal_uInt16& 
rRow, sal_uInt16& rC
 rInsTableOpts.mnRowsToRepeat = 0;
 if (!m_xDontSplitCB->get_active())
 nInsMode |= SwInsertTableFlags::SplitLayout;
-if( m_xTAutoFormat )
+if (m_xTAutoFormat && !comphelper::LibreOfficeKit::isActive())
 {
 prTAFormat.reset(new SwTableAutoFormat( *m_xTAutoFormat ));
 rAutoName = prTAFormat->GetName();
@@ -151,8 +153,8 @@ void SwInsTableDlg::InitAutoTableFormat()
 // 1 means default table style
 // unfortunately when the table has a style 
sw/qa/uitest/writer_tests4/tdf115573.py fails
 // because tables that have pre-applied style resets the style of the 
elements in their cells
-// when a new row is inserted and the ui test above relies on that. For 
now this is LOK only
-m_lbIndex = comphelper::LibreOfficeKit::isActive() ? 1 : 0;
+// when a new row is inserted and the ui test above relies on that.
+m_lbIndex = 0;
 m_xLbFormat->select(m_lbIndex);
 m_tbIndex = lbIndexToTableIndex(m_lbIndex);
 


core.git: Branch 'distro/collabora/co-24.04' - sw/source sw/uiconfig

2024-06-04 Thread Miklos Vajna (via logerrit)
 sw/source/ui/misc/pgfnote.cxx  |   29 +
 sw/source/uibase/inc/pgfnote.hxx   |4 
 sw/source/uibase/utlui/uitool.cxx  |7 +++
 sw/uiconfig/swriter/ui/footnoteareapage.ui |8 
 4 files changed, 44 insertions(+), 4 deletions(-)

New commits:
commit c080c2598537a7283849d344b61c1032e5cc7979
Author: Miklos Vajna 
AuthorDate: Fri May 31 16:11:42 2024 +0200
Commit: Miklos Vajna 
CommitDate: Tue Jun 4 14:53:29 2024 +0200

tdf#160984 sw continuous endnotes: hide not functional UI in this mode

Previous commits bug have fixed cases where opening a Word document
rendered a different foot/endnote separator than expected for Word. The
followings were modified:

- distance between body text and separator, between separator and first
  note

- the vertical position of the line

- the length of the line

Now ODT files keep the original feature set and Word files look as
expected, but a couple of UI controls are ignored by the layout, hide
these as they intentionally don't do anything while we're in Word compat
mode.

(cherry picked from commit 8f3e11dc9a4b3fd9ad1985d88b241df7bcb66fec)

Change-Id: I72a3dde637d3e224038886a79550fa069253a4f9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168375
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/ui/misc/pgfnote.cxx b/sw/source/ui/misc/pgfnote.cxx
index 14eec4b21be1..8da1597882d7 100644
--- a/sw/source/ui/misc/pgfnote.cxx
+++ b/sw/source/ui/misc/pgfnote.cxx
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -99,13 +100,17 @@ SwFootNotePage::SwFootNotePage(weld::Container* pPage, 
weld::DialogController* p
 , m_xMaxHeightPageBtn(m_xBuilder->weld_radio_button("maxheightpage"))
 , m_xMaxHeightBtn(m_xBuilder->weld_radio_button("maxheight"))
 , m_xMaxHeightEdit(m_xBuilder->weld_metric_spin_button("maxheightsb", 
FieldUnit::CM))
+, m_xDistLabel(m_xBuilder->weld_label("spacetotextlabel"))
 , m_xDistEdit(m_xBuilder->weld_metric_spin_button("spacetotext", 
FieldUnit::CM))
+, m_xLinePosLabel(m_xBuilder->weld_label("positionlabel"))
 , m_xLinePosBox(m_xBuilder->weld_combo_box("position"))
 , m_xLineTypeBox(new SvtLineListBox(m_xBuilder->weld_menu_button("style")))
 , m_xLineWidthEdit(m_xBuilder->weld_metric_spin_button("thickness", 
FieldUnit::POINT))
 , m_xLineColorBox(new ColorListBox(m_xBuilder->weld_menu_button("color"),
 [this]{ return GetDialogController()->getDialog(); }))
+, m_xLineLengthLabel(m_xBuilder->weld_label("lengthlabel"))
 , m_xLineLengthEdit(m_xBuilder->weld_metric_spin_button("length", 
FieldUnit::PERCENT))
+, m_xLineDistLabel(m_xBuilder->weld_label("spacingtocontentslabel"))
 , m_xLineDistEdit(m_xBuilder->weld_metric_spin_button("spacingtocontents", 
FieldUnit::CM))
 {
 SetExchangeSupport();
@@ -116,6 +121,30 @@ SwFootNotePage::SwFootNotePage(weld::Container* pPage, 
weld::DialogController* p
 MeasurementSystem eSys = 
SvtSysLocale().GetLocaleData().getMeasurementSystemEnum();
 tools::Long nHeightValue = MeasurementSystem::Metric != eSys ? 1440 : 1134;
 
m_xMaxHeightEdit->set_value(m_xMaxHeightEdit->normalize(nHeightValue),FieldUnit::TWIP);
+
+bool bContinuousEndnotes = false;
+if (const SfxGrabBagItem* pGragbagItem = 
rSet.GetItemIfSet(SID_ATTR_CHAR_GRABBAG))
+{
+auto it = pGragbagItem->GetGrabBag().find("ContinuousEndnotes");
+if (it != pGragbagItem->GetGrabBag().end())
+{
+it->second >>= bContinuousEndnotes;
+}
+}
+
+if (bContinuousEndnotes)
+{
+// These are ignored in SwFootnoteContFrame::Format() and 
SwFootnoteContFrame::PaintLine(),
+// hide them.
+m_xDistLabel->set_visible(false);
+m_xDistEdit->set_visible(false);
+m_xLinePosLabel->set_visible(false);
+m_xLinePosBox->set_visible(false);
+m_xLineLengthLabel->set_visible(false);
+m_xLineLengthEdit->set_visible(false);
+m_xLineDistLabel->set_visible(false);
+m_xLineDistEdit->set_visible(false);
+}
 }
 
 SwFootNotePage::~SwFootNotePage()
diff --git a/sw/source/uibase/inc/pgfnote.hxx b/sw/source/uibase/inc/pgfnote.hxx
index c239f1ed292f..0abb09a80a9d 100644
--- a/sw/source/uibase/inc/pgfnote.hxx
+++ b/sw/source/uibase/inc/pgfnote.hxx
@@ -44,12 +44,16 @@ private:
 std::unique_ptr m_xMaxHeightPageBtn;
 std::unique_ptr m_xMaxHeightBtn;
 std::unique_ptr m_xMaxHeightEdit;
+std::unique_ptr m_xDistLabel;
 std::unique_ptr m_xDistEdit;
+std::unique_ptr m_xLinePosLabel;
 std::unique_ptr m_xLinePosBox;
 std::unique_ptr m_xLineTypeBox;
 std::unique_ptr m_xLineWidthEdit;
 std::unique_ptr m_xLineColorBox;
+std::unique_ptr m_xLineLengthLabel;
 s

core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-06-04 Thread Mike Kaganski (via logerrit)
 sw/source/core/layout/flowfrm.cxx |2 +-
 sw/source/core/layout/sectfrm.cxx |3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

New commits:
commit a96dd31ad4dfa18312f482c452e3186334fbaa65
Author: Mike Kaganski 
AuthorDate: Tue Jun 4 10:12:26 2024 +0500
Commit: Miklos Vajna 
CommitDate: Tue Jun 4 09:41:36 2024 +0200

Make sure that the big value doesn't readily overflow

As shown in 
https://gerrit.libreoffice.org/c/core/+/168235/6#message-5e7ed6fecf7fd36dc167193e25c3ec94daa11cb3

> looks like this started to break e.g. CppunitTest_sw_mailmerge2 with
>
> /sw/inc/swrect.hxx:251:48: runtime error: signed integer overflow: 13569 
+ 9223372036854775807 cannot be represented in type 'long'
> #0 0x7f30b337cb90 in SwRect::Bottom() const /sw/inc/swrect.hxx:251:48
> #1 0x7f30b337234f in SwRect::Overlaps(SwRect const&) const 
/sw/inc/swrect.hxx:376:30
> #2 0x7f30b699354b in lcl_CheckFlowBack(SwFrame*, SwRect const&) 
/sw/source/core/layout/frmtool.cxx:3316:23
> #3 0x7f30b699376f in lcl_CheckFlowBack(SwFrame*, SwRect const&) 
/sw/source/core/layout/frmtool.cxx:3317:17
> #4 0x7f30b699376f in lcl_CheckFlowBack(SwFrame*, SwRect const&) 
/sw/source/core/layout/frmtool.cxx:3317:17
> #5 0x7f30b698d21e in Notify_Background(SdrObject const*, 
SwPageFrame*, SwRect const&, PrepareHint, bool) 
/sw/source/core/layout/frmtool.cxx:3415:13
> #6 0x7f30b5b941b4 in lcl_NotifyBackgroundOfObj(SwDrawContact const&, 
SdrObject const&, tools::Rectangle const*) 
/sw/source/core/draw/dcontact.cxx:955:13
> #7 0x7f30b5b7c9b9 in SwDrawContact::DisconnectFromLayout(bool) 
/sw/source/core/draw/dcontact.cxx:1689:9
> #8 0x7f30b5ba0cae in SwDrawContact::SwClientNotify(SwModify const&, 
SfxHint const&) /sw/source/core/draw/dcontact.cxx:1544:17
> #9 0x7f30b399e3c2 in SwModify::CallSwClientNotify(SfxHint const&) 
const /sw/source/core/attr/calbck.cxx:311:18
> #10 0x7f30b399e6c5 in 
sw::BroadcastingModify::CallSwClientNotify(SfxHint const&) const 
/sw/source/core/attr/calbck.cxx:316:15
> #11 0x7f30b6656d23 in SwDrawFrameFormat::DelFrames() 
/sw/source/core/layout/atrfrm.cxx:3525:5
> #12 0x7f30b51785f8 in 
sw::DocumentLayoutManager::DelLayoutFormat(SwFrameFormat*) 
/sw/source/core/doc/DocumentLayoutManager.cxx:235:14
> #13 0x7f30b4df70ac in 
sw::DocumentContentOperationsManager::DelFullPara(SwPaM&) 
/sw/source/core/doc/DocumentContentOperationsManager.cxx:2343:55
> #14 0x7f30b42b5701 in SwDoc::RemoveInvisibleContent() 
/sw/source/core/doc/doc.cxx:1576:57
> #15 0x7f30ba70c920 in SwDBManager::MergeMailFiles(SwWrtShell*, 
SwMergeDescriptor const&) /sw/source/uibase/dbui/dbmgr.cxx:1468:35
> #16 0x7f30ba6f7eff in SwDBManager::Merge(SwMergeDescriptor const&) 
/sw/source/uibase/dbui/dbmgr.cxx:556:20
> #17 0x7f30bbe0d561 in 
SwXMailMerge::execute(com::sun::star::uno::Sequence
 const&) /sw/source/uibase/uno/unomailmerge.cxx:786:24
> #18 0x7f30bbe103ce in non-virtual thunk to 
SwXMailMerge::execute(com::sun::star::uno::Sequence
 const&) /sw/source/uibase/uno/unomailmerge.cxx
> #19 0x7f30d009b8ed in (anonymous 
namespace)::MMTest2::executeMailMerge(bool) 
/sw/qa/extras/mailmerge/mailmerge2.cxx:195:31
> #20 0x7f30d00eb3e5 in (anonymous 
namespace)::testTdf123057_file::verify() 
/sw/qa/extras/mailmerge/mailmerge2.cxx:597:5
> #21 0x7f30d00a11eb in (anonymous 
namespace)::MMTest2::executeMailMergeTest(char const*, char const*, char 
const*, char const*, int, char const*) 
/sw/qa/extras/mailmerge/mailmerge2.cxx:99:9
> #22 0x7f30d00efc32 in (anonymous 
namespace)::testTdf123057_file::MailMerge() 
/sw/qa/extras/mailmerge/mailmerge2.cxx:594:1
> (;)

Change-Id: Ic34ad5c39d3b89c84f124e145a30714ba3752103
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168364
Reviewed-by: Mike Kaganski 
Tested-by: Jenkins
(cherry picked from commit ecd42fe1885e8fca0ec302a6d0a666f925fa62d9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168322
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/core/layout/flowfrm.cxx 
b/sw/source/core/layout/flowfrm.cxx
index 66ec8ea9e7c2..b45c8d100fcb 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -609,7 +609,7 @@ bool SwFlowFrame::PasteTree( SwFrame *pStart, SwLayoutFrame 
*pParent, SwFrame *p
 else
 bRet = true;
 
-nGrowVal += aRectFnSet.GetHeight(pFloat->getFrameArea());
+nGrowVal = o3tl::saturating_add(nGrowVal, 
aRectFnSet.GetHeight(pFloat->getFrameArea()));
 if ( pFloat->GetNext() )
 pFloat = pFloat->GetNext();
 else
diff --git a/sw/source/core/layout/sectfrm.cxx 
b/sw/source/core/layout/sectfrm.cxx
index c92af1303fae..4dc31c4256fd 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/s

core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-05-31 Thread Caolán McNamara (via logerrit)
 sw/source/uibase/docvw/AnnotationWin.cxx  |9 ++---
 sw/source/uibase/docvw/AnnotationWin2.cxx |   10 --
 2 files changed, 10 insertions(+), 9 deletions(-)

New commits:
commit 946ca1b3f7617e9c6bb81d58096b03c50318b88f
Author: Caolán McNamara 
AuthorDate: Thu May 30 08:47:09 2024 +0100
Commit: Caolán McNamara 
CommitDate: Fri May 31 09:28:14 2024 +0200

ubsan: runtime error: reference binding to null pointer of type 'const 
SwFrame'

since:

commit 124a988ea99096ea5080060c0d1a801528bd7a5c
Date:   Wed May 22 11:57:57 2024 +0100

create comment reply synchronously

Change-Id: I62a6499c4dda7155e95bf8ffb344bfa81750844f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168200
Reviewed-by: Pranam Lashkari 
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx 
b/sw/source/uibase/docvw/AnnotationWin.cxx
index 714c1419d2ed..426c097e9e58 100644
--- a/sw/source/uibase/docvw/AnnotationWin.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin.cxx
@@ -120,9 +120,12 @@ SwAnnotationWin::SwAnnotationWin( SwEditWin& rEditWin,
 }
 
 #if !ENABLE_WASM_STRIP_ACCESSIBILITY
-mrMgr.ConnectSidebarWinToFrame( 
*(mrSidebarItem.maLayoutInfo.mpAnchorFrame),
-  mrSidebarItem.GetFormatField(),
-  *this );
+if (rSidebarItem.maLayoutInfo.mpAnchorFrame)
+{
+mrMgr.ConnectSidebarWinToFrame( 
*(rSidebarItem.maLayoutInfo.mpAnchorFrame),
+  mrSidebarItem.GetFormatField(),
+  *this );
+}
 #endif
 
 if (SupportsDoubleBuffering())
diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx 
b/sw/source/uibase/docvw/AnnotationWin2.cxx
index a1f6e5794f1a..73c035abdaf7 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -1063,16 +1063,13 @@ void SwAnnotationWin::ExecuteCommand(sal_uInt16 nSlot)
 
 SwDocShell* pShell = mrView.GetDocShell();
 if (bReply)
-
pShell->GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::START, nullptr);
+
pShell->GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::INSERT, nullptr);
 
 // synchronous dispatch
 mrView.GetViewFrame().GetDispatcher()->Execute(FN_POSTIT);
 
 if (bReply)
 {
-SwUndoId nUndoId(SwUndoId::END);
-mrView.GetWrtShell().GetLastUndoInfo(nullptr, &nUndoId);
-
 // Get newly created SwPostItField and set its paraIdParent
 auto pPostItField = mrMgr.GetLatestPostItField();
 pPostItField->SetParentId(GetTopReplyNote()->GetParaId());
@@ -1088,7 +1085,7 @@ void SwAnnotationWin::ExecuteCommand(sal_uInt16 nSlot)
 
 SwRewriter aRewriter;
 aRewriter.AddRule(UndoArg1, pPostItField->GetDescription());
-pShell->GetDoc()->GetIDocumentUndoRedo().EndUndo(nUndoId, 
&aRewriter);
+
pShell->GetDoc()->GetIDocumentUndoRedo().EndUndo(SwUndoId::INSERT, &aRewriter);
 }
 break;
 }
@@ -1416,7 +1413,7 @@ void SwAnnotationWin::ChangeSidebarItem( SwSidebarItem 
const & rSidebarItem )
 {
 #if !ENABLE_WASM_STRIP_ACCESSIBILITY
 const bool bAnchorChanged = mpAnchorFrame != 
rSidebarItem.maLayoutInfo.mpAnchorFrame;
-if ( bAnchorChanged )
+if (bAnchorChanged && mpAnchorFrame)
 {
 mrMgr.DisconnectSidebarWinFromFrame( *mpAnchorFrame, *this );
 }
@@ -1424,6 +1421,7 @@ void SwAnnotationWin::ChangeSidebarItem( SwSidebarItem 
const & rSidebarItem )
 
 mrSidebarItem = rSidebarItem;
 mpAnchorFrame = mrSidebarItem.maLayoutInfo.mpAnchorFrame;
+assert(mpAnchorFrame);
 
 #if !ENABLE_WASM_STRIP_ACCESSIBILITY
 if (mxSidebarWinAccessible)


core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-05-21 Thread Caolán McNamara (via logerrit)
 sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 922581328e181292d9219dc775e2bb39af71
Author: Caolán McNamara 
AuthorDate: Tue May 21 12:51:20 2024 +0100
Commit: Aron Budea 
CommitDate: Tue May 21 13:54:26 2024 +0200

fix build break wrt ‘Wait’ is not a member of ‘PointerStyle’

Change-Id: Id5845e55a879fafbb5dc269b4179d87f7f94285b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167896
Reviewed-by: Aron Budea 
Tested-by: Aron Budea 

diff --git a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx 
b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
index fab35b1b04b2..129b37713fe8 100644
--- a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
+++ b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 


core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-05-21 Thread Tomaž Vajngerl (via logerrit)
 sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx |   10 ++
 1 file changed, 10 insertions(+)

New commits:
commit 10ef0f03bb6a9efc0dcabe8710b59bd7b41a2fcf
Author: Tomaž Vajngerl 
AuthorDate: Tue May 21 14:25:21 2024 +0900
Commit: Michael Meeks 
CommitDate: Tue May 21 13:12:30 2024 +0200

sw: show "wait" pointer while accessibility check is running

Change-Id: I234af45560db7940d07669be9abd1b1ec50a74cd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167880
Tested-by: Michael Meeks 
Reviewed-by: Michael Meeks 

diff --git a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx 
b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
index c29574a84933..fab35b1b04b2 100644
--- a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
+++ b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
@@ -19,6 +19,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -227,6 +228,12 @@ void A11yCheckIssuesPanel::populateIssues()
 if (!mpDoc || !mxAccessibilityBox->is_visible())
 return;
 
+SfxViewShell* pViewShell = SfxViewShell::Current();
+auto* pWindow = pViewShell ? pViewShell->GetWindow() : nullptr;
+
+if (pWindow)
+pWindow->SetPointer(PointerStyle::Wait);
+
 sw::AccessibilityCheck aCheck(mpDoc);
 aCheck.check();
 m_aIssueCollection = aCheck.getIssueCollection();
@@ -313,6 +320,9 @@ void A11yCheckIssuesPanel::populateIssues()
 m_xExpanders[nGroupIndex]->hide();
 nGroupIndex++;
 }
+
+if (pWindow)
+pWindow->SetPointer(PointerStyle::Arrow);
 }
 
 void A11yCheckIssuesPanel::NotifyItemUpdate(const sal_uInt16 nSid, const 
SfxItemState /* eState */,


core.git: Branch 'distro/collabora/co-24.04' - sw/source sw/uiconfig

2024-05-20 Thread Tomaž Vajngerl (via logerrit)
 sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx |   33 --
 sw/source/uibase/sidebar/A11yCheckIssuesPanel.hxx |6 
 sw/uiconfig/swriter/ui/a11ycheckissuespanel.ui|   26 +
 3 files changed, 63 insertions(+), 2 deletions(-)

New commits:
commit 5e6d7927e27551aa63a2b22134b1a9ee6408d39a
Author: Tomaž Vajngerl 
AuthorDate: Mon May 20 15:45:51 2024 +0900
Commit: Caolán McNamara 
CommitDate: Mon May 20 13:17:31 2024 +0200

sw: add update button to a11y check sidebar when using LOKit

Running the a11y check when the sidebar gets enable takes some
time, because populating the widgets is quite expensive. Instead
of running the check right away, add a "update" button to the
sidebar, that needs to be clicked first to start running the
accessibility check. This does not check the behavior of the
sidebar in desktop LibreOffice.

Also change the populate call to be async, which helps a bit to
make the UI interaction more fluent, but doesn't fix the issue.

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

diff --git a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx 
b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
index 7bbbf130678c..c29574a84933 100644
--- a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
+++ b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "A11yCheckIssuesPanel.hxx"
 
@@ -103,6 +104,9 @@ std::unique_ptr 
A11yCheckIssuesPanel::Create(weld::Widget* pParent,
 
 A11yCheckIssuesPanel::A11yCheckIssuesPanel(weld::Widget* pParent, SfxBindings* 
pBindings)
 : PanelLayout(pParent, "A11yCheckIssuesPanel", 
"modules/swriter/ui/a11ycheckissuespanel.ui")
+, mxAccessibilityBox(m_xBuilder->weld_box("accessibilityCheckBox"))
+, mxUpdateBox(m_xBuilder->weld_box("updateBox"))
+, mxUpdateLinkButton(m_xBuilder->weld_link_button("updateLinkButton"))
 , mpBindings(pBindings)
 , mpDoc(nullptr)
 , maA11yCheckController(FN_STAT_ACCESSIBILITY_CHECK, *pBindings, *this)
@@ -131,6 +135,9 @@ A11yCheckIssuesPanel::A11yCheckIssuesPanel(weld::Widget* 
pParent, SfxBindings* p
 m_xBoxes[8] = m_xBuilder->weld_box("box_numbering");
 m_xBoxes[9] = m_xBuilder->weld_box("box_other");
 
+mxUpdateLinkButton->connect_activate_link(
+LINK(this, A11yCheckIssuesPanel, UpdateLinkButtonClicked));
+
 SwDocShell* pDocSh = dynamic_cast(SfxObjectShell::Current());
 if (!pDocSh)
 return;
@@ -149,9 +156,31 @@ A11yCheckIssuesPanel::A11yCheckIssuesPanel(weld::Widget* 
pParent, SfxBindings* p
 
 mpDoc = pDocSh->GetDoc();
 
-populateIssues();
+// If LOKit is enabled, then enable the update button and don't run the 
accessibility check.
+// In desktop don't show the update button and schedule to run the 
accessibility check async
+if (comphelper::LibreOfficeKit::isActive())
+{
+mxAccessibilityBox->hide();
+mxUpdateBox->show();
+}
+else
+{
+mxAccessibilityBox->show();
+mxUpdateBox->hide();
+Application::PostUserEvent(LINK(this, A11yCheckIssuesPanel, 
PopulateIssuesHdl));
+}
 }
 
+IMPL_LINK_NOARG(A11yCheckIssuesPanel, UpdateLinkButtonClicked, 
weld::LinkButton&, bool)
+{
+mxAccessibilityBox->show();
+mxUpdateBox->hide();
+Application::PostUserEvent(LINK(this, A11yCheckIssuesPanel, 
PopulateIssuesHdl));
+return true;
+}
+
+IMPL_LINK_NOARG(A11yCheckIssuesPanel, PopulateIssuesHdl, void*, void) { 
populateIssues(); }
+
 void A11yCheckIssuesPanel::ImplDestroy()
 {
 // Restore state when this panel is no longer used
@@ -195,7 +224,7 @@ void 
A11yCheckIssuesPanel::addEntryForGroup(AccessibilityCheckGroups eGroup,
 
 void A11yCheckIssuesPanel::populateIssues()
 {
-if (!mpDoc)
+if (!mpDoc || !mxAccessibilityBox->is_visible())
 return;
 
 sw::AccessibilityCheck aCheck(mpDoc);
diff --git a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.hxx 
b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.hxx
index 519cd6b244e8..ef8d4da0e186 100644
--- a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.hxx
+++ b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.hxx
@@ -78,11 +78,17 @@ private:
 std::array>, 10> 
m_aEntries;
 std::array, 10> m_xExpanders;
 std::array, 10> m_xBoxes;
+std::unique_ptr mxAccessibilityBox;
+std::unique_ptr mxUpdateBox;
+std::unique_ptr mxUpdateLinkButton;
 
 sfx::AccessibilityIssueCollection m_aIssueCollection;
 void removeAllEntries();
 void populateIssues();
 
+DECL_LINK(UpdateLinkButtonClicked, weld::LinkButton&, bool);
+DECL_LINK(PopulateIssuesHdl, void*, void);
+
 void addEntryForGroup(AccessibilityCheckGroups eGroup, 
std::vector& rIndices,
   std::shared_ptr const& 
pIssue);
 
diff --g

core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-05-16 Thread Pranam Lashkari (via logerrit)
 sw/source/uibase/docvw/AnnotationWin2.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 2a040bfe3e9f58db5c9f6503796778f07e2beba9
Author: Pranam Lashkari 
AuthorDate: Wed May 15 23:08:23 2024 +0300
Commit: Pranam Lashkari 
CommitDate: Thu May 16 18:35:43 2024 +0200

Added parent / child relationship to comments.

Adding parent name of a comment into odf file when there is a parent.

problem:
adding reply to any comment, saving and reopening doc will not show
reply in same thread.
regression from: c0187d9f5e6ab5129b6fc4682555f2f8775d6f67

this part affects core only, similar thing online was done in 
62cc2217217650d23c72e4646ccd793f76722d94

Change-Id: I563e3a2785543da69d717f8770f91a514699e604
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167711
Reviewed-by: Gökay ŞATIR 
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx 
b/sw/source/uibase/docvw/AnnotationWin2.cxx
index 6b8895f1d9d2..a5e332ef4346 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -1067,6 +1067,7 @@ void SwAnnotationWin::ExecuteCommand(sal_uInt16 nSlot)
 auto pPostItField = mrMgr.GetLatestPostItField();
 pPostItField->SetParentId(GetTopReplyNote()->GetParaId());
 
pPostItField->SetParentPostItId(GetTopReplyNote()->GetPostItField()->GetPostItId());
+this->GeneratePostItName();
 
pPostItField->SetParentName(GetTopReplyNote()->GetPostItField()->GetName());
 }
 break;


core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-05-13 Thread Jaume Pujantell (via logerrit)
 sw/source/uibase/uiview/viewtab.cxx |8 
 1 file changed, 8 insertions(+)

New commits:
commit c6c1c7afc18f32453c06a3af25f389ccb9074a1b
Author: Jaume Pujantell 
AuthorDate: Fri May 10 10:04:47 2024 +0200
Commit: Tomaž Vajngerl 
CommitDate: Mon May 13 10:47:31 2024 +0200

sw: avoid unwanted row height changes

When changing a row's height with SID_TABLE_CHANGE_CURRENT_BORDER_POSITION
avoid knock-on effects to lower rows.

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

diff --git a/sw/source/uibase/uiview/viewtab.cxx 
b/sw/source/uibase/uiview/viewtab.cxx
index 52a26eabb672..35d173a7a6dd 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -1169,7 +1169,15 @@ void SwView::ExecTabWin( SfxRequest const & rReq )
 auto & rEntry = aTabRows.GetEntry(nIndex);
 tools::Long nNewPosition = rEntry.nPos + nOffset;
 nNewPosition = std::clamp(nNewPosition, rEntry.nMin, 
rEntry.nMax - constDistanceOffset);
+tools::Long nActualOffset = nNewPosition - rEntry.nPos;
 rEntry.nPos = nNewPosition;
+// Maintain the size of the other rows
+for (size_t i = nIndex + 1; i < aTabRows.Count(); ++i)
+{
+auto& rNextEntry = aTabRows.GetEntry(i);
+rNextEntry.nPos += nActualOffset;
+}
+aTabRows.SetRight(aTabRows.GetRight() + nActualOffset);
 }
 
 rSh.SetTabRows(aTabRows, false);


core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-05-10 Thread Miklos Vajna (via logerrit)
 sw/source/core/inc/pagefrm.hxx|1 +
 sw/source/core/inc/sectfrm.hxx|4 
 sw/source/core/layout/findfrm.cxx |   23 +++
 sw/source/core/layout/sectfrm.cxx |1 +
 4 files changed, 29 insertions(+)

New commits:
commit e747e6df648a7ff076663ab376a4dbbc041b5180
Author: Miklos Vajna 
AuthorDate: Thu May 9 08:20:21 2024 +0200
Commit: Caolán McNamara 
CommitDate: Fri May 10 16:03:56 2024 +0200

tdf#160984 sw continuous endnotes: add a way to find the endnote section 
start

Existing code with endnotes on separate page at the end of the document
works by searching for a current or next page that is an endnote page in
SwFootnoteBossFrame::AppendFootnote(), and in case none is found, then
an endnote page is created.

Add similar infrastructure for the inline endnotes case: here we want to
find the first page that has an endnotes section, which also requires
being able to tell if a section is an endnotes one.

The newly introduced SwPageFrame::GetEndNoteSection() is not yet used in
SwFootnoteBossFrame::AppendFootnote(), though.

(cherry picked from commit 8bae684c93bd23bbe98707ba9cf75d1a39427131)

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

diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx
index 54458032f188..054495eeea80 100644
--- a/sw/source/core/inc/pagefrm.hxx
+++ b/sw/source/core/inc/pagefrm.hxx
@@ -204,6 +204,7 @@ public:
 bool IsEndNotePage() const  { return m_bEndNotePage; }
 void SetFootnotePage( bool b )   { m_bFootnotePage = 
b; }
 void SetEndNotePage( bool b )   { m_bEndNotePage = b; }
+SwSectionFrame* GetEndNoteSection();
 
 sal_uInt16 GetPhyPageNum() const{ return m_nPhyPageNum;}
 void SetPhyPageNum( sal_uInt16 nNum )   { m_nPhyPageNum = nNum;}
diff --git a/sw/source/core/inc/sectfrm.hxx b/sw/source/core/inc/sectfrm.hxx
index 3debf367f05a..ac57bd815d5f 100644
--- a/sw/source/core/inc/sectfrm.hxx
+++ b/sw/source/core/inc/sectfrm.hxx
@@ -52,6 +52,8 @@ class SW_DLLPUBLIC SwSectionFrame final: public 
SwLayoutFrame, public SwFlowFram
 SwSection* m_pSection;
 bool m_bFootnoteAtEnd; // footnotes at the end of section
 bool m_bEndnAtEnd; // endnotes at the end of section
+/// If this is a section for endnotes, then the SwSection is not backed by 
an SwSectionNode.
+bool m_bEndNoteSection = false;
 bool m_bContentLock; // content locked
 bool m_bOwnFootnoteNum; // special numbering of footnotes
 bool m_bFootnoteLock; // ftn, don't leave this section bwd
@@ -171,6 +173,8 @@ public:
 
 void SetFootnoteLock( bool bNew ) { m_bFootnoteLock = bNew; }
 bool IsFootnoteLock() const { return m_bFootnoteLock; }
+void SetEndNoteSection(bool bEndNoteSection) { m_bEndNoteSection = 
bEndNoteSection; }
+bool IsEndNoteSection() const { return m_bEndNoteSection; }
 };
 
 inline const SwSectionFrame *SwSectionFrame::GetFollow() const
diff --git a/sw/source/core/layout/findfrm.cxx 
b/sw/source/core/layout/findfrm.cxx
index 0dd64c6aecff..378e451b9f89 100644
--- a/sw/source/core/layout/findfrm.cxx
+++ b/sw/source/core/layout/findfrm.cxx
@@ -65,6 +65,29 @@ SwContentFrame *SwPageFrame::FindLastBodyContent()
 return pRet;
 }
 
+SwSectionFrame* SwPageFrame::GetEndNoteSection()
+{
+SwLayoutFrame* pBody = FindBodyCont();
+if (!pBody)
+{
+return nullptr;
+}
+
+SwFrame* pLast = pBody->GetLastLower();
+if (!pLast || !pLast->IsSctFrame())
+{
+return nullptr;
+}
+
+auto pLastSection = static_cast(pLast);
+if (!pLastSection->IsEndNoteSection())
+{
+return nullptr;
+}
+
+return pLastSection;
+}
+
 /**
  * Checks if the frame contains one or more ContentFrame's anywhere in his
  * subsidiary structure; if so the first found ContentFrame is returned.
diff --git a/sw/source/core/layout/sectfrm.cxx 
b/sw/source/core/layout/sectfrm.cxx
index 3967a1f56442..78278da9cb38 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -94,6 +94,7 @@ SwSectionFrame::SwSectionFrame( SwSectionFrame &rSect, bool 
bMaster ) :
 m_bOwnFootnoteNum( false ),
 m_bFootnoteLock( false )
 {
+m_bEndNoteSection = rSect.m_bEndNoteSection;
 StartListening(rSect.GetFormat()->GetNotifier());
 
 mnFrameType = SwFrameType::Section;


core.git: Branch 'distro/collabora/co-24.04' - sw/source

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

New commits:
commit 863720dfc09343f61bc3e5f8105bfaf3544cfc3c
Author: Michael Stahl 
AuthorDate: Fri May 3 17:33:56 2024 +0200
Commit: Miklos Vajna 
CommitDate: Fri May 10 14:20:09 2024 +0200

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

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

(regression from commit 5c04c4474236cc50009aea6d89f7c443c861af19)

(cherry picked from commit fdd44d9e7c6066aac8572d6d78dedef339b6058e)

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

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


core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-05-09 Thread Miklos Vajna (via logerrit)
 sw/source/uibase/shells/drwbassh.cxx |   18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 0f7127aa6019363d15a167ab492ba06e0347174a
Author: Miklos Vajna 
AuthorDate: Thu May 9 13:09:43 2024 +0200
Commit: Caolán McNamara 
CommitDate: Thu May 9 14:59:53 2024 +0200

sw: fix -Wshadow warnings


/home/vmiklos/git/libreoffice/co-24.04/sw/source/uibase/shells/drwbassh.cxx: In 
lambda function:

/home/vmiklos/git/libreoffice/co-24.04/sw/source/uibase/shells/drwbassh.cxx:656:38:
 error: declaration of ‘aTitle’ shadows a previous local [-Werror=shadow]
  656 | OUString aTitle;
  |  ^~

/home/vmiklos/git/libreoffice/co-24.04/sw/source/uibase/shells/drwbassh.cxx:643:26:
 note: shadowed declaration is here
  643 | OUString aTitle(pSelected->GetTitle());
  |  ^~

/home/vmiklos/git/libreoffice/co-24.04/sw/source/uibase/shells/drwbassh.cxx:657:38:
 error: declaration of ‘aDescription’ shadows a previous local [-Werror=shadow]
  657 | OUString aDescription;
  |  ^~~~

/home/vmiklos/git/libreoffice/co-24.04/sw/source/uibase/shells/drwbassh.cxx:644:26:
 note: shadowed declaration is here
  644 | OUString 
aDescription(pSelected->GetDescription());
  |  ^~~~

/home/vmiklos/git/libreoffice/co-24.04/sw/source/uibase/shells/drwbassh.cxx:658:34:
 error: declaration of ‘isDecorative’ shadows a previous local [-Werror=shadow]
  658 | bool isDecorative;
  |  ^~~~

/home/vmiklos/git/libreoffice/co-24.04/sw/source/uibase/shells/drwbassh.cxx:645:22:
 note: shadowed declaration is here
  645 | bool 
isDecorative(pSelected->IsDecorative());
  |  ^~~~
cc1plus: all warnings being treated as errors

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

diff --git a/sw/source/uibase/shells/drwbassh.cxx 
b/sw/source/uibase/shells/drwbassh.cxx
index ebd1eb3ce705..c98e97eb7aba 100644
--- a/sw/source/uibase/shells/drwbassh.cxx
+++ b/sw/source/uibase/shells/drwbassh.cxx
@@ -653,17 +653,17 @@ void SwDrawBaseShell::Execute(SfxRequest const &rReq)
 {
 if (nResult == RET_OK)
 {
-OUString aTitle;
-OUString aDescription;
-bool isDecorative;
+OUString aNewTitle;
+OUString aNewDescription;
+bool newIsDecorative;
 
-pDlg->GetTitle(aTitle);
-pDlg->GetDescription(aDescription);
-pDlg->IsDecorative(isDecorative);
+pDlg->GetTitle(aNewTitle);
+pDlg->GetDescription(aNewDescription);
+pDlg->IsDecorative(newIsDecorative);
 
-pSelected->SetTitle(aTitle);
-pSelected->SetDescription(aDescription);
-pSelected->SetDecorative(isDecorative);
+pSelected->SetTitle(aNewTitle);
+pSelected->SetDescription(aNewDescription);
+pSelected->SetDecorative(newIsDecorative);
 
 pSh->SetModified();
 }


core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-05-02 Thread Tomaž Vajngerl (via logerrit)
 sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx |  210 +++---
 sw/source/uibase/sidebar/A11yCheckIssuesPanel.hxx |   56 ++---
 2 files changed, 97 insertions(+), 169 deletions(-)

New commits:
commit 3565d5be15d536c0732fd6930d3173c51458c3b6
Author: Tomaž Vajngerl 
AuthorDate: Tue Apr 30 23:28:10 2024 +0900
Commit: Szymon Kłos 
CommitDate: Thu May 2 10:38:28 2024 +0200

sw: simplify widgets in A11yCheckIssuesPanel

Change-Id: Iee8db2953c5836f7dee667dadab9441f73706d52
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166955
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Szymon Kłos 

diff --git a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx 
b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
index a1907c9b6306..7bbbf130678c 100644
--- a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
+++ b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "A11yCheckIssuesPanel.hxx"
 
@@ -80,13 +81,15 @@ AccessibilityCheckEntry::AccessibilityCheckEntry(
 
 IMPL_LINK_NOARG(AccessibilityCheckEntry, GotoButtonClicked, weld::LinkButton&, 
bool)
 {
-m_pAccessibilityIssue->gotoIssue();
+if (m_pAccessibilityIssue)
+m_pAccessibilityIssue->gotoIssue();
 return true;
 }
 
 IMPL_LINK_NOARG(AccessibilityCheckEntry, FixButtonClicked, weld::Button&, void)
 {
-m_pAccessibilityIssue->quickFixIssue();
+if (m_pAccessibilityIssue)
+m_pAccessibilityIssue->quickFixIssue();
 }
 
 std::unique_ptr A11yCheckIssuesPanel::Create(weld::Widget* 
pParent,
@@ -100,32 +103,34 @@ std::unique_ptr 
A11yCheckIssuesPanel::Create(weld::Widget* pParent,
 
 A11yCheckIssuesPanel::A11yCheckIssuesPanel(weld::Widget* pParent, SfxBindings* 
pBindings)
 : PanelLayout(pParent, "A11yCheckIssuesPanel", 
"modules/swriter/ui/a11ycheckissuespanel.ui")
-, m_xExpanderDocument(m_xBuilder->weld_expander("expand_document"))
-, m_xExpanderStyles(m_xBuilder->weld_expander("expand_styles"))
-, m_xExpanderLinked(m_xBuilder->weld_expander("expand_linked"))
-, m_xExpanderNoAlt(m_xBuilder->weld_expander("expand_no_alt"))
-, m_xExpanderTable(m_xBuilder->weld_expander("expand_table"))
-, m_xExpanderFormatting(m_xBuilder->weld_expander("expand_formatting"))
-, m_xExpanderHyperlink(m_xBuilder->weld_expander("expand_hyperlink"))
-, m_xExpanderFakes(m_xBuilder->weld_expander("expand_fakes"))
-, m_xExpanderNumbering(m_xBuilder->weld_expander("expand_numbering"))
-, m_xExpanderOther(m_xBuilder->weld_expander("expand_other"))
-, m_xBoxDocument(m_xBuilder->weld_box("box_document"))
-, m_xBoxStyles(m_xBuilder->weld_box("box_styles"))
-, m_xBoxLinked(m_xBuilder->weld_box("box_linked"))
-, m_xBoxNoAlt(m_xBuilder->weld_box("box_no_alt"))
-, m_xBoxTable(m_xBuilder->weld_box("box_table"))
-, m_xBoxFormatting(m_xBuilder->weld_box("box_formatting"))
-, m_xBoxHyperlink(m_xBuilder->weld_box("box_hyperlink"))
-, m_xBoxFakes(m_xBuilder->weld_box("box_fakes"))
-, m_xBoxNumbering(m_xBuilder->weld_box("box_numbering"))
-, m_xBoxOther(m_xBuilder->weld_box("box_other"))
 , mpBindings(pBindings)
 , mpDoc(nullptr)
 , maA11yCheckController(FN_STAT_ACCESSIBILITY_CHECK, *pBindings, *this)
 , mnIssueCount(0)
 , mbAutomaticCheckEnabled(false)
 {
+m_xExpanders[0] = m_xBuilder->weld_expander("expand_document");
+m_xExpanders[1] = m_xBuilder->weld_expander("expand_styles");
+m_xExpanders[2] = m_xBuilder->weld_expander("expand_linked");
+m_xExpanders[3] = m_xBuilder->weld_expander("expand_no_alt");
+m_xExpanders[4] = m_xBuilder->weld_expander("expand_table");
+m_xExpanders[5] = m_xBuilder->weld_expander("expand_formatting");
+m_xExpanders[6] = m_xBuilder->weld_expander("expand_hyperlink");
+m_xExpanders[7] = m_xBuilder->weld_expander("expand_fakes");
+m_xExpanders[8] = m_xBuilder->weld_expander("expand_numbering");
+m_xExpanders[9] = m_xBuilder->weld_expander("expand_other");
+
+m_xBoxes[0] = m_xBuilder->weld_box("box_document");
+m_xBoxes[1] = m_xBuilder->weld_box("box_styles");
+m_xBoxes[2] = m_xBuilder->weld_box("box_linked");
+m_xBoxes[3] = m_xBuilder->weld_box("box_no_alt");
+m_xBoxes[4] = m_xBuilder->weld_box("box_table");
+m_xBoxes[5] = m_xBuilder->weld_box("box_formatting");
+m_xBoxes[6] = m_xBuilder->weld_box("box_hyperlink");
+m_xBoxes[7] = m_xBuilder->weld_box("box_fakes");
+m_xBoxes[8] = m_xBuilder->weld_box("box_numbering");
+m_xBoxes[9] = m_xBuilder->weld_box("box_other");
+
 SwDocShell* pDocSh = dynamic_cast(SfxObjectShell::Current());
 if (!pDocSh)
 return;
@@ -158,93 +163,49 @@ void A11yCheckIssuesPanel::ImplDestroy()
 batch->commit();
 mpBindings->Invalidate(SID_ACCESSIBILITY_CHECK_ONLINE);
 }
-m_xExpanderDocument.reset();
-m_xExpanderStyles.reset();
-m_xExpanderLinked.reset();
-m_xExpanderNoAlt.reset();
-

core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-04-02 Thread Justin Luth (via logerrit)
 sw/source/core/layout/paintfrm.cxx |   22 ++
 1 file changed, 22 insertions(+)

New commits:
commit a1214585c7cb849c7d47591ec6bc0d68ea9a7ba8
Author: Justin Luth 
AuthorDate: Mon Mar 25 16:01:44 2024 -0400
Commit: Miklos Vajna 
CommitDate: Tue Apr 2 09:07:57 2024 +0200

tdf#131253 sw: draw frame text boundary only if show formatting marks

This squashed backport includes c51f9f15b8c308e62b4839cc13d623fdab0486c2

It is infuriating to see a border around your image
when there is no border defined. View - Text boundaries
does NOT sound like something that would apply to images,
and it is NOT nice to turn that off because then you also
lose the body text markers as well as the header/footer indicators.

Instead, do the same thing as the page boundaries - only show
the (full) boundary when show formatting marks is turned on
(and there are no partial boundaries for frames...)

These text boundaries around AT-anchored flies
only became visible in LO 6.0.

Change-Id: I7954effc46d977e1761cba71758f7a7af2072807
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165294
Reviewed-by: Justin Luth 
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165463
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 46c9189f0dfd..ff5abcfcf898 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -7488,6 +7488,28 @@ void SwLayoutFrame::PaintSubsidiaryLines( const 
SwPageFrame *pPage,
 const bool bFlys = pPage->GetSortedObjs() != nullptr;
 
 const bool bCell = IsCellFrame();
+
+if (!bCell && IsFlyFrame())
+{
+// particularly with images (but also plausible for any kind of frame),
+// it is very disconcerting to see a fake border,
+// so (just like the page boundary) only show fly "text boundaries"
+// when "Show Formatting Marks" is turned on
+if (!gProp.pSGlobalShell->GetViewOptions()->IsViewMetaChars())
+return;
+
+// if the frame is wrap none or wrap through, then text boundary lines 
have no meaning
+// (unless the frame itself contains text)
+const text::WrapTextMode aSurround = 
GetFormat()->GetSurround().GetSurround();
+if (GetFormat()->GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR
+&& (!Lower() || !Lower()->IsTextFrame())
+&& (aSurround == text::WrapTextMode::WrapTextMode_THROUGH
+|| aSurround == text::WrapTextMode::WrapTextMode_NONE))
+{
+return;
+}
+}
+
 //  #i3662# - use frame area for cells for section use also frame area
 const bool bUseFrameArea = bCell || IsSctFrame();
 SwRect aOriginal( bUseFrameArea ? getFrameArea() : getFramePrintArea() );


core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-03-19 Thread Justin Luth (via logerrit)
 sw/source/core/crsr/findtxt.cxx |   14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 60b39486660f238fd4385a9cab48a396ed15a155
Author: Justin Luth 
AuthorDate: Fri Mar 15 12:40:42 2024 -0400
Commit: Miklos Vajna 
CommitDate: Tue Mar 19 08:56:56 2024 +0100

DoSearch's pPam was not optional - made it an SwPam& rPam

oPam also is not a real optional - it is always populated
by MakeRegion, and known to be non-null since it was used
in the containing while loop clause earlier

Change-Id: I33133c8f9f9188e57fe100f3c455dc92453d05f4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164868
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Noel Grandin 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164981
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index 5f63f8f13694..9d05c3290e50 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -361,7 +361,7 @@ static bool DoSearch(SwPaM & rSearchPam,
 bool bSrchForward, bool bRegSearch, bool bChkEmptyPara, bool bChkParaEnd,
 AmbiguousIndex & nStart, AmbiguousIndex & nEnd, AmbiguousIndex nTextLen,
 SwTextNode const* pNode, SwTextFrame const* pTextFrame,
-SwRootFrame const* pLayout, SwPaM* pPam);
+SwRootFrame const* pLayout, SwPaM& rPam);
 
 namespace sw {
 
@@ -677,7 +677,7 @@ bool FindTextImpl(SwPaM & rSearchPam,
bRegSearch, bChkEmptyPara, bChkParaEnd,
nStartInside, nEndInside, nTextLen,
pNode->GetTextNode(), pFrame, pLayout,
-   oPam ? &*oPam : nullptr );
+   *oPam);
 if ( bFound )
 break;
 else
@@ -710,7 +710,7 @@ bool FindTextImpl(SwPaM & rSearchPam,
bRegSearch, bChkEmptyPara, bChkParaEnd,
nStart, nEnd, nTextLen,
pNode->GetTextNode(), pFrame, pLayout,
-   oPam ? &*oPam : nullptr );
+   *oPam);
 }
 if (bFound)
 break;
@@ -727,10 +727,10 @@ bool DoSearch(SwPaM & rSearchPam,
   bool bChkEmptyPara, bool bChkParaEnd,
 AmbiguousIndex & nStart, AmbiguousIndex & nEnd, AmbiguousIndex const 
nTextLen,
 SwTextNode const*const pNode, SwTextFrame const*const pFrame,
-SwRootFrame const*const pLayout, SwPaM* pPam)
+SwRootFrame const*const pLayout, SwPaM& rPam)
 {
 bool bFound = false;
-SwPosition& rPtPos = *pPam->GetPoint();
+SwPosition& rPtPos = *rPam.GetPoint();
 OUString sCleanStr;
 std::vector aFltArr;
 LanguageType eLastLang = LANGUAGE_SYSTEM;
@@ -818,7 +818,7 @@ bool DoSearch(SwPaM & rSearchPam,
 nStart = nProxyStart;
 nEnd = nProxyEnd;
 // set section correctly
-*rSearchPam.GetPoint() = *pPam->GetPoint();
+*rSearchPam.GetPoint() = *rPam.GetPoint();
 rSearchPam.SetMark();
 
 // adjust start and end
@@ -875,7 +875,7 @@ bool DoSearch(SwPaM & rSearchPam,
 else if ((bChkEmptyPara && !nStart.GetAnyIndex() && 
!nTextLen.GetAnyIndex())
  || bChkParaEnd)
 {
-*rSearchPam.GetPoint() = *pPam->GetPoint();
+*rSearchPam.GetPoint() = *rPam.GetPoint();
 if (pLayout)
 {
 *rSearchPam.GetPoint() = pFrame->MapViewToModelPos(


core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-03-14 Thread Antony (via logerrit)
 sw/source/ui/dialog/swdlgfact.cxx  |5 +
 sw/source/ui/dialog/swdlgfact.hxx  |3 ++-
 sw/source/ui/misc/bookmark.cxx |   23 +--
 sw/source/uibase/inc/swrenamexnameddlg.hxx |4 ++--
 4 files changed, 22 insertions(+), 13 deletions(-)

New commits:
commit 1222d98eaad463e35286f215b3bdeb909ea155bf
Author: Antony 
AuthorDate: Thu Mar 14 15:24:11 2024 +0530
Commit: Miklos Vajna 
CommitDate: Thu Mar 14 13:57:20 2024 +0100

cool#8456 : Convert bookmark rename dialog to async

* Changed bookmark rename dialog from synchronous to asynchronous execution.
* Removed the reference operator from variables m_xNamed and m_xNameAccess 
declared in swrenamexnameddlg.hxx to prevent use-after-free

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

diff --git a/sw/source/ui/dialog/swdlgfact.cxx 
b/sw/source/ui/dialog/swdlgfact.cxx
index fbe9d4a5d9ed..c70608b6f46a 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -242,6 +242,11 @@ short AbstractSwRenameXNamedDlg_Impl::Execute()
 return m_xDlg->run();
 }
 
+bool 
AbstractSwRenameXNamedDlg_Impl::StartExecuteAsync(VclAbstractDialog::AsyncContext&
 rCtx)
+{
+return weld::DialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
+}
+
 bool 
AbstractSwContentControlListItemDlg_Impl::StartExecuteAsync(VclAbstractDialog::AsyncContext&
 rCtx)
 {
 return weld::DialogController::runAsync(m_xDlg, rCtx.maEndDialogFn);
diff --git a/sw/source/ui/dialog/swdlgfact.hxx 
b/sw/source/ui/dialog/swdlgfact.hxx
index c2c043bb3eb6..5dc47327daa5 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -466,13 +466,14 @@ public:
 
 class AbstractSwRenameXNamedDlg_Impl : public AbstractSwRenameXNamedDlg
 {
-std::unique_ptr m_xDlg;
+std::shared_ptr m_xDlg;
 public:
 explicit AbstractSwRenameXNamedDlg_Impl(std::unique_ptr 
p)
 : m_xDlg(std::move(p))
 {
 }
 virtual short Execute() override;
+virtual bool StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) 
override;
 virtual void SetForbiddenChars( const OUString& rSet ) override;
 virtual void SetAlternativeAccess(
  css::uno::Reference< css::container::XNameAccess > & xSecond,
diff --git a/sw/source/ui/misc/bookmark.cxx b/sw/source/ui/misc/bookmark.cxx
index 6431809c9569..40cebea7ead7 100644
--- a/sw/source/ui/misc/bookmark.cxx
+++ b/sw/source/ui/misc/bookmark.cxx
@@ -215,20 +215,23 @@ IMPL_LINK_NOARG(SwInsertBookmarkDlg, RenameHdl, 
weld::Button&, void)
 aObj >>= xTmp;
 uno::Reference xNamed(xTmp, uno::UNO_QUERY);
 SwAbstractDialogFactory& rFact = swui::GetFactory();
-ScopedVclPtr pDlg(
+VclPtr pDlg(
 rFact.CreateSwRenameXNamedDlg(m_xDialog.get(), xNamed, xNameAccess));
 pDlg->SetForbiddenChars(BookmarkTable::aForbiddenChars
 + OUStringChar(BookmarkTable::s_cSeparator));
 
-if (pDlg->Execute())
-{
-ValidateBookmarks();
-m_xDeleteBtn->set_sensitive(false);
-m_xGotoBtn->set_sensitive(false);
-m_xEditTextBtn->set_sensitive(false);
-m_xRenameBtn->set_sensitive(false);
-m_xInsertBtn->set_sensitive(false);
-}
+pDlg->StartExecuteAsync([pDlg, this](sal_Int32 nResult) {
+if (nResult == RET_OK)
+{
+ValidateBookmarks();
+m_xDeleteBtn->set_sensitive(false);
+m_xGotoBtn->set_sensitive(false);
+m_xEditTextBtn->set_sensitive(false);
+m_xRenameBtn->set_sensitive(false);
+m_xInsertBtn->set_sensitive(false);
+}
+pDlg->disposeOnce();
+});
 }
 
 // callback to an insert button. Inserts a new text mark to the current 
position.
diff --git a/sw/source/uibase/inc/swrenamexnameddlg.hxx 
b/sw/source/uibase/inc/swrenamexnameddlg.hxx
index 4575df5d414c..4702f1ac20bc 100644
--- a/sw/source/uibase/inc/swrenamexnameddlg.hxx
+++ b/sw/source/uibase/inc/swrenamexnameddlg.hxx
@@ -25,8 +25,8 @@
 
 class SwRenameXNamedDlg final : public weld::GenericDialogController
 {
-css::uno::Reference< css::container::XNamed > &   m_xNamed;
-css::uno::Reference< css::container::XNameAccess > & m_xNameAccess;
+css::uno::Reference< css::container::XNamed >m_xNamed;
+css::uno::Reference< css::container::XNameAccess >   m_xNameAccess;
 css::uno::Reference< css::container::XNameAccess >   m_xSecondAccess;
 css::uno::Reference< css::container::XNameAccess >   m_xThirdAccess;
 


core.git: Branch 'distro/collabora/co-24.04' - sw/source

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

New commits:
commit c471d021b91331241a7630cca098f1347deda1bb
Author: Caolán McNamara 
AuthorDate: Tue Mar 12 11:18:08 2024 +
Commit: Caolán McNamara 
CommitDate: Tue Mar 12 13:02:29 2024 +0100

Draw indicators for header/footer when cursor is inside one

for real, typo the last time :-(

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

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 9b97fed6d5e2..e0e1f41f54ad 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -7168,7 +7168,7 @@ static std::vector 
lcl_CreatePageAreaDelimiterPolygons(cons
 std::vector aPolygons;
 
 // Hide text boundaries by default - cool#3491
-if (!bHeaderFooter && !comphelper::LibreOfficeKit::isActive())
+if (!bHeaderFooter && comphelper::LibreOfficeKit::isActive())
 return aPolygons;
 
 double nLineLength = 200.0; // in Twips


core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-03-12 Thread Caolán McNamara (via logerrit)
 sw/source/core/layout/paintfrm.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 375c49929f7cd41d637f26b9caa0930506b27a24
Author: Caolán McNamara 
AuthorDate: Mon Mar 11 11:21:14 2024 +
Commit: Caolán McNamara 
CommitDate: Tue Mar 12 10:15:59 2024 +0100

Draw indicators for header/footer when cursor is inside one

continue to not draw it for the main body text as per:
https://github.com/CollaboraOnline/online/issues/3491

but give an indication when the cursor is inside the header/footer:
https://github.com/CollaboraOnline/online/issues/5298

Change-Id: I500806fe44c131585ea4292536908261660ae20a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164653
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 
(cherry picked from commit cf234d0e546046cf481ed080bc5f6984a8aba36a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164680
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 2b9d8ac60130..9b97fed6d5e2 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -7163,12 +7163,12 @@ static void lcl_RefreshLine( const SwLayoutFrame *pLay,
 }
 }
 
-static std::vector 
lcl_CreatePageAreaDelimiterPolygons(const SwRect& rRect)
+static std::vector 
lcl_CreatePageAreaDelimiterPolygons(const SwRect& rRect, bool bHeaderFooter)
 {
 std::vector aPolygons;
 
 // Hide text boundaries by default - cool#3491
-if (comphelper::LibreOfficeKit::isActive())
+if (!bHeaderFooter && !comphelper::LibreOfficeKit::isActive())
 return aPolygons;
 
 double nLineLength = 200.0; // in Twips
@@ -7291,7 +7291,7 @@ std::vector 
SwPageFrame::GetSubsidiaryLinesPolygons(const S
 return aPolygons;
 
 if (!rViewShell.GetViewOptions()->IsViewMetaChars())
-aPolygons = lcl_CreatePageAreaDelimiterPolygons(aArea);
+aPolygons = lcl_CreatePageAreaDelimiterPolygons(aArea, false /* body 
*/);
 else
 aPolygons = lcl_CreateRectangleDelimiterPolygons(aArea);
 
@@ -7420,7 +7420,7 @@ std::vector 
SwHeadFootFrame::GetSubsidiaryLinesPolygons(con
 SwRect aArea( getFramePrintArea() );
 aArea.Pos() += getFrameArea().Pos();
 if (!rViewShell.GetViewOptions()->IsViewMetaChars( ))
-aPolygons = lcl_CreatePageAreaDelimiterPolygons(aArea);
+aPolygons = lcl_CreatePageAreaDelimiterPolygons(aArea, true /* 
header/footer*/);
 else
 aPolygons = lcl_CreateRectangleDelimiterPolygons(aArea);
 


core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-02-25 Thread Justin Luth (via logerrit)
 sw/source/filter/ww8/docxexport.cxx |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 57244c2096782dbedfd55cea5629ae08433e204a
Author: Justin Luth 
AuthorDate: Fri Feb 9 17:26:52 2024 -0500
Commit: Miklos Vajna 
CommitDate: Mon Feb 26 08:43:38 2024 +0100

tdf#126533 docx export: page background vml fill: tiles/patterns

This patch only benefits LO. MSO ignores "frame" and always
treats page background as it if were tiled,
but that is a trait we do NOT want to mimic.

Textures are the primary fill type that needs to be tiled
(instead of scaled/stretched).

LO export also treats patterns as tiled bitmaps,
and the end result of exporting as a tile looks the same
as the original pattern.
It just loses HOW the page background (i.e. as a pattern)
but that is very low value. It is rather difficult
to export as a true pattern and just not worth the effort
of identifying the correct fore/background colors,
converting to b&w image, and inverting the B&W image
if the first pixel is white instead of black.

[Hatching seems similar to patterns,
but rarely (and only coincidentally) would it tile well.
I think hatching is a new DML-only thing.
Hatching is not in the page background UI of MS Word.
LO just exports any hatching as a solid color.]

Change-Id: I5cd3f1c6e380edb5e5b21900bad289fa298574e2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163206
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163863
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/source/filter/ww8/docxexport.cxx 
b/sw/source/filter/ww8/docxexport.cxx
index 46e66a4a42a0..a4c06ab5ac5b 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -55,6 +55,7 @@
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
@@ -1914,6 +1915,7 @@ void DocxExport::WriteMainText()
 m_pDocumentFS->startElementNS(XML_w, XML_background, FSNS(XML_w, 
XML_color),
   
msfilter::util::ConvertColor(oBrush->GetColor()));
 
+const SwAttrSet& rPageStyleAttrSet = 
m_rDoc.GetPageDesc(0).GetMaster().GetAttrSet();
 const GraphicObject* pGraphicObj = oBrush->GetGraphicObject();
 if (pGraphicObj) // image/pattern/texture
 {
@@ -1922,8 +1924,12 @@ void DocxExport::WriteMainText()
 {
 m_pDocumentFS->startElementNS(XML_v, XML_background);
 
+// Although MSO treats everything as tile, it is better for LO 
to not always tile
+OString sType = "frame"_ostr; // single image
+if (rPageStyleAttrSet.Get(XATTR_FILLBMP_TILE).GetValue())
+sType = "tile"_ostr; // primarily for patterns / textures
 m_pDocumentFS->singleElementNS(XML_v, XML_fill, FSNS(XML_r, 
XML_id), aRelId,
-XML_type, "frame");
+XML_type, sType);
 
 m_pDocumentFS->endElementNS(XML_v, XML_background);
 }


core.git: Branch 'distro/collabora/co-24.04' - sw/source

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

New commits:
commit b721e34f7c873dd994ad3a7ecfb118755a3f2623
Author: Miklos Vajna 
AuthorDate: Mon Feb 19 16:46:53 2024 +0100
Commit: Miklos Vajna 
CommitDate: Tue Feb 20 10:30:16 2024 +0100

sw: fix crash in SwSpellDialogChildWindow::LockFocusNotification()

Crashreport signature:

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

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

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

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

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

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

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

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


core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-02-16 Thread Pranam Lashkari (via logerrit)
 sw/source/core/doc/DocumentRedlineManager.cxx |   12 +++-
 sw/source/core/doc/docredln.cxx   |   36 +++---
 2 files changed, 37 insertions(+), 11 deletions(-)

New commits:
commit 5952bde2ad94f27cc7b5111266abbdd90552e564
Author: Pranam Lashkari 
AuthorDate: Wed Feb 14 15:07:38 2024 +0530
Commit: Pranam Lashkari 
CommitDate: Fri Feb 16 15:51:50 2024 +0100

writer: LOK: make sure redline comment undo/redo is notified

problem:
when actions were performed on comments and changes were tracked,
LOK was not notified and actions were not reflected

Change-Id: Iad4d9338a6205278b586106e8f39769b731f18dc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163357
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Gökay ŞATIR 
(cherry picked from commit 0b7a9c231f66b5c2659ab3aa6a0f3c7991b9e721)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163500
Reviewed-by: Pranam Lashkari 

diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx 
b/sw/source/core/doc/DocumentRedlineManager.cxx
index 8d52c814e81a..1c6ba5ccd482 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -40,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace com::sun::star;
 
@@ -383,8 +385,14 @@ void UpdateFramesForRemoveDeleteRedline(SwDoc & rDoc, 
SwPaM const& rPam)
 // fields last - SwGetRefField::UpdateField requires up-to-date frames
 UpdateFieldsForRedline(rDoc.getIDocumentFieldsAccess()); // after footnotes
 
-// update SwPostItMgr / notes in the margin
-rDoc.GetDocShell()->Broadcast(
+const SwTextNode *pTextNode = rPam.GetPointNode().GetTextNode();
+SwTextAttr* pTextAttr = pTextNode ? 
pTextNode->GetFieldTextAttrAt(rPam.GetPoint()->GetContentIndex() - 1, 
::sw::GetTextAttrMode::Default) : nullptr;
+SwTextField *const 
pTextField(static_txtattr_cast(pTextAttr));
+if (pTextField && comphelper::LibreOfficeKit::isActive() )
+rDoc.GetDocShell()->Broadcast(
+SwFormatFieldHint(&pTextField->GetFormatField(), 
SwFormatFieldHintWhich::INSERTED));
+else
+rDoc.GetDocShell()->Broadcast(
 SwFormatFieldHint(nullptr, SwFormatFieldHintWhich::INSERTED) );
 }
 
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 45af1e8e3f85..6093001bf086 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -1372,6 +1372,22 @@ void SwRedlineData::dumpAsXml(xmlTextWriterPtr pWriter) 
const
 
 sal_uInt32 SwRangeRedline::s_nLastId = 1;
 
+namespace
+{
+void lcl_LOKBroadcastCommentOperation(RedlineType type, const SwPaM& rPam)
+{
+if (comphelper::LibreOfficeKit::isActive())
+{
+auto eHintType = RedlineType::Delete == type ? 
SwFormatFieldHintWhich::REDLINED_DELETION: SwFormatFieldHintWhich::INSERTED;
+const SwTextNode *pTextNode = rPam.GetPointNode().GetTextNode();
+SwTextAttr* pTextAttr = pTextNode ? 
pTextNode->GetFieldTextAttrAt(rPam.GetPoint()->GetContentIndex() - 1, 
::sw::GetTextAttrMode::Default) : nullptr;
+SwTextField *const 
pTextField(static_txtattr_cast(pTextAttr));
+if (pTextField)
+
const_cast(pTextField->GetFormatField()).Broadcast(SwFormatFieldHint(&pTextField->GetFormatField(),
 eHintType));
+}
+}
+} // anonymous namespace
+
 SwRangeRedline::SwRangeRedline(RedlineType eTyp, const SwPaM& rPam, sal_uInt32 
nMovedID )
 : SwPaM( *rPam.GetMark(), *rPam.GetPoint() ), m_pRedlineData(
   new SwRedlineData(eTyp, 
GetDoc().getIDocumentRedlineAccess().GetRedlineAuthor(), nMovedID ) )
@@ -1393,15 +1409,7 @@ SwRangeRedline::SwRangeRedline(RedlineType eTyp, const 
SwPaM& rPam, sal_uInt32 n
 ? SwResId(STR_REDLINE_COMMENT_DELETED)
 : SwResId(STR_REDLINE_COMMENT_ADDED) );
 
-if (comphelper::LibreOfficeKit::isActive())
-{
-auto eHintType = RedlineType::Delete == eTyp ? 
SwFormatFieldHintWhich::REDLINED_DELETION: SwFormatFieldHintWhich::INSERTED;
-const SwTextNode *pTextNode = rPam.GetPointNode().GetTextNode();
-SwTextAttr* pTextAttr = pTextNode ? 
pTextNode->GetFieldTextAttrAt(rPam.GetPoint()->GetContentIndex() - 1, 
::sw::GetTextAttrMode::Default) : nullptr;
-SwTextField *const 
pTextField(static_txtattr_cast(pTextAttr));
-if (pTextField)
-
const_cast(pTextField->GetFormatField()).Broadcast(SwFormatFieldHint(&pTextField->GetFormatField(),
 eHintType));
-}
+lcl_LOKBroadcastCommentOperation(eTyp, rPam);
 }
 }
 
@@ -1417,6 +1425,16 @@ SwRangeRedline::SwRangeRedline( const SwRedlineData& 
rData, const SwPaM& rPam )
 m_bIsVisible = true;
 if( !rPam.HasMark() )
 DeleteMark();
+
+// set default comment for single annotations added or deleted
+if 

core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-02-16 Thread Pranam Lashkari (via logerrit)
 sw/source/core/crsr/pam.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit f7a570fd5d64ba2964a33ac4c5ecfe9f236d316b
Author: Pranam Lashkari 
AuthorDate: Fri Feb 16 00:59:49 2024 +0530
Commit: Pranam Lashkari 
CommitDate: Fri Feb 16 14:00:05 2024 +0100

avoid using subView on empty OUString

it causes assertion failure
rtl::OUString SwPaM::GetText() const: Assertion `(nEnd-nStart) == 
(aTmpStr.getLength() - nStart)' failed

Change-Id: Ie479f224e8a1516735f96c3a09181d4c46dba10d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163461
Reviewed-by: Noel Grandin 
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Gökay ŞATIR 
(cherry picked from commit 0b0b70772f2d9836010e523bff0132b626713862)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163499
Reviewed-by: Pranam Lashkari 

diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index 25bf8d0ef68e..14552d33a912 100644
--- a/sw/source/core/crsr/pam.cxx
+++ b/sw/source/core/crsr/pam.cxx
@@ -1325,7 +1325,7 @@ OUString SwPaM::GetText() const
 }
 const OUString& aTmpStr = pTextNode->GetText();
 
-if (bIsStartNode || bIsEndNode)
+if (aTmpStr.getLength() > 0 && (bIsStartNode || bIsEndNode))
 {
 // Handle corner cases of start/end node(s)
 const sal_Int32 nStart = bIsStartNode


core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-02-13 Thread Pranam Lashkari (via logerrit)
 sw/source/uibase/docvw/PostItMgr.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit cdbb0a77d142ee10a3f7a90f14f1ef28463e3cde
Author: Pranam Lashkari 
AuthorDate: Tue Feb 6 13:27:41 2024 +0530
Commit: Pranam Lashkari 
CommitDate: Tue Feb 13 12:20:20 2024 +0100

writer:LOK: make sure deleted comment is not notified incorrectly

problem:
on saving the existing docummunet with tracked deleted comment,
LOK gets comment added msg for those comments

Change-Id: I5c63a57215bf7416412604530af4a6c69358
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163040
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163156
Tested-by: Jenkins
(cherry picked from commit 7327752ef5d1fa2239cdd8355fb78da41c282717)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163275
Reviewed-by: Gökay ŞATIR 
Tested-by: Pranam Lashkari 

diff --git a/sw/source/uibase/docvw/PostItMgr.cxx 
b/sw/source/uibase/docvw/PostItMgr.cxx
index dee622d4b502..d9eaa7fa324a 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -900,7 +900,7 @@ void SwPostItMgr::LayoutPostIts()
 {
 if (bLoKitActive && !bTiledAnnotations)
 {
-if (visiblePostIt->GetSidebarItem().mbPendingLayout)
+if (visiblePostIt->GetSidebarItem().mbPendingLayout && 
visiblePostIt->GetSidebarItem().mLayoutStatus != SwPostItHelper::DELETED)
 lcl_CommentNotification(mpView, 
CommentNotificationType::Add, &visiblePostIt->GetSidebarItem(), 0);
 else if (visiblePostIt->IsAnchorRectChanged())
 {