accessibility/source/extended/textwindowaccessibility.cxx | 26 +--- basctl/source/basicide/baside2.cxx | 3 basctl/source/basicide/baside2b.cxx | 12 +- cui/source/dialogs/SpellDialog.cxx | 24 ++-- include/vcl/textdata.hxx | 10 - include/vcl/texteng.hxx | 10 - include/vcl/txtattr.hxx | 50 ++++---- sw/source/ui/dbui/mmaddressblockpage.cxx | 21 +-- vcl/source/control/edit.cxx | 12 -- vcl/source/edit/textdoc.cxx | 20 +-- vcl/source/edit/textdoc.hxx | 12 +- vcl/source/edit/texteng.cxx | 79 ++++++-------- vcl/source/edit/textundo.cxx | 8 - vcl/source/edit/textview.cxx | 71 +++++------- vcl/source/edit/xtextedt.cxx | 16 +- 15 files changed, 175 insertions(+), 199 deletions(-)
New commits: commit 44cd9ef88bfc14b4520de8a73a692f0d59c40946 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sat Aug 1 19:31:34 2015 +0200 sal_uInt16 to sal_Int32, constify, minor optimizations Change-Id: Icc41bbe09e495454ca27e9281eca6f4731a135c8 diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx index be6a976..2224fec 100644 --- a/accessibility/source/extended/textwindowaccessibility.cxx +++ b/accessibility/source/extended/textwindowaccessibility.cxx @@ -882,13 +882,11 @@ void Document::retrieveParagraphSelection(Paragraph const * pParagraph, if ( nNumber >= aMinPaM.GetPara() && nNumber <= aMaxPaM.GetPara() ) { - *pBegin = nNumber > aMinPaM.GetPara() - ? 0 - : static_cast< ::sal_Int32 >( aMinPaM.GetIndex() ); + *pBegin = nNumber > aMinPaM.GetPara() ? 0 : aMinPaM.GetIndex(); // XXX numeric overflow *pEnd = nNumber < aMaxPaM.GetPara() - ? static_cast< ::sal_Int32 >( m_rEngine.GetText(static_cast< ::sal_uLong >(nNumber)).getLength() ) - : static_cast< ::sal_Int32 >( aMaxPaM.GetIndex() ); + ? m_rEngine.GetText(static_cast< ::sal_uLong >(nNumber)).getLength() + : aMaxPaM.GetIndex(); // XXX numeric overflow (3x) if ( aStartPaM > aEndPaM ) @@ -909,8 +907,7 @@ void Document::retrieveParagraphSelection(Paragraph const * pParagraph, Paragraphs::size_type nNumber = pParagraph->getNumber(); TextPaM aEndPaM( rSelection.GetEnd() ); - return aEndPaM.GetPara() == nNumber - ? static_cast< ::sal_Int32 >(aEndPaM.GetIndex()) : -1; + return aEndPaM.GetPara() == nNumber ? aEndPaM.GetIndex() : -1; } css::awt::Rectangle @@ -974,8 +971,7 @@ Document::retrieveCharacterBounds(Paragraph const * pParagraph, ::TextPaM aPaM(m_rEngine.GetPaM(::Point(static_cast< long >(rPoint.X), static_cast< long >(rPoint.Y)))); // XXX numeric overflow (2x) - return aPaM.GetPara() == nNumber - ? static_cast< ::sal_Int32 >(aPaM.GetIndex()) : -1; + return aPaM.GetPara() == nNumber ? aPaM.GetIndex() : -1; // XXX numeric overflow } @@ -2248,13 +2244,11 @@ void Document::handleSelectionChangeNotification() "bad TEXT_HINT_VIEWSELECTIONCHANGED event"); ::sal_Int32 nNewFirstPara = static_cast< ::sal_Int32 >(rSelection.GetStart().GetPara()); - ::sal_Int32 nNewFirstPos - = static_cast< ::sal_Int32 >(rSelection.GetStart().GetIndex()); + ::sal_Int32 nNewFirstPos = rSelection.GetStart().GetIndex(); // XXX numeric overflow ::sal_Int32 nNewLastPara = static_cast< ::sal_Int32 >(rSelection.GetEnd().GetPara()); - ::sal_Int32 nNewLastPos - = static_cast< ::sal_Int32 >(rSelection.GetEnd().GetIndex()); + ::sal_Int32 nNewLastPos = rSelection.GetEnd().GetIndex(); // XXX numeric overflow // Lose focus: diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 9512e40..0a4277f 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -598,7 +598,7 @@ void EditorWindow::HandleAutoCorrect() { TextSelection aSel = GetEditView()->GetSelection(); sal_uLong nLine = aSel.GetStart().GetPara(); - sal_uInt16 nIndex = aSel.GetStart().GetIndex(); + const sal_Int32 nIndex = aSel.GetStart().GetIndex(); OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified const OUString& sActSubName = GetActualSubName( nLine ); // the actual procedure @@ -609,7 +609,7 @@ void EditorWindow::HandleAutoCorrect() return; HighlightPortion& r = aPortions.back(); - if( nIndex != aPortions.size()-1 ) + if( static_cast<size_t>(nIndex) != aPortions.size()-1 ) {//cursor is not standing at the end of the line for (std::vector<HighlightPortion>::iterator i(aPortions.begin()); i != aPortions.end(); ++i) @@ -675,14 +675,14 @@ void EditorWindow::HandleAutoCorrect() TextSelection EditorWindow::GetLastHighlightPortionTextSelection() {//creates a text selection from the highlight portion on the cursor sal_uLong nLine = GetEditView()->GetSelection().GetStart().GetPara(); - sal_uInt16 nIndex = GetEditView()->GetSelection().GetStart().GetIndex(); + const sal_Int32 nIndex = GetEditView()->GetSelection().GetStart().GetIndex(); OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified std::vector<HighlightPortion> aPortions; aHighlighter.getHighlightPortions( aLine, aPortions ); assert(!aPortions.empty()); HighlightPortion& r = aPortions.back(); - if( nIndex != aPortions.size()-1 ) + if( static_cast<size_t>(nIndex) != aPortions.size()-1 ) {//cursor is not standing at the end of the line for (std::vector<HighlightPortion>::iterator i(aPortions.begin()); i != aPortions.end(); ++i) @@ -906,8 +906,8 @@ void EditorWindow::SetupAndShowCodeCompleteWnd( const std::vector< OUString >& a pCodeCompleteWnd->ResizeAndPositionListBox(); pCodeCompleteWnd->SelectFirstEntry(); // correct text selection, and set it - aSel.GetStart().GetIndex() += 1; - aSel.GetEnd().GetIndex() += 1; + ++aSel.GetStart().GetIndex(); + ++aSel.GetEnd().GetIndex(); pCodeCompleteWnd->SetTextSelection( aSel ); //give the focus to the EditView pEditView->GetWindow()->GrabFocus(); diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx index 631ab8c..754cb7b 100644 --- a/cui/source/dialogs/SpellDialog.cxx +++ b/cui/source/dialogs/SpellDialog.cxx @@ -1601,10 +1601,10 @@ bool SentenceEditWindow_Impl::MarkNextError( bool bIgnoreCurrentError, css::uno: ChangeMarkedWord(sReplacement, LanguageTag::convertToLanguageType( pSpellErrorDescription->aLocale )); - aCursor.GetIndex() = aCursor.GetIndex() + (sal_uInt16)(xEntry->getReplacementText().getLength()); + aCursor.GetIndex() += xEntry->getReplacementText().getLength(); // maybe the error found here is already added to the dictionary and has to be ignored } else if(pSpellErrorDescription && !bGrammarError && xSpell->isValid( GetErrorText(), LanguageTag::convertToLanguageType( pSpellErrorDescription->aLocale ), Sequence< PropertyValue >() )) { - aCursor.GetIndex() = aCursor.GetIndex() + 1; + ++aCursor.GetIndex(); } else break; @@ -1853,7 +1853,7 @@ svx::SpellPortions SentenceEditWindow_Impl::CreateSpellPortions( bool bSetIgnore pLastError = pError; } - aCursor.GetIndex()++; + ++aCursor.GetIndex(); } if(nTextLen && aBreakPositions.empty()) diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx index 83929a0..69af627 100644 --- a/vcl/source/edit/texteng.cxx +++ b/vcl/source/edit/texteng.cxx @@ -53,6 +53,7 @@ #include <unicode/ubidi.h> +#include <algorithm> #include <cstdlib> #include <memory> #include <set> @@ -410,7 +411,7 @@ OUString TextEngine::GetText( const TextSelection& rSel, LineEnd aSeparator ) co { TextNode* pNode = mpDoc->GetNodes()[ nNode ]; - sal_uInt16 nStartPos = 0; + sal_Int32 nStartPos = 0; sal_Int32 nEndPos = pNode->GetText().getLength(); if ( nNode == nStartPara ) nStartPos = aSel.GetStart().GetIndex(); @@ -637,10 +638,7 @@ bool TextEngine::IsInputSequenceCheckingRequired( sal_Unicode c, const TextSelec SvtCTLOptions aCTLOptions; // get the index that really is first - sal_uInt16 nFirstPos = rCurSel.GetStart().GetIndex(); - sal_uInt16 nMaxPos = rCurSel.GetEnd().GetIndex(); - if (nMaxPos < nFirstPos) - nFirstPos = nMaxPos; + const sal_Int32 nFirstPos = std::min(rCurSel.GetStart().GetIndex(), rCurSel.GetEnd().GetIndex()); bool bIsSequenceChecking = aCTLOptions.IsCTLFontEnabled() && @@ -685,7 +683,7 @@ TextPaM TextEngine::ImpInsertText( sal_Unicode c, const TextSelection& rCurSel, { // if selection, then don't overwrite a character TextSelection aTmpSel( aPaM ); - aTmpSel.GetEnd().GetIndex()++; + ++aTmpSel.GetEnd().GetIndex(); ImpDeleteText( aTmpSel ); } @@ -721,7 +719,7 @@ TextPaM TextEngine::ImpInsertText( sal_Unicode c, const TextSelection& rCurSel, OUString aChgText( aNewText.copy( nChgPos ) ); // select text from first pos to be changed to current pos - TextSelection aSel( TextPaM( aPaM.GetPara(), (sal_uInt16) nChgPos ), aPaM ); + TextSelection aSel( TextPaM( aPaM.GetPara(), nChgPos ), aPaM ); if (!aChgText.isEmpty()) // ImpInsertText implicitly handles undo... @@ -895,7 +893,7 @@ Rectangle TextEngine::GetEditCursor( const TextPaM& rPaM, bool bSpecial, bool bP */ long nY = 0; - sal_uInt16 nCurIndex = 0; + sal_Int32 nCurIndex = 0; TextLine* pLine = 0; for ( size_t nLine = 0; nLine < pPortion->GetLines().size(); nLine++ ) { @@ -1678,7 +1676,7 @@ void TextEngine::ImpBreakLine( sal_uLong nPara, TextLine* pLine, TETextPortion*, static const com::sun::star::lang::Locale aDefLocale; i18n::LineBreakResults aLBR = xBI->getLineBreak( pNode->GetText(), nMaxBreakPos, aDefLocale, pLine->GetStart(), aHyphOptions, aUserOptions ); - sal_uInt16 nBreakPos = (sal_uInt16)aLBR.breakIndex; + sal_Int32 nBreakPos = aLBR.breakIndex; if ( nBreakPos <= pLine->GetStart() ) { nBreakPos = nMaxBreakPos; @@ -1960,7 +1958,7 @@ void TextEngine::ImpPaint( OutputDevice* pOutDev, const Point& rStartPos, Rectan { // for all lines of the paragraph sal_uInt16 nLines = pPortion->GetLines().size(); - sal_uInt16 nIndex = 0; + sal_Int32 nIndex = 0; for ( sal_uInt16 nLine = 0; nLine < nLines; nLine++ ) { TextLine& pLine = pPortion->GetLines()[nLine]; @@ -2004,8 +2002,8 @@ void TextEngine::ImpPaint( OutputDevice* pOutDev, const Point& rStartPos, Rectan aFont.SetTransparent( false ); pOutDev->SetFont( aFont ); - sal_uInt16 nTmpIndex = nIndex; - sal_uInt16 nEnd = nTmpIndex + pTextPortion->GetLen(); + sal_Int32 nTmpIndex = nIndex; + sal_Int32 nEnd = nTmpIndex + pTextPortion->GetLen(); Point aPos = aTmpPos; if ( pPaintRange ) { @@ -2030,12 +2028,10 @@ void TextEngine::ImpPaint( OutputDevice* pOutDev, const Point& rStartPos, Rectan TextPaM aTextEnd( nPara, nEnd ); if ( ( aTextStart < *pSelEnd ) && ( aTextEnd > *pSelStart ) ) { - sal_uInt16 nL; - // 1) vcl::Region before Selection if ( aTextStart < *pSelStart ) { - nL = pSelStart->GetIndex() - nTmpIndex; + const sal_Int32 nL = pSelStart->GetIndex() - nTmpIndex; pOutDev->SetFont( aFont); aPos.X() = rStartPos.X() + ImpGetOutputOffset( nPara, &pLine, nTmpIndex, nTmpIndex+nL ); pOutDev->DrawText( aPos, pPortion->GetNode()->GetText(), nTmpIndex, nL ); @@ -2043,7 +2039,7 @@ void TextEngine::ImpPaint( OutputDevice* pOutDev, const Point& rStartPos, Rectan } // 2) vcl::Region with Selection - nL = nEnd-nTmpIndex; + sal_Int32 nL = nEnd - nTmpIndex; if ( aTextEnd > *pSelEnd ) nL = pSelEnd->GetIndex() - nTmpIndex; if ( nL ) @@ -2464,8 +2460,8 @@ OUString TextEngine::GetWord( const TextPaM& rCursorPos, TextPaM* pStartOfWord ) TextNode* pNode = mpDoc->GetNodes()[ rCursorPos.GetPara() ]; uno::Reference < i18n::XBreakIterator > xBI = GetBreakIterator(); i18n::Boundary aBoundary = xBI->getWordBoundary( pNode->GetText(), rCursorPos.GetIndex(), GetLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES, true ); - aSel.GetStart().GetIndex() = (sal_uInt16)aBoundary.startPos; - aSel.GetEnd().GetIndex() = (sal_uInt16)aBoundary.endPos; + aSel.GetStart().GetIndex() = aBoundary.startPos; + aSel.GetEnd().GetIndex() = aBoundary.endPos; aWord = pNode->GetText().copy( aSel.GetStart().GetIndex(), aSel.GetEnd().GetIndex() - aSel.GetStart().GetIndex() ); if ( pStartOfWord ) *pStartOfWord = aSel.GetStart(); @@ -2541,12 +2537,10 @@ bool TextEngine::Write( SvStream& rOutput, const TextSelection* pSel, bool bHTML { TextNode* pNode = mpDoc->GetNodes()[ nPara ]; - sal_Int32 nStartPos = 0; - sal_Int32 nEndPos = pNode->GetText().getLength(); - if ( nPara == aSel.GetStart().GetPara() ) - nStartPos = aSel.GetStart().GetIndex(); - if ( nPara == aSel.GetEnd().GetPara() ) - nEndPos = aSel.GetEnd().GetIndex(); + const sal_Int32 nStartPos = nPara == aSel.GetStart().GetPara() + ? aSel.GetStart().GetIndex() : 0; + const sal_Int32 nEndPos = nPara == aSel.GetEnd().GetPara() + ? aSel.GetEnd().GetIndex() : pNode->GetText().getLength(); OUStringBuffer aText; if ( !bHTML ) @@ -2831,7 +2825,7 @@ void TextEngine::ImpCharsInserted( sal_uLong nPara, sal_Int32 nPos, sal_Int32 nC if ( rPaM.GetPara() == nPara ) { if ( rPaM.GetIndex() >= nPos ) - rPaM.GetIndex() = rPaM.GetIndex() + nChars; + rPaM.GetIndex() += nChars; } } } diff --git a/vcl/source/edit/textundo.cxx b/vcl/source/edit/textundo.cxx index 1ba423a..328c3ca 100644 --- a/vcl/source/edit/textundo.cxx +++ b/vcl/source/edit/textundo.cxx @@ -259,7 +259,7 @@ TextUndoInsertChars::TextUndoInsertChars( TextEngine* pTextEngine, const TextPaM void TextUndoInsertChars::Undo() { TextSelection aSel( maTextPaM, maTextPaM ); - aSel.GetEnd().GetIndex() = aSel.GetEnd().GetIndex() + maText.getLength(); + aSel.GetEnd().GetIndex() += maText.getLength(); TextPaM aPaM = GetTextEngine()->ImpDeleteText( aSel ); SetSelection( aPaM ); } @@ -269,7 +269,7 @@ void TextUndoInsertChars::Redo() TextSelection aSel( maTextPaM, maTextPaM ); GetTextEngine()->ImpInsertText( aSel, maText ); TextPaM aNewPaM( maTextPaM ); - aNewPaM.GetIndex() = aNewPaM.GetIndex() + maText.getLength(); + aNewPaM.GetIndex() += maText.getLength(); SetSelection( TextSelection( aSel.GetStart(), aNewPaM ) ); } @@ -309,14 +309,14 @@ void TextUndoRemoveChars::Undo() { TextSelection aSel( maTextPaM, maTextPaM ); GetTextEngine()->ImpInsertText( aSel, maText ); - aSel.GetEnd().GetIndex() = aSel.GetEnd().GetIndex() + maText.getLength(); + aSel.GetEnd().GetIndex() += maText.getLength(); SetSelection( aSel ); } void TextUndoRemoveChars::Redo() { TextSelection aSel( maTextPaM, maTextPaM ); - aSel.GetEnd().GetIndex() = aSel.GetEnd().GetIndex() + maText.getLength(); + aSel.GetEnd().GetIndex() += maText.getLength(); TextPaM aPaM = GetTextEngine()->ImpDeleteText( aSel ); SetSelection( aPaM ); } diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx index affa0c8..f680f23 100644 --- a/vcl/source/edit/textview.cxx +++ b/vcl/source/edit/textview.cxx @@ -56,6 +56,8 @@ #include <osl/mutex.hxx> +#include <algorithm> + using namespace ::com::sun::star; class TETextDataObject : public ::com::sun::star::datatransfer::XTransferable, @@ -418,8 +420,8 @@ void TextView::ImpHighlight( const TextSelection& rSel ) for ( sal_uInt16 nLine = nStartLine; nLine <= nEndLine; nLine++ ) { TextLine& pLine = pTEParaPortion->GetLines()[ nLine ]; - sal_uInt16 nStartIndex = pLine.GetStart(); - sal_uInt16 nEndIndex = pLine.GetEnd(); + sal_Int32 nStartIndex = pLine.GetStart(); + sal_Int32 nEndIndex = pLine.GetEnd(); if ( ( nPara == nStartPara ) && ( nLine == nStartLine ) ) nStartIndex = aSel.GetStart().GetIndex(); if ( ( nPara == nEndPara ) && ( nLine == nEndLine ) ) @@ -732,7 +734,7 @@ bool TextView::KeyInput( const KeyEvent& rKeyEvent ) if ( mpImpl->mbAutoIndent ) { TextNode* pPrev = mpImpl->mpTextEngine->mpDoc->GetNodes()[ aCurSel.GetEnd().GetPara() - 1 ]; - sal_uInt16 n = 0; + sal_Int32 n = 0; while ( ( n < pPrev->GetText().getLength() ) && ( ( pPrev->GetText()[ n ] == ' ' ) || ( pPrev->GetText()[ n ] == '\t' ) ) ) @@ -856,18 +858,16 @@ void TextView::MouseButtonDown( const MouseEvent& rMouseEvent ) uno::Reference < i18n::XBreakIterator > xBI = mpImpl->mpTextEngine->GetBreakIterator(); i18n::Boundary aBoundary = xBI->getWordBoundary( pNode->GetText(), mpImpl->maSelection.GetEnd().GetIndex(), mpImpl->mpTextEngine->GetLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES, true ); TextSelection aNewSel( mpImpl->maSelection ); - aNewSel.GetStart().GetIndex() = (sal_uInt16)aBoundary.startPos; - aNewSel.GetEnd().GetIndex() = (sal_uInt16)aBoundary.endPos; + aNewSel.GetStart().GetIndex() = aBoundary.startPos; + aNewSel.GetEnd().GetIndex() = aBoundary.endPos; if(mpImpl->mbSupportProtectAttribute) { //expand selection to include all protected content - if there is any const TextCharAttrib* pStartAttr = mpImpl->mpTextEngine->FindCharAttrib( - TextPaM(aNewSel.GetStart().GetPara(), - (sal_uInt16)aBoundary.startPos), + TextPaM(aNewSel.GetStart().GetPara(), aBoundary.startPos), TEXTATTR_PROTECTED ); const TextCharAttrib* pEndAttr = mpImpl->mpTextEngine->FindCharAttrib( - TextPaM(aNewSel.GetEnd().GetPara(), - (sal_uInt16)aBoundary.endPos), + TextPaM(aNewSel.GetEnd().GetPara(), aBoundary.endPos), TEXTATTR_PROTECTED ); if(pStartAttr && pStartAttr->GetStart() < aNewSel.GetStart().GetIndex()) { @@ -950,14 +950,14 @@ void TextView::Command( const CommandEvent& rCEvt ) if ( !pData->IsOnlyCursorChanged() ) { TextSelection aSelect( mpImpl->mpTextEngine->mpIMEInfos->aPos ); - aSelect.GetEnd().GetIndex() = aSelect.GetEnd().GetIndex() + mpImpl->mpTextEngine->mpIMEInfos->nLen; + aSelect.GetEnd().GetIndex() += mpImpl->mpTextEngine->mpIMEInfos->nLen; aSelect = mpImpl->mpTextEngine->ImpDeleteText( aSelect ); aSelect = mpImpl->mpTextEngine->ImpInsertText( aSelect, pData->GetText() ); if ( mpImpl->mpTextEngine->mpIMEInfos->bWasCursorOverwrite ) { - sal_Int32 nOldIMETextLen = mpImpl->mpTextEngine->mpIMEInfos->nLen; - sal_Int32 nNewIMETextLen = pData->GetText().getLength(); + const sal_Int32 nOldIMETextLen = mpImpl->mpTextEngine->mpIMEInfos->nLen; + const sal_Int32 nNewIMETextLen = pData->GetText().getLength(); if ( ( nOldIMETextLen > nNewIMETextLen ) && ( nNewIMETextLen < mpImpl->mpTextEngine->mpIMEInfos->aOldTextAfterStartPos.getLength() ) ) @@ -965,22 +965,19 @@ void TextView::Command( const CommandEvent& rCEvt ) // restore old characters sal_Int32 nRestore = nOldIMETextLen - nNewIMETextLen; TextPaM aPaM( mpImpl->mpTextEngine->mpIMEInfos->aPos ); - aPaM.GetIndex() = aPaM.GetIndex() + nNewIMETextLen; + aPaM.GetIndex() += nNewIMETextLen; mpImpl->mpTextEngine->ImpInsertText( aPaM, mpImpl->mpTextEngine->mpIMEInfos->aOldTextAfterStartPos.copy( nNewIMETextLen, nRestore ) ); } else if ( ( nOldIMETextLen < nNewIMETextLen ) && ( nOldIMETextLen < mpImpl->mpTextEngine->mpIMEInfos->aOldTextAfterStartPos.getLength() ) ) { // overwrite - sal_uInt16 nOverwrite = nNewIMETextLen - nOldIMETextLen; - if ( ( nOldIMETextLen + nOverwrite ) > mpImpl->mpTextEngine->mpIMEInfos->aOldTextAfterStartPos.getLength() ) - nOverwrite = mpImpl->mpTextEngine->mpIMEInfos->aOldTextAfterStartPos.getLength() - nOldIMETextLen; + const sal_Int32 nOverwrite = std::min( nNewIMETextLen, mpImpl->mpTextEngine->mpIMEInfos->aOldTextAfterStartPos.getLength() ) - nOldIMETextLen; DBG_ASSERT( nOverwrite && (nOverwrite < 0xFF00), "IME Overwrite?!" ); TextPaM aPaM( mpImpl->mpTextEngine->mpIMEInfos->aPos ); - aPaM.GetIndex() = aPaM.GetIndex() + nNewIMETextLen; + aPaM.GetIndex() += nNewIMETextLen; TextSelection aSel( aPaM ); - aSel.GetEnd().GetIndex() = - aSel.GetEnd().GetIndex() + nOverwrite; + aSel.GetEnd().GetIndex() += nOverwrite; mpImpl->mpTextEngine->ImpDeleteText( aSel ); } } @@ -1367,7 +1364,7 @@ TextPaM TextView::CursorLeft( const TextPaM& rPaM, sal_uInt16 nCharacterIterator TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes()[ aPaM.GetPara() ]; uno::Reference < i18n::XBreakIterator > xBI = mpImpl->mpTextEngine->GetBreakIterator(); sal_Int32 nCount = 1; - aPaM.GetIndex() = (sal_uInt16)xBI->previousCharacters( pNode->GetText(), aPaM.GetIndex(), mpImpl->mpTextEngine->GetLocale(), nCharacterIteratorMode, nCount, nCount ); + aPaM.GetIndex() = xBI->previousCharacters( pNode->GetText(), aPaM.GetIndex(), mpImpl->mpTextEngine->GetLocale(), nCharacterIteratorMode, nCount, nCount ); } else if ( aPaM.GetPara() ) { @@ -1387,7 +1384,7 @@ TextPaM TextView::CursorRight( const TextPaM& rPaM, sal_uInt16 nCharacterIterato { uno::Reference < i18n::XBreakIterator > xBI = mpImpl->mpTextEngine->GetBreakIterator(); sal_Int32 nCount = 1; - aPaM.GetIndex() = (sal_uInt16)xBI->nextCharacters( pNode->GetText(), aPaM.GetIndex(), mpImpl->mpTextEngine->GetLocale(), nCharacterIteratorMode, nCount, nCount ); + aPaM.GetIndex() = xBI->nextCharacters( pNode->GetText(), aPaM.GetIndex(), mpImpl->mpTextEngine->GetLocale(), nCharacterIteratorMode, nCount, nCount ); } else if ( aPaM.GetPara() < ( mpImpl->mpTextEngine->mpDoc->GetNodes().size()-1) ) { @@ -1409,7 +1406,7 @@ TextPaM TextView::CursorWordLeft( const TextPaM& rPaM ) i18n::Boundary aBoundary = xBI->getWordBoundary( pNode->GetText(), rPaM.GetIndex(), mpImpl->mpTextEngine->GetLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES, true ); if ( aBoundary.startPos >= rPaM.GetIndex() ) aBoundary = xBI->previousWord( pNode->GetText(), rPaM.GetIndex(), mpImpl->mpTextEngine->GetLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES ); - aPaM.GetIndex() = ( aBoundary.startPos != -1 ) ? (sal_uInt16)aBoundary.startPos : 0; + aPaM.GetIndex() = ( aBoundary.startPos != -1 ) ? aBoundary.startPos : 0; } else if ( aPaM.GetPara() ) { @@ -1429,7 +1426,7 @@ TextPaM TextView::CursorWordRight( const TextPaM& rPaM ) { uno::Reference < i18n::XBreakIterator > xBI = mpImpl->mpTextEngine->GetBreakIterator(); i18n::Boundary aBoundary = xBI->nextWord( pNode->GetText(), aPaM.GetIndex(), mpImpl->mpTextEngine->GetLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES ); - aPaM.GetIndex() = (sal_uInt16)aBoundary.startPos; + aPaM.GetIndex() = aBoundary.startPos; } else if ( aPaM.GetPara() < ( mpImpl->mpTextEngine->mpDoc->GetNodes().size()-1) ) { @@ -1461,7 +1458,7 @@ TextPaM TextView::ImpDelete( sal_uInt8 nMode, sal_uInt8 nDelMode ) if ( aBoundary.startPos == mpImpl->maSelection.GetEnd().GetIndex() ) aBoundary = xBI->previousWord( pNode->GetText(), mpImpl->maSelection.GetEnd().GetIndex(), mpImpl->mpTextEngine->GetLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES ); // #i63506# startPos is -1 when the paragraph starts with a tab - aEndPaM.GetIndex() = (aBoundary.startPos >= 0) ? (sal_uInt16)aBoundary.startPos : 0; + aEndPaM.GetIndex() = std::max<sal_Int32>(aBoundary.startPos, 0); } else // DELMODE_RESTOFCONTENT { @@ -1486,7 +1483,7 @@ TextPaM TextView::ImpDelete( sal_uInt8 nMode, sal_uInt8 nDelMode ) TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes()[ aEndPaM.GetPara() ]; uno::Reference < i18n::XBreakIterator > xBI = mpImpl->mpTextEngine->GetBreakIterator(); i18n::Boundary aBoundary = xBI->nextWord( pNode->GetText(), mpImpl->maSelection.GetEnd().GetIndex(), mpImpl->mpTextEngine->GetLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES ); - aEndPaM.GetIndex() = (sal_uInt16)aBoundary.startPos; + aEndPaM.GetIndex() = aBoundary.startPos; } else // DELMODE_RESTOFCONTENT { @@ -1530,7 +1527,7 @@ TextPaM TextView::CursorUp( const TextPaM& rPaM ) // Problem: Last character of an automatically wrapped line = Cursor TextLine& pLine = pPPortion->GetLines()[ nLine - 1 ]; if ( aPaM.GetIndex() && ( aPaM.GetIndex() == pLine.GetEnd() ) ) - aPaM.GetIndex()--; + --aPaM.GetIndex(); } else if ( rPaM.GetPara() ) // previous paragraph { @@ -1567,7 +1564,7 @@ TextPaM TextView::CursorDown( const TextPaM& rPaM ) // special case CursorUp TextLine& pLine = pPPortion->GetLines()[ nLine + 1 ]; if ( ( aPaM.GetIndex() == pLine.GetEnd() ) && ( aPaM.GetIndex() > pLine.GetStart() ) && aPaM.GetIndex() < pPPortion->GetNode()->GetText().getLength() ) - aPaM.GetIndex()--; + --aPaM.GetIndex(); } else if ( rPaM.GetPara() < ( mpImpl->mpTextEngine->mpDoc->GetNodes().size() - 1 ) ) // next paragraph { @@ -1577,7 +1574,7 @@ TextPaM TextView::CursorDown( const TextPaM& rPaM ) aPaM.GetIndex() = nCharPos; TextLine& pLine = pPPortion->GetLines().front(); if ( ( aPaM.GetIndex() == pLine.GetEnd() ) && ( aPaM.GetIndex() > pLine.GetStart() ) && ( pPPortion->GetLines().size() > 1 ) ) - aPaM.GetIndex()--; + --aPaM.GetIndex(); } return aPaM; @@ -1612,7 +1609,7 @@ TextPaM TextView::CursorEndOfLine( const TextPaM& rPaM ) // for a blank in an automatically-wrapped line it is better to stand before it, // as the user will intend to stand behind the prior word. // If there is a change, special case for Pos1 after End! - aPaM.GetIndex()--; + --aPaM.GetIndex(); } } return aPaM; @@ -2094,11 +2091,9 @@ void TextView::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEv const sal_Int32 nNewChars = mpImpl->mpTextEngine->GetTextLen( aPrevSel.GetStart().GetPara() ) - nPrevStartParaLen; - aPrevSel.GetStart().GetIndex() = - aPrevSel.GetStart().GetIndex() + nNewChars; + aPrevSel.GetStart().GetIndex() += nNewChars; if ( aPrevSel.GetStart().GetPara() == aPrevSel.GetEnd().GetPara() ) - aPrevSel.GetEnd().GetIndex() = - aPrevSel.GetEnd().GetIndex() + nNewChars; + aPrevSel.GetEnd().GetIndex() += nNewChars; } } else @@ -2108,11 +2103,9 @@ void TextView::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEv aPaM.GetPara() -= ( aPrevSel.GetEnd().GetPara() - aPrevSel.GetStart().GetPara() ); if ( aPrevSel.GetEnd().GetPara() == mpImpl->mpDDInfo->maDropPos.GetPara() ) { - aPaM.GetIndex() = - aPaM.GetIndex() - aPrevSel.GetEnd().GetIndex(); + aPaM.GetIndex() -= aPrevSel.GetEnd().GetIndex(); if ( aPrevSel.GetStart().GetPara() == mpImpl->mpDDInfo->maDropPos.GetPara() ) - aPaM.GetIndex() = - aPaM.GetIndex() + aPrevSel.GetStart().GetIndex(); + aPaM.GetIndex() += aPrevSel.GetStart().GetIndex(); } ImpSetSelection( aPaM ); diff --git a/vcl/source/edit/xtextedt.cxx b/vcl/source/edit/xtextedt.cxx index 072e1f9..de773e2 100644 --- a/vcl/source/edit/xtextedt.cxx +++ b/vcl/source/edit/xtextedt.cxx @@ -37,7 +37,7 @@ ExtTextEngine::~ExtTextEngine() TextSelection ExtTextEngine::MatchGroup( const TextPaM& rCursor ) const { TextSelection aSel( rCursor ); - sal_uInt16 nPos = rCursor.GetIndex(); + const sal_Int32 nPos = rCursor.GetIndex(); sal_uLong nPara = rCursor.GetPara(); sal_uLong nParas = GetParagraphCount(); if ( ( nPara < nParas ) && ( nPos < GetTextLen( nPara ) ) ) @@ -51,7 +51,7 @@ TextSelection ExtTextEngine::MatchGroup( const TextPaM& rCursor ) const sal_Unicode nSC = maGroupChars[ nMatchIndex ]; sal_Unicode nEC = maGroupChars[ nMatchIndex+1 ]; - sal_uInt16 nCur = nPos+1; + sal_Int32 nCur = nPos+1; sal_uInt16 nLevel = 1; while ( nLevel && ( nPara < nParas ) ) { @@ -87,7 +87,7 @@ TextSelection ExtTextEngine::MatchGroup( const TextPaM& rCursor ) const sal_Unicode nEC = maGroupChars[ nMatchIndex ]; sal_Unicode nSC = maGroupChars[ nMatchIndex-1 ]; - sal_uInt16 nCur = rCursor.GetIndex()-1; + sal_Int32 nCur = rCursor.GetIndex()-1; sal_uInt16 nLevel = 1; while ( nLevel ) { @@ -124,7 +124,7 @@ TextSelection ExtTextEngine::MatchGroup( const TextPaM& rCursor ) const if ( nLevel == 0 ) // found { aSel.GetStart() = rCursor; - aSel.GetStart().GetIndex()++; // behind the char + ++aSel.GetStart().GetIndex(); // behind the char aSel.GetEnd() = TextPaM( nPara, nCur ); } } @@ -373,16 +373,16 @@ bool ExtTextView::ImpIndentBlock( bool bRight ) bool bRange = aSel.HasRange(); if ( bRight ) { - aSel.GetStart().GetIndex()++; + ++aSel.GetStart().GetIndex(); if ( bRange && ( aSel.GetEnd().GetPara() == nEndPara ) ) - aSel.GetEnd().GetIndex()++; + ++aSel.GetEnd().GetIndex(); } else { if ( aSel.GetStart().GetIndex() ) - aSel.GetStart().GetIndex()--; + --aSel.GetStart().GetIndex(); if ( bRange && aSel.GetEnd().GetIndex() ) - aSel.GetEnd().GetIndex()--; + --aSel.GetEnd().GetIndex(); } ImpSetSelection( aSel ); commit 9b49846fad132f121b2848c69477e42a0051884e Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sat Aug 1 15:41:34 2015 +0200 Simplify Change-Id: Ia0de7ff756d9578b6c036d713ef1394f8a1461d6 diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx index 9b0b284..1bb0ec8 100644 --- a/sw/source/ui/dbui/mmaddressblockpage.cxx +++ b/sw/source/ui/dbui/mmaddressblockpage.cxx @@ -1411,15 +1411,16 @@ void AddressMultiLineEdit::SetText( const OUString& rStr ) TextPaM aPaM(nPara, sPara.getLength()); pTextEngine->ReplaceText(TextSelection( aPaM ), " "); } - while(true) + for(;;) { - sal_Int32 nStart = sPara.indexOf( '<', nIndex ); - sal_Int32 nEnd = nStart == -1 ? -1 : sPara.indexOf( '>', nStart ); - nIndex = nEnd; - if(nStart != -1 && nEnd != -1) - pTextEngine->SetAttrib( aProtectAttr, nPara, nStart, nEnd + 1, false ); - else + const sal_Int32 nStart = sPara.indexOf( '<', nIndex ); + if (nStart < 0) + break; + const sal_Int32 nEnd = sPara.indexOf( '>', nStart ); + if (nEnd < 0) break; + nIndex = nEnd; + pTextEngine->SetAttrib( aProtectAttr, nPara, nStart, nEnd + 1, false ); } } commit 7669cbf594b6bc1cc2731f2da6a0d17a0e9954fe Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Sat Aug 1 15:20:42 2015 +0200 sal_uInt16 to sal_Int32 Change-Id: Ic2af80d2335875672fee5b61083b1f7f9703dac7 diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx index c694a0b..be6a976 100644 --- a/accessibility/source/extended/textwindowaccessibility.cxx +++ b/accessibility/source/extended/textwindowaccessibility.cxx @@ -1324,14 +1324,12 @@ void Document::changeParagraphAttributes( if ( rAttributeSet[i].Name == "CharColor" ) m_rEngine.SetAttrib(::TextAttribFontColor( mapFontColor(rAttributeSet[i].Value)), - nNumber, static_cast< ::sal_uInt16 >(nBegin), - static_cast< ::sal_uInt16 >(nEnd)); + nNumber, nBegin, nEnd); // XXX numeric overflow (2x) else if ( rAttributeSet[i].Name == "CharWeight" ) m_rEngine.SetAttrib(::TextAttribFontWeight( mapFontWeight(rAttributeSet[i].Value)), - nNumber, static_cast< ::sal_uInt16 >(nBegin), - static_cast< ::sal_uInt16 >(nEnd)); + nNumber, nBegin, nEnd); // XXX numeric overflow (2x) } } diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx index d3590ec..631ab8c 100644 --- a/cui/source/dialogs/SpellDialog.cxx +++ b/cui/source/dialogs/SpellDialog.cxx @@ -1555,7 +1555,7 @@ bool SentenceEditWindow_Impl::MarkNextError( bool bIgnoreCurrentError, css::uno: if (bIgnoreCurrentError) m_aIgnoreErrorsAt.insert( m_nErrorStart ); ExtTextEngine* pTextEngine = GetTextEngine(); - sal_uInt16 nTextLen = pTextEngine->GetTextLen(0); + const sal_Int32 nTextLen = pTextEngine->GetTextLen(0); if(m_nErrorEnd >= nTextLen - 1) return false; //if it's not already modified the modified flag has to be reset at the end of the marking @@ -1681,20 +1681,20 @@ void SentenceEditWindow_Impl::ChangeMarkedWord(const OUString& rNewWord, Languag const TextCharAttrib* pLangAttrib = pTextEngine->FindCharAttrib( TextPaM(0, m_nErrorEnd), TEXTATTR_SPELL_LANGUAGE ); - sal_uInt16 nTextLen = pTextEngine->GetTextLen( 0 ); + const sal_Int32 nTextLen = pTextEngine->GetTextLen( 0 ); if(pLangAttrib && !pLangAttrib->GetStart() && pLangAttrib->GetEnd() == nTextLen) { SpellLanguageAttrib aNewLangAttrib( static_cast<const SpellLanguageAttrib&>(pLangAttrib->GetAttr()).GetLanguage()); pTextEngine->RemoveAttrib(0, *pLangAttrib); - pTextEngine->SetAttrib( aNewLangAttrib, 0, (sal_uInt16)(m_nErrorEnd + nDiffLen) , nTextLen ); + pTextEngine->SetAttrib( aNewLangAttrib, 0, m_nErrorEnd + nDiffLen, nTextLen ); } } // undo expanded attributes! if( pBackAttrib && pBackAttrib->GetStart() < m_nErrorStart && pBackAttrib->GetEnd() == m_nErrorEnd + nDiffLen) { boost::scoped_ptr<TextAttrib> pNewBackground(pBackAttrib->GetAttr().Clone()); - sal_uInt16 nStart = pBackAttrib->GetStart(); + const sal_Int32 nStart = pBackAttrib->GetStart(); pTextEngine->RemoveAttrib(0, *pBackAttrib); pTextEngine->SetAttrib(*pNewBackground, 0, nStart, m_nErrorStart); } @@ -1826,7 +1826,7 @@ svx::SpellPortions SentenceEditWindow_Impl::CreateSpellPortions( bool bSetIgnore { svx::SpellPortions aRet; ExtTextEngine* pTextEngine = GetTextEngine(); - const sal_uInt16 nTextLen = pTextEngine->GetTextLen(0); + const sal_Int32 nTextLen = pTextEngine->GetTextLen(0); if(nTextLen) { TextPaM aCursor(0, 0); diff --git a/include/vcl/texteng.hxx b/include/vcl/texteng.hxx index f64227b..17e0745 100644 --- a/include/vcl/texteng.hxx +++ b/include/vcl/texteng.hxx @@ -151,7 +151,7 @@ protected: TextPaM ImpInsertText( const TextSelection& rSel, const OUString& rText ); TextPaM ImpInsertParaBreak( const TextSelection& rTextSelection, bool bKeepEndingAttribs = true ); TextPaM ImpInsertParaBreak( const TextPaM& rPaM, bool bKeepEndingAttribs = true ); - void ImpRemoveChars( const TextPaM& rPaM, sal_uInt16 nChars, SfxUndoAction* pCurUndo = 0 ); + void ImpRemoveChars( const TextPaM& rPaM, sal_Int32 nChars, SfxUndoAction* pCurUndo = 0 ); TextPaM ImpConnectParagraphs( sal_uLong nLeft, sal_uLong nRight ); void ImpRemoveParagraph( sal_uLong nPara ); void ImpInitWritingDirections( sal_uLong nPara ); @@ -168,8 +168,8 @@ protected: // broadcast or adjust selections void ImpParagraphInserted( sal_uLong nPara ); void ImpParagraphRemoved( sal_uLong nPara ); - void ImpCharsRemoved( sal_uLong nPara, sal_uInt16 nPos, sal_uInt16 nChars ); - void ImpCharsInserted( sal_uLong nPara, sal_uInt16 nPos, sal_uInt16 nChars ); + void ImpCharsRemoved( sal_uLong nPara, sal_Int32 nPos, sal_Int32 nChars ); + void ImpCharsInserted( sal_uLong nPara, sal_Int32 nPos, sal_Int32 nChars ); void ImpFormattingParagraph( sal_uLong nPara ); void ImpTextHeightChanged(); void ImpTextFormatted(); @@ -263,7 +263,7 @@ public: sal_uLong GetParagraphCount() const; OUString GetText( sal_uLong nParagraph ) const; - sal_uInt16 GetTextLen( sal_uLong nParagraph ) const; + sal_Int32 GetTextLen( sal_uLong nParagraph ) const; sal_uLong GetTextHeight( sal_uLong nParagraph ) const; sal_uInt16 GetLineCount( sal_uLong nParagraph ) const; @@ -303,7 +303,7 @@ public: void RemoveAttribs( sal_uLong nPara, sal_uInt16 nWhich, bool bIdleFormatAndUpdate ); void RemoveAttrib( sal_uLong nPara, const TextCharAttrib& rAttrib ); void RemoveAttribs( sal_uLong nPara, bool bIdleFormatAndUpdate = true ); - void SetAttrib( const TextAttrib& rAttr, sal_uLong nPara, sal_uInt16 nStart, sal_uInt16 nEnd, bool bIdleFormatAndUpdate = true ); + void SetAttrib( const TextAttrib& rAttr, sal_uLong nPara, sal_Int32 nStart, sal_Int32 nEnd, bool bIdleFormatAndUpdate = true ); TxtAlign GetTextAlign() const { return meAlign; } void SetTextAlign( TxtAlign eAlign ); diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx index f6ba3ba..83929a0 100644 --- a/vcl/source/edit/texteng.cxx +++ b/vcl/source/edit/texteng.cxx @@ -296,7 +296,7 @@ sal_uLong TextEngine::GetTextLen( const TextSelection& rSel, LineEnd aSeparator return mpDoc->GetTextLen( static_getLineEndText( aSeparator ), &aSel ); } -sal_uInt16 TextEngine::GetTextLen( sal_uLong nPara ) const +sal_Int32 TextEngine::GetTextLen( sal_uLong nPara ) const { return mpDoc->GetNodes()[ nPara ]->GetText().getLength(); } @@ -480,7 +480,7 @@ void TextEngine::CursorMoved( sal_uLong nNode ) pNode->GetCharAttribs().DeleteEmptyAttribs(); } -void TextEngine::ImpRemoveChars( const TextPaM& rPaM, sal_uInt16 nChars, SfxUndoAction* ) +void TextEngine::ImpRemoveChars( const TextPaM& rPaM, sal_Int32 nChars, SfxUndoAction* ) { DBG_ASSERT( nChars, "ImpRemoveChars: 0 Chars?!" ); if ( IsUndoEnabled() && !IsInUndo() ) @@ -592,8 +592,7 @@ TextPaM TextEngine::ImpDeleteText( const TextSelection& rSel ) } else { - sal_uInt16 nChars; - nChars = aEndPaM.GetIndex() - aStartPaM.GetIndex(); + const sal_Int32 nChars = aEndPaM.GetIndex() - aStartPaM.GetIndex(); ImpRemoveChars( aStartPaM, nChars ); TEParaPortion* pPortion = mpTEParaPortions->GetObject( nStartNode ); DBG_ASSERT( pPortion, "ImpDeleteText(5): bad Index" ); @@ -2677,7 +2676,7 @@ void TextEngine::RemoveAttrib( sal_uLong nPara, const TextCharAttrib& rAttrib ) } } -void TextEngine::SetAttrib( const TextAttrib& rAttr, sal_uLong nPara, sal_uInt16 nStart, sal_uInt16 nEnd, bool bIdleFormatAndUpdate ) +void TextEngine::SetAttrib( const TextAttrib& rAttr, sal_uLong nPara, sal_Int32 nStart, sal_Int32 nEnd, bool bIdleFormatAndUpdate ) { // For now do not check if Attributes overlap! @@ -2690,7 +2689,7 @@ void TextEngine::SetAttrib( const TextAttrib& rAttr, sal_uLong nPara, sal_uInt16 TextNode* pNode = mpDoc->GetNodes()[ nPara ]; TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara ); - sal_Int32 nMax = pNode->GetText().getLength(); + const sal_Int32 nMax = pNode->GetText().getLength(); if ( nStart > nMax ) nStart = nMax; if ( nEnd > nMax ) @@ -2732,7 +2731,7 @@ void TextEngine::ValidatePaM( TextPaM& rPaM ) const rPaM.GetIndex() = 0xFFFF; } - sal_uInt16 nMaxIndex = GetTextLen( rPaM.GetPara() ); + const sal_Int32 nMaxIndex = GetTextLen( rPaM.GetPara() ); if ( rPaM.GetIndex() > nMaxIndex ) rPaM.GetIndex() = nMaxIndex; } @@ -2790,7 +2789,7 @@ void TextEngine::ImpParagraphRemoved( sal_uLong nPara ) Broadcast( TextHint( TEXT_HINT_PARAREMOVED, nPara ) ); } -void TextEngine::ImpCharsRemoved( sal_uLong nPara, sal_uInt16 nPos, sal_uInt16 nChars ) +void TextEngine::ImpCharsRemoved( sal_uLong nPara, sal_Int32 nPos, sal_Int32 nChars ) { if ( mpViews->size() > 1 ) { @@ -2799,7 +2798,7 @@ void TextEngine::ImpCharsRemoved( sal_uLong nPara, sal_uInt16 nPos, sal_uInt16 n TextView* pView = (*mpViews)[ --nView ]; if ( pView != GetActiveView() ) { - sal_uInt16 nEnd = nPos+nChars; + const sal_Int32 nEnd = nPos + nChars; for ( int n = 0; n <= 1; n++ ) { TextPaM& rPaM = n ? pView->GetSelection().GetStart(): pView->GetSelection().GetEnd(); @@ -2817,7 +2816,7 @@ void TextEngine::ImpCharsRemoved( sal_uLong nPara, sal_uInt16 nPos, sal_uInt16 n Broadcast( TextHint( TEXT_HINT_PARACONTENTCHANGED, nPara ) ); } -void TextEngine::ImpCharsInserted( sal_uLong nPara, sal_uInt16 nPos, sal_uInt16 nChars ) +void TextEngine::ImpCharsInserted( sal_uLong nPara, sal_Int32 nPos, sal_Int32 nChars ) { if ( mpViews->size() > 1 ) { diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx index 7f9da0e..affa0c8 100644 --- a/vcl/source/edit/textview.cxx +++ b/vcl/source/edit/textview.cxx @@ -2034,7 +2034,7 @@ void TextView::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEv TextSelection aPrevSel( mpImpl->maSelection ); aPrevSel.Justify(); sal_uLong nPrevParaCount = mpImpl->mpTextEngine->GetParagraphCount(); - sal_uInt16 nPrevStartParaLen = mpImpl->mpTextEngine->GetTextLen( aPrevSel.GetStart().GetPara() ); + const sal_Int32 nPrevStartParaLen = mpImpl->mpTextEngine->GetTextLen( aPrevSel.GetStart().GetPara() ); bool bStarterOfDD = false; for ( sal_uInt16 nView = mpImpl->mpTextEngine->GetViewCount(); nView && !bStarterOfDD; ) @@ -2091,7 +2091,7 @@ void TextView::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEv if ( mpImpl->mpDDInfo->maDropPos.GetPara() == aPrevSel.GetStart().GetPara() ) { - sal_uInt16 nNewChars = + const sal_Int32 nNewChars = mpImpl->mpTextEngine->GetTextLen( aPrevSel.GetStart().GetPara() ) - nPrevStartParaLen; aPrevSel.GetStart().GetIndex() = commit 297b109e220249bc81738144555c33bf22796bac Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Tue Jul 28 08:13:58 2015 +0200 sal_uInt16 to sal_Int32, constify and simplify Change-Id: If97d75dbfb683191f4a30d796ca132cedec6c92e diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 43ba36c..cb10b95 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -2131,22 +2131,20 @@ void Edit::Command( const CommandEvent& rCEvt ) maText.insert( mpIMEInfos->nPos, pData->GetText() ); if ( mpIMEInfos->bWasCursorOverwrite ) { - sal_Int32 nOldIMETextLen = mpIMEInfos->nLen; - sal_Int32 nNewIMETextLen = pData->GetText().getLength(); + const sal_Int32 nOldIMETextLen = mpIMEInfos->nLen; + const sal_Int32 nNewIMETextLen = pData->GetText().getLength(); if ( ( nOldIMETextLen > nNewIMETextLen ) && ( nNewIMETextLen < mpIMEInfos->aOldTextAfterStartPos.getLength() ) ) { // restore old characters - sal_Int32 nRestore = nOldIMETextLen - nNewIMETextLen; + const sal_Int32 nRestore = nOldIMETextLen - nNewIMETextLen; maText.insert( mpIMEInfos->nPos + nNewIMETextLen, mpIMEInfos->aOldTextAfterStartPos.copy( nNewIMETextLen, nRestore ) ); } else if ( ( nOldIMETextLen < nNewIMETextLen ) && ( nOldIMETextLen < mpIMEInfos->aOldTextAfterStartPos.getLength() ) ) { - // overwrite - sal_uInt16 nOverwrite = nNewIMETextLen - nOldIMETextLen; - if ( ( nOldIMETextLen + nOverwrite ) > mpIMEInfos->aOldTextAfterStartPos.getLength() ) - nOverwrite = mpIMEInfos->aOldTextAfterStartPos.getLength() - nOldIMETextLen; + const sal_Int32 nOverwrite = ( nNewIMETextLen > mpIMEInfos->aOldTextAfterStartPos.getLength() + ? mpIMEInfos->aOldTextAfterStartPos.getLength() : nNewIMETextLen ) - nOldIMETextLen; maText.remove( mpIMEInfos->nPos + nNewIMETextLen, nOverwrite ); } } commit 288f49440f304ef43b9b1c6983ce0ee2af62225f Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Mon Jul 27 22:41:44 2015 +0200 sal_uInt16 to sal_uInt32 Change-Id: Ib95d8812b0ce288b9691a398fe0396e73ea9af97 diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx index 3520300..d3590ec 100644 --- a/cui/source/dialogs/SpellDialog.cxx +++ b/cui/source/dialogs/SpellDialog.cxx @@ -1473,8 +1473,8 @@ bool SentenceEditWindow_Impl::PreNotify( NotifyEvent& rNEvt ) if(pErrorAttrLeft) { boost::scoped_ptr<TextAttrib> pNewError(pErrorAttrLeft->GetAttr().Clone()); - sal_uInt16 nStart = pErrorAttrLeft->GetStart(); - sal_uInt16 nEnd = pErrorAttrLeft->GetEnd(); + const sal_Int32 nStart = pErrorAttrLeft->GetStart(); + sal_Int32 nEnd = pErrorAttrLeft->GetEnd(); pTextEngine->RemoveAttrib( 0, *pErrorAttrLeft ); SetAttrib( *pNewError, 0, nStart, ++nEnd ); //only active errors move the mark @@ -1508,8 +1508,8 @@ bool SentenceEditWindow_Impl::PreNotify( NotifyEvent& rNEvt ) if(pBackAttrLeft) { boost::scoped_ptr<TextAttrib> pNewBack(pBackAttrLeft->GetAttr().Clone()); - sal_uInt16 _nStart = pBackAttrLeft->GetStart(); - sal_uInt16 _nEnd = pBackAttrLeft->GetEnd(); + const sal_Int32 _nStart = pBackAttrLeft->GetStart(); + const sal_Int32 _nEnd = pBackAttrLeft->GetEnd(); pTextEngine->RemoveAttrib( 0, *pBackAttrLeft ); SetAttrib( *pNewBack, 0, _nStart, _nEnd - nAddedChars); } diff --git a/include/vcl/txtattr.hxx b/include/vcl/txtattr.hxx index 825f2ae..f82f524 100644 --- a/include/vcl/txtattr.hxx +++ b/include/vcl/txtattr.hxx @@ -139,14 +139,14 @@ class TextCharAttrib { private: TextAttrib* mpAttr; - sal_uInt16 mnStart; - sal_uInt16 mnEnd; + sal_Int32 mnStart; + sal_Int32 mnEnd; protected: public: - TextCharAttrib( const TextAttrib& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); + TextCharAttrib( const TextAttrib& rAttr, sal_Int32 nStart, sal_Int32 nEnd ); TextCharAttrib( const TextCharAttrib& rTextCharAttrib ); ~TextCharAttrib(); @@ -154,64 +154,64 @@ public: sal_uInt16 Which() const { return mpAttr->Which(); } - sal_uInt16 GetStart() const { return mnStart; } - sal_uInt16& GetStart() { return mnStart; } + sal_Int32 GetStart() const { return mnStart; } + sal_Int32& GetStart() { return mnStart; } - sal_uInt16 GetEnd() const { return mnEnd; } - sal_uInt16& GetEnd() { return mnEnd; } + sal_Int32 GetEnd() const { return mnEnd; } + sal_Int32& GetEnd() { return mnEnd; } - inline sal_uInt16 GetLen() const; + inline sal_Int32 GetLen() const; - inline void MoveForward( sal_uInt16 nDiff ); - inline void MoveBackward( sal_uInt16 nDiff ); + inline void MoveForward( sal_Int32 nDiff ); + inline void MoveBackward( sal_Int32 nDiff ); - inline void Expand( sal_uInt16 nDiff ); - inline void Collaps( sal_uInt16 nDiff ); + inline void Expand( sal_Int32 nDiff ); + inline void Collaps( sal_Int32 nDiff ); - inline bool IsIn( sal_uInt16 nIndex ); - inline bool IsInside( sal_uInt16 nIndex ); + inline bool IsIn( sal_Int32 nIndex ); + inline bool IsInside( sal_Int32 nIndex ); inline bool IsEmpty() const; }; -inline sal_uInt16 TextCharAttrib::GetLen() const +inline sal_Int32 TextCharAttrib::GetLen() const { DBG_ASSERT( mnEnd >= mnStart, "TextCharAttrib: nEnd < nStart!" ); return mnEnd-mnStart; } -inline void TextCharAttrib::MoveForward( sal_uInt16 nDiff ) +inline void TextCharAttrib::MoveForward( sal_Int32 nDiff ) { - DBG_ASSERT( ((long)mnEnd + nDiff) <= 0xFFFF, "TextCharAttrib: MoveForward?!" ); + DBG_ASSERT( nDiff <= SAL_MAX_INT32-mnEnd, "TextCharAttrib: MoveForward?!" ); mnStart = mnStart + nDiff; mnEnd = mnEnd + nDiff; } -inline void TextCharAttrib::MoveBackward( sal_uInt16 nDiff ) +inline void TextCharAttrib::MoveBackward( sal_Int32 nDiff ) { - DBG_ASSERT( ((long)mnStart - nDiff) >= 0, "TextCharAttrib: MoveBackward?!" ); + DBG_ASSERT( mnStart >= nDiff, "TextCharAttrib: MoveBackward?!" ); mnStart = mnStart - nDiff; mnEnd = mnEnd - nDiff; } -inline void TextCharAttrib::Expand( sal_uInt16 nDiff ) +inline void TextCharAttrib::Expand( sal_Int32 nDiff ) { - DBG_ASSERT( ( ((long)mnEnd + nDiff) <= (long)0xFFFF ), "TextCharAttrib: Expand?!" ); + DBG_ASSERT( nDiff <= SAL_MAX_INT32-mnEnd, "TextCharAttrib: Expand?!" ); mnEnd = mnEnd + nDiff; } -inline void TextCharAttrib::Collaps( sal_uInt16 nDiff ) +inline void TextCharAttrib::Collaps( sal_Int32 nDiff ) { - DBG_ASSERT( (long)mnEnd - nDiff >= (long)mnStart, "TextCharAttrib: Collaps?!" ); + DBG_ASSERT( mnEnd-mnStart >= nDiff, "TextCharAttrib: Collaps?!" ); mnEnd = mnEnd - nDiff; } -inline bool TextCharAttrib::IsIn( sal_uInt16 nIndex ) +inline bool TextCharAttrib::IsIn( sal_Int32 nIndex ) { return ( ( mnStart <= nIndex ) && ( mnEnd >= nIndex ) ); } -inline bool TextCharAttrib::IsInside( sal_uInt16 nIndex ) +inline bool TextCharAttrib::IsInside( sal_Int32 nIndex ) { return ( ( mnStart < nIndex ) && ( mnEnd > nIndex ) ); } diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx index 8773982..9b0b284 100644 --- a/sw/source/ui/dbui/mmaddressblockpage.cxx +++ b/sw/source/ui/dbui/mmaddressblockpage.cxx @@ -1506,7 +1506,7 @@ void AddressMultiLineEdit::MoveCurrentItem(sal_uInt16 nMove) { //current item has been found sal_uLong nPara = rSelection.GetStart().GetPara(); - sal_uInt16 nIndex = pBeginAttrib->GetStart(); + sal_Int32 nIndex = pBeginAttrib->GetStart(); TextSelection aEntrySel(TextPaM( nPara, pBeginAttrib->GetStart()), TextPaM(nPara, pBeginAttrib->GetEnd())); const OUString sCurrentItem = pTextEngine->GetText(aEntrySel); pTextEngine->RemoveAttrib( nPara, *pBeginAttrib ); diff --git a/vcl/source/edit/textdoc.cxx b/vcl/source/edit/textdoc.cxx index fe8d485..a19202c 100644 --- a/vcl/source/edit/textdoc.cxx +++ b/vcl/source/edit/textdoc.cxx @@ -28,7 +28,7 @@ static bool CompareStart( const TextCharAttrib& pFirst, const TextCharAttrib& pS return pFirst.GetStart() < pSecond.GetStart(); } -TextCharAttrib::TextCharAttrib( const TextAttrib& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ) +TextCharAttrib::TextCharAttrib( const TextAttrib& rAttr, sal_Int32 nStart, sal_Int32 nEnd ) { mpAttr = rAttr.Clone(); mnStart = nStart, @@ -67,7 +67,7 @@ void TextCharAttribList::InsertAttrib( TextCharAttrib* pAttrib ) if ( pAttrib->IsEmpty() ) mbHasEmptyAttribs = true; - const sal_uInt16 nStart = pAttrib->GetStart(); // maybe better for Comp.Opt. + const sal_Int32 nStart = pAttrib->GetStart(); // maybe better for Comp.Opt. bool bInserted = false; for (TextCharAttribs::iterator it = maAttribs.begin(); it != maAttribs.end(); ++it) { diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx index 6c907c0..f6ba3ba 100644 --- a/vcl/source/edit/texteng.cxx +++ b/vcl/source/edit/texteng.cxx @@ -1747,8 +1747,8 @@ void TextEngine::CreateTextPortions( sal_uLong nPara, sal_uInt16 nStartPos ) TextNode* pNode = pTEParaPortion->GetNode(); DBG_ASSERT( !pNode->GetText().isEmpty(), "CreateTextPortions: should not be used for empty paragraphs!" ); - std::set<sal_uInt16> aPositions; - std::set<sal_uInt16>::iterator aPositionsIt; + std::set<sal_Int32> aPositions; + std::set<sal_Int32>::iterator aPositionsIt; aPositions.insert(0); sal_uInt16 nAttribs = pNode->GetCharAttribs().Count(); @@ -1824,7 +1824,7 @@ void TextEngine::CreateTextPortions( sal_uLong nPara, sal_uInt16 nStartPos ) if ( aPositionsIt != aPositions.end() ) { - std::set<sal_uInt16>::iterator nextIt = aPositionsIt; + std::set<sal_Int32>::iterator nextIt = aPositionsIt; for ( ++nextIt; nextIt != aPositions.end(); ++aPositionsIt, ++nextIt ) { TETextPortion* pNew = new TETextPortion( *nextIt - *aPositionsIt ); @@ -2565,8 +2565,8 @@ bool TextEngine::Write( SvStream& rOutput, const TextSelection* pSel, bool bHTML } else { - sal_uInt16 nTmpStart = nStartPos; - sal_uInt16 nTmpEnd = nEndPos; + sal_Int32 nTmpStart = nStartPos; + sal_Int32 nTmpEnd = nEndPos; do { const TextCharAttrib* pAttr = pNode->GetCharAttribs().FindNextAttrib( TEXTATTR_HYPERLINK, nTmpStart, nEndPos ); @@ -2577,7 +2577,7 @@ bool TextEngine::Write( SvStream& rOutput, const TextSelection* pSel, bool bHTML if ( pAttr ) { - nTmpEnd = std::min( pAttr->GetEnd(), (sal_uInt16) nEndPos ); + nTmpEnd = std::min( pAttr->GetEnd(), nEndPos ); // e.g. <A HREF="http://www.mopo.de/">Morgenpost</A> aText.append( "<A HREF=\"" ); commit 2a57ea7a67a016b09d91cbf0e97c22e6909a298c Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Mon Jul 27 22:35:56 2015 +0200 sal_uInt16 to sal_Int32 Change-Id: I723d7c187ec186ccc68f061ba2357712a5f31869 diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx index 39e79b0..dbdc329 100644 --- a/basctl/source/basicide/baside2.cxx +++ b/basctl/source/basicide/baside2.cxx @@ -703,8 +703,7 @@ void ModulWindow::BasicAddWatch() if ( !aWord.isEmpty() ) { TextSelection aSel( aWordStart ); - sal_uInt16& rIndex = aSel.GetEnd().GetIndex(); - rIndex = rIndex + aWord.getLength(); + aSel.GetEnd().GetIndex() += aWord.getLength(); GetEditView()->SetSelection( aSel ); bAdd = true; } diff --git a/include/vcl/textdata.hxx b/include/vcl/textdata.hxx index fe37fbd..722a94c 100644 --- a/include/vcl/textdata.hxx +++ b/include/vcl/textdata.hxx @@ -31,17 +31,17 @@ class TextPaM { private: sal_uLong mnPara; - sal_uInt16 mnIndex; + sal_Int32 mnIndex; public: - TextPaM() { mnPara = 0, mnIndex = 0; } - TextPaM( sal_uLong nPara, sal_uInt16 nIndex ) { mnPara = nPara, mnIndex = nIndex; } + TextPaM() : mnPara(0), mnIndex(0) {} + TextPaM( sal_uLong nPara, sal_Int32 nIndex ) : mnPara(nPara), mnIndex(nIndex) {} sal_uLong GetPara() const { return mnPara; } sal_uLong& GetPara() { return mnPara; } - sal_uInt16 GetIndex() const { return mnIndex; } - sal_uInt16& GetIndex() { return mnIndex; } + sal_Int32 GetIndex() const { return mnIndex; } + sal_Int32& GetIndex() { return mnIndex; } inline bool operator == ( const TextPaM& rPaM ) const; inline bool operator != ( const TextPaM& rPaM ) const; diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx index 91dd110..8773982 100644 --- a/sw/source/ui/dbui/mmaddressblockpage.cxx +++ b/sw/source/ui/dbui/mmaddressblockpage.cxx @@ -1443,7 +1443,7 @@ void AddressMultiLineEdit::InsertNewEntry( const OUString& rStr ) ExtTextView* pTextView = GetTextView(); const TextSelection& rSelection = pTextView->GetSelection(); sal_uLong nPara = rSelection.GetStart().GetPara(); - sal_uInt16 nIndex = rSelection.GetEnd().GetIndex(); + sal_Int32 nIndex = rSelection.GetEnd().GetIndex(); ExtTextEngine *pTextEngine = GetTextEngine(); const TextCharAttrib *pAttrib; if(0 != (pAttrib = pTextEngine->FindCharAttrib( rSelection.GetStart(), TEXTATTR_PROTECTED ))) @@ -1452,7 +1452,7 @@ void AddressMultiLineEdit::InsertNewEntry( const OUString& rStr ) // select the new entry pAttrib = pTextEngine->FindCharAttrib(TextPaM(nPara, nIndex),TEXTATTR_PROTECTED); - const sal_uInt16 nEnd = pAttrib ? pAttrib->GetEnd() : nIndex; + const sal_Int32 nEnd = pAttrib ? pAttrib->GetEnd() : nIndex; TextSelection aEntrySel(TextPaM(nPara, nIndex), TextPaM(nPara, nEnd)); pTextView->SetSelection(aEntrySel); Invalidate(); diff --git a/vcl/source/edit/textdoc.cxx b/vcl/source/edit/textdoc.cxx index bca417a..fe8d485 100644 --- a/vcl/source/edit/textdoc.cxx +++ b/vcl/source/edit/textdoc.cxx @@ -474,7 +474,7 @@ sal_uLong TextDoc::GetTextLen( const sal_Unicode* pSep, const TextSelection* pSe { TextNode* pNode = maTextNodes[ nNode ]; - sal_uInt16 nS = 0; + sal_Int32 nS = 0; sal_Int32 nE = pNode->GetText().getLength(); if ( pSel && ( nNode == pSel->GetStart().GetPara() ) ) nS = pSel->GetStart().GetIndex(); diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx index 5b9b0c7..6c907c0 100644 --- a/vcl/source/edit/texteng.cxx +++ b/vcl/source/edit/texteng.cxx @@ -490,8 +490,8 @@ void TextEngine::ImpRemoveChars( const TextPaM& rPaM, sal_uInt16 nChars, SfxUndo OUString aStr( pNode->GetText().copy( rPaM.GetIndex(), nChars ) ); // check if attributes are being deleted or changed - sal_uInt16 nStart = rPaM.GetIndex(); - sal_uInt16 nEnd = nStart + nChars; + const sal_Int32 nStart = rPaM.GetIndex(); + const sal_Int32 nEnd = nStart + nChars; for ( sal_uInt16 nAttr = pNode->GetCharAttribs().Count(); nAttr; ) { TextCharAttrib& rAttr = pNode->GetCharAttribs().GetAttrib( --nAttr ); @@ -2542,7 +2542,7 @@ bool TextEngine::Write( SvStream& rOutput, const TextSelection* pSel, bool bHTML { TextNode* pNode = mpDoc->GetNodes()[ nPara ]; - sal_uInt16 nStartPos = 0; + sal_Int32 nStartPos = 0; sal_Int32 nEndPos = pNode->GetText().getLength(); if ( nPara == aSel.GetStart().GetPara() ) nStartPos = aSel.GetStart().GetIndex(); commit 69a4c6626c7924cef6ccfcd48a47d3010e5837c8 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Mon Jul 27 22:27:15 2015 +0200 sal_uInt16 to sal_Int32 Change-Id: I19785cc516daf03aee8783a23399929785d30c5f diff --git a/vcl/source/edit/textdoc.cxx b/vcl/source/edit/textdoc.cxx index 3d3028a..bca417a 100644 --- a/vcl/source/edit/textdoc.cxx +++ b/vcl/source/edit/textdoc.cxx @@ -163,7 +163,7 @@ TextNode::TextNode( const OUString& rText ) : { } -void TextNode::ExpandAttribs( sal_uInt16 nIndex, sal_uInt16 nNew ) +void TextNode::ExpandAttribs( sal_Int32 nIndex, sal_Int32 nNew ) { if ( !nNew ) return; @@ -227,13 +227,13 @@ void TextNode::ExpandAttribs( sal_uInt16 nIndex, sal_uInt16 nNew ) maCharAttribs.ResortAttribs(); } -void TextNode::CollapsAttribs( sal_uInt16 nIndex, sal_uInt16 nDeleted ) +void TextNode::CollapsAttribs( sal_Int32 nIndex, sal_Int32 nDeleted ) { if ( !nDeleted ) return; bool bResort = false; - sal_uInt16 nEndChanges = nIndex+nDeleted; + const sal_Int32 nEndChanges = nIndex+nDeleted; for ( sal_uInt16 nAttr = 0; nAttr < maCharAttribs.Count(); nAttr++ ) { @@ -289,25 +289,25 @@ void TextNode::CollapsAttribs( sal_uInt16 nIndex, sal_uInt16 nDeleted ) maCharAttribs.ResortAttribs(); } -void TextNode::InsertText( sal_uInt16 nPos, const OUString& rText ) +void TextNode::InsertText( sal_Int32 nPos, const OUString& rText ) { maText = maText.replaceAt( nPos, 0, rText ); ExpandAttribs( nPos, rText.getLength() ); } -void TextNode::InsertText( sal_uInt16 nPos, sal_Unicode c ) +void TextNode::InsertText( sal_Int32 nPos, sal_Unicode c ) { maText = maText.replaceAt( nPos, 0, OUString(c) ); ExpandAttribs( nPos, 1 ); } -void TextNode::RemoveText( sal_uInt16 nPos, sal_uInt16 nChars ) +void TextNode::RemoveText( sal_Int32 nPos, sal_Int32 nChars ) { maText = maText.replaceAt( nPos, nChars, "" ); CollapsAttribs( nPos, nChars ); } -TextNode* TextNode::Split( sal_uInt16 nPos, bool bKeepEndingAttribs ) +TextNode* TextNode::Split( sal_Int32 nPos, bool bKeepEndingAttribs ) { OUString aNewText; if ( nPos < maText.getLength() ) diff --git a/vcl/source/edit/textdoc.hxx b/vcl/source/edit/textdoc.hxx index f317cb7..566c9f3 100644 --- a/vcl/source/edit/textdoc.hxx +++ b/vcl/source/edit/textdoc.hxx @@ -69,8 +69,8 @@ private: TextNode( const TextNode& ) {;} protected: - void ExpandAttribs( sal_uInt16 nIndex, sal_uInt16 nNewChars ); - void CollapsAttribs( sal_uInt16 nIndex, sal_uInt16 nDelChars ); + void ExpandAttribs( sal_Int32 nIndex, sal_Int32 nNewChars ); + void CollapsAttribs( sal_Int32 nIndex, sal_Int32 nDelChars ); public: TextNode( const OUString& rText ); @@ -81,11 +81,11 @@ public: const TextCharAttribList& GetCharAttribs() const { return maCharAttribs; } TextCharAttribList& GetCharAttribs() { return maCharAttribs; } - void InsertText( sal_uInt16 nPos, const OUString& rText ); - void InsertText( sal_uInt16 nPos, sal_Unicode c ); - void RemoveText( sal_uInt16 nPos, sal_uInt16 nChars ); + void InsertText( sal_Int32 nPos, const OUString& rText ); + void InsertText( sal_Int32 nPos, sal_Unicode c ); + void RemoveText( sal_Int32 nPos, sal_Int32 nChars ); - TextNode* Split( sal_uInt16 nPos, bool bKeepEndigAttribs ); + TextNode* Split( sal_Int32 nPos, bool bKeepEndigAttribs ); void Append( const TextNode& rNode ); }; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits