diff options
-rw-r--r-- | sw/qa/extras/ww8export/data/fdo66304-1.odt | bin | 0 -> 54780 bytes | |||
-rw-r--r-- | sw/qa/extras/ww8export/ww8export.cxx | 5 | ||||
-rw-r--r-- | sw/source/core/doc/DocumentContentOperationsManager.cxx | 25 |
3 files changed, 30 insertions, 0 deletions
diff --git a/sw/qa/extras/ww8export/data/fdo66304-1.odt b/sw/qa/extras/ww8export/data/fdo66304-1.odt Binary files differnew file mode 100644 index 000000000000..c3fb9bcfa286 --- /dev/null +++ b/sw/qa/extras/ww8export/data/fdo66304-1.odt diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx index 2347fdc297c0..e1626cd5f60c 100644 --- a/sw/qa/extras/ww8export/ww8export.cxx +++ b/sw/qa/extras/ww8export/ww8export.cxx @@ -529,6 +529,11 @@ DECLARE_WW8EXPORT_TEST(testCommentExport, "comment-export.odt") } } +DECLARE_WW8EXPORT_TEST(testMoveRange, "fdo66304-1.odt") +{ + //the save must survive without asserting +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index 4f7b0bda1ed0..f3ef4c28dbee 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -1961,8 +1961,33 @@ bool DocumentContentOperationsManager::MoveRange( SwPaM& rPaM, SwPosition& rPos, const std::shared_ptr<sw::mark::ContentIdxStore> pContentStore(sw::mark::ContentIdxStore::Create()); pContentStore->Save( &m_rDoc, rPos.nNode.GetIndex(), rPos.nContent.GetIndex(), true ); + SwTextNode * pOrigNode = pTNd; + assert(*aSavePam.GetPoint() == *aSavePam.GetMark() && + *aSavePam.GetPoint() == rPos); + assert(aSavePam.GetPoint()->nContent.GetIdxReg() == pOrigNode); + assert(aSavePam.GetPoint()->nNode == rPos.nNode.GetIndex()); + assert(rPos.nNode.GetIndex() == pOrigNode->GetIndex()); + pTNd = pTNd->SplitContentNode( rPos )->GetTextNode(); + //A new node was inserted before the orig pTNd and the content up to + //rPos moved into it. The old node is returned with the remainder + //of the content in it. + // + //aSavePam was created with rPos, it continues to point to the + //old node, but with the *original* content index into the node. + //Seeing as all the orignode content before that index has + //been removed, the new index into the original node should now be set + //to 0 and the content index of rPos should also be adapted to the + //truncated node + assert(*aSavePam.GetPoint() == *aSavePam.GetMark() && + *aSavePam.GetPoint() == rPos); + assert(aSavePam.GetPoint()->nContent.GetIdxReg() == pOrigNode); + assert(aSavePam.GetPoint()->nNode == rPos.nNode.GetIndex()); + assert(rPos.nNode.GetIndex() == pOrigNode->GetIndex()); + aSavePam.GetPoint()->nContent.Assign(pOrigNode, 0); + rPos = *aSavePam.GetMark() = *aSavePam.GetPoint(); + if( !pContentStore->Empty() ) pContentStore->Restore( &m_rDoc, rPos.nNode.GetIndex()-1, 0, true ); |