sw/qa/extras/uiwriter/data/section-shape.fodt | 123 ++++++++++++++++++++++++++ sw/qa/extras/uiwriter/uiwriter9.cxx | 105 ++++++++++++++++++++++ sw/source/core/undo/undobj.cxx | 13 +- 3 files changed, 233 insertions(+), 8 deletions(-)
New commits: commit 40d659647d3dbb5e316963968947272f0a71104d Author: Michael Stahl <michael.st...@collabora.com> AuthorDate: Wed Jul 23 18:56:40 2025 +0200 Commit: Thorsten Behrens <thorsten.behr...@collabora.com> CommitDate: Thu Jul 24 00:09:43 2025 +0200 sw: Backspace/Delete hidden section must delete flys anchored therein During save to ODF this asserts, or later crashes: atrfrm.cxx:3810: void sw::CheckAnchoredFlyConsistency(const SwDoc&): Assertion `std::find(rFlys.begin(), rFlys.end(), pSpz) != rFlys.end()' failed. Initial idea was to fix this by changing SwWrtShell to not use the ArtificialSelection mode when a hidden section is selected - this fixes the initial problem but there is another one! Because ArtificialSelection is now also set in SwXTextRange::DeleteAndInsert() and SwXTextCursor::DeleteAndInsert(), the crash can also be reproduced by calling setString("nonempty") on a cursor that selects multiple nodes with an object anchored on a middle node. So better to fix this in SwUndoSaveContent::DelContentIndex() by moving the Replace check into the IsSelected functions, and to ignore *only* flys on the start and the end node of the selection, so flys anchored on the middle nodes are now deleted. In any case for Undo to work a SwHistoryHint must be created for these which ExcludeFlyAtStartEnd prevents so it's a different case. This covers all the initially intended use-cases of DelContentType::Replace, which actually only were 1-2 node selections anyway (limited by UI); the arbitrary-sized selection cases were from later re-uses of the flag for other use cases, and in both the Backspace and the API case the possibility of flys anchored on middle nodes was unfortunately missed. Currently SwUndoSaveContent::DelContentIndex() was the only caller of the IsSelected functions that could see a DelContentType::Replace. (regression from commit 85376a02348810812d515ee72140dbf56f2b6040) Change-Id: Ifc5aad47e80c638d4e7cb5f66c035fdf1e34b89f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188251 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behr...@collabora.com> diff --git a/sw/qa/extras/uiwriter/data/section-shape.fodt b/sw/qa/extras/uiwriter/data/section-shape.fodt new file mode 100644 index 000000000000..82d141fec775 --- /dev/null +++ b/sw/qa/extras/uiwriter/data/section-shape.fodt @@ -0,0 +1,123 @@ +<?xml version='1.0' encoding='UTF-8'?> +<office:document xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:c alcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns: meta:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" office:version="1.4" office:mimetype="application/vnd.oasis.opendocument.text"> + <office:font-face-decls> + <style:font-face style:name="Liberation Serif" svg:font-family="'Liberation Serif'" style:font-family-generic="roman" style:font-pitch="variable"/> + <style:font-face style:name="Noto Sans1" svg:font-family="'Noto Sans'" style:font-family-generic="system" style:font-pitch="variable"/> + <style:font-face style:name="Noto Serif CJK SC" svg:font-family="'Noto Serif CJK SC'" style:font-family-generic="system" style:font-pitch="variable"/> + </office:font-face-decls> + <office:styles> + <style:default-style style:family="graphic"> + <style:graphic-properties svg:stroke-color="#3465a4" draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.3cm" draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" draw:start-line-spacing-vertical="0.283cm" draw:end-line-spacing-horizontal="0.283cm" draw:end-line-spacing-vertical="0.283cm" style:writing-mode="lr-tb" style:flow-with-text="false"/> + <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" loext:tab-stop-distance="0cm" style:writing-mode="lr-tb" style:font-independent-line-spacing="false"> + <style:tab-stops/> + </style:paragraph-properties> + <style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="de" fo:country="DE" style:letter-kerning="true" style:font-name-asian="Noto Serif CJK SC" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Noto Sans1" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN"/> + </style:default-style> + <style:default-style style:family="paragraph"> + <style:paragraph-properties fo:orphans="2" fo:widows="2" fo:hyphenation-ladder-count="no-limit" fo:hyphenation-keep="auto" loext:hyphenation-keep-type="column" loext:hyphenation-keep-line="false" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="1.251cm" style:writing-mode="page"/> + <style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="de" fo:country="DE" style:letter-kerning="true" style:font-name-asian="Noto Serif CJK SC" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Noto Sans1" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2" loext:hyphenation-no-caps="false" loext:hyphenation-no-last-word="false" loext:hyphenation-word-char-count="5" loext:hyphenation-zone="no-limit"/> + </style:default-style> + <style:default-style style:family="table"> + <style:table-properties table:border-model="collapsing"/> + </style:default-style> + <style:default-style style:family="table-row"> + <style:table-row-properties fo:keep-together="auto"/> + </style:default-style> + <style:style style:name="Standard" style:family="paragraph" style:class="text"/> + <text:outline-style style:name="Outline"> + <text:outline-level-style text:level="1" loext:num-list-format="%1%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="2" loext:num-list-format="%2%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="3" loext:num-list-format="%3%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="4" loext:num-list-format="%4%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="5" loext:num-list-format="%5%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="6" loext:num-list-format="%6%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="7" loext:num-list-format="%7%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="8" loext:num-list-format="%8%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="9" loext:num-list-format="%9%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="10" loext:num-list-format="%10%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + </text:outline-style> + <text:notes-configuration text:note-class="footnote" style:num-format="1" text:start-value="0" text:footnotes-position="page" text:start-numbering-at="document"/> + <text:notes-configuration text:note-class="endnote" style:num-format="i" text:start-value="0"/> + <text:linenumbering-configuration text:number-lines="false" text:offset="0.499cm" style:num-format="1" text:number-position="left" text:increment="5"/> + </office:styles> + <office:automatic-styles> + <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Standard"> + <style:text-properties/> + </style:style> + <style:style style:name="Sect1" style:family="section"> + <style:section-properties style:editable="false"> + <style:columns fo:column-count="1" fo:column-gap="0cm"/> + </style:section-properties> + </style:style> + <style:style style:name="gr1" style:family="graphic"> + <style:graphic-properties draw:textarea-horizontal-align="justify" draw:textarea-vertical-align="middle" draw:auto-grow-height="false" fo:min-height="0.332cm" fo:min-width="3.108cm" loext:decorative="false" style:run-through="foreground" style:wrap="run-through" style:number-wrapped-paragraphs="no-limit" style:vertical-pos="from-top" style:vertical-rel="paragraph" style:horizontal-pos="from-left" style:horizontal-rel="paragraph" draw:wrap-influence-on-position="once-concurrent" loext:allow-overlap="true" style:flow-with-text="false"/> + </style:style> + <style:page-layout style:name="pm1"> + <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:layout-grid-color="#c0c0c0" style:layout-grid-lines="20" style:layout-grid-base-height="0.706cm" style:layout-grid-ruby-height="0.353cm" style:layout-grid-mode="none" style:layout-grid-ruby-below="false" style:layout-grid-print="false" style:layout-grid-display="false" style:footnote-max-height="0cm" loext:margin-gutter="0cm"> + <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/> + </style:page-layout-properties> + <style:header-style/> + <style:footer-style/> + </style:page-layout> + <style:style style:name="dp1" style:family="drawing-page"> + <style:drawing-page-properties draw:background-size="full"/> + </style:style> + </office:automatic-styles> + <office:master-styles> + <style:master-page style:name="Standard" style:page-layout-name="pm1" draw:style-name="dp1"/> + </office:master-styles> + <office:body> + <office:text> + <text:section text:style-name="Sect1" text:name="Section1"> + <text:p text:style-name="P1">First</text:p> + </text:section> + <text:section text:style-name="Sect1" text:name="Section2" text:display="none"> + <text:p text:style-name="P1"><draw:custom-shape text:anchor-type="paragraph" draw:z-index="0" draw:name="Shape 1" draw:style-name="gr1" svg:width="3.109cm" svg:height="0.332cm" svg:x="7.408cm" svg:y="0.153cm"> + <text:p/> + <draw:enhanced-geometry svg:viewBox="0 0 21600 21600" draw:type="rectangle" draw:enhanced-path="M 0 0 L 21600 0 21600 21600 0 21600 0 0 Z N"/> + </draw:custom-shape>second</text:p> + </text:section> + <text:p text:style-name="P1">body</text:p> + </office:text> + </office:body> +</office:document> diff --git a/sw/qa/extras/uiwriter/uiwriter9.cxx b/sw/qa/extras/uiwriter/uiwriter9.cxx index ffc647101fda..d5e02a24de72 100644 --- a/sw/qa/extras/uiwriter/uiwriter9.cxx +++ b/sw/qa/extras/uiwriter/uiwriter9.cxx @@ -9,6 +9,7 @@ #include <swmodeltestbase.hxx> #include <officecfg/Office/Common.hxx> +#include <officecfg/Office/Writer.hxx> #include <com/sun/star/document/XEmbeddedObjectSupplier2.hpp> #include <com/sun/star/embed/EmbedStates.hpp> #include <com/sun/star/embed/XEmbeddedObject.hpp> @@ -22,6 +23,7 @@ #include <com/sun/star/text/XDocumentIndex.hpp> #include <com/sun/star/text/XTextField.hpp> #include <com/sun/star/text/XTextFrame.hpp> +#include <com/sun/star/text/XTextSection.hpp> #include <com/sun/star/text/XTextTable.hpp> #include <com/sun/star/text/XTextViewCursorSupplier.hpp> #include <com/sun/star/text/XPageCursor.hpp> @@ -54,6 +56,9 @@ #include <IDocumentLayoutAccess.hxx> #include <IDocumentRedlineAccess.hxx> #include <IDocumentLinksAdministration.hxx> +#include <IDocumentUndoRedo.hxx> +#include <fmtanchr.hxx> +#include <fmtfsize.hxx> #include <fmtinfmt.hxx> #include <rootfrm.hxx> #include <svx/svxids.hrc> @@ -125,6 +130,106 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf158785) CPPUNIT_ASSERT_EQUAL(IsAttrAtPos::NONE, aContentAtPos.eContentAtPos); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testHiddenSectionShape) +{ + createSwDoc("section-shape.fodt"); + + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); + CPPUNIT_ASSERT(pWrtShell); + + auto xTextSectionsSupplier = mxComponent.queryThrow<css::text::XTextSectionsSupplier>(); + auto xSections = xTextSectionsSupplier->getTextSections(); + CPPUNIT_ASSERT(xSections); + CPPUNIT_ASSERT(xSections->getByName(u"Section1"_ustr) + .queryThrow<css::beans::XPropertySet>() + ->getPropertyValue(u"IsVisible"_ustr) + .get<bool>()); + CPPUNIT_ASSERT(!xSections->getByName(u"Section2"_ustr) + .queryThrow<css::beans::XPropertySet>() + ->getPropertyValue(u"IsVisible"_ustr) + .get<bool>()); + + // shape is anchored in hidden section + auto xShape = getShape(1).queryThrow<text::XTextContent>(); + CPPUNIT_ASSERT_EQUAL(u"Section2"_ustr, getProperty<uno::Reference<container::XNamed>>( + xShape->getAnchor(), u"TextSection"_ustr) + ->getName()); + + // prevent the warning dialog which is automatically cancelled + std::shared_ptr<comphelper::ConfigurationChanges> pBatch( + comphelper::ConfigurationChanges::create()); + officecfg::Office::Writer::Content::Display::ShowWarningHiddenSection::set(false, pBatch); + pBatch->commit(); + comphelper::ScopeGuard _([&] { + officecfg::Office::Writer::Content::Display::ShowWarningHiddenSection::set(true, pBatch); + pBatch->commit(); + }); + + // backspace should delete the hidden section + pWrtShell->Down(/*bSelect=*/false, /*nCount=*/1); + pWrtShell->DelLeft(); + + CPPUNIT_ASSERT_THROW(xSections->getByName(u"Section2"_ustr), container::NoSuchElementException); + + CPPUNIT_ASSERT_EQUAL(0, getShapes()); + + // this would assert/crash because the shape was anchored to SwEndNode + save(mpFilter); +} + +CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testSetStringDeletesShape) +{ + createSwDoc(); + SwDoc* const pDoc = getSwDoc(); + SwWrtShell* const pWrtShell = getSwDocShell()->GetWrtShell(); + + IDocumentUndoRedo& rUndoManager = pDoc->GetIDocumentUndoRedo(); + + sw::UnoCursorPointer pCursor( + pDoc->CreateUnoCursor(SwPosition(pDoc->GetNodes().GetEndOfContent(), SwNodeOffset(-1)))); + + pDoc->getIDocumentContentOperations().InsertString(*pCursor, u"foo"_ustr); + pDoc->getIDocumentContentOperations().SplitNode(*pCursor->GetPoint(), false); + pDoc->getIDocumentContentOperations().SplitNode(*pCursor->GetPoint(), false); + pDoc->getIDocumentContentOperations().InsertString(*pCursor, u"end"_ustr); + + { + SfxItemSet flySet(pDoc->GetAttrPool(), + svl::Items<RES_FRM_SIZE, RES_FRM_SIZE, RES_ANCHOR, RES_ANCHOR>); + SwFormatAnchor anchor(RndStdIds::FLY_AT_CHAR); + pWrtShell->StartOfSection(false); + pWrtShell->Down(/*bSelect=*/false, 1, /*bBasicCall=*/false); + anchor.SetAnchor(pWrtShell->GetCursor()->GetPoint()); + flySet.Put(anchor); + SwFormatFrameSize size(SwFrameSize::Minimum, 1000, 1000); + flySet.Put(size); // set a size, else we get 1 char per line... + SwFrameFormat const* pFly = pWrtShell->NewFlyFrame(flySet, /*bAnchValid=*/true); + CPPUNIT_ASSERT(pFly != nullptr); + } + CPPUNIT_ASSERT_EQUAL(size_t(1), pDoc->GetFlyCount(FLYCNTTYPE_FRM)); + + auto xCursor = mxComponent.queryThrow<text::XTextDocument>()->getText()->createTextCursor(); + xCursor->gotoStart(false); + xCursor->goRight(3, false); + xCursor->gotoEnd(true); + xCursor->setString("bar"); // replace multi-paragraph selection + + // the problem was that the fly on the middle node was not deleted + CPPUNIT_ASSERT_EQUAL(size_t(0), pDoc->GetFlyCount(FLYCNTTYPE_FRM)); + + rUndoManager.Undo(); + + CPPUNIT_ASSERT_EQUAL(size_t(1), pDoc->GetFlyCount(FLYCNTTYPE_FRM)); + + rUndoManager.Redo(); + + CPPUNIT_ASSERT_EQUAL(size_t(0), pDoc->GetFlyCount(FLYCNTTYPE_FRM)); + + rUndoManager.Undo(); + + CPPUNIT_ASSERT_EQUAL(size_t(1), pDoc->GetFlyCount(FLYCNTTYPE_FRM)); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf159377) { createSwDoc(); diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx index 6d73d8d80c11..7cbf440c4b10 100644 --- a/sw/source/core/undo/undobj.cxx +++ b/sw/source/core/undo/undobj.cxx @@ -1045,8 +1045,7 @@ void SwUndoSaveContent::DelContentIndex( const SwPosition& rMark, if (!m_pHistory) m_pHistory.reset( new SwHistory ); - if (!(DelContentType::Replace & nDelContentType) - && IsSelectFrameAnchoredAtPara(*pAPos, *pStart, *pEnd, nDelContentType)) + if (IsSelectFrameAnchoredAtPara(*pAPos, *pStart, *pEnd, nDelContentType)) { m_pHistory->AddDeleteFly(*pFormat, nChainInsPos); // reset n so that no Format is skipped @@ -1081,9 +1080,7 @@ void SwUndoSaveContent::DelContentIndex( const SwPosition& rMark, { if( !m_pHistory ) m_pHistory.reset( new SwHistory ); - if (!(DelContentType::Replace & nDelContentType) - && IsDestroyFrameAnchoredAtChar( - *pAPos, *pStart, *pEnd, nDelContentType)) + if (IsDestroyFrameAnchoredAtChar(*pAPos, *pStart, *pEnd, nDelContentType)) { m_pHistory->AddDeleteFly(*pFormat, nChainInsPos); n = n >= rSpzArr.size() ? rSpzArr.size() : n+1; @@ -1700,7 +1697,7 @@ bool IsDestroyFrameAnchoredAtChar(SwPosition const & rAnchorPos, return (rStart < rAnchorPos) && (rAnchorPos < rEnd); } - if (nDelContentType & DelContentType::ExcludeFlyAtStartEnd) + if (nDelContentType & (DelContentType::ExcludeFlyAtStartEnd|DelContentType::Replace)) { // exclude selection start and end node return (rAnchorPos.GetNode() < rEnd.GetNode()) && (rStart.GetNode() < rAnchorPos.GetNode()); @@ -1749,7 +1746,7 @@ bool IsSelectFrameAnchoredAtPara(SwPosition const & rAnchorPos, // in general, exclude the start and end position return ((rStart.GetNode() < rAnchorPos.GetNode()) || (rStart.GetNode() == rAnchorPos.GetNode() - && !(nDelContentType & DelContentType::ExcludeFlyAtStartEnd) + && !(nDelContentType & (DelContentType::ExcludeFlyAtStartEnd|DelContentType::Replace)) // special case: fully deleted node && ((rStart.GetNode() != rEnd.GetNode() && rStart.GetContentIndex() == 0 // but not if the selection is backspace/delete! @@ -1757,7 +1754,7 @@ bool IsSelectFrameAnchoredAtPara(SwPosition const & rAnchorPos, || (IsAtStartOfSection2(rStart) && IsAtEndOfSection2(rEnd))))) && ((rAnchorPos.GetNode() < rEnd.GetNode()) || (rAnchorPos.GetNode() == rEnd.GetNode() - && !(nDelContentType & DelContentType::ExcludeFlyAtStartEnd) + && !(nDelContentType & (DelContentType::ExcludeFlyAtStartEnd|DelContentType::Replace)) // special case: fully deleted node && ((rEnd.GetNode() != rStart.GetNode() && rEnd.GetContentIndex() == rEnd.GetNode().GetTextNode()->Len() && IsNotBackspaceHeuristic(rStart, rEnd))