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

sw_redlinehide_2: MapModelToView needs to work on hidden nodes...

... that have no extents as well; add a pointer to the last node that
can be used for comparing.

Change-Id: Ibe7a84b523bb5921b3ca7fed2e330c54d85c5498
üst 0fa39cb0
......@@ -922,14 +922,18 @@ struct MergedPara
SwTextNode const* pParaPropsNode;
/// except break attributes, those are taken from the first node
SwTextNode *const pFirstNode;
/// mainly for sanity checks
SwTextNode const* pLastNode;
MergedPara(SwTextFrame & rFrame, std::vector<Extent>&& rExtents,
OUString const& rText,
SwTextNode const*const pProps, SwTextNode *const pFirst)
SwTextNode const*const pProps, SwTextNode *const pFirst,
SwTextNode const*const pLast)
: listener(rFrame), extents(std::move(rExtents)), mergedText(rText)
, pParaPropsNode(pProps), pFirstNode(pFirst)
, pParaPropsNode(pProps), pFirstNode(pFirst), pLastNode(pLast)
{
assert(pParaPropsNode);
assert(pFirstNode);
assert(pLastNode);
}
};
......
......@@ -157,7 +157,8 @@ CheckParaRedlineMerge(SwTextFrame & rFrame, SwTextNode & rTextNode,
}
}
auto pRet(o3tl::make_unique<sw::MergedPara>(rFrame, std::move(extents),
mergedText.makeStringAndClear(), pParaPropsNode, &rTextNode));
mergedText.makeStringAndClear(), pParaPropsNode, &rTextNode,
nodes.back()));
for (SwTextNode * pTmp : nodes)
{
pRet->listener.StartListening(pTmp);
......
......@@ -910,10 +910,16 @@ MapViewToModel(MergedPara const& rMerged, TextFrameIndex const i_nIndex)
TextFrameIndex MapModelToView(MergedPara const& rMerged, SwTextNode const*const pNode, sal_Int32 const nIndex)
{
assert(rMerged.pFirstNode->GetIndex() <= pNode->GetIndex()
&& pNode->GetIndex() <= rMerged.pLastNode->GetIndex());
sal_Int32 nRet(0);
bool bFoundNode(false);
for (auto const& e : rMerged.extents)
{
if (pNode->GetIndex() < e.pNode->GetIndex())
{
return TextFrameIndex(nRet);
}
if (e.pNode == pNode)
{
if (e.nStart <= nIndex && nIndex <= e.nEnd)
......@@ -944,7 +950,6 @@ TextFrameIndex MapModelToView(MergedPara const& rMerged, SwTextNode const*const
assert(nIndex <= pNode->Len());
return TextFrameIndex(0);
}
assert(!"text node not found");
return TextFrameIndex(COMPLETE_STRING);
}
......
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