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

sw_redlinehide: this m_nCurrentIndexOffset is giving me headaches

Just use the mapping functions in GetNextAttr().

Change-Id: I4108e62ffbefbf3b0afe03b31ff97013969ea3a3
üst 0a90ad68
...@@ -601,36 +601,39 @@ TextFrameIndex SwAttrIter::GetNextAttr() const ...@@ -601,36 +601,39 @@ TextFrameIndex SwAttrIter::GetNextAttr() const
sal_Int32 nNext = GetNextAttrImpl(pTextNode, nStartIndex, nEndIndex, nPosition); sal_Int32 nNext = GetNextAttrImpl(pTextNode, nStartIndex, nEndIndex, nPosition);
if( m_pRedline ) if( m_pRedline )
{ {
// TODO refactor this so it can iterate std::pair<sal_Int32, SwRangeRedline const*> const redline(
std::pair<sal_Int32, SwRangeRedline const*> const redline(m_pRedline->GetNextRedln(nNext, pTextNode, nActRedline)); m_pRedline->GetNextRedln(nNext, pTextNode, nActRedline));
if (redline.second) if (redline.second)
{ {
assert(m_pMergedPara);
if (CanSkipOverRedline(*redline.second, nStartIndex, nEndIndex)) if (CanSkipOverRedline(*redline.second, nStartIndex, nEndIndex))
{ {
if (&redline.second->End()->nNode.GetNode() != pTextNode) if (&redline.second->End()->nNode.GetNode() != pTextNode)
{ {
// FIXME when to update the offset? now or when seeking?
const_cast<SwAttrIter*>(this)->m_nCurrentIndexOffset += pTextNode->Len() - redline.first;
// FIXME this needs to sum up *all* prev. nodes?
const_cast<SwAttrIter*>(this)->m_nCurrentIndexOffset = redline.second->End()->nContent.GetIndex() - pTextNode->Len();
pTextNode = redline.second->End()->nNode.GetNode().GetTextNode(); pTextNode = redline.second->End()->nNode.GetNode().GetTextNode();
nPosition = redline.second->End()->nContent.GetIndex(); nPosition = redline.second->End()->nContent.GetIndex();
// TODO: reset m_pRedline ... its m_pExt ...
} }
else else
{ {
nPosition = redline.second->End()->nContent.GetIndex(); nPosition = redline.second->End()->nContent.GetIndex();
const_cast<SwAttrIter*>(this)->m_nCurrentIndexOffset += (redline.second->End()->nContent.GetIndex() - redline.first);
} }
} }
else else
return redline.first - m_nCurrentIndexOffset; {
return sw::MapModelToView(*m_pMergedPara, pTextNode, redline.first);
}
} }
else else
return redline.first - m_nCurrentIndexOffset; {
return m_pMergedPara
? sw::MapModelToView(*m_pMergedPara, pTextNode, redline.first)
: TextFrameIndex(redline.first);
}
} }
else else
return nNext - m_nCurrentIndexOffset; {
return TextFrameIndex(nNext);
}
} }
} }
......
...@@ -63,8 +63,6 @@ private: ...@@ -63,8 +63,6 @@ private:
/// input: the current text node /// input: the current text node
const SwTextNode* m_pTextNode; const SwTextNode* m_pTextNode;
sw::MergedPara const* m_pMergedPara; sw::MergedPara const* m_pMergedPara;
/// from view (text frame) index to current node index
sal_Int32 m_nCurrentIndexOffset;
void SeekFwd( const sal_Int32 nPos ); void SeekFwd( const sal_Int32 nPos );
void SetFnt( SwFont* pNew ) { m_pFont = pNew; } void SetFnt( SwFont* pNew ) { m_pFont = pNew; }
...@@ -87,7 +85,6 @@ protected: ...@@ -87,7 +85,6 @@ protected:
, m_nPropFont(0) , m_nPropFont(0)
, m_pTextNode(pTextNode) , m_pTextNode(pTextNode)
, m_pMergedPara(nullptr) , m_pMergedPara(nullptr)
, m_nCurrentIndexOffset(0)
{ {
m_aMagicNo[SwFontScript::Latin] = m_aMagicNo[SwFontScript::CJK] = m_aMagicNo[SwFontScript::CTL] = nullptr; m_aMagicNo[SwFontScript::Latin] = m_aMagicNo[SwFontScript::CJK] = m_aMagicNo[SwFontScript::CTL] = nullptr;
} }
...@@ -99,7 +96,6 @@ public: ...@@ -99,7 +96,6 @@ public:
SwAttrIter( SwTextNode& rTextNode, SwScriptInfo& rScrInf ) SwAttrIter( SwTextNode& rTextNode, SwScriptInfo& rScrInf )
: m_pViewShell(nullptr), m_pFont(nullptr), m_pHints(nullptr), m_pScriptInfo(nullptr), m_pLastOut(nullptr), m_nChgCnt(0), m_pRedline(nullptr),m_nPropFont(0), m_pTextNode(&rTextNode) : m_pViewShell(nullptr), m_pFont(nullptr), m_pHints(nullptr), m_pScriptInfo(nullptr), m_pLastOut(nullptr), m_nChgCnt(0), m_pRedline(nullptr),m_nPropFont(0), m_pTextNode(&rTextNode)
, m_pMergedPara(nullptr) , m_pMergedPara(nullptr)
, m_nCurrentIndexOffset(0)
{ CtorInitAttrIter( rTextNode, rScrInf ); } { CtorInitAttrIter( rTextNode, rScrInf ); }
virtual ~SwAttrIter(); virtual ~SwAttrIter();
......
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