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

sw_redlinehide_2: SwContentNode::DelFrames()

... needs to remove extents when it's called when moving nodes to
Undo-nodes-array.

Change-Id: I32cf38074d9f3d614d5f854979be6b0135d53914
üst 9e1efcc8
......@@ -412,7 +412,7 @@ public:
/** Method deletes all views of document for the node. The content-
frames are removed from the respective layout.
*/
void DelFrames(SwRootFrame const* pLayout, bool fromDtor = false);
void DelFrames(SwRootFrame const* pLayout);
/** @return count of elements of node content. Default is 1.
There are differences between text node and formula node. */
......
......@@ -1320,7 +1320,7 @@ void SwContentNode::MakeFramesForAdjacentContentNode(SwContentNode& rNode)
* Deletes all Views from the Doc for this Node.
* The ContentFrames are removed from the corresponding Layout.
*/
void SwContentNode::DelFrames(SwRootFrame const*const pLayout, bool const fromDtor)
void SwContentNode::DelFrames(SwRootFrame const*const pLayout)
{
if( !HasWriterListeners() )
return;
......@@ -1339,24 +1339,27 @@ void SwContentNode::DelFrames(SwRootFrame const*const pLayout, bool const fromDt
{
if (this != pMerged->pFirstNode)
{
if (fromDtor)
// pointer should have been updated to a different node
assert(this != pMerged->pParaPropsNode);
// SwNodes::RemoveNode iterates *backwards* - so
// ensure there are no more extents pointing to this
// node as SwFrame::InvalidatePage() will access them.
// Note: cannot send via SwClientNotify from dtor
// because that would access deleted wrong-lists
sw::UpdateMergedParaForDelete(*pMerged, true,
*static_cast<SwTextNode*>(this), 0, Len());
if (this == pMerged->pLastNode)
{
// pointer should have been updated to a different node
assert(this != pMerged->pParaPropsNode);
// manual update required i'm afraid...
if (this == pMerged->pLastNode)
{
pMerged->pLastNode = GetNodes()[GetIndex()-1]->GetTextNode();
// at first glance nothing guarantees this...
// but the redline must end on a text-node...
// so everything before this node that isn't a text
// node should have been deleted already so that
// there's a text node before.
assert(pMerged->pLastNode->IsTextNode());
}
// avoid re-parenting mess (ModifyChangedHint)
pMerged->listener.EndListening(this);
pMerged->pLastNode = GetNodes()[GetIndex()-1]->GetTextNode();
// at first glance nothing guarantees this...
// but the redline must end on a text-node...
// so everything before this node that isn't a text
// node should have been deleted already so that
// there's a text node before.
assert(pMerged->pLastNode->IsTextNode());
}
// avoid re-parenting mess (ModifyChangedHint)
pMerged->listener.EndListening(this);
continue; // don't delete
}
}
......
......@@ -101,6 +101,10 @@ std::unique_ptr<sw::MergedPara> CheckParaRedlineMerge(SwTextFrame & rFrame, SwTe
bool FrameContainsNode(SwContentFrame const& rFrame, sal_uLong nNodeIndex);
TextFrameIndex UpdateMergedParaForDelete(MergedPara & rMerged,
bool isRealDelete,
SwTextNode const& rNode, sal_Int32 nIndex, sal_Int32 nLen);
} // namespace sw
/// Represents the visualization of a paragraph. Typical upper is an
......
......@@ -841,7 +841,7 @@ static TextFrameIndex UpdateMergedParaForInsert(MergedPara & rMerged,
// 1. if real delete => correct nStart/nEnd for full nLen
// 2. if rl delete => do not correct nStart/nEnd but just exclude deleted
static TextFrameIndex UpdateMergedParaForDelete(MergedPara & rMerged,
TextFrameIndex UpdateMergedParaForDelete(MergedPara & rMerged,
bool const isRealDelete,
SwTextNode const& rNode, sal_Int32 nIndex, sal_Int32 const nLen)
{
......
......@@ -264,7 +264,7 @@ SwTextNode::~SwTextNode()
RemoveFromList();
InitSwParaStatistics( false );
DelFrames(nullptr, true); // must be called here while it's still a SwTextNode
DelFrames(nullptr); // must be called here while it's still a SwTextNode
DelFrames_TextNodePart();
}
......
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