Kaydet (Commit) e521930e authored tarafından Michael Stahl's avatar Michael Stahl

fdo#58327: writerfilter: RemoveLastParagraph is tricky:

What happens here is that the xCursor->goLeft( 1, true ) selects the
entire inserted table, which is then deleted.  That causes annoyances,
such as an assertion from ~SwIndexReg because as collateral damage the
SwTxtNode that SwReader::Read's pUndoPam points to is also deleted, as
well as missing tables in the document.

DomainMapper_Impl::RemoveLastParagraph() can avoid this by not using
setString() but instead disposing the paragraph, like it already does in
other cases.  But don't do it for new (loaded) documents, because it may
kill flys in that case, which i strangely couldn't reproduce when
pasting as RTF.

Change-Id: I87302b8916e39ca42bc4fedfee40ac38fadd0939
üst b05250de
......@@ -282,7 +282,13 @@ void DomainMapper_Impl::RemoveLastParagraph( )
// Keep the character properties of the last but one paragraph, even if
// it's empty. This works for headers/footers, and maybe in other cases
// as well, but surely not in textboxes.
if (m_bInHeaderFooterImport && xEnumerationAccess.is())
// fdo#58327: also do this at the end of the document: when pasting,
// a table before the cursor position would be deleted
// (but only for paste/insert, not load; otherwise it can happen that
// flys anchored at the disposed paragraph are deleted (fdo47036.rtf))
bool const bEndOfDocument(m_aTextAppendStack.size() == 1);
if ((m_bInHeaderFooterImport || (bEndOfDocument && !m_bIsNewDoc))
&& xEnumerationAccess.is())
{
uno::Reference<container::XEnumeration> xEnumeration = xEnumerationAccess->createEnumeration();
uno::Reference<lang::XComponent> xParagraph(xEnumeration->nextElement(), uno::UNO_QUERY);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment