From 04b2310aaa094794ceedaa1bb6ff1823a2d29d3e Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 10 Jan 2020 13:20:40 +0100 Subject: DOCX import: fix lost objects anchored to the single para of a linked header Regression from commit 08f13ab85b5c65b5dc8adfa15918fb3e426fcc3c (tdf#112202 writerfilter,sw: fix loss of headers, 2019-12-16), the problem is that on one hand, copyText() is meant to copy a complete XText (header, table cell, footnote, etc), OTOH the internal API use used only copies at-para anchored objects for complete text nodes, so a one-paragraph header will loose its anchored objects when a linked header is copied. Introduce a new "CopyText" flag that provides the expected copyText() behavior and use that when the copyText() UNO API is invoked, but leave the selection behavior unchanged. Perform the inclusive check in IsSelectFrameAnchoredAtPara(), opt in for that from SwXText::copyText(), the rest is just passing the flag around. Change-Id: Id727f7ca4f6121a7050340359716a52ecb4886f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86529 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- sw/source/filter/docx/swdocxreader.cxx | 2 +- sw/source/filter/ww8/ww8glsy.cxx | 2 +- sw/source/filter/xml/xmltbli.cxx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'sw/source/filter') diff --git a/sw/source/filter/docx/swdocxreader.cxx b/sw/source/filter/docx/swdocxreader.cxx index f13127fcabd7..ce04767173ad 100644 --- a/sw/source/filter/docx/swdocxreader.cxx +++ b/sw/source/filter/docx/swdocxreader.cxx @@ -233,7 +233,7 @@ bool SwDOCXReader::MakeEntries( SwDoc *pD, SwTextBlocks &rBlocks ) SwNodeIndex aIdx( pGlDoc->GetNodes().GetEndOfContent(), -1 ); pCNd = aIdx.GetNode().GetContentNode(); SwPosition aPos( aIdx, SwIndex( pCNd, pCNd ? pCNd->Len() : 0 ) ); - pD->getIDocumentContentOperations().CopyRange( aPam, aPos, /*bCopyAll=*/false, /*bCheckPos=*/true ); + pD->getIDocumentContentOperations().CopyRange( aPam, aPos, /*bCopyAll=*/false, /*bCheckPos=*/true, /*bCopyText=*/false ); rBlocks.PutDoc(); } else diff --git a/sw/source/filter/ww8/ww8glsy.cxx b/sw/source/filter/ww8/ww8glsy.cxx index 7606b2436797..cb23b4ac8d41 100644 --- a/sw/source/filter/ww8/ww8glsy.cxx +++ b/sw/source/filter/ww8/ww8glsy.cxx @@ -167,7 +167,7 @@ bool WW8Glossary::MakeEntries(SwDoc *pD, SwTextBlocks &rBlocks, -1 ); pCNd = aIdx.GetNode().GetContentNode(); SwPosition aPos(aIdx, SwIndex(pCNd, pCNd ? pCNd->Len() : 0)); - pD->getIDocumentContentOperations().CopyRange( aPam, aPos, /*bCopyAll=*/false, /*bCheckPos=*/true ); + pD->getIDocumentContentOperations().CopyRange( aPam, aPos, /*bCopyAll=*/false, /*bCheckPos=*/true, /*bCopyText=*/false ); rBlocks.PutDoc(); } } diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index bc815b7a098d..922815d5f94e 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -686,7 +686,7 @@ void SwXMLTableCellContext_Impl::EndElement() assert(pDstTextCursor && "SwXTextCursor missing"); SwPaM aSrcPaM(*pSrcPaM->GetMark(), *pSrcPaM->GetPoint()); SwPosition aDstPos( *pDstTextCursor->GetPaM()->GetPoint() ); - pDoc->getIDocumentContentOperations().CopyRange( aSrcPaM, aDstPos, /*bCopyAll=*/false, /*bCheckPos=*/true ); + pDoc->getIDocumentContentOperations().CopyRange( aSrcPaM, aDstPos, /*bCopyAll=*/false, /*bCheckPos=*/true, /*bCopyText=*/false ); m_nColRepeat--; } -- cgit