diff options
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/IDocumentMarkAccess.hxx | 2 | ||||
-rw-r--r-- | sw/inc/crsrsh.hxx | 2 | ||||
-rw-r--r-- | sw/inc/pam.hxx | 2 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport5.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/crsr/crsrsh.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/crsr/pam.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/doc/docbm.cxx | 9 | ||||
-rw-r--r-- | sw/source/core/edit/eddel.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/edit/edfcol.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/inc/MarkManager.hxx | 2 |
10 files changed, 20 insertions, 17 deletions
diff --git a/sw/inc/IDocumentMarkAccess.hxx b/sw/inc/IDocumentMarkAccess.hxx index 98037c7917e3..ca63a45c7ce8 100644 --- a/sw/inc/IDocumentMarkAccess.hxx +++ b/sw/inc/IDocumentMarkAccess.hxx @@ -282,7 +282,7 @@ class IDocumentMarkAccess // interface IBookmarks (BOOKMARK, CROSSREF_NUMITEM_BOOKMARK, CROSSREF_HEADING_BOOKMARK ) /** check if the selection would delete a BOOKMARK */ - virtual bool isBookmarkDeleted(SwPaM const& rPaM) const =0; + virtual bool isBookmarkDeleted(SwPaM const& rPaM, bool isReplace) const =0; /** returns a STL-like random access iterator to the begin of the sequence the IBookmarks. */ diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx index 306acf96f3fc..d552cba2b503 100644 --- a/sw/inc/crsrsh.hxx +++ b/sw/inc/crsrsh.hxx @@ -477,7 +477,7 @@ public: // Cursor is placed in something that is protected or selection contains // something that is protected. - bool HasReadonlySel() const; + bool HasReadonlySel(bool isReplace = false) const; // Can the cursor be set to read only ranges? bool IsReadOnlyAvailable() const { return m_bSetCursorInReadOnly; } diff --git a/sw/inc/pam.hxx b/sw/inc/pam.hxx index a56677cfaa5a..7002d07a017d 100644 --- a/sw/inc/pam.hxx +++ b/sw/inc/pam.hxx @@ -304,7 +304,7 @@ public: /** Is in something protected (readonly) or selection contains something protected. */ - bool HasReadonlySel( bool bFormView ) const; + bool HasReadonlySel(bool bFormView, bool isReplace) const; bool ContainsPosition(const SwPosition & rPos) const { diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx index d34e5ce957f0..4e3812960d90 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx @@ -1262,11 +1262,11 @@ CPPUNIT_TEST_FIXTURE(Test, tdf122201_editUnprotectedText) // check protected area SwPaM aPaMProtected(aDocStart); - CPPUNIT_ASSERT(aPaMProtected.HasReadonlySel(false)); + CPPUNIT_ASSERT(aPaMProtected.HasReadonlySel(false, false)); // check unprotected area SwPaM aPaMUnprotected(aDocEnd); - CPPUNIT_ASSERT(!aPaMUnprotected.HasReadonlySel(false)); + CPPUNIT_ASSERT(!aPaMUnprotected.HasReadonlySel(false, false)); } CPPUNIT_TEST_FIXTURE(Test, testSectionHeader) diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 17718f8357b6..c37595430761 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -2743,7 +2743,7 @@ bool SwCursorShell::IsOverReadOnlyPos( const Point& rPt ) const SwPaM aPam( *m_pCurrentCursor->GetPoint() ); GetLayout()->GetModelPositionForViewPoint( aPam.GetPoint(), aPt ); // form view - return aPam.HasReadonlySel( GetViewOptions()->IsFormView() ); + return aPam.HasReadonlySel(GetViewOptions()->IsFormView(), false); } /** Get the number of elements in the ring of cursors @@ -3356,7 +3356,7 @@ void SwCursorShell::SetReadOnlyAvailable( bool bFlag ) } } -bool SwCursorShell::HasReadonlySel() const +bool SwCursorShell::HasReadonlySel(bool const isReplace) const { if (GetViewOptions()->IsShowOutlineContentVisibilityButton()) { @@ -3393,13 +3393,13 @@ bool SwCursorShell::HasReadonlySel() const if ( m_pTableCursor != nullptr ) { bRet = m_pTableCursor->HasReadOnlyBoxSel() - || m_pTableCursor->HasReadonlySel( GetViewOptions()->IsFormView() ); + || m_pTableCursor->HasReadonlySel(GetViewOptions()->IsFormView(), isReplace); } else { for(const SwPaM& rCursor : m_pCurrentCursor->GetRingContainer()) { - if( rCursor.HasReadonlySel( GetViewOptions()->IsFormView() ) ) + if (rCursor.HasReadonlySel(GetViewOptions()->IsFormView(), isReplace)) { bRet = true; break; diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx index 4154ed39b176..0fd78618ef44 100644 --- a/sw/source/core/crsr/pam.cxx +++ b/sw/source/core/crsr/pam.cxx @@ -707,7 +707,7 @@ static const SwFrame* lcl_FindEditInReadonlyFrame( const SwFrame& rFrame ) } /// is in protected section or selection surrounds something protected -bool SwPaM::HasReadonlySel( bool bFormView ) const +bool SwPaM::HasReadonlySel(bool bFormView, bool const isReplace) const { bool bRet = false; @@ -886,7 +886,7 @@ bool SwPaM::HasReadonlySel( bool bFormView ) const if (!bRet && rDoc.getIDocumentSettingAccess().get(DocumentSettingId::PROTECT_BOOKMARKS)) { - if (rDoc.getIDocumentMarkAccess()->isBookmarkDeleted(*this)) + if (rDoc.getIDocumentMarkAccess()->isBookmarkDeleted(*this, isReplace)) { return true; } diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx index 52461872b6e0..027cc884ce08 100644 --- a/sw/source/core/doc/docbm.cxx +++ b/sw/source/core/doc/docbm.cxx @@ -973,6 +973,7 @@ namespace sw::mark static bool isDeleteMark( ::sw::mark::MarkBase const*const pMark, + bool const isReplace, SwNode const& rStt, SwNode const& rEnd, std::optional<sal_Int32> oStartContentIdx, @@ -996,6 +997,8 @@ namespace sw::mark && lcl_Lower(pMark->GetOtherMarkPos(), rEnd, oEndContentIdx); // special case: completely in range, touching the end? if ( oEndContentIdx.has_value() + && !(isReplace && IDocumentMarkAccess::GetType(*pMark) + == IDocumentMarkAccess::MarkType::BOOKMARK) && ( ( rbIsOtherPosInRange && pMark->GetMarkPos().GetNode() == rEnd && pMark->GetMarkPos().GetContentIndex() == *oEndContentIdx ) @@ -1041,7 +1044,7 @@ namespace sw::mark return false; } - bool MarkManager::isBookmarkDeleted(SwPaM const& rPaM) const + bool MarkManager::isBookmarkDeleted(SwPaM const& rPaM, bool const isReplace) const { SwPosition const& rStart(*rPaM.Start()); SwPosition const& rEnd(*rPaM.End()); @@ -1051,7 +1054,7 @@ namespace sw::mark { bool bIsPosInRange(false); bool bIsOtherPosInRange(false); - bool const bDeleteMark = isDeleteMark(*ppMark, + bool const bDeleteMark = isDeleteMark(*ppMark, isReplace, rStart.GetNode(), rEnd.GetNode(), rStart.GetContentIndex(), rEnd.GetContentIndex(), bIsPosInRange, bIsOtherPosInRange); if (bDeleteMark @@ -1087,7 +1090,7 @@ namespace sw::mark ::sw::mark::MarkBase *const pMark = *ppMark; bool bIsPosInRange(false); bool bIsOtherPosInRange(false); - bool const bDeleteMark = isDeleteMark(pMark, rStt, rEnd, oStartContentIdx, oEndContentIdx, bIsPosInRange, bIsOtherPosInRange); + bool const bDeleteMark = isDeleteMark(pMark, false, rStt, rEnd, oStartContentIdx, oEndContentIdx, bIsPosInRange, bIsOtherPosInRange); if ( bIsPosInRange && ( bIsOtherPosInRange diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx index c19d93b71b61..d4fce54b3fa3 100644 --- a/sw/source/core/edit/eddel.cxx +++ b/sw/source/core/edit/eddel.cxx @@ -316,7 +316,7 @@ bool SwEditShell::Replace( const OUString& rNewStr, bool bRegExpRplc ) CurrShell aCurr( this ); bool bRet = false; - if( !HasReadonlySel() ) + if (!HasReadonlySel(true)) { StartAllAction(); GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::EMPTY, nullptr); diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx index e0f2e5e506a3..d4f1c84dc76d 100644 --- a/sw/source/core/edit/edfcol.cxx +++ b/sw/source/core/edit/edfcol.cxx @@ -2199,7 +2199,7 @@ void SwEditShell::SetTextFormatColl(SwTextFormatColl *pFormat, GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::SETFMTCOLL, &aRewriter); for(SwPaM& rPaM : GetCursor()->GetRingContainer()) { - if ( !rPaM.HasReadonlySel( GetViewOptions()->IsFormView() ) ) + if (!rPaM.HasReadonlySel( GetViewOptions()->IsFormView(), true)) { // store previous paragraph style for track changes OUString sParaStyleName; diff --git a/sw/source/core/inc/MarkManager.hxx b/sw/source/core/inc/MarkManager.hxx index 2af05601867c..9aaf7c352e58 100644 --- a/sw/source/core/inc/MarkManager.hxx +++ b/sw/source/core/inc/MarkManager.hxx @@ -82,7 +82,7 @@ namespace sw::mark { virtual const_iterator_t findMark(const OUString& rName) const override; // bookmarks - virtual bool isBookmarkDeleted(SwPaM const& rPaM) const override; + virtual bool isBookmarkDeleted(SwPaM const& rPaM, bool isReplace) const override; virtual const_iterator_t getBookmarksBegin() const override; virtual const_iterator_t getBookmarksEnd() const override; virtual sal_Int32 getBookmarksCount() const override; |