Kaydet (Commit) 96646c35 authored tarafından Miklos Vajna's avatar Miklos Vajna

sw: prefix members of SwAccessiblePortionData

Change-Id: Ia41a57b11e2df5261657855e92701dce4cbe95aa
üst c9805c52
...@@ -69,78 +69,78 @@ SwAccessiblePortionData::SwAccessiblePortionData( ...@@ -69,78 +69,78 @@ SwAccessiblePortionData::SwAccessiblePortionData(
const SwTextNode* pTextNd, const SwTextNode* pTextNd,
const SwViewOption* pViewOpt ) : const SwViewOption* pViewOpt ) :
SwPortionHandler(), SwPortionHandler(),
pTextNode( pTextNd ), m_pTextNode( pTextNd ),
aBuffer(), m_aBuffer(),
nModelPosition( 0 ), m_nModelPosition( 0 ),
pViewOptions( pViewOpt ), m_pViewOptions( pViewOpt ),
sAccessibleString(), m_sAccessibleString(),
aLineBreaks(), m_aLineBreaks(),
aModelPositions(), m_aModelPositions(),
aAccessiblePositions(), m_aAccessiblePositions(),
aFieldPosition(), m_aFieldPosition(),
aAttrFieldType(), m_aAttrFieldType(),
aPortionAttrs(), m_aPortionAttrs(),
pSentences( nullptr ), m_pSentences( nullptr ),
nBeforePortions( 0 ), m_nBeforePortions( 0 ),
bFinished( false ), m_bFinished( false ),
bLastIsSpecial( false ) m_bLastIsSpecial( false )
{ {
OSL_ENSURE( pTextNode != nullptr, "Text node is needed!" ); OSL_ENSURE( m_pTextNode != nullptr, "Text node is needed!" );
// reserve some space to reduce memory allocations // reserve some space to reduce memory allocations
aLineBreaks.reserve( 5 ); m_aLineBreaks.reserve( 5 );
aModelPositions.reserve( 10 ); m_aModelPositions.reserve( 10 );
aAccessiblePositions.reserve( 10 ); m_aAccessiblePositions.reserve( 10 );
// always include 'first' line-break position // always include 'first' line-break position
aLineBreaks.push_back( 0 ); m_aLineBreaks.push_back( 0 );
} }
SwAccessiblePortionData::~SwAccessiblePortionData() SwAccessiblePortionData::~SwAccessiblePortionData()
{ {
delete pSentences; delete m_pSentences;
} }
void SwAccessiblePortionData::Text(sal_Int32 nLength, sal_uInt16 nType, sal_Int32 /*nHeight*/, sal_Int32 /*nWidth*/) void SwAccessiblePortionData::Text(sal_Int32 nLength, sal_uInt16 nType, sal_Int32 /*nHeight*/, sal_Int32 /*nWidth*/)
{ {
OSL_ENSURE( (nModelPosition + nLength) <= pTextNode->GetText().getLength(), OSL_ENSURE( (m_nModelPosition + nLength) <= m_pTextNode->GetText().getLength(),
"portion exceeds model string!" ); "portion exceeds model string!" );
OSL_ENSURE( !bFinished, "We are already done!" ); OSL_ENSURE( !m_bFinished, "We are already done!" );
// ignore zero-length portions // ignore zero-length portions
if( nLength == 0 ) if( nLength == 0 )
return; return;
// store 'old' positions // store 'old' positions
aModelPositions.push_back( nModelPosition ); m_aModelPositions.push_back( m_nModelPosition );
aAccessiblePositions.push_back( aBuffer.getLength() ); m_aAccessiblePositions.push_back( m_aBuffer.getLength() );
// store portion attributes // store portion attributes
sal_uInt8 nAttr = IsGrayPortionType(nType) ? PORATTR_GRAY : 0; sal_uInt8 nAttr = IsGrayPortionType(nType) ? PORATTR_GRAY : 0;
aPortionAttrs.push_back( nAttr ); m_aPortionAttrs.push_back( nAttr );
// update buffer + nModelPosition // update buffer + nModelPosition
aBuffer.append( pTextNode->GetText().copy(nModelPosition, nLength) ); m_aBuffer.append( m_pTextNode->GetText().copy(m_nModelPosition, nLength) );
nModelPosition += nLength; m_nModelPosition += nLength;
bLastIsSpecial = false; m_bLastIsSpecial = false;
} }
void SwAccessiblePortionData::SetAttrFieldType( sal_uInt16 nAttrFieldType ) void SwAccessiblePortionData::SetAttrFieldType( sal_uInt16 nAttrFieldType )
{ {
aAttrFieldType.push_back(nAttrFieldType); m_aAttrFieldType.push_back(nAttrFieldType);
return; return;
} }
void SwAccessiblePortionData::Special( void SwAccessiblePortionData::Special(
sal_Int32 nLength, const OUString& rText, sal_uInt16 nType, sal_Int32 /*nHeight*/, sal_Int32 /*nWidth*/, const SwFont* /*pFont*/) sal_Int32 nLength, const OUString& rText, sal_uInt16 nType, sal_Int32 /*nHeight*/, sal_Int32 /*nWidth*/, const SwFont* /*pFont*/)
{ {
OSL_ENSURE( nModelPosition >= 0, "illegal position" ); OSL_ENSURE( m_nModelPosition >= 0, "illegal position" );
OSL_ENSURE( (nModelPosition + nLength) <= pTextNode->GetText().getLength(), OSL_ENSURE( (m_nModelPosition + nLength) <= m_pTextNode->GetText().getLength(),
"portion exceeds model string!" ); "portion exceeds model string!" );
OSL_ENSURE( !bFinished, "We are already done!" ); OSL_ENSURE( !m_bFinished, "We are already done!" );
// construct string with representation; either directly from // construct string with representation; either directly from
// rText, or use resources for special case portions // rText, or use resources for special case portions
...@@ -160,15 +160,15 @@ void SwAccessiblePortionData::Special( ...@@ -160,15 +160,15 @@ void SwAccessiblePortionData::Special(
sDisplay = OUString(sal_Unicode(0xfffc)); sDisplay = OUString(sal_Unicode(0xfffc));
else else
sDisplay = rText; sDisplay = rText;
aFieldPosition.push_back(aBuffer.getLength()); m_aFieldPosition.push_back(m_aBuffer.getLength());
aFieldPosition.push_back(aBuffer.getLength() + rText.getLength()); m_aFieldPosition.push_back(m_aBuffer.getLength() + rText.getLength());
break; break;
case POR_FTNNUM: case POR_FTNNUM:
break; break;
case POR_FTN: case POR_FTN:
{ {
sDisplay = rText; sDisplay = rText;
sal_Int32 nStart=aBuffer.getLength(); sal_Int32 nStart=m_aBuffer.getLength();
sal_Int32 nEnd=nStart + rText.getLength(); sal_Int32 nEnd=nStart + rText.getLength();
m_vecPairPos.push_back(std::make_pair(nStart,nEnd)); m_vecPairPos.push_back(std::make_pair(nStart,nEnd));
break; break;
...@@ -184,7 +184,7 @@ void SwAccessiblePortionData::Special( ...@@ -184,7 +184,7 @@ void SwAccessiblePortionData::Special(
// #i111768# - apply patch from kstribley: // #i111768# - apply patch from kstribley:
// Include the control characters. // Include the control characters.
case POR_CONTROLCHAR: case POR_CONTROLCHAR:
sDisplay = rText + OUStringLiteral1( pTextNode->GetText()[nModelPosition] ); sDisplay = rText + OUStringLiteral1( m_pTextNode->GetText()[m_nModelPosition] );
break; break;
default: default:
sDisplay = rText; sDisplay = rText;
...@@ -197,50 +197,50 @@ void SwAccessiblePortionData::Special( ...@@ -197,50 +197,50 @@ void SwAccessiblePortionData::Special(
// special treatment for zero length portion at the beginning: // special treatment for zero length portion at the beginning:
// count as 'before' portion // count as 'before' portion
if( ( nLength == 0 ) && ( nModelPosition == 0 ) ) if( ( nLength == 0 ) && ( m_nModelPosition == 0 ) )
nBeforePortions++; m_nBeforePortions++;
// store the 'old' positions // store the 'old' positions
aModelPositions.push_back( nModelPosition ); m_aModelPositions.push_back( m_nModelPosition );
aAccessiblePositions.push_back( aBuffer.getLength() ); m_aAccessiblePositions.push_back( m_aBuffer.getLength() );
// store portion attributes // store portion attributes
sal_uInt8 nAttr = PORATTR_SPECIAL; sal_uInt8 nAttr = PORATTR_SPECIAL;
if( IsGrayPortionType(nType) ) nAttr |= PORATTR_GRAY; if( IsGrayPortionType(nType) ) nAttr |= PORATTR_GRAY;
if( nLength == 0 ) nAttr |= PORATTR_READONLY; if( nLength == 0 ) nAttr |= PORATTR_READONLY;
if( nType == POR_TERMINATE ) nAttr |= PORATTR_TERM; if( nType == POR_TERMINATE ) nAttr |= PORATTR_TERM;
aPortionAttrs.push_back( nAttr ); m_aPortionAttrs.push_back( nAttr );
// update buffer + nModelPosition // update buffer + nModelPosition
aBuffer.append( sDisplay ); m_aBuffer.append( sDisplay );
nModelPosition += nLength; m_nModelPosition += nLength;
// remember 'last' special portion (unless it's our own 'closing' // remember 'last' special portion (unless it's our own 'closing'
// portions from 'Finish()' // portions from 'Finish()'
if( nType != POR_TERMINATE ) if( nType != POR_TERMINATE )
bLastIsSpecial = true; m_bLastIsSpecial = true;
} }
void SwAccessiblePortionData::LineBreak(sal_Int32 /*nWidth*/) void SwAccessiblePortionData::LineBreak(sal_Int32 /*nWidth*/)
{ {
OSL_ENSURE( !bFinished, "We are already done!" ); OSL_ENSURE( !m_bFinished, "We are already done!" );
aLineBreaks.push_back( aBuffer.getLength() ); m_aLineBreaks.push_back( m_aBuffer.getLength() );
} }
void SwAccessiblePortionData::Skip(sal_Int32 nLength) void SwAccessiblePortionData::Skip(sal_Int32 nLength)
{ {
OSL_ENSURE( !bFinished, "We are already done!" ); OSL_ENSURE( !m_bFinished, "We are already done!" );
OSL_ENSURE( aModelPositions.empty(), "Never Skip() after portions" ); OSL_ENSURE( m_aModelPositions.empty(), "Never Skip() after portions" );
OSL_ENSURE( nLength <= pTextNode->GetText().getLength(), OSL_ENSURE( nLength <= m_pTextNode->GetText().getLength(),
"skip exceeds model string!" ); "skip exceeds model string!" );
nModelPosition += nLength; m_nModelPosition += nLength;
} }
void SwAccessiblePortionData::Finish() void SwAccessiblePortionData::Finish()
{ {
OSL_ENSURE( !bFinished, "We are already done!" ); OSL_ENSURE( !m_bFinished, "We are already done!" );
// include terminator values: always include two 'last character' // include terminator values: always include two 'last character'
// markers in the position arrays to make sure we always find one // markers in the position arrays to make sure we always find one
...@@ -250,16 +250,16 @@ void SwAccessiblePortionData::Finish() ...@@ -250,16 +250,16 @@ void SwAccessiblePortionData::Finish()
LineBreak(0); LineBreak(0);
LineBreak(0); LineBreak(0);
sAccessibleString = aBuffer.makeStringAndClear(); m_sAccessibleString = m_aBuffer.makeStringAndClear();
bFinished = true; m_bFinished = true;
} }
bool SwAccessiblePortionData::IsPortionAttrSet( bool SwAccessiblePortionData::IsPortionAttrSet(
size_t nPortionNo, sal_uInt8 nAttr ) const size_t nPortionNo, sal_uInt8 nAttr ) const
{ {
OSL_ENSURE( nPortionNo < aPortionAttrs.size(), OSL_ENSURE( nPortionNo < m_aPortionAttrs.size(),
"Illegal portion number" ); "Illegal portion number" );
return (aPortionAttrs[nPortionNo] & nAttr) != 0; return (m_aPortionAttrs[nPortionNo] & nAttr) != 0;
} }
bool SwAccessiblePortionData::IsSpecialPortion( size_t nPortionNo ) const bool SwAccessiblePortionData::IsSpecialPortion( size_t nPortionNo ) const
...@@ -290,12 +290,12 @@ bool SwAccessiblePortionData::IsGrayPortionType( sal_uInt16 nType ) const ...@@ -290,12 +290,12 @@ bool SwAccessiblePortionData::IsGrayPortionType( sal_uInt16 nType ) const
case POR_ISOTOX: case POR_ISOTOX:
case POR_TOX: case POR_TOX:
case POR_HIDDEN: case POR_HIDDEN:
bGray = !pViewOptions->IsPagePreview() && bGray = !m_pViewOptions->IsPagePreview() &&
!pViewOptions->IsReadonly() && SwViewOption::IsFieldShadings(); !m_pViewOptions->IsReadonly() && SwViewOption::IsFieldShadings();
break; break;
case POR_TAB: bGray = pViewOptions->IsTab(); break; case POR_TAB: bGray = m_pViewOptions->IsTab(); break;
case POR_SOFTHYPH: bGray = pViewOptions->IsSoftHyph(); break; case POR_SOFTHYPH: bGray = m_pViewOptions->IsSoftHyph(); break;
case POR_BLANK: bGray = pViewOptions->IsHardBlank(); break; case POR_BLANK: bGray = m_pViewOptions->IsHardBlank(); break;
default: default:
break; // bGray is false break; // bGray is false
} }
...@@ -304,23 +304,23 @@ bool SwAccessiblePortionData::IsGrayPortionType( sal_uInt16 nType ) const ...@@ -304,23 +304,23 @@ bool SwAccessiblePortionData::IsGrayPortionType( sal_uInt16 nType ) const
const OUString& SwAccessiblePortionData::GetAccessibleString() const const OUString& SwAccessiblePortionData::GetAccessibleString() const
{ {
OSL_ENSURE( bFinished, "Shouldn't call this before we are done!" ); OSL_ENSURE( m_bFinished, "Shouldn't call this before we are done!" );
return sAccessibleString; return m_sAccessibleString;
} }
void SwAccessiblePortionData::GetLineBoundary( void SwAccessiblePortionData::GetLineBoundary(
Boundary& rBound, Boundary& rBound,
sal_Int32 nPos ) const sal_Int32 nPos ) const
{ {
FillBoundary( rBound, aLineBreaks, FillBoundary( rBound, m_aLineBreaks,
FindBreak( aLineBreaks, nPos ) ); FindBreak( m_aLineBreaks, nPos ) );
} }
// #i89175# // #i89175#
sal_Int32 SwAccessiblePortionData::GetLineCount() const sal_Int32 SwAccessiblePortionData::GetLineCount() const
{ {
size_t nBreaks = aLineBreaks.size(); size_t nBreaks = m_aLineBreaks.size();
// A non-empty paragraph has at least 4 breaks: one for each line3 and // A non-empty paragraph has at least 4 breaks: one for each line3 and
// 3 additional ones. // 3 additional ones.
// An empty paragraph has 3 breaks. // An empty paragraph has 3 breaks.
...@@ -333,7 +333,7 @@ sal_Int32 SwAccessiblePortionData::GetLineCount() const ...@@ -333,7 +333,7 @@ sal_Int32 SwAccessiblePortionData::GetLineCount() const
sal_Int32 SwAccessiblePortionData::GetLineNo( const sal_Int32 nPos ) const sal_Int32 SwAccessiblePortionData::GetLineNo( const sal_Int32 nPos ) const
{ {
sal_Int32 nLineNo = FindBreak( aLineBreaks, nPos ); sal_Int32 nLineNo = FindBreak( m_aLineBreaks, nPos );
// handling of position after last character // handling of position after last character
const sal_Int32 nLineCount( GetLineCount() ); const sal_Int32 nLineCount( GetLineCount() );
...@@ -348,42 +348,42 @@ sal_Int32 SwAccessiblePortionData::GetLineNo( const sal_Int32 nPos ) const ...@@ -348,42 +348,42 @@ sal_Int32 SwAccessiblePortionData::GetLineNo( const sal_Int32 nPos ) const
void SwAccessiblePortionData::GetBoundaryOfLine( const sal_Int32 nLineNo, void SwAccessiblePortionData::GetBoundaryOfLine( const sal_Int32 nLineNo,
i18n::Boundary& rLineBound ) i18n::Boundary& rLineBound )
{ {
FillBoundary( rLineBound, aLineBreaks, nLineNo ); FillBoundary( rLineBound, m_aLineBreaks, nLineNo );
} }
void SwAccessiblePortionData::GetLastLineBoundary( void SwAccessiblePortionData::GetLastLineBoundary(
Boundary& rBound ) const Boundary& rBound ) const
{ {
OSL_ENSURE( aLineBreaks.size() >= 2, "need min + max value" ); OSL_ENSURE( m_aLineBreaks.size() >= 2, "need min + max value" );
// The last two positions except the two delimiters are the ones // The last two positions except the two delimiters are the ones
// we are looking for, except for empty paragraphs (nBreaks==3) // we are looking for, except for empty paragraphs (nBreaks==3)
size_t nBreaks = aLineBreaks.size(); size_t nBreaks = m_aLineBreaks.size();
FillBoundary( rBound, aLineBreaks, nBreaks <= 3 ? 0 : nBreaks-4 ); FillBoundary( rBound, m_aLineBreaks, nBreaks <= 3 ? 0 : nBreaks-4 );
} }
sal_Int32 SwAccessiblePortionData::GetModelPosition( sal_Int32 nPos ) const sal_Int32 SwAccessiblePortionData::GetModelPosition( sal_Int32 nPos ) const
{ {
OSL_ENSURE( nPos >= 0, "illegal position" ); OSL_ENSURE( nPos >= 0, "illegal position" );
OSL_ENSURE( nPos <= sAccessibleString.getLength(), "illegal position" ); OSL_ENSURE( nPos <= m_sAccessibleString.getLength(), "illegal position" );
// find the portion number // find the portion number
size_t nPortionNo = FindBreak( aAccessiblePositions, nPos ); size_t nPortionNo = FindBreak( m_aAccessiblePositions, nPos );
// get model portion size // get model portion size
sal_Int32 nStartPos = aModelPositions[nPortionNo]; sal_Int32 nStartPos = m_aModelPositions[nPortionNo];
// if it's a non-special portion, move into the portion, else // if it's a non-special portion, move into the portion, else
// return the portion start // return the portion start
if( ! IsSpecialPortion( nPortionNo ) ) if( ! IsSpecialPortion( nPortionNo ) )
{ {
// 'wide' portions have to be of the same width // 'wide' portions have to be of the same width
OSL_ENSURE( ( aModelPositions[nPortionNo+1] - nStartPos ) == OSL_ENSURE( ( m_aModelPositions[nPortionNo+1] - nStartPos ) ==
( aAccessiblePositions[nPortionNo+1] - ( m_aAccessiblePositions[nPortionNo+1] -
aAccessiblePositions[nPortionNo] ), m_aAccessiblePositions[nPortionNo] ),
"accessibility portion disagrees with text model" ); "accessibility portion disagrees with text model" );
nStartPos += nPos - aAccessiblePositions[nPortionNo]; nStartPos += nPos - m_aAccessiblePositions[nPortionNo];
} }
// else: return nStartPos unmodified // else: return nStartPos unmodified
...@@ -479,30 +479,30 @@ void SwAccessiblePortionData::GetSentenceBoundary( ...@@ -479,30 +479,30 @@ void SwAccessiblePortionData::GetSentenceBoundary(
sal_Int32 nPos ) sal_Int32 nPos )
{ {
OSL_ENSURE( nPos >= 0, "illegal position; check before" ); OSL_ENSURE( nPos >= 0, "illegal position; check before" );
OSL_ENSURE( nPos < sAccessibleString.getLength(), "illegal position" ); OSL_ENSURE( nPos < m_sAccessibleString.getLength(), "illegal position" );
if( pSentences == nullptr ) if( m_pSentences == nullptr )
{ {
OSL_ENSURE( g_pBreakIt != nullptr, "We always need a break." ); OSL_ENSURE( g_pBreakIt != nullptr, "We always need a break." );
OSL_ENSURE( g_pBreakIt->GetBreakIter().is(), "No break-iterator." ); OSL_ENSURE( g_pBreakIt->GetBreakIter().is(), "No break-iterator." );
if( g_pBreakIt->GetBreakIter().is() ) if( g_pBreakIt->GetBreakIter().is() )
{ {
pSentences = new Positions_t(); m_pSentences = new Positions_t();
pSentences->reserve(10); m_pSentences->reserve(10);
// use xBreak->endOfSentence to iterate over all words; store // use xBreak->endOfSentence to iterate over all words; store
// positions in pSentences // positions in pSentences
sal_Int32 nCurrent = 0; sal_Int32 nCurrent = 0;
sal_Int32 nLength = sAccessibleString.getLength(); sal_Int32 nLength = m_sAccessibleString.getLength();
do do
{ {
pSentences->push_back( nCurrent ); m_pSentences->push_back( nCurrent );
const sal_Int32 nModelPos = GetModelPosition( nCurrent ); const sal_Int32 nModelPos = GetModelPosition( nCurrent );
sal_Int32 nNew = g_pBreakIt->GetBreakIter()->endOfSentence( sal_Int32 nNew = g_pBreakIt->GetBreakIter()->endOfSentence(
sAccessibleString, nCurrent, m_sAccessibleString, nCurrent,
g_pBreakIt->GetLocale(pTextNode->GetLang(nModelPos)) ) + 1; g_pBreakIt->GetLocale(m_pTextNode->GetLang(nModelPos)) ) + 1;
if( (nNew < 0) && (nNew > nLength) ) if( (nNew < 0) && (nNew > nLength) )
nNew = nLength; nNew = nLength;
...@@ -514,8 +514,8 @@ void SwAccessiblePortionData::GetSentenceBoundary( ...@@ -514,8 +514,8 @@ void SwAccessiblePortionData::GetSentenceBoundary(
while (nCurrent < nLength); while (nCurrent < nLength);
// finish with two terminators // finish with two terminators
pSentences->push_back( nLength ); m_pSentences->push_back( nLength );
pSentences->push_back( nLength ); m_pSentences->push_back( nLength );
} }
else else
{ {
...@@ -526,48 +526,48 @@ void SwAccessiblePortionData::GetSentenceBoundary( ...@@ -526,48 +526,48 @@ void SwAccessiblePortionData::GetSentenceBoundary(
} }
} }
FillBoundary( rBound, *pSentences, FindBreak( *pSentences, nPos ) ); FillBoundary( rBound, *m_pSentences, FindBreak( *m_pSentences, nPos ) );
} }
void SwAccessiblePortionData::GetAttributeBoundary( void SwAccessiblePortionData::GetAttributeBoundary(
Boundary& rBound, Boundary& rBound,
sal_Int32 nPos) const sal_Int32 nPos) const
{ {
OSL_ENSURE( pTextNode != nullptr, "Need SwTextNode!" ); OSL_ENSURE( m_pTextNode != nullptr, "Need SwTextNode!" );
// attribute boundaries can only occur on portion boundaries // attribute boundaries can only occur on portion boundaries
FillBoundary( rBound, aAccessiblePositions, FillBoundary( rBound, m_aAccessiblePositions,
FindBreak( aAccessiblePositions, nPos ) ); FindBreak( m_aAccessiblePositions, nPos ) );
} }
sal_Int32 SwAccessiblePortionData::GetAccessiblePosition( sal_Int32 nPos ) const sal_Int32 SwAccessiblePortionData::GetAccessiblePosition( sal_Int32 nPos ) const
{ {
OSL_ENSURE( nPos <= pTextNode->GetText().getLength(), "illegal position" ); OSL_ENSURE( nPos <= m_pTextNode->GetText().getLength(), "illegal position" );
// find the portion number // find the portion number
// #i70538# - consider "empty" model portions - e.g. number portion // #i70538# - consider "empty" model portions - e.g. number portion
size_t nPortionNo = FindLastBreak( aModelPositions, nPos ); size_t nPortionNo = FindLastBreak( m_aModelPositions, nPos );
sal_Int32 nRet = aAccessiblePositions[nPortionNo]; sal_Int32 nRet = m_aAccessiblePositions[nPortionNo];
// if the model portion has more than one position, go into it; // if the model portion has more than one position, go into it;
// else return that position // else return that position
sal_Int32 nStartPos = aModelPositions[nPortionNo]; sal_Int32 nStartPos = m_aModelPositions[nPortionNo];
sal_Int32 nEndPos = aModelPositions[nPortionNo+1]; sal_Int32 nEndPos = m_aModelPositions[nPortionNo+1];
if( (nEndPos - nStartPos) > 1 ) if( (nEndPos - nStartPos) > 1 )
{ {
// 'wide' portions have to be of the same width // 'wide' portions have to be of the same width
OSL_ENSURE( ( nEndPos - nStartPos ) == OSL_ENSURE( ( nEndPos - nStartPos ) ==
( aAccessiblePositions[nPortionNo+1] - ( m_aAccessiblePositions[nPortionNo+1] -
aAccessiblePositions[nPortionNo] ), m_aAccessiblePositions[nPortionNo] ),
"accessibility portion disagrees with text model" ); "accessibility portion disagrees with text model" );
sal_Int32 nWithinPortion = nPos - aModelPositions[nPortionNo]; sal_Int32 nWithinPortion = nPos - m_aModelPositions[nPortionNo];
nRet += nWithinPortion; nRet += nWithinPortion;
} }
// else: return nRet unmodified // else: return nRet unmodified
OSL_ENSURE( (nRet >= 0) && (nRet <= sAccessibleString.getLength()), OSL_ENSURE( (nRet >= 0) && (nRet <= m_sAccessibleString.getLength()),
"too long!" ); "too long!" );
return nRet; return nRet;
} }
...@@ -577,21 +577,21 @@ sal_Int32 SwAccessiblePortionData::FillSpecialPos( ...@@ -577,21 +577,21 @@ sal_Int32 SwAccessiblePortionData::FillSpecialPos(
SwSpecialPos& rPos, SwSpecialPos& rPos,
SwSpecialPos*& rpPos ) const SwSpecialPos*& rpPos ) const
{ {
size_t nPortionNo = FindLastBreak( aAccessiblePositions, nPos ); size_t nPortionNo = FindLastBreak( m_aAccessiblePositions, nPos );
SwSPExtendRange nExtend(SwSPExtendRange::NONE); SwSPExtendRange nExtend(SwSPExtendRange::NONE);
sal_Int32 nRefPos(0); sal_Int32 nRefPos(0);
sal_Int32 nModelPos(0); sal_Int32 nModelPos(0);
if( nPortionNo < nBeforePortions ) if( nPortionNo < m_nBeforePortions )
{ {
nExtend = SwSPExtendRange::BEFORE; nExtend = SwSPExtendRange::BEFORE;
rpPos = &rPos; rpPos = &rPos;
} }
else else
{ {
sal_Int32 nModelEndPos = aModelPositions[nPortionNo+1]; sal_Int32 nModelEndPos = m_aModelPositions[nPortionNo+1];
nModelPos = aModelPositions[nPortionNo]; nModelPos = m_aModelPositions[nPortionNo];
// skip backwards over zero-length portions, since GetCharRect() // skip backwards over zero-length portions, since GetCharRect()
// counts all model-zero-length portions as belonging to the // counts all model-zero-length portions as belonging to the
...@@ -601,22 +601,22 @@ sal_Int32 SwAccessiblePortionData::FillSpecialPos( ...@@ -601,22 +601,22 @@ sal_Int32 SwAccessiblePortionData::FillSpecialPos(
{ {
nCorePortionNo--; nCorePortionNo--;
nModelEndPos = nModelPos; nModelEndPos = nModelPos;
nModelPos = aModelPositions[nCorePortionNo]; nModelPos = m_aModelPositions[nCorePortionNo];
OSL_ENSURE( nModelPos >= 0, "Can't happen." ); OSL_ENSURE( nModelPos >= 0, "Can't happen." );
OSL_ENSURE( nCorePortionNo >= nBeforePortions, "Can't happen." ); OSL_ENSURE( nCorePortionNo >= m_nBeforePortions, "Can't happen." );
} }
OSL_ENSURE( nModelPos != nModelEndPos, OSL_ENSURE( nModelPos != nModelEndPos,
"portion with core-representation expected" ); "portion with core-representation expected" );
// if we have anything except plain text, compute nExtend + nRefPos // if we have anything except plain text, compute nExtend + nRefPos
if( (nModelEndPos - nModelPos == 1) && if( (nModelEndPos - nModelPos == 1) &&
(pTextNode->GetText()[nModelPos] != sAccessibleString[nPos])) (m_pTextNode->GetText()[nModelPos] != m_sAccessibleString[nPos]))
{ {
// case 1: a one-character, non-text portion // case 1: a one-character, non-text portion
// reference position is the first accessibilty for our // reference position is the first accessibilty for our
// core portion // core portion
nRefPos = aAccessiblePositions[ nCorePortionNo ]; nRefPos = m_aAccessiblePositions[ nCorePortionNo ];
nExtend = SwSPExtendRange::NONE; nExtend = SwSPExtendRange::NONE;
rpPos = &rPos; rpPos = &rPos;
} }
...@@ -626,7 +626,7 @@ sal_Int32 SwAccessiblePortionData::FillSpecialPos( ...@@ -626,7 +626,7 @@ sal_Int32 SwAccessiblePortionData::FillSpecialPos(
// zero-length portions // zero-length portions
// reference position is the first character of the next // reference position is the first character of the next
// portion, and we are 'behind' // portion, and we are 'behind'
nRefPos = aAccessiblePositions[ nCorePortionNo+1 ]; nRefPos = m_aAccessiblePositions[ nCorePortionNo+1 ];
nExtend = SwSPExtendRange::BEHIND; nExtend = SwSPExtendRange::BEHIND;
rpPos = &rPos; rpPos = &rPos;
} }
...@@ -634,11 +634,11 @@ sal_Int32 SwAccessiblePortionData::FillSpecialPos( ...@@ -634,11 +634,11 @@ sal_Int32 SwAccessiblePortionData::FillSpecialPos(
{ {
// case 3: regular text portion // case 3: regular text portion
OSL_ENSURE( ( nModelEndPos - nModelPos ) == OSL_ENSURE( ( nModelEndPos - nModelPos ) ==
( aAccessiblePositions[nPortionNo+1] - ( m_aAccessiblePositions[nPortionNo+1] -
aAccessiblePositions[nPortionNo] ), m_aAccessiblePositions[nPortionNo] ),
"text portion expected" ); "text portion expected" );
nModelPos += nPos - aAccessiblePositions[ nPortionNo ]; nModelPos += nPos - m_aAccessiblePositions[ nPortionNo ];
rpPos = nullptr; rpPos = nullptr;
} }
} }
...@@ -649,11 +649,11 @@ sal_Int32 SwAccessiblePortionData::FillSpecialPos( ...@@ -649,11 +649,11 @@ sal_Int32 SwAccessiblePortionData::FillSpecialPos(
// get the line number, and adjust nRefPos for the line // get the line number, and adjust nRefPos for the line
// (if necessary) // (if necessary)
size_t nRefLine = FindBreak( aLineBreaks, nRefPos ); size_t nRefLine = FindBreak( m_aLineBreaks, nRefPos );
size_t nMyLine = FindBreak( aLineBreaks, nPos ); size_t nMyLine = FindBreak( m_aLineBreaks, nPos );
sal_uInt16 nLineOffset = static_cast<sal_uInt16>( nMyLine - nRefLine ); sal_uInt16 nLineOffset = static_cast<sal_uInt16>( nMyLine - nRefLine );
if( nLineOffset != 0 ) if( nLineOffset != 0 )
nRefPos = aLineBreaks[ nMyLine ]; nRefPos = m_aLineBreaks[ nMyLine ];
// fill char offset and 'special position' // fill char offset and 'special position'
rPos.nCharOfst = nPos - nRefPos; rPos.nCharOfst = nPos - nRefPos;
...@@ -666,14 +666,14 @@ sal_Int32 SwAccessiblePortionData::FillSpecialPos( ...@@ -666,14 +666,14 @@ sal_Int32 SwAccessiblePortionData::FillSpecialPos(
bool SwAccessiblePortionData::FillBoundaryIFDateField( css::i18n::Boundary& rBound, const sal_Int32 nPos ) bool SwAccessiblePortionData::FillBoundaryIFDateField( css::i18n::Boundary& rBound, const sal_Int32 nPos )
{ {
if( aFieldPosition.size() < 2 ) if( m_aFieldPosition.size() < 2 )
return false; return false;
for( size_t i = 0; i < aFieldPosition.size() - 1; i += 2 ) for( size_t i = 0; i < m_aFieldPosition.size() - 1; i += 2 )
{ {
if( nPos < aFieldPosition[ i + 1 ] && nPos >= aFieldPosition[ i ] ) if( nPos < m_aFieldPosition[ i + 1 ] && nPos >= m_aFieldPosition[ i ] )
{ {
rBound.startPos = aFieldPosition[i]; rBound.startPos = m_aFieldPosition[i];
rBound.endPos = aFieldPosition[i + 1]; rBound.endPos = m_aFieldPosition[i + 1];
return true; return true;
} }
} }
...@@ -687,15 +687,15 @@ void SwAccessiblePortionData::AdjustAndCheck( ...@@ -687,15 +687,15 @@ void SwAccessiblePortionData::AdjustAndCheck(
bool& bEdit) const bool& bEdit) const
{ {
// find portion and get mode position // find portion and get mode position
nPortionNo = FindBreak( aAccessiblePositions, nPos ); nPortionNo = FindBreak( m_aAccessiblePositions, nPos );
nCorePos = aModelPositions[ nPortionNo ]; nCorePos = m_aModelPositions[ nPortionNo ];
// for special portions, make sure we're on a portion boundary // for special portions, make sure we're on a portion boundary
// for text portions, add the in-portion offset // for text portions, add the in-portion offset
if( IsSpecialPortion( nPortionNo ) ) if( IsSpecialPortion( nPortionNo ) )
bEdit &= nPos == aAccessiblePositions[nPortionNo]; bEdit &= nPos == m_aAccessiblePositions[nPortionNo];
else else
nCorePos += nPos - aAccessiblePositions[nPortionNo]; nCorePos += nPos - m_aAccessiblePositions[nPortionNo];
} }
bool SwAccessiblePortionData::GetEditableRange( bool SwAccessiblePortionData::GetEditableRange(
...@@ -738,14 +738,14 @@ bool SwAccessiblePortionData::GetEditableRange( ...@@ -738,14 +738,14 @@ bool SwAccessiblePortionData::GetEditableRange(
bool SwAccessiblePortionData::IsValidCorePosition( sal_Int32 nPos ) const bool SwAccessiblePortionData::IsValidCorePosition( sal_Int32 nPos ) const
{ {
// a position is valid its within the model positions that we know // a position is valid its within the model positions that we know
return ( aModelPositions[0] <= nPos ) && return ( m_aModelPositions[0] <= nPos ) &&
( nPos <= aModelPositions[ aModelPositions.size()-1 ] ); ( nPos <= m_aModelPositions[ m_aModelPositions.size()-1 ] );
} }
bool SwAccessiblePortionData::IsZeroCorePositionData() bool SwAccessiblePortionData::IsZeroCorePositionData()
{ {
if( aModelPositions.size() < 1 ) return true; if( m_aModelPositions.size() < 1 ) return true;
return aModelPositions[0] == 0 && aModelPositions[aModelPositions.size()-1] == 0; return m_aModelPositions[0] == 0 && m_aModelPositions[m_aModelPositions.size()-1] == 0;
} }
bool SwAccessiblePortionData::IsIndexInFootnode(sal_Int32 nIndex) bool SwAccessiblePortionData::IsIndexInFootnode(sal_Int32 nIndex)
...@@ -765,18 +765,18 @@ bool SwAccessiblePortionData::IsIndexInFootnode(sal_Int32 nIndex) ...@@ -765,18 +765,18 @@ bool SwAccessiblePortionData::IsIndexInFootnode(sal_Int32 nIndex)
bool SwAccessiblePortionData::IsInGrayPortion( sal_Int32 nPos ) bool SwAccessiblePortionData::IsInGrayPortion( sal_Int32 nPos )
{ {
// return IsGrayPortion( FindBreak( aAccessiblePositions, nPos ) ); // return IsGrayPortion( FindBreak( aAccessiblePositions, nPos ) );
return IsPortionAttrSet( FindBreak( aAccessiblePositions, nPos ), return IsPortionAttrSet( FindBreak( m_aAccessiblePositions, nPos ),
PORATTR_GRAY ); PORATTR_GRAY );
} }
sal_Int32 SwAccessiblePortionData::GetFieldIndex(sal_Int32 nPos) sal_Int32 SwAccessiblePortionData::GetFieldIndex(sal_Int32 nPos)
{ {
sal_Int32 nIndex = -1; sal_Int32 nIndex = -1;
if( aFieldPosition.size() >= 2 ) if( m_aFieldPosition.size() >= 2 )
{ {
for( size_t i = 0; i < aFieldPosition.size() - 1; i += 2 ) for( size_t i = 0; i < m_aFieldPosition.size() - 1; i += 2 )
{ {
if( nPos <= aFieldPosition[ i + 1 ] && nPos >= aFieldPosition[ i ] ) if( nPos <= m_aFieldPosition[ i + 1 ] && nPos >= m_aFieldPosition[ i ] )
{ {
nIndex = i/2; nIndex = i/2;
break; break;
...@@ -788,12 +788,12 @@ sal_Int32 SwAccessiblePortionData::GetFieldIndex(sal_Int32 nPos) ...@@ -788,12 +788,12 @@ sal_Int32 SwAccessiblePortionData::GetFieldIndex(sal_Int32 nPos)
sal_Int32 SwAccessiblePortionData::GetFirstValidCorePosition() const sal_Int32 SwAccessiblePortionData::GetFirstValidCorePosition() const
{ {
return aModelPositions[0]; return m_aModelPositions[0];
} }
sal_Int32 SwAccessiblePortionData::GetLastValidCorePosition() const sal_Int32 SwAccessiblePortionData::GetLastValidCorePosition() const
{ {
return aModelPositions[ aModelPositions.size()-1 ]; return m_aModelPositions[ m_aModelPositions.size()-1 ];
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -38,15 +38,15 @@ namespace com { namespace sun { namespace star { ...@@ -38,15 +38,15 @@ namespace com { namespace sun { namespace star {
class SwAccessiblePortionData : public SwPortionHandler class SwAccessiblePortionData : public SwPortionHandler
{ {
// the node this portion is referring to // the node this portion is referring to
const SwTextNode* pTextNode; const SwTextNode* m_pTextNode;
// variables used while collecting the data // variables used while collecting the data
OUStringBuffer aBuffer; OUStringBuffer m_aBuffer;
sal_Int32 nModelPosition; sal_Int32 m_nModelPosition;
const SwViewOption* pViewOptions; const SwViewOption* m_pViewOptions;
// the accessible string // the accessible string
OUString sAccessibleString; OUString m_sAccessibleString;
// positions array // positions array
// instances of Position_t must always include the minimum and // instances of Position_t must always include the minimum and
...@@ -54,20 +54,20 @@ class SwAccessiblePortionData : public SwPortionHandler ...@@ -54,20 +54,20 @@ class SwAccessiblePortionData : public SwPortionHandler
// algorithms) // algorithms)
typedef std::vector<sal_Int32> Positions_t; typedef std::vector<sal_Int32> Positions_t;
Positions_t aLineBreaks; /// position of line breaks Positions_t m_aLineBreaks; /// position of line breaks
Positions_t aModelPositions; /// position of portion breaks in the model Positions_t m_aModelPositions; /// position of portion breaks in the model
Positions_t aAccessiblePositions; /// portion breaks in sAccessibleString Positions_t m_aAccessiblePositions; /// portion breaks in sAccessibleString
Positions_t aFieldPosition; Positions_t m_aFieldPosition;
Positions_t aAttrFieldType; Positions_t m_aAttrFieldType;
typedef std::vector<sal_uInt8> PortionAttrs_t; typedef std::vector<sal_uInt8> PortionAttrs_t;
PortionAttrs_t aPortionAttrs; /// additional portion attributes PortionAttrs_t m_aPortionAttrs; /// additional portion attributes
Positions_t* pSentences; /// positions of sentence breaks Positions_t* m_pSentences; /// positions of sentence breaks
size_t nBeforePortions; /// # of portions before first model character size_t m_nBeforePortions; /// # of portions before first model character
bool bFinished; bool m_bFinished;
bool bLastIsSpecial; /// set if last portion was 'Special()' bool m_bLastIsSpecial; /// set if last portion was 'Special()'
/// returns the index of the first position whose value is smaller /// returns the index of the first position whose value is smaller
/// or equal, and whose following value is equal or larger /// or equal, and whose following value is equal or larger
......
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