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

sw_redlinehide: SwTextFrame::IsHiddenNow() needs some work

Iterating the fields here looks a bit expensive, maybe it would be
better to check the ViewOptions first...

Change-Id: I41830e89a4fd683eee35bd2b0901fb9fb121b51c
üst 97c5d77e
...@@ -75,6 +75,7 @@ ...@@ -75,6 +75,7 @@
#include <numrule.hxx> #include <numrule.hxx>
#include <swtable.hxx> #include <swtable.hxx>
#include <fldupde.hxx> #include <fldupde.hxx>
#include <docufld.hxx>
#include <IGrammarContact.hxx> #include <IGrammarContact.hxx>
#include <calbck.hxx> #include <calbck.hxx>
#include <ftnidx.hxx> #include <ftnidx.hxx>
...@@ -990,10 +991,56 @@ bool SwTextFrame::IsHiddenNow() const ...@@ -990,10 +991,56 @@ bool SwTextFrame::IsHiddenNow() const
return true; return true;
} }
if ( const SwViewShell* pVsh = getRootFrame()->GetCurrShell() ) bool bHiddenCharsHidePara(false);
bool bHiddenParaField(false);
if (m_pMergedPara)
{
TextFrameIndex nHiddenStart(COMPLETE_STRING);
TextFrameIndex nHiddenEnd(0);
if (auto const pScriptInfo = GetScriptInfo())
{
pScriptInfo->GetBoundsOfHiddenRange(TextFrameIndex(0),
nHiddenStart, nHiddenEnd);
}
else // ParaPortion is created in Format, but this is called earlier
{
SwScriptInfo aInfo;
aInfo.InitScriptInfo(*m_pMergedPara->pFirstNode, m_pMergedPara.get(), IsRightToLeft());
aInfo.GetBoundsOfHiddenRange(TextFrameIndex(0),
nHiddenStart, nHiddenEnd);
}
if (TextFrameIndex(0) == nHiddenStart &&
TextFrameIndex(GetText().getLength()) <= nHiddenEnd)
{
bHiddenCharsHidePara = true;
}
sw::MergedAttrIter iter(*this);
SwTextNode const* pNode(nullptr);
for (SwTextAttr const* pHint = iter.NextAttr(&pNode); pHint; pHint = iter.NextAttr(&pNode))
{
if (pHint->Which() == RES_TXTATR_FIELD)
{
const SwFormatField& rField = pHint->GetFormatField();
if (pNode->FieldCanHidePara(rField.GetField()->GetTyp()->Which()))
{
bHiddenParaField = pNode->FieldHidesPara(*rField.GetField());
if (!bHiddenParaField)
{
break; // not hidden, see CalcHiddenParaField()
}
}
}
}
}
else
{
bHiddenCharsHidePara = static_cast<SwTextNode const*>(SwFrame::GetDep())->HasHiddenCharAttribute( true );
bHiddenParaField = static_cast<SwTextNode const*>(SwFrame::GetDep())->IsHiddenByParaField();
}
const SwViewShell* pVsh = getRootFrame()->GetCurrShell();
if ( pVsh && ( bHiddenCharsHidePara || bHiddenParaField ) )
{ {
const bool bHiddenCharsHidePara = GetTextNode()->HasHiddenCharAttribute(true);
const bool bHiddenParaField = GetTextNode()->IsHiddenByParaField();
if ( if (
( bHiddenParaField && ( bHiddenParaField &&
......
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