Kaydet (Commit) eb4cd7e7 authored tarafından Caolán McNamara's avatar Caolán McNamara

some remaining sal_uInt16 to sal_Int32 editeng ESelection bounds

Change-Id: Ib47dea5c2d965cf613c465e624a1bdd81becb1c2
üst f1f7f3f1
...@@ -180,7 +180,7 @@ namespace accessibility ...@@ -180,7 +180,7 @@ namespace accessibility
void AccessibleEditableTextPara::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) void AccessibleEditableTextPara::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex )
{ {
sal_uInt16 nStart, nEnd; sal_Int32 nStart, nEnd;
if( GetSelection( nStart, nEnd ) ) if( GetSelection( nStart, nEnd ) )
{ {
...@@ -359,8 +359,7 @@ namespace accessibility ...@@ -359,8 +359,7 @@ namespace accessibility
"AccessibleEditableTextPara::MakeSelection: index value overflow"); "AccessibleEditableTextPara::MakeSelection: index value overflow");
sal_Int32 nParaIndex = GetParagraphIndex(); sal_Int32 nParaIndex = GetParagraphIndex();
return ESelection( nParaIndex, static_cast< sal_uInt16 >( nStartEEIndex ), return ESelection(nParaIndex, nStartEEIndex, nParaIndex, nEndEEIndex);
nParaIndex, static_cast< sal_uInt16 >( nEndEEIndex ) );
} }
ESelection AccessibleEditableTextPara::MakeSelection( sal_Int32 nEEIndex ) ESelection AccessibleEditableTextPara::MakeSelection( sal_Int32 nEEIndex )
...@@ -395,7 +394,7 @@ namespace accessibility ...@@ -395,7 +394,7 @@ namespace accessibility
CheckPosition( nEnd ); CheckPosition( nEnd );
} }
bool AccessibleEditableTextPara::GetSelection( sal_uInt16& nStartPos, sal_uInt16& nEndPos ) bool AccessibleEditableTextPara::GetSelection(sal_Int32 &nStartPos, sal_Int32 &nEndPos)
{ {
ESelection aSelection; ESelection aSelection;
sal_Int32 nPara = GetParagraphIndex(); sal_Int32 nPara = GetParagraphIndex();
...@@ -443,9 +442,9 @@ namespace accessibility ...@@ -443,9 +442,9 @@ namespace accessibility
return GetTextForwarder().GetText( MakeSelection(nStartIndex, nEndIndex) ); return GetTextForwarder().GetText( MakeSelection(nStartIndex, nEndIndex) );
} }
sal_uInt16 AccessibleEditableTextPara::GetTextLen() const sal_Int32 AccessibleEditableTextPara::GetTextLen() const
{ {
return GetTextForwarder().GetTextLen( static_cast< sal_uInt16 >( GetParagraphIndex() ) ); return GetTextForwarder().GetTextLen(GetParagraphIndex());
} }
SvxEditSourceAdapter& AccessibleEditableTextPara::GetEditSource() const SvxEditSourceAdapter& AccessibleEditableTextPara::GetEditSource() const
...@@ -652,7 +651,7 @@ namespace accessibility ...@@ -652,7 +651,7 @@ namespace accessibility
return GetTextForwarder().GetAttributeRun( nStartIndex, return GetTextForwarder().GetAttributeRun( nStartIndex,
nEndIndex, nEndIndex,
GetParagraphIndex(), GetParagraphIndex(),
static_cast< sal_uInt16 >(nIndex) ); nIndex );
} }
uno::Any SAL_CALL AccessibleEditableTextPara::queryInterface (const uno::Type & rType) throw (uno::RuntimeException, std::exception) uno::Any SAL_CALL AccessibleEditableTextPara::queryInterface (const uno::Type & rType) throw (uno::RuntimeException, std::exception)
...@@ -915,13 +914,13 @@ namespace accessibility ...@@ -915,13 +914,13 @@ namespace accessibility
//For field object info //For field object info
sal_Int32 nParaIndex = GetParagraphIndex(); sal_Int32 nParaIndex = GetParagraphIndex();
sal_Int32 nAllFieldLen = 0; sal_Int32 nAllFieldLen = 0;
sal_Int32 nField = rCacheTF.GetFieldCount(sal_uInt16(nParaIndex)), nFoundFieldIndex = -1; sal_Int32 nField = rCacheTF.GetFieldCount(nParaIndex), nFoundFieldIndex = -1;
EFieldInfo ree; EFieldInfo ree;
sal_Int32 reeBegin, reeEnd; sal_Int32 reeBegin, reeEnd;
sal_Int32 nFieldType = -1; sal_Int32 nFieldType = -1;
for(sal_uInt16 j = 0; j < nField; j++) for(sal_Int32 j = 0; j < nField; j++)
{ {
ree = rCacheTF.GetFieldInfo(sal_uInt16(nParaIndex), j); ree = rCacheTF.GetFieldInfo(nParaIndex, j);
reeBegin = ree.aPosition.nIndex + nAllFieldLen; reeBegin = ree.aPosition.nIndex + nAllFieldLen;
reeEnd = reeBegin + ree.aCurrentText.getLength(); reeEnd = reeBegin + ree.aCurrentText.getLength();
nAllFieldLen += (ree.aCurrentText.getLength() - 1); nAllFieldLen += (ree.aCurrentText.getLength() - 1);
...@@ -1064,7 +1063,7 @@ namespace accessibility ...@@ -1064,7 +1063,7 @@ namespace accessibility
SvxTextForwarder& rCacheTF = GetTextForwarder(); SvxTextForwarder& rCacheTF = GetTextForwarder();
Point aLogPoint( GetViewForwarder().PixelToLogic( aPoint, rCacheTF.GetMapMode() ) ); Point aLogPoint( GetViewForwarder().PixelToLogic( aPoint, rCacheTF.GetMapMode() ) );
EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo( static_cast< sal_uInt16 > (GetParagraphIndex()) ); EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo(GetParagraphIndex());
if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
aBulletInfo.bVisible && aBulletInfo.bVisible &&
...@@ -1205,7 +1204,7 @@ namespace accessibility ...@@ -1205,7 +1204,7 @@ namespace accessibility
GetParagraphIndex() == aSelection.nEndPara ) GetParagraphIndex() == aSelection.nEndPara )
{ {
// caret is always nEndPara,nEndPos // caret is always nEndPara,nEndPos
EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo( static_cast< sal_uInt16 >(GetParagraphIndex()) ); EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo(GetParagraphIndex());
if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
aBulletInfo.bVisible && aBulletInfo.bVisible &&
aBulletInfo.nType != SVX_NUM_BITMAP ) aBulletInfo.nType != SVX_NUM_BITMAP )
...@@ -1242,7 +1241,7 @@ namespace accessibility ...@@ -1242,7 +1241,7 @@ namespace accessibility
//Skip the bullet range to ingnore the bullet text //Skip the bullet range to ingnore the bullet text
SvxTextForwarder& rCacheTF = GetTextForwarder(); SvxTextForwarder& rCacheTF = GetTextForwarder();
EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo( static_cast< sal_uInt16 >(GetParagraphIndex()) ); EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo(GetParagraphIndex());
if (aBulletInfo.bVisible) if (aBulletInfo.bVisible)
nIndex += aBulletInfo.aText.getLength(); nIndex += aBulletInfo.aText.getLength();
CheckIndex(nIndex); // may throw IndexOutOfBoundsException CheckIndex(nIndex); // may throw IndexOutOfBoundsException
...@@ -1352,7 +1351,7 @@ namespace accessibility ...@@ -1352,7 +1351,7 @@ namespace accessibility
CheckPosition( nIndex ); CheckPosition( nIndex );
SvxTextForwarder& rCacheTF = GetTextForwarder(); SvxTextForwarder& rCacheTF = GetTextForwarder();
Rectangle aRect = rCacheTF.GetCharBounds( static_cast< sal_uInt16 >( GetParagraphIndex() ), static_cast< sal_uInt16 >( nIndex ) ); Rectangle aRect = rCacheTF.GetCharBounds(GetParagraphIndex(), nIndex);
// convert to screen // convert to screen
Rectangle aScreenRect = AccessibleEditableTextPara::LogicToPixel( aRect, Rectangle aScreenRect = AccessibleEditableTextPara::LogicToPixel( aRect,
...@@ -1554,26 +1553,6 @@ namespace accessibility ...@@ -1554,26 +1553,6 @@ namespace accessibility
// Underline // Underline
if (rRes.Name == "CharUnderline") if (rRes.Name == "CharUnderline")
{ {
/*
// MT: Implement XAccessibleTextMarkup, mark with TextMarkupType::SPELLCHECK. This way done in SW.
if (IsCurrentEditorEnableAutoSpell( mxParent ))
{
try
{
SvxEditViewForwarder& rCacheVF = GetEditViewForwarder( false );
sal_Bool bWrong = rCacheVF.IsWrongSpelledWordAtPos( GetParagraphIndex(), nIndex );
if ( bWrong )
{
uno::Any &anyUnderLine = pRes[9].Value;
// MT IA2: Not needed? sal_uInt16 crUnderLine = (sal_uInt16)(anyUnderLine.pReserved);
anyUnderLine <<= (sal_uInt16)UNDERLINE_WAVE;
}
}
catch( const uno::RuntimeException& )
{
}
}
*/
continue; continue;
} }
// Underline color && Mis-spell // Underline color && Mis-spell
...@@ -1608,32 +1587,12 @@ namespace accessibility ...@@ -1608,32 +1587,12 @@ namespace accessibility
} }
} }
} }
// MT: Implement XAccessibleTextMarkup, mark with TextMarkupType::SPELLCHECK. This way done in SW.
/*
if (IsCurrentEditorEnableAutoSpell( mxParent ))
{
try
{
SvxEditViewForwarder& rCacheVF = GetEditViewForwarder( false );
sal_Bool bWrong = rCacheVF.IsWrongSpelledWordAtPos( GetParagraphIndex(), nIndex );
if ( bWrong )
{
uno::Any &anyUnderLineColor = rRes.Value;
// MT IA2: Not needed? sal_uInt16 crUnderLineColor = (sal_uInt16)(anyUnderLineColor.pReserved);
anyUnderLineColor <<= COL_LIGHTRED;
}
}
catch( const uno::RuntimeException& )
{
}
}
*/
continue; continue;
} }
// NumberingLevel // NumberingLevel
if (rRes.Name == "NumberingLevel") if (rRes.Name == "NumberingLevel")
{ {
const SvxNumBulletItem& rNumBullet = ( SvxNumBulletItem& )rCacheTF.GetParaAttribs(static_cast< sal_uInt16 >(GetParagraphIndex())).Get(EE_PARA_NUMBULLET); const SvxNumBulletItem& rNumBullet = ( SvxNumBulletItem& )rCacheTF.GetParaAttribs(GetParagraphIndex()).Get(EE_PARA_NUMBULLET);
if(rNumBullet.GetNumRule()->GetLevelCount()==0) if(rNumBullet.GetNumRule()->GetLevelCount()==0)
{ {
rRes.Value <<= (sal_Int16)-1; rRes.Value <<= (sal_Int16)-1;
...@@ -1657,7 +1616,7 @@ namespace accessibility ...@@ -1657,7 +1616,7 @@ namespace accessibility
// NumberingRules // NumberingRules
if (rRes.Name == "NumberingRules") if (rRes.Name == "NumberingRules")
{ {
SfxItemSet aAttribs = rCacheTF.GetParaAttribs( static_cast< sal_uInt16 >(GetParagraphIndex()) ); SfxItemSet aAttribs = rCacheTF.GetParaAttribs(GetParagraphIndex());
bool bVis = ((const SfxUInt16Item&)aAttribs.Get( EE_PARA_BULLETSTATE )).GetValue() ? sal_True : sal_False; bool bVis = ((const SfxUInt16Item&)aAttribs.Get( EE_PARA_BULLETSTATE )).GetValue() ? sal_True : sal_False;
if(bVis) if(bVis)
{ {
...@@ -1683,12 +1642,12 @@ namespace accessibility ...@@ -1683,12 +1642,12 @@ namespace accessibility
sal_Int32 nParaIndex = GetParagraphIndex(); sal_Int32 nParaIndex = GetParagraphIndex();
SvxAccessibleTextAdapter& rCacheTF = GetTextForwarder(); SvxAccessibleTextAdapter& rCacheTF = GetTextForwarder();
sal_Int32 nAllFieldLen = 0; sal_Int32 nAllFieldLen = 0;
sal_Int32 nField = rCacheTF.GetFieldCount(sal_uInt16(nParaIndex)), nFoundFieldIndex = -1; sal_Int32 nField = rCacheTF.GetFieldCount(nParaIndex), nFoundFieldIndex = -1;
EFieldInfo ree; EFieldInfo ree;
sal_Int32 reeBegin=0, reeEnd=0; sal_Int32 reeBegin=0, reeEnd=0;
for(sal_uInt16 j = 0; j < nField; j++) for (sal_Int32 j = 0; j < nField; j++)
{ {
ree = rCacheTF.GetFieldInfo(sal_uInt16(nParaIndex), j); ree = rCacheTF.GetFieldInfo(nParaIndex, j);
reeBegin = ree.aPosition.nIndex + nAllFieldLen; reeBegin = ree.aPosition.nIndex + nAllFieldLen;
reeEnd = reeBegin + ree.aCurrentText.getLength(); reeEnd = reeBegin + ree.aCurrentText.getLength();
nAllFieldLen += (ree.aCurrentText.getLength() - 1); nAllFieldLen += (ree.aCurrentText.getLength() - 1);
...@@ -1719,12 +1678,12 @@ namespace accessibility ...@@ -1719,12 +1678,12 @@ namespace accessibility
sal_Int32 nParaIndex = GetParagraphIndex(); sal_Int32 nParaIndex = GetParagraphIndex();
SvxAccessibleTextAdapter& rCacheTF = GetTextForwarder(); SvxAccessibleTextAdapter& rCacheTF = GetTextForwarder();
sal_Int32 nAllFieldLen = 0; sal_Int32 nAllFieldLen = 0;
sal_Int32 nField = rCacheTF.GetFieldCount(sal_uInt16(nParaIndex)), nFoundFieldIndex = -1; sal_Int32 nField = rCacheTF.GetFieldCount(nParaIndex), nFoundFieldIndex = -1;
EFieldInfo ree; EFieldInfo ree;
sal_Int32 reeBegin=0, reeEnd=0; sal_Int32 reeBegin=0, reeEnd=0;
for(sal_uInt16 j = 0; j < nField; j++) for (sal_Int32 j = 0; j < nField; j++)
{ {
ree = rCacheTF.GetFieldInfo(sal_uInt16(nParaIndex), j); ree = rCacheTF.GetFieldInfo(nParaIndex, j);
reeBegin = ree.aPosition.nIndex + nAllFieldLen; reeBegin = ree.aPosition.nIndex + nAllFieldLen;
reeEnd = reeBegin + ree.aCurrentText.getLength(); reeEnd = reeBegin + ree.aCurrentText.getLength();
nAllFieldLen += (ree.aCurrentText.getLength() - 1); nAllFieldLen += (ree.aCurrentText.getLength() - 1);
...@@ -1758,7 +1717,7 @@ namespace accessibility ...@@ -1758,7 +1717,7 @@ namespace accessibility
if( bExtend ) if( bExtend )
{ {
//If there is a bullet before the field, should add the bullet length into the segment. //If there is a bullet before the field, should add the bullet length into the segment.
EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo(sal_uInt16(nParaIndex)); EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo(nParaIndex);
sal_Int32 nBulletLen = aBulletInfo.aText.getLength(); sal_Int32 nBulletLen = aBulletInfo.aText.getLength();
if (nBulletLen > 0) if (nBulletLen > 0)
{ {
...@@ -1815,7 +1774,7 @@ namespace accessibility ...@@ -1815,7 +1774,7 @@ namespace accessibility
//For the bullet paragraph, the bullet string is ingnored for IAText::attributes() function. //For the bullet paragraph, the bullet string is ingnored for IAText::attributes() function.
SvxTextForwarder& rCacheTF = GetTextForwarder(); SvxTextForwarder& rCacheTF = GetTextForwarder();
// MT IA2: Not used? sal_Int32 nBulletLen = 0; // MT IA2: Not used? sal_Int32 nBulletLen = 0;
EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo( static_cast< sal_uInt16 >(GetParagraphIndex()) ); EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo(GetParagraphIndex());
if (aBulletInfo.bVisible) if (aBulletInfo.bVisible)
nIndex += aBulletInfo.aText.getLength(); nIndex += aBulletInfo.aText.getLength();
if (nIndex != 0 && nIndex >= getCharacterCount()) if (nIndex != 0 && nIndex >= getCharacterCount())
...@@ -1960,7 +1919,7 @@ namespace accessibility ...@@ -1960,7 +1919,7 @@ namespace accessibility
nLastIndex = nCurIndex; nLastIndex = nCurIndex;
if (nLine == 0) if (nLine == 0)
{ {
EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo( static_cast< sal_uInt16 >(nParaIndex) ); EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo(nParaIndex);
if (aBulletInfo.bVisible) if (aBulletInfo.bVisible)
{ {
//in bullet or numbering; //in bullet or numbering;
...@@ -1989,7 +1948,7 @@ namespace accessibility ...@@ -1989,7 +1948,7 @@ namespace accessibility
else if (nLine == 1) else if (nLine == 1)
{ {
aResult.SegmentStart = 0; aResult.SegmentStart = 0;
aResult.SegmentEnd = static_cast< sal_uInt16 >( nLastIndex ); aResult.SegmentEnd = nLastIndex;
aResult.SegmentText = GetTextRange( aResult.SegmentStart, aResult.SegmentEnd + nBulletLen); aResult.SegmentText = GetTextRange( aResult.SegmentStart, aResult.SegmentEnd + nBulletLen);
break; break;
} }
...@@ -1997,7 +1956,7 @@ namespace accessibility ...@@ -1997,7 +1956,7 @@ namespace accessibility
{ {
//aResult.SegmentStart = nLastIndex - nCurLineLen; //aResult.SegmentStart = nLastIndex - nCurLineLen;
aResult.SegmentStart = nLastIndex - nLastLineLen; aResult.SegmentStart = nLastIndex - nLastLineLen;
aResult.SegmentEnd = static_cast< sal_uInt16 >( nLastIndex ); aResult.SegmentEnd = nLastIndex;
aResult.SegmentText = GetTextRange( aResult.SegmentStart + nBulletLen, aResult.SegmentEnd + nBulletLen); aResult.SegmentText = GetTextRange( aResult.SegmentStart + nBulletLen, aResult.SegmentEnd + nBulletLen);
break; break;
} }
...@@ -2095,7 +2054,6 @@ namespace accessibility ...@@ -2095,7 +2054,6 @@ namespace accessibility
{ {
SvxTextForwarder& rCacheTF = GetTextForwarder(); SvxTextForwarder& rCacheTF = GetTextForwarder();
sal_Int32 nParaIndex = GetParagraphIndex(); sal_Int32 nParaIndex = GetParagraphIndex();
// MT IA2 not needed? sal_Int32 nTextLen = rCacheTF.GetTextLen( static_cast< sal_uInt16 >( nParaIndex ) );
CheckPosition(nIndex); CheckPosition(nIndex);
...@@ -2110,14 +2068,13 @@ namespace accessibility ...@@ -2110,14 +2068,13 @@ namespace accessibility
{ {
if (nLine == 0) if (nLine == 0)
{ {
EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo( static_cast< sal_uInt16 >(nParaIndex) ); EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo(nParaIndex);
if (aBulletInfo.bVisible) if (aBulletInfo.bVisible)
{ {
//in bullet or numbering; //in bullet or numbering;
nBulletLen = aBulletInfo.aText.getLength(); nBulletLen = aBulletInfo.aText.getLength();
} }
} }
//nCurIndex += rCacheTF.GetLineLen(static_cast< sal_uInt16 >( nParaIndex ), nLine);
sal_Int32 nLineLen = rCacheTF.GetLineLen( nParaIndex, nLine); sal_Int32 nLineLen = rCacheTF.GetLineLen( nParaIndex, nLine);
if (nLine == 0) if (nLine == 0)
...@@ -2207,7 +2164,7 @@ namespace accessibility ...@@ -2207,7 +2164,7 @@ namespace accessibility
//Because bullet may occupy one or more characters, the TextAdapter will include bullet to calculate the selection. Add offset to handle bullet //Because bullet may occupy one or more characters, the TextAdapter will include bullet to calculate the selection. Add offset to handle bullet
sal_Int32 nBulletLen = 0; sal_Int32 nBulletLen = 0;
EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo( static_cast< sal_uInt16 >(GetParagraphIndex()) ); EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo(GetParagraphIndex());
if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && aBulletInfo.bVisible ) if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && aBulletInfo.bVisible )
nBulletLen = aBulletInfo.aText.getLength(); nBulletLen = aBulletInfo.aText.getLength();
// save current selection // save current selection
...@@ -2245,7 +2202,7 @@ namespace accessibility ...@@ -2245,7 +2202,7 @@ namespace accessibility
// Because bullet may occupy one or more characters, the TextAdapter will include bullet to calculate the selection. Add offset to handle bullet // Because bullet may occupy one or more characters, the TextAdapter will include bullet to calculate the selection. Add offset to handle bullet
sal_Int32 nBulletLen = 0; sal_Int32 nBulletLen = 0;
EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo( static_cast< sal_uInt16 >(GetParagraphIndex()) ); EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo(GetParagraphIndex());
if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && aBulletInfo.bVisible ) if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && aBulletInfo.bVisible )
nBulletLen = aBulletInfo.aText.getLength(); nBulletLen = aBulletInfo.aText.getLength();
ESelection aSelection = MakeSelection (nStartIndex + nBulletLen, nEndIndex + nBulletLen); ESelection aSelection = MakeSelection (nStartIndex + nBulletLen, nEndIndex + nBulletLen);
...@@ -2282,7 +2239,7 @@ namespace accessibility ...@@ -2282,7 +2239,7 @@ namespace accessibility
// Because bullet may occupy one or more characters, the TextAdapter will include bullet to calculate the selection. Add offset to handle bullet // Because bullet may occupy one or more characters, the TextAdapter will include bullet to calculate the selection. Add offset to handle bullet
sal_Int32 nBulletLen = 0; sal_Int32 nBulletLen = 0;
EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo( static_cast< sal_uInt16 >(GetParagraphIndex()) ); EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo(GetParagraphIndex());
if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && aBulletInfo.bVisible ) if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && aBulletInfo.bVisible )
nBulletLen = aBulletInfo.aText.getLength(); nBulletLen = aBulletInfo.aText.getLength();
if( !rCacheTF.IsEditable( MakeSelection(nIndex + nBulletLen) ) ) if( !rCacheTF.IsEditable( MakeSelection(nIndex + nBulletLen) ) )
...@@ -2319,7 +2276,7 @@ namespace accessibility ...@@ -2319,7 +2276,7 @@ namespace accessibility
// Because bullet may occupy one or more characters, the TextAdapter will include bullet to calculate the selection. Add offset to handle bullet // Because bullet may occupy one or more characters, the TextAdapter will include bullet to calculate the selection. Add offset to handle bullet
sal_Int32 nBulletLen = 0; sal_Int32 nBulletLen = 0;
EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo( static_cast< sal_uInt16 >(GetParagraphIndex()) ); EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo(GetParagraphIndex());
if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && aBulletInfo.bVisible ) if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && aBulletInfo.bVisible )
nBulletLen = aBulletInfo.aText.getLength(); nBulletLen = aBulletInfo.aText.getLength();
ESelection aSelection = MakeSelection (nStartIndex + nBulletLen, nEndIndex + nBulletLen); ESelection aSelection = MakeSelection (nStartIndex + nBulletLen, nEndIndex + nBulletLen);
...@@ -2360,7 +2317,7 @@ namespace accessibility ...@@ -2360,7 +2317,7 @@ namespace accessibility
// Because bullet may occupy one or more characters, the TextAdapter will include bullet to calculate the selection. Add offset to handle bullet // Because bullet may occupy one or more characters, the TextAdapter will include bullet to calculate the selection. Add offset to handle bullet
sal_Int32 nBulletLen = 0; sal_Int32 nBulletLen = 0;
EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo( static_cast< sal_uInt16 >(GetParagraphIndex()) ); EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo(GetParagraphIndex());
if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && aBulletInfo.bVisible ) if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && aBulletInfo.bVisible )
nBulletLen = aBulletInfo.aText.getLength(); nBulletLen = aBulletInfo.aText.getLength();
...@@ -2400,7 +2357,7 @@ namespace accessibility ...@@ -2400,7 +2357,7 @@ namespace accessibility
// Because bullet may occupy one or more characters, the TextAdapter will include bullet to calculate the selection. Add offset to handle bullet // Because bullet may occupy one or more characters, the TextAdapter will include bullet to calculate the selection. Add offset to handle bullet
sal_Int32 nBulletLen = 0; sal_Int32 nBulletLen = 0;
EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo( static_cast< sal_uInt16 >(GetParagraphIndex()) ); EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo(GetParagraphIndex());
if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && aBulletInfo.bVisible ) if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && aBulletInfo.bVisible )
nBulletLen = aBulletInfo.aText.getLength(); nBulletLen = aBulletInfo.aText.getLength();
ESelection aSelection = MakeSelection (nStartIndex + nBulletLen, nEndIndex + nBulletLen); ESelection aSelection = MakeSelection (nStartIndex + nBulletLen, nEndIndex + nBulletLen);
...@@ -2435,7 +2392,7 @@ namespace accessibility ...@@ -2435,7 +2392,7 @@ namespace accessibility
// AccessibleEmptyEditSource relies on this behaviour // AccessibleEmptyEditSource relies on this behaviour
GetEditViewForwarder( true ); GetEditViewForwarder( true );
SvxAccessibleTextAdapter& rCacheTF = GetTextForwarder(); // MUST be after GetEditViewForwarder(), see method docs SvxAccessibleTextAdapter& rCacheTF = GetTextForwarder(); // MUST be after GetEditViewForwarder(), see method docs
sal_uInt16 nPara = static_cast< sal_uInt16 >( GetParagraphIndex() ); sal_Int32 nPara = GetParagraphIndex();
DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
"AccessibleEditableTextPara::setAttributes: index value overflow"); "AccessibleEditableTextPara::setAttributes: index value overflow");
...@@ -2684,9 +2641,9 @@ namespace accessibility ...@@ -2684,9 +2641,9 @@ namespace accessibility
SvxAccessibleTextAdapter& rT = GetTextForwarder(); SvxAccessibleTextAdapter& rT = GetTextForwarder();
const sal_Int32 nPara = GetParagraphIndex(); const sal_Int32 nPara = GetParagraphIndex();
sal_uInt16 nHyperLinks = 0; sal_Int32 nHyperLinks = 0;
sal_uInt16 nFields = rT.GetFieldCount( nPara ); sal_Int32 nFields = rT.GetFieldCount( nPara );
for ( sal_uInt16 n = 0; n < nFields; n++ ) for (sal_Int32 n = 0; n < nFields; ++n)
{ {
EFieldInfo aField = rT.GetFieldInfo( nPara, n ); EFieldInfo aField = rT.GetFieldInfo( nPara, n );
if ( aField.pFieldItem->GetField()->ISA( SvxURLField ) ) if ( aField.pFieldItem->GetField()->ISA( SvxURLField ) )
...@@ -2702,20 +2659,20 @@ namespace accessibility ...@@ -2702,20 +2659,20 @@ namespace accessibility
SvxAccessibleTextAdapter& rT = GetTextForwarder(); SvxAccessibleTextAdapter& rT = GetTextForwarder();
const sal_Int32 nPara = GetParagraphIndex(); const sal_Int32 nPara = GetParagraphIndex();
sal_uInt16 nHyperLink = 0; sal_Int32 nHyperLink = 0;
sal_uInt16 nFields = rT.GetFieldCount( nPara ); sal_Int32 nFields = rT.GetFieldCount( nPara );
for ( sal_uInt16 n = 0; n < nFields; n++ ) for (sal_Int32 n = 0; n < nFields; ++n)
{ {
EFieldInfo aField = rT.GetFieldInfo( nPara, n ); EFieldInfo aField = rT.GetFieldInfo( nPara, n );
if ( aField.pFieldItem->GetField()->ISA( SvxURLField ) ) if ( aField.pFieldItem->GetField()->ISA( SvxURLField ) )
{ {
if ( nHyperLink == nLinkIndex ) if ( nHyperLink == nLinkIndex )
{ {
sal_uInt16 nEEStart = aField.aPosition.nIndex; sal_Int32 nEEStart = aField.aPosition.nIndex;
// Translate EE Index to accessible index // Translate EE Index to accessible index
sal_uInt16 nStart = rT.CalcEditEngineIndex( nPara, nEEStart ); sal_Int32 nStart = rT.CalcEditEngineIndex( nPara, nEEStart );
sal_uInt16 nEnd = nStart + aField.aCurrentText.getLength(); sal_Int32 nEnd = nStart + aField.aCurrentText.getLength();
xRef = new AccessibleHyperlink( rT, new SvxFieldItem( *aField.pFieldItem ), nPara, nEEStart, nStart, nEnd, aField.aCurrentText ); xRef = new AccessibleHyperlink( rT, new SvxFieldItem( *aField.pFieldItem ), nPara, nEEStart, nStart, nEnd, aField.aCurrentText );
break; break;
} }
...@@ -2731,15 +2688,11 @@ namespace accessibility ...@@ -2731,15 +2688,11 @@ namespace accessibility
const sal_Int32 nPara = GetParagraphIndex(); const sal_Int32 nPara = GetParagraphIndex();
SvxAccessibleTextAdapter& rT = GetTextForwarder(); SvxAccessibleTextAdapter& rT = GetTextForwarder();
// SvxAccessibleTextIndex aIndex; const sal_Int32 nEEIndex = rT.CalcEditEngineIndex( nPara, nCharIndex );
// aIndex.SetIndex(nPara, nCharIndex, rT);
// const sal_uInt16 nEEIndex = aIndex.GetEEIndex();
const sal_uInt16 nEEIndex = rT.CalcEditEngineIndex( nPara, nCharIndex );
sal_Int32 nHLIndex = -1; //i123620 sal_Int32 nHLIndex = -1; //i123620
sal_uInt16 nHyperLink = 0; sal_Int32 nHyperLink = 0;
sal_uInt16 nFields = rT.GetFieldCount( nPara ); sal_Int32 nFields = rT.GetFieldCount( nPara );
for ( sal_uInt16 n = 0; n < nFields; n++ ) for (sal_Int32 n = 0; n < nFields; ++n)
{ {
EFieldInfo aField = rT.GetFieldInfo( nPara, n ); EFieldInfo aField = rT.GetFieldInfo( nPara, n );
if ( aField.pFieldItem->GetField()->ISA( SvxURLField ) ) if ( aField.pFieldItem->GetField()->ISA( SvxURLField ) )
......
...@@ -92,8 +92,7 @@ namespace accessibility ...@@ -92,8 +92,7 @@ namespace accessibility
nEndIndex >= 0 && nEndIndex <= USHRT_MAX , nEndIndex >= 0 && nEndIndex <= USHRT_MAX ,
"AccessibleStaticTextBase_Impl::MakeSelection: index value overflow"); "AccessibleStaticTextBase_Impl::MakeSelection: index value overflow");
return ESelection( nStartPara, static_cast< sal_uInt16 >(nStartIndex), return ESelection(nStartPara, nStartIndex, nEndPara, nEndIndex);
nEndPara, static_cast< sal_uInt16 >(nEndIndex) );
} }
...@@ -360,7 +359,7 @@ namespace accessibility ...@@ -360,7 +359,7 @@ namespace accessibility
nFlatIndex - nCurrIndex + nCurrCount >= 0 && nFlatIndex - nCurrIndex + nCurrCount <= USHRT_MAX , nFlatIndex - nCurrIndex + nCurrCount >= 0 && nFlatIndex - nCurrIndex + nCurrCount <= USHRT_MAX ,
"AccessibleStaticTextBase_Impl::Index2Internal: index value overflow"); "AccessibleStaticTextBase_Impl::Index2Internal: index value overflow");
return EPosition( nCurrPara, static_cast< sal_uInt16 >(nFlatIndex - nCurrIndex + nCurrCount) ); return EPosition(nCurrPara, nFlatIndex - nCurrIndex + nCurrCount);
} }
} }
...@@ -372,7 +371,7 @@ namespace accessibility ...@@ -372,7 +371,7 @@ namespace accessibility
nFlatIndex - nCurrIndex + nCurrCount >= 0 && nFlatIndex - nCurrIndex + nCurrCount <= USHRT_MAX , nFlatIndex - nCurrIndex + nCurrCount >= 0 && nFlatIndex - nCurrIndex + nCurrCount <= USHRT_MAX ,
"AccessibleStaticTextBase_Impl::Index2Internal: index value overflow"); "AccessibleStaticTextBase_Impl::Index2Internal: index value overflow");
return EPosition( nCurrPara-1, static_cast< sal_uInt16 >(nFlatIndex - nCurrIndex + nCurrCount) ); return EPosition(nCurrPara-1, nFlatIndex - nCurrIndex + nCurrCount);
} }
// not found? Out of bounds // not found? Out of bounds
...@@ -744,8 +743,7 @@ namespace accessibility ...@@ -744,8 +743,7 @@ namespace accessibility
// #112814# Use correct index offset // #112814# Use correct index offset
if ( ( nIndex = rPara.getIndexAtPoint( aPoint ) ) != -1 ) if ( ( nIndex = rPara.getIndexAtPoint( aPoint ) ) != -1 )
return mpImpl->Internal2Index( EPosition(sal::static_int_cast<sal_uInt16>(i), return mpImpl->Internal2Index(EPosition(i, nIndex));
sal::static_int_cast<sal_uInt16>(nIndex)) );
} }
return -1; return -1;
......
...@@ -319,13 +319,13 @@ namespace accessibility ...@@ -319,13 +319,13 @@ namespace accessibility
// Get text from forwarder // Get text from forwarder
OUString GetTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ); OUString GetTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex );
sal_uInt16 GetTextLen() const; sal_Int32 GetTextLen() const;
/** Get the current selection of this paragraph /** Get the current selection of this paragraph
@return sal_False, if nothing in this paragraph is selected @return sal_False, if nothing in this paragraph is selected
*/ */
bool GetSelection( sal_uInt16& nStartPos, sal_uInt16& nEndPos ); bool GetSelection(sal_Int32& nStartPos, sal_Int32& nEndPos );
/** create selection from Accessible selection. /** create selection from Accessible selection.
......
...@@ -492,8 +492,8 @@ void FuInsertFile::InsTextOrRTFinDrMode(SfxMedium* pMedium) ...@@ -492,8 +492,8 @@ void FuInsertFile::InsTextOrRTFinDrMode(SfxMedium* pMedium)
{ {
Paragraph* pPara = pOutliner->GetParagraph( 0 ); Paragraph* pPara = pOutliner->GetParagraph( 0 );
sal_uLong nLen = pOutliner->GetText( pPara, 1 ).getLength(); sal_uLong nLen = pOutliner->GetText( pPara, 1 ).getLength();
pOutliner->QuickDelete( ESelection( 0, (sal_uInt16) nLen, 1, 0 ) ); pOutliner->QuickDelete( ESelection( 0, nLen, 1, 0 ) );
pOutliner->QuickInsertLineBreak( ESelection( 0, (sal_uInt16) nLen, 0, (sal_uInt16) nLen ) ); pOutliner->QuickInsertLineBreak( ESelection( 0, nLen, 0, nLen ) );
} }
} }
} }
......
...@@ -601,8 +601,8 @@ uno::Reference< text::XTextRange > SdUnoSearchReplaceShape::Search( uno::Refere ...@@ -601,8 +601,8 @@ uno::Reference< text::XTextRange > SdUnoSearchReplaceShape::Search( uno::Refere
{ {
if( nStartPos <= nTextLen && nEndPos <= nTextLen ) if( nStartPos <= nTextLen && nEndPos <= nTextLen )
{ {
ESelection aSelection( pConvertPara[nStartPos], (sal_uInt16)pConvertPos[nStartPos], ESelection aSelection( pConvertPara[nStartPos], pConvertPos[nStartPos],
pConvertPara[nEndPos], (sal_uInt16)pConvertPos[nEndPos] ); pConvertPara[nEndPos], pConvertPos[nEndPos] );
SvxUnoTextRange *pRange; SvxUnoTextRange *pRange;
SvxUnoTextBase* pParent = SvxUnoTextBase::getImplementation( xParent ); SvxUnoTextBase* pParent = SvxUnoTextBase::getImplementation( xParent );
......
...@@ -323,7 +323,7 @@ void View::DoPaste (::Window* pWindow) ...@@ -323,7 +323,7 @@ void View::DoPaste (::Window* pWindow)
for( sal_Int32 nPara = nParaCount - 2; nPara >= 0; nPara-- ) for( sal_Int32 nPara = nParaCount - 2; nPara >= 0; nPara-- )
{ {
const sal_uInt16 nParaLen = (sal_uInt16)rEdit.GetTextLen( nPara ); const sal_Int32 nParaLen = rEdit.GetTextLen( nPara );
pOutliner->QuickDelete( ESelection( nPara, nParaLen, nPara+1, 0 ) ); pOutliner->QuickDelete( ESelection( nPara, nParaLen, nPara+1, 0 ) );
pOutliner->QuickInsertLineBreak( ESelection( nPara, nParaLen, nPara, nParaLen ) ); pOutliner->QuickInsertLineBreak( ESelection( nPara, nParaLen, nPara, nParaLen ) );
} }
......
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