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

sw_redlinehide_4a: fix the number handling in SwEditShell::GetScriptType()

This is really to complicated & should be simplified, but while it seems
reasonable to assume that a frame always exists (or that nodes without
frames should be skipped), there needs to be a way to update a
SwScriptInfo if it turns out to be invalid...

Change-Id: I185733c2e1e93b0c4d2453eeb3ea48cd4b9b6779
üst b070202b
...@@ -599,15 +599,15 @@ static bool lcl_IsNoEndTextAttrAtPos(SwRootFrame const& rLayout, ...@@ -599,15 +599,15 @@ static bool lcl_IsNoEndTextAttrAtPos(SwRootFrame const& rLayout,
if ( bNum ) if ( bNum )
{ {
bRet = false; bRet = false;
SwTextNode const*const pPropsNode(sw::GetParaPropsNode(rLayout, rTNd));
if (sw::IsParaPropsNode(rLayout, rTNd) && rTNd.IsInList()) if (pPropsNode->IsInList())
{ {
OSL_ENSURE( rTNd.GetNumRule(), OSL_ENSURE( pPropsNode->GetNumRule(),
"<lcl_IsNoEndTextAttrAtPos(..)> - no list style found at text node. Serious defect." ); "<lcl_IsNoEndTextAttrAtPos(..)> - no list style found at text node. Serious defect." );
const SwNumRule* pNumRule = rTNd.GetNumRule(); const SwNumRule* pNumRule = pPropsNode->GetNumRule();
if(pNumRule) if(pNumRule)
{ {
int nListLevel = rTNd.GetActualListLevel(); int nListLevel = pPropsNode->GetActualListLevel();
if (nListLevel < 0) if (nListLevel < 0)
nListLevel = 0; nListLevel = 0;
...@@ -621,7 +621,7 @@ static bool lcl_IsNoEndTextAttrAtPos(SwRootFrame const& rLayout, ...@@ -621,7 +621,7 @@ static bool lcl_IsNoEndTextAttrAtPos(SwRootFrame const& rLayout,
if ( SVX_NUM_CHAR_SPECIAL == rNumFormat.GetNumberingType() ) if ( SVX_NUM_CHAR_SPECIAL == rNumFormat.GetNumberingType() )
sExp = OUString(rNumFormat.GetBulletChar()); sExp = OUString(rNumFormat.GetBulletChar());
else else
sExp = rTNd.GetNumString(); sExp = pPropsNode->GetNumString(true, MAXLEVEL, &rLayout);
} }
} }
} }
...@@ -741,6 +741,9 @@ SvtScriptType SwEditShell::GetScriptType() const ...@@ -741,6 +741,9 @@ SvtScriptType SwEditShell::GetScriptType() const
if (nEndPos > rText.getLength()) if (nEndPos > rText.getLength())
nEndPos = rText.getLength(); nEndPos = rText.getLength();
bool const isUntilEnd(pScriptInfo
? pFrame->MapViewToModelPos(TextFrameIndex(pFrame->GetText().getLength())) <= *pEnd
: rText.getLength() == nEndPos);
sal_uInt16 nScript; sal_uInt16 nScript;
while( nChg < nEndPos ) while( nChg < nEndPos )
{ {
...@@ -753,8 +756,10 @@ SvtScriptType SwEditShell::GetScriptType() const ...@@ -753,8 +756,10 @@ SvtScriptType SwEditShell::GetScriptType() const
rText, nChg ); rText, nChg );
if (!lcl_IsNoEndTextAttrAtPos(*GetLayout(), *pTNd, nChg, nRet, true, if (!lcl_IsNoEndTextAttrAtPos(*GetLayout(), *pTNd, nChg, nRet, true,
0 == nChg && rText.getLength() == nEndPos)) TextFrameIndex(0) == iChg && isUntilEnd))
{
nRet |= lcl_SetScriptFlags( nScript ); nRet |= lcl_SetScriptFlags( nScript );
}
if( (SvtScriptType::LATIN | SvtScriptType::ASIAN | if( (SvtScriptType::LATIN | SvtScriptType::ASIAN |
SvtScriptType::COMPLEX) == nRet ) SvtScriptType::COMPLEX) == nRet )
......
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