diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2014-02-02 22:16:48 -0600 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2014-02-03 07:44:28 +0000 |
commit | 3cbfcee36dd16e451d76c561eaaaee0ff29b01a5 (patch) | |
tree | 7377a9e1d8cd56279104429abce73aec334569d5 /editeng | |
parent | 5c39b6b997ddc85e6848efc230a427a124b97264 (diff) |
xub_StrLen and tools/string.hxx final straw
Thre is still some 0xffff limit left and possibly some
less than gracefully handled overflow/error cases
Change-Id: I00957ee3a30b02f73918ea49d7353056263dc638
Reviewed-on: https://gerrit.libreoffice.org/7787
Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com>
Tested-by: Norbert Thiebaud <nthiebaud@gmail.com>
Diffstat (limited to 'editeng')
35 files changed, 852 insertions, 862 deletions
diff --git a/editeng/qa/unit/core-test.cxx b/editeng/qa/unit/core-test.cxx index 27b910eeb11f..bae28f4b32c7 100644 --- a/editeng/qa/unit/core-test.cxx +++ b/editeng/qa/unit/core-test.cxx @@ -403,26 +403,26 @@ void Test::testSectionAttributes() // First section should be 0-3 of paragraph 0, and it should only have boldness applied. const editeng::Section* pSecAttr = &aAttrs[0]; - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), pSecAttr->mnParagraph); - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), pSecAttr->mnStart); - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), pSecAttr->mnEnd); - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pSecAttr->maAttributes.size()); + CPPUNIT_ASSERT_EQUAL(0, (int)pSecAttr->mnParagraph); + CPPUNIT_ASSERT_EQUAL(0, (int)pSecAttr->mnStart); + CPPUNIT_ASSERT_EQUAL(3, (int)pSecAttr->mnEnd); + CPPUNIT_ASSERT_EQUAL(1, (int)pSecAttr->maAttributes.size()); CPPUNIT_ASSERT_MESSAGE("This section must be bold.", hasBold(*pSecAttr)); // Second section should be 3-6, and it should be both bold and italic. pSecAttr = &aAttrs[1]; - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), pSecAttr->mnParagraph); - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), pSecAttr->mnStart); - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(6), pSecAttr->mnEnd); - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), pSecAttr->maAttributes.size()); + CPPUNIT_ASSERT_EQUAL(0, (int)pSecAttr->mnParagraph); + CPPUNIT_ASSERT_EQUAL(3, (int)pSecAttr->mnStart); + CPPUNIT_ASSERT_EQUAL(6, (int)pSecAttr->mnEnd); + CPPUNIT_ASSERT_EQUAL(2, (int)pSecAttr->maAttributes.size()); CPPUNIT_ASSERT_MESSAGE("This section must be bold and italic.", hasBold(*pSecAttr) && hasItalic(*pSecAttr)); // Third section should be 6-9, and it should be only italic. pSecAttr = &aAttrs[2]; - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), pSecAttr->mnParagraph); - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(6), pSecAttr->mnStart); - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(9), pSecAttr->mnEnd); - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pSecAttr->maAttributes.size()); + CPPUNIT_ASSERT_EQUAL(0, (int)pSecAttr->mnParagraph); + CPPUNIT_ASSERT_EQUAL(6, (int)pSecAttr->mnStart); + CPPUNIT_ASSERT_EQUAL(9, (int)pSecAttr->mnEnd); + CPPUNIT_ASSERT_EQUAL(1, (int)pSecAttr->maAttributes.size()); CPPUNIT_ASSERT_MESSAGE("This section must be italic.", hasItalic(*pSecAttr)); } @@ -452,37 +452,37 @@ void Test::testSectionAttributes() // 1st, 3rd and 5th sections should correspond with 1st, 3rd and 5th paragraphs. const editeng::Section* pSecAttr = &aAttrs[0]; - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), pSecAttr->mnParagraph); - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), pSecAttr->mnStart); - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), pSecAttr->mnEnd); - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pSecAttr->maAttributes.size()); + CPPUNIT_ASSERT_EQUAL(0, (int)pSecAttr->mnParagraph); + CPPUNIT_ASSERT_EQUAL(0, (int)pSecAttr->mnStart); + CPPUNIT_ASSERT_EQUAL(3, (int)pSecAttr->mnEnd); + CPPUNIT_ASSERT_EQUAL(1, (int)pSecAttr->maAttributes.size()); CPPUNIT_ASSERT_MESSAGE("This section must be bold.", hasBold(*pSecAttr)); pSecAttr = &aAttrs[2]; - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), pSecAttr->mnParagraph); - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), pSecAttr->mnStart); - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), pSecAttr->mnEnd); - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pSecAttr->maAttributes.size()); + CPPUNIT_ASSERT_EQUAL(2, (int)pSecAttr->mnParagraph); + CPPUNIT_ASSERT_EQUAL(0, (int)pSecAttr->mnStart); + CPPUNIT_ASSERT_EQUAL(3, (int)pSecAttr->mnEnd); + CPPUNIT_ASSERT_EQUAL(1, (int)pSecAttr->maAttributes.size()); CPPUNIT_ASSERT_MESSAGE("This section must be bold.", hasBold(*pSecAttr)); pSecAttr = &aAttrs[4]; - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), pSecAttr->mnParagraph); - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), pSecAttr->mnStart); - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(5), pSecAttr->mnEnd); - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pSecAttr->maAttributes.size()); + CPPUNIT_ASSERT_EQUAL(4, (int)pSecAttr->mnParagraph); + CPPUNIT_ASSERT_EQUAL(0, (int)pSecAttr->mnStart); + CPPUNIT_ASSERT_EQUAL(5, (int)pSecAttr->mnEnd); + CPPUNIT_ASSERT_EQUAL(1, (int)pSecAttr->maAttributes.size()); CPPUNIT_ASSERT_MESSAGE("This section must be bold.", hasBold(*pSecAttr)); // The 2nd and 4th paragraphs should be empty. pSecAttr = &aAttrs[1]; - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pSecAttr->mnParagraph); - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), pSecAttr->mnStart); - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), pSecAttr->mnEnd); + CPPUNIT_ASSERT_EQUAL(1, (int)pSecAttr->mnParagraph); + CPPUNIT_ASSERT_EQUAL(0, (int)pSecAttr->mnStart); + CPPUNIT_ASSERT_EQUAL(0, (int)pSecAttr->mnEnd); CPPUNIT_ASSERT_MESSAGE("Attribute array should be empty.", pSecAttr->maAttributes.empty()); pSecAttr = &aAttrs[3]; - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), pSecAttr->mnParagraph); - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), pSecAttr->mnStart); - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), pSecAttr->mnEnd); + CPPUNIT_ASSERT_EQUAL(3, (int)pSecAttr->mnParagraph); + CPPUNIT_ASSERT_EQUAL(0, (int)pSecAttr->mnStart); + CPPUNIT_ASSERT_EQUAL(0, (int)pSecAttr->mnEnd); CPPUNIT_ASSERT_MESSAGE("Attribute array should be empty.", pSecAttr->maAttributes.empty()); } } diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx b/editeng/source/accessibility/AccessibleEditableTextPara.cxx index 001389b5a4fb..7fc3f5371043 100644 --- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx +++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx @@ -217,7 +217,7 @@ namespace accessibility rBoundary.startPos = rBoundary.endPos = -1; - const sal_uInt16 nLineCount=rCacheTF.GetLineCount( nParaIndex ); + const sal_Int32 nLineCount=rCacheTF.GetLineCount( nParaIndex ); if( nIndex == nTextLen ) { @@ -233,7 +233,7 @@ namespace accessibility else { // normal line search - sal_uInt16 nLine; + sal_Int32 nLine; sal_Int32 nCurIndex; for( nLine=0, nCurIndex=0; nLine<nLineCount; ++nLine ) { @@ -650,9 +650,9 @@ namespace accessibility } } - sal_Bool AccessibleEditableTextPara::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_Int32 nIndex ) + sal_Bool AccessibleEditableTextPara::GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nEndIndex, sal_Int32 nIndex ) { - DBG_ASSERT(nIndex >= 0 && nIndex <= USHRT_MAX, + DBG_ASSERT(nIndex >= 0 && nIndex <= SAL_MAX_INT32, "AccessibleEditableTextPara::GetAttributeRun: index value overflow"); DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= SAL_MAX_INT32, @@ -1398,7 +1398,7 @@ namespace accessibility SolarMutexGuard aGuard; sal_Int32 nPara; - sal_uInt16 nIndex; + sal_Int32 nIndex; // offset from surrounding cell/shape Point aOffset( GetEEOffset() ); @@ -1821,7 +1821,7 @@ namespace accessibility } else { - sal_uInt16 nStartIndex, nEndIndex; + sal_Int32 nStartIndex, nEndIndex; //For the bullet paragraph, the bullet string is ingnored for IAText::attributes() function. SvxTextForwarder& rCacheTF = GetTextForwarder(); // MT IA2: Not used? sal_Int32 nBulletLen = 0; @@ -1852,7 +1852,7 @@ namespace accessibility CheckPosition(nIndex); if (nIndex != 0 && nIndex == getCharacterCount()) --nIndex; - sal_uInt16 nLine, nLineCount=rCacheTF.GetLineCount( nParaIndex ); + sal_Int32 nLine, nLineCount=rCacheTF.GetLineCount( nParaIndex ); sal_Int32 nCurIndex; //the problem is that rCacheTF.GetLineLen() will include the bullet length. But for the bullet line, //the text value doesn't contain the bullet characters. all of the bullet and numbering info are exposed @@ -1921,7 +1921,7 @@ namespace accessibility case AccessibleTextType::ATTRIBUTE_RUN: { const sal_Int32 nTextLen = GetTextForwarder().GetTextLen( GetParagraphIndex() ); - sal_uInt16 nStartIndex, nEndIndex; + sal_Int32 nStartIndex, nEndIndex; if( nIndex == nTextLen ) { @@ -1958,7 +1958,7 @@ namespace accessibility CheckPosition(nIndex); - sal_uInt16 nLine, nLineCount=rCacheTF.GetLineCount( static_cast< sal_uInt16 >( nParaIndex ) ); + sal_Int32 nLine, nLineCount=rCacheTF.GetLineCount( nParaIndex ); //the problem is that rCacheTF.GetLineLen() will include the bullet length. But for the bullet line, //the text value doesn't contain the bullet characters. all of the bullet and numbering info are exposed //by the IAText::attributes(). So here must do special support for bullet line. @@ -1981,7 +1981,7 @@ namespace accessibility nLastLineLen = nCurLineLen - nBulletLen; else nLastLineLen = nCurLineLen; - nCurLineLen = rCacheTF.GetLineLen(static_cast< sal_uInt16 >( nParaIndex ), nLine); + nCurLineLen = rCacheTF.GetLineLen( nParaIndex, nLine); //nCurIndex += nCurLineLen; if (nLine == 0) nCurIndex += nCurLineLen - nBulletLen; @@ -2083,7 +2083,7 @@ namespace accessibility { case AccessibleTextType::ATTRIBUTE_RUN: { - sal_uInt16 nStartIndex, nEndIndex; + sal_Int32 nStartIndex, nEndIndex; if( GetAttributeRun(nStartIndex, nEndIndex, nIndex) ) { @@ -2109,7 +2109,7 @@ namespace accessibility CheckPosition(nIndex); - sal_uInt16 nLine, nLineCount=rCacheTF.GetLineCount( static_cast< sal_uInt16 >( nParaIndex ) ); + sal_Int32 nLine, nLineCount = rCacheTF.GetLineCount( nParaIndex ); sal_Int32 nCurIndex; //the problem is that rCacheTF.GetLineLen() will include the bullet length. But for the bullet line, //the text value doesn't contain the bullet characters. all of the bullet and numbering info are exposed @@ -2128,7 +2128,7 @@ namespace accessibility } } //nCurIndex += rCacheTF.GetLineLen(static_cast< sal_uInt16 >( nParaIndex ), nLine); - sal_Int32 nLineLen = rCacheTF.GetLineLen( static_cast< sal_uInt16 >( nParaIndex ), nLine); + sal_Int32 nLineLen = rCacheTF.GetLineLen( nParaIndex, nLine); if (nLine == 0) nCurIndex += nLineLen - nBulletLen; @@ -2139,7 +2139,7 @@ namespace accessibility nLine < nLineCount-1 ) { aResult.SegmentStart = nCurIndex; - aResult.SegmentEnd = nCurIndex + rCacheTF.GetLineLen(static_cast< sal_uInt16 >( nParaIndex ), nLine+1); + aResult.SegmentEnd = nCurIndex + rCacheTF.GetLineLen( nParaIndex, nLine+1); aResult.SegmentText = GetTextRange( aResult.SegmentStart + nBulletLen, aResult.SegmentEnd + nBulletLen); break; } @@ -2780,7 +2780,7 @@ namespace accessibility { // we explicitly allow for the index to point at the character right behind the text if (0 <= nIndex && nIndex <= rCacheTF.GetTextLen( nPara )) - nRes = rCacheTF.GetLineNumberAtIndex( nPara, static_cast< sal_uInt16 >(nIndex) ); + nRes = rCacheTF.GetLineNumberAtIndex( nPara, nIndex ); else throw lang::IndexOutOfBoundsException(); } @@ -2800,9 +2800,9 @@ namespace accessibility { if (0 <= nLineNo && nLineNo < rCacheTF.GetLineCount( nPara )) { - sal_uInt16 nStart = 0, nEnd = 0; - rCacheTF.GetLineBoundaries( nStart, nEnd, nPara, static_cast< sal_uInt16 >(nLineNo) ); - if (nStart != 0xFFFF && nEnd != 0xFFFF) + sal_Int32 nStart = 0, nEnd = 0; + rCacheTF.GetLineBoundaries( nStart, nEnd, nPara, nLineNo ); + if (nStart >= 0 && nEnd >= 0) { try { diff --git a/editeng/source/accessibility/AccessibleStaticTextBase.cxx b/editeng/source/accessibility/AccessibleStaticTextBase.cxx index d7fa15827c6f..74dfa9fbdc08 100644 --- a/editeng/source/accessibility/AccessibleStaticTextBase.cxx +++ b/editeng/source/accessibility/AccessibleStaticTextBase.cxx @@ -926,7 +926,7 @@ namespace accessibility else if ( AccessibleTextType::ATTRIBUTE_RUN == aTextType ) { SvxAccessibleTextAdapter& rTextForwarder = mpImpl->GetParagraph( aPos.nIndex ).GetTextForwarder(); - sal_uInt16 nStartIndex, nEndIndex; + sal_Int32 nStartIndex, nEndIndex; if ( rTextForwarder.GetAttributeRun( nStartIndex, nEndIndex, aPos.nPara, aPos.nIndex, sal_True ) ) { aResult.SegmentText = getTextRange( nStartIndex, nEndIndex ); diff --git a/editeng/source/editeng/editattr.hxx b/editeng/source/editeng/editattr.hxx index 39174273c1d4..035efdae77d2 100644 --- a/editeng/source/editeng/editattr.hxx +++ b/editeng/source/editeng/editattr.hxx @@ -117,28 +117,28 @@ inline sal_uInt16 EditCharAttrib::GetLen() const inline void EditCharAttrib::MoveForward( sal_uInt16 nDiff ) { - DBG_ASSERT( ((long)nEnd + nDiff) <= 0xFFFF, "EditCharAttrib: MoveForward?!" ); + DBG_ASSERT( SAL_MAX_INT32 - nDiff > nEnd, "EditCharAttrib: MoveForward?!" ); nStart = nStart + nDiff; nEnd = nEnd + nDiff; } inline void EditCharAttrib::MoveBackward( sal_uInt16 nDiff ) { - DBG_ASSERT( ((long)nStart - nDiff) >= 0, "EditCharAttrib: MoveBackward?!" ); + DBG_ASSERT( (nStart - nDiff) >= 0, "EditCharAttrib: MoveBackward?!" ); nStart = nStart - nDiff; nEnd = nEnd - nDiff; } inline void EditCharAttrib::Expand( sal_uInt16 nDiff ) { - DBG_ASSERT( ( ((long)nEnd + nDiff) <= (long)0xFFFF ), "EditCharAttrib: Expand?!" ); + DBG_ASSERT( SAL_MAX_INT32 - nDiff > nEnd, "EditCharAttrib: Expand?!" ); DBG_ASSERT( !bFeature, "Please do not expand any features!" ); nEnd = nEnd + nDiff; } inline void EditCharAttrib::Collaps( sal_uInt16 nDiff ) { - DBG_ASSERT( (long)nEnd - nDiff >= (long)nStart, "EditCharAttrib: Collaps?!" ); + DBG_ASSERT( nEnd - nDiff >= nStart, "EditCharAttrib: Collaps?!" ); DBG_ASSERT( !bFeature, "Please do not shrink any Features!" ); nEnd = nEnd - nDiff; } diff --git a/editeng/source/editeng/editdbg.cxx b/editeng/source/editeng/editdbg.cxx index ed1ca6e4c31c..a857cb811170 100644 --- a/editeng/source/editeng/editdbg.cxx +++ b/editeng/source/editeng/editdbg.cxx @@ -371,7 +371,7 @@ void EditDbg::ShowEditEngineData( EditEngine* pEE, sal_Bool bInfoBox ) aPortionStr.append("\nA"); aPortionStr.append(static_cast<sal_Int32>(nPortion)); aPortionStr.append(": "); - sal_uLong n = 0; + sal_Int32 n = 0; for ( z = 0; z < nTextPortions; z++ ) { TextPortion* pPortion = pPPortion->GetTextPortions()[z]; diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index a581781c166a..4732c621d09c 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -252,7 +252,7 @@ const sal_uInt16 aV5Map[] = { 4035, 4036, 4037, 4038 }; -EditCharAttrib* MakeCharAttrib( SfxItemPool& rPool, const SfxPoolItem& rAttr, sal_uInt16 nS, sal_uInt16 nE ) +EditCharAttrib* MakeCharAttrib( SfxItemPool& rPool, const SfxPoolItem& rAttr, sal_Int32 nS, sal_Int32 nE ) { // Create a new attribute in the pool const SfxPoolItem& rNew = rPool.Put( rAttr ); @@ -407,25 +407,25 @@ void TextPortionList::Reset() maPortions.clear(); } -void TextPortionList::DeleteFromPortion(size_t nDelFrom) +void TextPortionList::DeleteFromPortion(sal_Int32 nDelFrom) { - DBG_ASSERT( ( nDelFrom < maPortions.size() ) || ( (nDelFrom == 0) && maPortions.empty() ), "DeleteFromPortion: Out of range" ); + DBG_ASSERT( ( nDelFrom < (sal_Int32)maPortions.size() ) || ( (nDelFrom == 0) && maPortions.empty() ), "DeleteFromPortion: Out of range" ); PortionsType::iterator it = maPortions.begin(); std::advance(it, nDelFrom); maPortions.erase(it, maPortions.end()); } -size_t TextPortionList::Count() const +sal_Int32 TextPortionList::Count() const { - return maPortions.size(); + return (sal_Int32)maPortions.size(); } -const TextPortion* TextPortionList::operator[](size_t nPos) const +const TextPortion* TextPortionList::operator[](sal_Int32 nPos) const { return &maPortions[nPos]; } -TextPortion* TextPortionList::operator[](size_t nPos) +TextPortion* TextPortionList::operator[](sal_Int32 nPos) { return &maPortions[nPos]; } @@ -435,12 +435,12 @@ void TextPortionList::Append(TextPortion* p) maPortions.push_back(p); } -void TextPortionList::Insert(size_t nPos, TextPortion* p) +void TextPortionList::Insert(sal_Int32 nPos, TextPortion* p) { maPortions.insert(maPortions.begin()+nPos, p); } -void TextPortionList::Remove(size_t nPos) +void TextPortionList::Remove(sal_Int32 nPos) { maPortions.erase(maPortions.begin()+nPos); } @@ -460,24 +460,24 @@ public: } -size_t TextPortionList::GetPos(const TextPortion* p) const +sal_Int32 TextPortionList::GetPos(const TextPortion* p) const { PortionsType::const_iterator it = std::find_if(maPortions.begin(), maPortions.end(), FindTextPortionByAddress(p)); if (it == maPortions.end()) - return std::numeric_limits<size_t>::max(); // not found. + return std::numeric_limits<sal_Int32>::max(); // not found. return std::distance(maPortions.begin(), it); } -size_t TextPortionList::FindPortion( - sal_uInt16 nCharPos, sal_uInt16& nPortionStart, bool bPreferStartingPortion) const +sal_Int32 TextPortionList::FindPortion( + sal_Int32 nCharPos, sal_Int32& nPortionStart, bool bPreferStartingPortion) const { // When nCharPos at portion limit, the left portion is found - sal_uInt16 nTmpPos = 0; - size_t n = maPortions.size(); - for (size_t i = 0; i < n; ++i) + sal_Int32 nTmpPos = 0; + sal_Int32 n = maPortions.size(); + for (sal_Int32 i = 0; i < n; ++i) { const TextPortion& rPortion = maPortions[i]; nTmpPos = nTmpPos + rPortion.GetLen(); @@ -495,10 +495,10 @@ size_t TextPortionList::FindPortion( return n - 1; } -sal_uInt16 TextPortionList::GetStartPos(size_t nPortion) +sal_Int32 TextPortionList::GetStartPos(sal_Int32 nPortion) { - sal_uInt16 nPos = 0; - for (size_t i = 0; i < nPortion; ++i) + sal_Int32 nPos = 0; + for (sal_Int32 i = 0; i < nPortion; ++i) { const TextPortion& rPortion = maPortions[i]; nPos = nPos + rPortion.GetLen(); @@ -524,7 +524,7 @@ ExtraPortionInfo::~ExtraPortionInfo() delete[] pOrgDXArray; } -void ExtraPortionInfo::SaveOrgDXArray( const sal_Int32* pDXArray, sal_uInt16 nLen ) +void ExtraPortionInfo::SaveOrgDXArray( const sal_Int32* pDXArray, sal_Int32 nLen ) { delete[] pOrgDXArray; pOrgDXArray = new sal_Int32[nLen]; @@ -551,7 +551,7 @@ ParaPortion::~ParaPortion() { } -void ParaPortion::MarkInvalid( sal_uInt16 nStart, short nDiff ) +void ParaPortion::MarkInvalid( sal_Int32 nStart, sal_Int32 nDiff ) { if ( bInvalid == sal_False ) { @@ -577,7 +577,7 @@ void ParaPortion::MarkInvalid( sal_uInt16 nStart, short nDiff ) { // nInvalidPosEnd = pNode->Len(); DBG_ASSERT( ( nDiff >= 0 ) || ( (nStart+nDiff) >= 0 ), "MarkInvalid: Diff out of Range" ); - nInvalidPosStart = std::min( nInvalidPosStart, (sal_uInt16) ( nDiff < 0 ? nStart+nDiff : nDiff ) ); + nInvalidPosStart = std::min( nInvalidPosStart, ( nDiff < 0 ? nStart+nDiff : nDiff ) ); nInvalidDiff = 0; bSimple = sal_False; } @@ -587,7 +587,7 @@ void ParaPortion::MarkInvalid( sal_uInt16 nStart, short nDiff ) aWritingDirectionInfos.clear(); } -void ParaPortion::MarkSelectionInvalid( sal_uInt16 nStart, sal_uInt16 /* nEnd */ ) +void ParaPortion::MarkSelectionInvalid( sal_Int32 nStart, sal_Int32 /* nEnd */ ) { if ( bInvalid == sal_False ) { @@ -606,15 +606,15 @@ void ParaPortion::MarkSelectionInvalid( sal_uInt16 nStart, sal_uInt16 /* nEnd */ aWritingDirectionInfos.clear(); } -sal_uInt16 ParaPortion::GetLineNumber( sal_uInt16 nIndex ) const +sal_Int32 ParaPortion::GetLineNumber( sal_Int32 nIndex ) const { DBG_ASSERTWARNING( aLineList.Count(), "Empty ParaPortion in GetLine!" ); DBG_ASSERT( bVisible, "Why GetLine() on an invisible paragraph?" ); - for ( sal_uInt16 nLine = 0; nLine < aLineList.Count(); nLine++ ) + for ( sal_Int32 nLine = 0; nLine < aLineList.Count(); nLine++ ) { if ( aLineList[nLine]->IsIn( nIndex ) ) - return nLine; + return (sal_Int32)nLine; } // Then it should be at the end of the last line! @@ -627,16 +627,16 @@ void ParaPortion::SetVisible( sal_Bool bMakeVisible ) bVisible = bMakeVisible; } -void ParaPortion::CorrectValuesBehindLastFormattedLine( sal_uInt16 nLastFormattedLine ) +void ParaPortion::CorrectValuesBehindLastFormattedLine( sal_Int32 nLastFormattedLine ) { - sal_uInt16 nLines = aLineList.Count(); + sal_Int32 nLines = aLineList.Count(); DBG_ASSERT( nLines, "CorrectPortionNumbersFromLine: Empty Portion?" ); if ( nLastFormattedLine < ( nLines - 1 ) ) { const EditLine* pLastFormatted = aLineList[ nLastFormattedLine ]; const EditLine* pUnformatted = aLineList[ nLastFormattedLine+1 ]; - short nPortionDiff = pUnformatted->GetStartPortion() - pLastFormatted->GetEndPortion(); - short nTextDiff = pUnformatted->GetStart() - pLastFormatted->GetEnd(); + sal_Int32 nPortionDiff = pUnformatted->GetStartPortion() - pLastFormatted->GetEndPortion(); + sal_Int32 nTextDiff = pUnformatted->GetStart() - pLastFormatted->GetEnd(); nTextDiff++; // LastFormatted->GetEnd() was included => 1 deducted too much! // The first unformatted must begin exactly one Portion behind the last @@ -647,19 +647,15 @@ void ParaPortion::CorrectValuesBehindLastFormattedLine( sal_uInt16 nLastFormatte int nTDiff = -( nTextDiff-1 ); if ( nPDiff || nTDiff ) { - for ( sal_uInt16 nL = nLastFormattedLine+1; nL < nLines; nL++ ) + for ( sal_Int32 nL = nLastFormattedLine+1; nL < nLines; nL++ ) { EditLine* pLine = aLineList[ nL ]; - pLine->GetStartPortion() = sal::static_int_cast< sal_uInt16 >( - pLine->GetStartPortion() + nPDiff); - pLine->GetEndPortion() = sal::static_int_cast< sal_uInt16 >( - pLine->GetEndPortion() + nPDiff); + pLine->GetStartPortion() = pLine->GetStartPortion() + nPDiff; + pLine->GetEndPortion() = pLine->GetEndPortion() + nPDiff; - pLine->GetStart() = sal::static_int_cast< sal_uInt16 >( - pLine->GetStart() + nTDiff); - pLine->GetEnd() = sal::static_int_cast< sal_uInt16 >( - pLine->GetEnd() + nTDiff); + pLine->GetStart() = pLine->GetStart() + nTDiff; + pLine->GetEnd() = pLine->GetEnd() + nTDiff; pLine->SetValid(); } @@ -673,22 +669,22 @@ void ParaPortion::CorrectValuesBehindLastFormattedLine( sal_uInt16 nLastFormatte namespace { template<typename _Array, typename _Val> -size_t FastGetPos(const _Array& rArray, const _Val* p, size_t& rLastPos) +sal_Int32 FastGetPos(const _Array& rArray, const _Val* p, sal_Int32& rLastPos) { - size_t nArrayLen = rArray.size(); + sal_Int32 nArrayLen = rArray.size(); // Through certain filter code-paths we do a lot of appends, which in // turn call GetPos - creating some N^2 nightmares. If we have a // non-trivially large list, do a few checks from the end first. if (rLastPos > 16 && nArrayLen > 16) { - size_t nEnd; + sal_Int32 nEnd; if (rLastPos > nArrayLen - 2) nEnd = nArrayLen; else nEnd = rLastPos + 2; - for (size_t nIdx = rLastPos - 2; nIdx < nEnd; ++nIdx) + for (sal_Int32 nIdx = rLastPos - 2; nIdx < nEnd; ++nIdx) { if (&rArray.at(nIdx) == p) { @@ -698,7 +694,7 @@ size_t FastGetPos(const _Array& rArray, const _Val* p, size_t& rLastPos) } } // The world's lamest linear search from svarray ... - for (size_t nIdx = 0; nIdx < nArrayLen; ++nIdx) + for (sal_Int32 nIdx = 0; nIdx < nArrayLen; ++nIdx) if (&rArray.at(nIdx) == p) return rLastPos = nIdx; @@ -723,17 +719,17 @@ sal_Int32 ParaPortionList::GetPos(const ParaPortion* p) const ParaPortion* ParaPortionList::operator [](sal_Int32 nPos) { - return 0 <= nPos && static_cast<size_t>(nPos) < maPortions.size() ? &maPortions[nPos] : NULL; + return 0 <= nPos && nPos < (sal_Int32)maPortions.size() ? &maPortions[nPos] : NULL; } const ParaPortion* ParaPortionList::operator [](sal_Int32 nPos) const { - return 0 <= nPos && static_cast<size_t>(nPos) < maPortions.size() ? &maPortions[nPos] : NULL; + return 0 <= nPos && nPos < (sal_Int32)maPortions.size() ? &maPortions[nPos] : NULL; } ParaPortion* ParaPortionList::Release(sal_Int32 nPos) { - if (nPos < 0 || maPortions.size() <= static_cast<size_t>(nPos)) + if (nPos < 0 || (sal_Int32)maPortions.size() <= nPos) { SAL_WARN( "editeng", "ParaPortionList::Release - out of bounds pos " << nPos); return NULL; @@ -743,7 +739,7 @@ ParaPortion* ParaPortionList::Release(sal_Int32 nPos) void ParaPortionList::Remove(sal_Int32 nPos) { - if (nPos < 0 || maPortions.size() <= static_cast<size_t>(nPos)) + if (nPos < 0 || (sal_Int32)maPortions.size() <= nPos) { SAL_WARN( "editeng", "ParaPortionList::Remove - out of bounds pos " << nPos); return; @@ -753,7 +749,7 @@ void ParaPortionList::Remove(sal_Int32 nPos) void ParaPortionList::Insert(sal_Int32 nPos, ParaPortion* p) { - if (nPos < 0 || maPortions.size() < static_cast<size_t>(nPos)) + if (nPos < 0 || (sal_Int32)maPortions.size() < nPos) { SAL_WARN( "editeng", "ParaPortionList::Insert - out of bounds pos " << nPos); return; @@ -768,7 +764,7 @@ void ParaPortionList::Append(ParaPortion* p) sal_Int32 ParaPortionList::Count() const { - size_t nSize = maPortions.size(); + sal_Int32 nSize = maPortions.size(); if (nSize > SAL_MAX_INT32) { SAL_WARN( "editeng", "ParaPortionList::Count - overflow " << nSize); @@ -785,7 +781,7 @@ void ParaPortionList::Reset() long ParaPortionList::GetYOffset(const ParaPortion* pPPortion) const { long nHeight = 0; - for (size_t i = 0, n = maPortions.size(); i < n; ++i) + for (sal_Int32 i = 0, n = maPortions.size(); i < n; ++i) { const ParaPortion* pTmpPortion = &maPortions[i]; if ( pTmpPortion == pPPortion ) @@ -799,7 +795,7 @@ long ParaPortionList::GetYOffset(const ParaPortion* pPPortion) const sal_Int32 ParaPortionList::FindParagraph(long nYOffset) const { long nY = 0; - for (size_t i = 0, n = maPortions.size(); i < n; ++i) + for (sal_Int32 i = 0, n = maPortions.size(); i < n; ++i) { nY += maPortions[i].GetHeight(); // should also be correct even in bVisible! if ( nY > nYOffset ) @@ -810,19 +806,19 @@ sal_Int32 ParaPortionList::FindParagraph(long nYOffset) const const ParaPortion* ParaPortionList::SafeGetObject(sal_Int32 nPos) const { - return 0 <= nPos && static_cast<size_t>(nPos) < maPortions.size() ? &maPortions[nPos] : NULL; + return 0 <= nPos && nPos < (sal_Int32)maPortions.size() ? &maPortions[nPos] : NULL; } ParaPortion* ParaPortionList::SafeGetObject(sal_Int32 nPos) { - return 0 <= nPos && static_cast<size_t>(nPos) < maPortions.size() ? &maPortions[nPos] : NULL; + return 0 <= nPos && nPos < (sal_Int32)maPortions.size() ? &maPortions[nPos] : NULL; } #if OSL_DEBUG_LEVEL > 2 void ParaPortionList::DbgCheck( EditDoc& rDoc) { DBG_ASSERT( Count() == rDoc.Count(), "ParaPortionList::DbgCheck() - Count() unequal!" ); - for ( sal_uInt16 i = 0; i < Count(); i++ ) + for ( sal_Int32 i = 0; i < Count(); i++ ) { DBG_ASSERT( SafeGetObject(i), "ParaPortionList::DbgCheck() - Null-Pointer in List!" ); DBG_ASSERT( GetObject(i)->GetNode(), "ParaPortionList::DbgCheck() - Null-Pointer in List(2)!" ); @@ -1064,11 +1060,11 @@ Size EditLine::CalcTextSize( ParaPortion& rParaPortion ) Size aTmpSz; TextPortion* pPortion; - sal_uInt16 nIndex = GetStart(); + sal_Int32 nIndex = GetStart(); DBG_ASSERT( rParaPortion.GetTextPortions().Count(), "GetTextSize before CreatePortions !" ); - for ( sal_uInt16 n = nStartPortion; n <= nEndPortion; n++ ) + for ( sal_Int32 n = nStartPortion; n <= nEndPortion; n++ ) { pPortion = rParaPortion.GetTextPortions()[n]; switch ( pPortion->GetKind() ) @@ -1110,18 +1106,18 @@ void EditLineList::Reset() maLines.clear(); } -void EditLineList::DeleteFromLine(size_t nDelFrom) +void EditLineList::DeleteFromLine(sal_Int32 nDelFrom) { - DBG_ASSERT( nDelFrom <= (maLines.size() - 1), "DeleteFromLine: Out of range" ); + DBG_ASSERT( nDelFrom <= ((sal_Int32)maLines.size() - 1), "DeleteFromLine: Out of range" ); LinesType::iterator it = maLines.begin(); std::advance(it, nDelFrom); maLines.erase(it, maLines.end()); } -size_t EditLineList::FindLine(sal_uInt16 nChar, bool bInclEnd) +sal_Int32 EditLineList::FindLine(sal_Int32 nChar, bool bInclEnd) { - size_t n = maLines.size(); - for (size_t i = 0; i < n; ++i) + sal_Int32 n = maLines.size(); + for (sal_Int32 i = 0; i < n; ++i) { const EditLine& rLine = maLines[i]; if ( (bInclEnd && (rLine.GetEnd() >= nChar)) || @@ -1135,17 +1131,17 @@ size_t EditLineList::FindLine(sal_uInt16 nChar, bool bInclEnd) return n - 1; } -size_t EditLineList::Count() const +sal_Int32 EditLineList::Count() const { return maLines.size(); } -const EditLine* EditLineList::operator[](size_t nPos) const +const EditLine* EditLineList::operator[](sal_Int32 nPos) const { return &maLines[nPos]; } -EditLine* EditLineList::operator[](size_t nPos) +EditLine* EditLineList::operator[](sal_Int32 nPos) { return &maLines[nPos]; } @@ -1155,7 +1151,7 @@ void EditLineList::Append(EditLine* p) maLines.push_back(p); } -void EditLineList::Insert(size_t nPos, EditLine* p) +void EditLineList::Insert(sal_Int32 nPos, EditLine* p) { maLines.insert(maLines.begin()+nPos, p); } @@ -1306,7 +1302,7 @@ ContentNode::~ContentNode() { } -void ContentNode::ExpandAttribs( sal_uInt16 nIndex, sal_uInt16 nNew, SfxItemPool& rItemPool ) +void ContentNode::ExpandAttribs( sal_Int32 nIndex, sal_Int32 nNew, SfxItemPool& rItemPool ) { if ( !nNew ) return; @@ -1320,7 +1316,7 @@ void ContentNode::ExpandAttribs( sal_uInt16 nIndex, sal_uInt16 nNew, SfxItemPool bool bResort = false; bool bExpandedEmptyAtIndexNull = false; - size_t nAttr = 0; + sal_Int32 nAttr = 0; CharAttribList::AttribsType& rAttribs = aCharAttribList.GetAttribs(); EditCharAttrib* pAttrib = GetAttrib(rAttribs, nAttr); while ( pAttrib ) @@ -1442,7 +1438,7 @@ void ContentNode::ExpandAttribs( sal_uInt16 nIndex, sal_uInt16 nNew, SfxItemPool #endif } -void ContentNode::CollapsAttribs( sal_uInt16 nIndex, sal_uInt16 nDeleted, SfxItemPool& rItemPool ) +void ContentNode::CollapsAttribs( sal_Int32 nIndex, sal_Int32 nDeleted, SfxItemPool& rItemPool ) { if ( !nDeleted ) return; @@ -1451,9 +1447,9 @@ void ContentNode::CollapsAttribs( sal_uInt16 nIndex, sal_uInt16 nDeleted, SfxIte // can also the order of the start list be change! bool bResort = false; bool bDelAttr = false; - sal_uInt16 nEndChanges = nIndex+nDeleted; + sal_Int32 nEndChanges = nIndex+nDeleted; - size_t nAttr = 0; + sal_Int32 nAttr = 0; CharAttribList::AttribsType& rAttribs = aCharAttribList.GetAttribs(); EditCharAttrib* pAttrib = GetAttrib(rAttribs, nAttr); while ( pAttrib ) @@ -1534,9 +1530,9 @@ void ContentNode::CopyAndCutAttribs( ContentNode* pPrevNode, SfxItemPool& rPool, { DBG_ASSERT( pPrevNode, "Copy of attributes to a null pointer?" ); - sal_uInt16 nCut = pPrevNode->Len(); + sal_Int32 nCut = pPrevNode->Len(); - size_t nAttr = 0; + sal_Int32 nAttr = 0; CharAttribList::AttribsType& rPrevAttribs = pPrevNode->GetCharAttribs().GetAttribs(); EditCharAttrib* pAttrib = GetAttrib(rPrevAttribs, nAttr); while ( pAttrib ) @@ -1586,13 +1582,13 @@ void ContentNode::AppendAttribs( ContentNode* pNextNode ) { DBG_ASSERT( pNextNode, "Copy of attributes to a null pointer?" ); - sal_uInt16 nNewStart = maString.getLength(); + sal_Int32 nNewStart = maString.getLength(); #if OSL_DEBUG_LEVEL > 2 OSL_ENSURE( aCharAttribList.DbgCheckAttribs(), "Attribute before AppendAttribs broken" ); #endif - size_t nAttr = 0; + sal_Int32 nAttr = 0; CharAttribList::AttribsType& rNextAttribs = pNextNode->GetCharAttribs().GetAttribs(); EditCharAttrib* pAttrib = GetAttrib(rNextAttribs, nAttr); while ( pAttrib ) @@ -1602,7 +1598,7 @@ void ContentNode::AppendAttribs( ContentNode* pNextNode ) if ( ( pAttrib->GetStart() == 0 ) && ( !pAttrib->IsFeature() ) ) { // Attributes can possibly be summarized as: - size_t nTmpAttr = 0; + sal_Int32 nTmpAttr = 0; EditCharAttrib* pTmpAttrib = GetAttrib( aCharAttribList.GetAttribs(), nTmpAttr ); while ( !bMelted && pTmpAttrib ) { @@ -1671,12 +1667,12 @@ void ContentNode::SetStyleSheet( SfxStyleSheet* pS, sal_Bool bRecalcFont ) CreateDefFont(); } -bool ContentNode::IsFeature( sal_uInt16 nPos ) const +bool ContentNode::IsFeature( sal_Int32 nPos ) const { return maString[nPos] == CH_FEATURE; } -sal_uInt16 ContentNode::Len() const +sal_Int32 ContentNode::Len() const { return maString.getLength(); } @@ -1686,12 +1682,12 @@ const OUString& ContentNode::GetString() const return maString; } -void ContentNode::SetChar(sal_uInt16 nPos, sal_Unicode c) +void ContentNode::SetChar(sal_Int32 nPos, sal_Unicode c) { maString = maString.replaceAt(nPos, 1, OUString(c)); } -void ContentNode::Insert(const OUString& rStr, sal_uInt16 nPos) +void ContentNode::Insert(const OUString& rStr, sal_Int32 nPos) { maString = maString.replaceAt(nPos, 0, rStr); } @@ -1701,27 +1697,27 @@ void ContentNode::Append(const OUString& rStr) maString += rStr; } -void ContentNode::Erase(sal_uInt16 nPos) +void ContentNode::Erase(sal_Int32 nPos) { maString = maString.copy(0, nPos); } -void ContentNode::Erase(sal_uInt16 nPos, sal_uInt16 nCount) +void ContentNode::Erase(sal_Int32 nPos, sal_Int32 nCount) { maString = maString.replaceAt(nPos, nCount, ""); } -OUString ContentNode::Copy(sal_uInt16 nPos) const +OUString ContentNode::Copy(sal_Int32 nPos) const { return maString.copy(nPos); } -OUString ContentNode::Copy(sal_uInt16 nPos, sal_uInt16 nCount) const +OUString ContentNode::Copy(sal_Int32 nPos, sal_Int32 nCount) const { return maString.copy(nPos, nCount); } -sal_Unicode ContentNode::GetChar(sal_uInt16 nPos) const +sal_Unicode ContentNode::GetChar(sal_Int32 nPos) const { return maString[nPos]; } @@ -1846,7 +1842,7 @@ const SfxPoolItem* ItemList::First() const SfxPoolItem* ItemList::Next() { - if ( CurrentItem + 1 < aItemPool.size() ) + if ( CurrentItem + 1 < (sal_Int32)aItemPool.size() ) { ++CurrentItem; return aItemPool[ CurrentItem ]; @@ -1911,7 +1907,7 @@ void EditDoc::ImplDestroyContents() void EditDoc::RemoveItemsFromPool(const ContentNode& rNode) { - for (size_t nAttr = 0; nAttr < rNode.GetCharAttribs().Count(); ++nAttr) + for (sal_Int32 nAttr = 0; nAttr < rNode.GetCharAttribs().Count(); ++nAttr) { const EditCharAttrib& rAttr = rNode.GetCharAttribs().GetAttribs()[nAttr]; GetItemPool().Remove(*rAttr.GetItem()); @@ -2016,12 +2012,12 @@ sal_Int32 EditDoc::GetPos(const ContentNode* p) const const ContentNode* EditDoc::GetObject(sal_Int32 nPos) const { - return 0 <= nPos && static_cast<size_t>(nPos) < maContents.size() ? &maContents[nPos] : NULL; + return 0 <= nPos && nPos < (sal_Int32)maContents.size() ? &maContents[nPos] : NULL; } ContentNode* EditDoc::GetObject(sal_Int32 nPos) { - return 0 <= nPos && static_cast<size_t>(nPos) < maContents.size() ? &maContents[nPos] : NULL; + return 0 <= nPos && nPos < (sal_Int32)maContents.size() ? &maContents[nPos] : NULL; } const ContentNode* EditDoc::operator[](sal_Int32 nPos) const @@ -2046,7 +2042,7 @@ void EditDoc::Insert(sal_Int32 nPos, ContentNode* p) void EditDoc::Remove(sal_Int32 nPos) { - if (nPos < 0 || static_cast<size_t>(nPos) >= maContents.size()) + if (nPos < 0 || nPos >= (sal_Int32)maContents.size()) { SAL_WARN( "editeng", "EditDoc::Remove - out of bounds pos " << nPos); return; @@ -2056,7 +2052,7 @@ void EditDoc::Remove(sal_Int32 nPos) void EditDoc::Release(sal_Int32 nPos) { - if (nPos < 0 || static_cast<size_t>(nPos) >= maContents.size()) + if (nPos < 0 || nPos >= (sal_Int32)maContents.size()) { SAL_WARN( "editeng", "EditDoc::Release - out of bounds pos " << nPos); return; @@ -2066,13 +2062,13 @@ void EditDoc::Release(sal_Int32 nPos) sal_Int32 EditDoc::Count() const { - size_t nSize = maContents.size(); + sal_Int32 nSize = maContents.size(); if (nSize > SAL_MAX_INT32) { SAL_WARN( "editeng", "EditDoc::Count - overflow " << nSize); return SAL_MAX_INT32; } - return static_cast<sal_Int32>(nSize); + return nSize; } OUString EditDoc::GetSepStr( LineEnd eEnd ) @@ -2121,19 +2117,19 @@ OUString EditDoc::GetParaAsString( sal_Int32 nNode ) const } OUString EditDoc::GetParaAsString( - const ContentNode* pNode, sal_uInt16 nStartPos, sal_uInt16 nEndPos, bool bResolveFields) const + const ContentNode* pNode, sal_Int32 nStartPos, sal_Int32 nEndPos, bool bResolveFields) const { - if ( nEndPos > pNode->Len() ) + if ( nEndPos < 0 || nEndPos > pNode->Len() ) nEndPos = pNode->Len(); DBG_ASSERT( nStartPos <= nEndPos, "Start and End reversed?" ); - sal_uInt16 nIndex = nStartPos; + sal_Int32 nIndex = nStartPos; OUString aStr; const EditCharAttrib* pNextFeature = pNode->GetCharAttribs().FindFeature( nIndex ); while ( nIndex < nEndPos ) { - sal_uInt16 nEnd = nEndPos; + sal_Int32 nEnd = nEndPos; if ( pNextFeature && ( pNextFeature->GetStart() < nEnd ) ) nEnd = pNextFeature->GetStart(); else @@ -2186,7 +2182,7 @@ sal_uLong EditDoc::GetTextLen() const nLen += pNode->Len(); // Fields can be longer than the placeholder in the Node const CharAttribList::AttribsType& rAttrs = pNode->GetCharAttribs().GetAttribs(); - for (size_t nAttr = rAttrs.size(); nAttr; ) + for (sal_Int32 nAttr = rAttrs.size(); nAttr; ) { const EditCharAttrib& rAttr = rAttrs[--nAttr]; if (rAttr.Which() == EE_FEATURE_FIELD) @@ -2349,7 +2345,7 @@ EditPaM EditDoc::ConnectParagraphs( ContentNode* pLeft, ContentNode* pRight ) return aPaM; } -EditPaM EditDoc::RemoveChars( EditPaM aPaM, sal_uInt16 nChars ) +EditPaM EditDoc::RemoveChars( EditPaM aPaM, sal_Int32 nChars ) { // Maybe remove Features! aPaM.GetNode()->Erase( aPaM.GetIndex(), nChars ); @@ -2360,7 +2356,7 @@ EditPaM EditDoc::RemoveChars( EditPaM aPaM, sal_uInt16 nChars ) return aPaM; } -void EditDoc::InsertAttribInSelection( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd, const SfxPoolItem& rPoolItem ) +void EditDoc::InsertAttribInSelection( ContentNode* pNode, sal_Int32 nStart, sal_Int32 nEnd, const SfxPoolItem& rPoolItem ) { DBG_ASSERT( pNode, "What to do with the attribute?" ); DBG_ASSERT( nEnd <= pNode->Len(), "InsertAttrib: Attribute to large!" ); @@ -2397,14 +2393,14 @@ void EditDoc::InsertAttribInSelection( ContentNode* pNode, sal_uInt16 nStart, sa SetModified(true); } -sal_Bool EditDoc::RemoveAttribs( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd, sal_uInt16 nWhich ) +sal_Bool EditDoc::RemoveAttribs( ContentNode* pNode, sal_Int32 nStart, sal_Int32 nEnd, sal_uInt16 nWhich ) { EditCharAttrib* pStarting; EditCharAttrib* pEnding; return RemoveAttribs( pNode, nStart, nEnd, pStarting, pEnding, nWhich ); } -sal_Bool EditDoc::RemoveAttribs( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd, EditCharAttrib*& rpStarting, EditCharAttrib*& rpEnding, sal_uInt16 nWhich ) +sal_Bool EditDoc::RemoveAttribs( ContentNode* pNode, sal_Int32 nStart, sal_Int32 nEnd, EditCharAttrib*& rpStarting, EditCharAttrib*& rpEnding, sal_uInt16 nWhich ) { DBG_ASSERT( pNode, "What to do with the attribute?" ); @@ -2420,7 +2416,7 @@ sal_Bool EditDoc::RemoveAttribs( ContentNode* pNode, sal_uInt16 nStart, sal_uInt DBG_ASSERT( nStart <= nEnd, "Small miscalculations in InsertAttribInSelection" ); // iterate over the attributes ... - size_t nAttr = 0; + sal_Int32 nAttr = 0; CharAttribList::AttribsType& rAttribs = pNode->GetCharAttribs().GetAttribs(); EditCharAttrib* pAttr = GetAttrib(rAttribs, nAttr); while ( pAttr ) @@ -2482,7 +2478,7 @@ sal_Bool EditDoc::RemoveAttribs( ContentNode* pNode, sal_uInt16 nStart, sal_uInt } else // Attribute must be split ... { - sal_uInt16 nOldEnd = pAttr->GetEnd(); + sal_Int32 nOldEnd = pAttr->GetEnd(); pAttr->GetEnd() = nStart; rpEnding = pAttr; InsertAttrib( *pAttr->GetItem(), pNode, nEnd, nOldEnd ); @@ -2513,7 +2509,7 @@ sal_Bool EditDoc::RemoveAttribs( ContentNode* pNode, sal_uInt16 nStart, sal_uInt return bChanged; } -void EditDoc::InsertAttrib( const SfxPoolItem& rPoolItem, ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd ) +void EditDoc::InsertAttrib( const SfxPoolItem& rPoolItem, ContentNode* pNode, sal_Int32 nStart, sal_Int32 nEnd ) { // This method no longer checks whether a corresponding attribute already // exists at this place! @@ -2524,7 +2520,7 @@ void EditDoc::InsertAttrib( const SfxPoolItem& rPoolItem, ContentNode* pNode, sa SetModified( true ); } -void EditDoc::InsertAttrib( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd, const SfxPoolItem& rPoolItem ) +void EditDoc::InsertAttrib( ContentNode* pNode, sal_Int32 nStart, sal_Int32 nEnd, const SfxPoolItem& rPoolItem ) { if ( nStart != nEnd ) { @@ -2548,7 +2544,7 @@ void EditDoc::InsertAttrib( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nE if ( pAttr->IsInside( nStart ) ) // split { // check again if really splitting, or return ! - sal_uInt16 nOldEnd = pAttr->GetEnd(); + sal_Int32 nOldEnd = pAttr->GetEnd(); pAttr->GetEnd() = nStart; EditCharAttrib* pNew = MakeCharAttrib( GetItemPool(), *(pAttr->GetItem()), nStart, nOldEnd ); rAttrList.InsertAttrib(pNew); @@ -2567,7 +2563,7 @@ void EditDoc::InsertAttrib( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nE SetModified( true ); } -void EditDoc::FindAttribs( ContentNode* pNode, sal_uInt16 nStartPos, sal_uInt16 nEndPos, SfxItemSet& rCurSet ) +void EditDoc::FindAttribs( ContentNode* pNode, sal_Int32 nStartPos, sal_Int32 nEndPos, SfxItemSet& rCurSet ) { DBG_ASSERT( pNode, "Where to search?" ); DBG_ASSERT( nStartPos <= nEndPos, "Invalid region!" ); @@ -2707,12 +2703,12 @@ void CharAttribList::InsertAttrib( EditCharAttrib* pAttrib ) // (InsertBinTextObject!) binary search would not be optimal here. // => Would bring something! - const sal_uInt16 nStart = pAttrib->GetStart(); // may be better for Comp.Opt. + const sal_Int32 nStart = pAttrib->GetStart(); // may be better for Comp.Opt. if ( pAttrib->IsEmpty() ) bHasEmptyAttribs = true; - for (size_t i = 0, n = aAttribs.size(); i < n; ++i) + for (sal_Int32 i = 0, n = aAttribs.size(); i < n; ++i) { const EditCharAttrib& rCurAttrib = aAttribs[i]; if (rCurAttrib.GetStart() > nStart) @@ -2732,10 +2728,10 @@ void CharAttribList::ResortAttribs() void CharAttribList::OptimizeRanges( SfxItemPool& rItemPool ) { - for (size_t i = 0; i < aAttribs.size(); ++i) + for (sal_Int32 i = 0; i < (sal_Int32)aAttribs.size(); ++i) { EditCharAttrib& rAttr = aAttribs[i]; - for (size_t nNext = i+1; nNext < aAttribs.size(); ++nNext) + for (sal_Int32 nNext = i+1; nNext < (sal_Int32)aAttribs.size(); ++nNext) { EditCharAttrib& rNext = aAttribs[nNext]; if (!rAttr.IsFeature() && rNext.GetStart() == rAttr.GetEnd() && rNext.Which() == rAttr.Which()) @@ -2756,12 +2752,12 @@ void CharAttribList::OptimizeRanges( SfxItemPool& rItemPool ) } } -size_t CharAttribList::Count() const +sal_Int32 CharAttribList::Count() const { return aAttribs.size(); } -const EditCharAttrib* CharAttribList::FindAttrib( sal_uInt16 nWhich, sal_uInt16 nPos ) const +const EditCharAttrib* CharAttribList::FindAttrib( sal_uInt16 nWhich, sal_Int32 nPos ) const { // Backwards, if one ends where the next starts. // => The starting one is the valid one ... @@ -2775,7 +2771,7 @@ const EditCharAttrib* CharAttribList::FindAttrib( sal_uInt16 nWhich, sal_uInt16 return NULL; } -EditCharAttrib* CharAttribList::FindAttrib( sal_uInt16 nWhich, sal_uInt16 nPos ) +EditCharAttrib* CharAttribList::FindAttrib( sal_uInt16 nWhich, sal_Int32 nPos ) { // Backwards, if one ends where the next starts. // => The starting one is the valid one ... @@ -2789,7 +2785,7 @@ EditCharAttrib* CharAttribList::FindAttrib( sal_uInt16 nWhich, sal_uInt16 nPos ) return NULL; } -const EditCharAttrib* CharAttribList::FindNextAttrib( sal_uInt16 nWhich, sal_uInt16 nFromPos ) const +const EditCharAttrib* CharAttribList::FindNextAttrib( sal_uInt16 nWhich, sal_Int32 nFromPos ) const { DBG_ASSERT( nWhich, "FindNextAttrib: Which?" ); AttribsType::const_iterator it = aAttribs.begin(), itEnd = aAttribs.end(); @@ -2802,7 +2798,7 @@ const EditCharAttrib* CharAttribList::FindNextAttrib( sal_uInt16 nWhich, sal_uIn return NULL; } -bool CharAttribList::HasAttrib( sal_uInt16 nStartPos, sal_uInt16 nEndPos ) const +bool CharAttribList::HasAttrib( sal_Int32 nStartPos, sal_Int32 nEndPos ) const { AttribsType::const_reverse_iterator it = aAttribs.rbegin(), itEnd = aAttribs.rend(); for (; it != itEnd; ++it) @@ -2846,9 +2842,9 @@ void CharAttribList::Remove(const EditCharAttrib* p) aAttribs.erase(it); } -void CharAttribList::Remove(size_t nPos) +void CharAttribList::Remove(sal_Int32 nPos) { - if (nPos >= aAttribs.size()) + if (nPos >= (sal_Int32)aAttribs.size()) return; aAttribs.erase(aAttribs.begin()+nPos); @@ -2866,7 +2862,7 @@ void CharAttribList::SetHasEmptyAttribs(bool b) bHasEmptyAttribs = b; } -bool CharAttribList::HasBoundingAttrib( sal_uInt16 nBound ) const +bool CharAttribList::HasBoundingAttrib( sal_Int32 nBound ) const { // Backwards, if one ends where the next starts. // => The starting one is the valid one ... @@ -2883,7 +2879,7 @@ bool CharAttribList::HasBoundingAttrib( sal_uInt16 nBound ) const return false; } -const EditCharAttrib* CharAttribList::FindEmptyAttrib( sal_uInt16 nWhich, sal_uInt16 nPos ) const +const EditCharAttrib* CharAttribList::FindEmptyAttrib( sal_uInt16 nWhich, sal_Int32 nPos ) const { if ( !bHasEmptyAttribs ) return NULL; @@ -2898,7 +2894,7 @@ const EditCharAttrib* CharAttribList::FindEmptyAttrib( sal_uInt16 nWhich, sal_uI return NULL; } -EditCharAttrib* CharAttribList::FindEmptyAttrib( sal_uInt16 nWhich, sal_uInt16 nPos ) +EditCharAttrib* CharAttribList::FindEmptyAttrib( sal_uInt16 nWhich, sal_Int32 nPos ) { if ( !bHasEmptyAttribs ) return NULL; @@ -2917,9 +2913,9 @@ namespace { class FindByStartPos : std::unary_function<EditCharAttrib, bool> { - sal_uInt16 mnPos; + sal_Int32 mnPos; public: - FindByStartPos(sal_uInt16 nPos) : mnPos(nPos) {} + FindByStartPos(sal_Int32 nPos) : mnPos(nPos) {} bool operator() (const EditCharAttrib& r) const { return r.GetStart() >= mnPos; @@ -2928,7 +2924,7 @@ public: } -const EditCharAttrib* CharAttribList::FindFeature( sal_uInt16 nPos ) const +const EditCharAttrib* CharAttribList::FindFeature( sal_Int32 nPos ) const { // First, find the first attribute that starts at or after specified position. AttribsType::const_iterator it = @@ -2996,23 +2992,23 @@ SvxColorList::SvxColorList() SvxColorList::~SvxColorList() { - for ( size_t i = 0, n = aColorList.size(); i < n; ++i ) + for ( sal_Int32 i = 0, n = aColorList.size(); i < n; ++i ) delete aColorList[ i ]; aColorList.clear(); } -size_t SvxColorList::GetId( const SvxColorItem& rColorItem ) +sal_Int32 SvxColorList::GetId( const SvxColorItem& rColorItem ) { - for ( size_t i = 0, n = aColorList.size(); i < n; ++i ) + for ( sal_Int32 i = 0, n = aColorList.size(); i < n; ++i ) if ( *aColorList[ i ] == rColorItem ) return i; DBG_WARNING( "Color not found: GetId()" ); return 0; } -void SvxColorList::Insert( SvxColorItem* pItem, size_t nIndex ) +void SvxColorList::Insert( SvxColorItem* pItem, sal_Int32 nIndex ) { - if ( nIndex >= aColorList.size() ) + if ( nIndex >= (sal_Int32)aColorList.size() ) { aColorList.push_back( pItem ); } @@ -3024,9 +3020,9 @@ void SvxColorList::Insert( SvxColorItem* pItem, size_t nIndex ) } } -SvxColorItem* SvxColorList::GetObject( size_t nIndex ) +SvxColorItem* SvxColorList::GetObject( sal_Int32 nIndex ) { - return ( nIndex >= aColorList.size() ) ? NULL : aColorList[ nIndex ]; + return ( nIndex >= (sal_Int32)aColorList.size() ) ? NULL : aColorList[ nIndex ]; } EditEngineItemPool::EditEngineItemPool( sal_Bool bPersistenRefCounts ) diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx index 1c8bdf24cdbe..aa317f5f9a38 100644 --- a/editeng/source/editeng/editdoc.hxx +++ b/editeng/source/editeng/editdoc.hxx @@ -48,7 +48,7 @@ void CreateFont( SvxFont& rFont, const SfxItemSet& rSet, bool bSearchInParent = sal_uInt16 GetScriptItemId( sal_uInt16 nItemId, short nScriptType ); sal_Bool IsScriptItemValid( sal_uInt16 nItemId, short nScriptType ); -EditCharAttrib* MakeCharAttrib( SfxItemPool& rPool, const SfxPoolItem& rAttr, sal_uInt16 nS, sal_uInt16 nE ); +EditCharAttrib* MakeCharAttrib( SfxItemPool& rPool, const SfxPoolItem& rAttr, sal_Int32 nS, sal_Int32 nE ); class ContentNode; class EditDoc; @@ -80,10 +80,10 @@ inline sal_Bool EPaM::operator == ( const EPaM& r ) const struct ScriptTypePosInfo { short nScriptType; - sal_uInt16 nStartPos; - sal_uInt16 nEndPos; + sal_Int32 nStartPos; + sal_Int32 nEndPos; - ScriptTypePosInfo( short _Type, sal_uInt16 _Start, sal_uInt16 _End ) + ScriptTypePosInfo( short _Type, sal_Int32 _Start, sal_Int32 _End ) : nScriptType(_Type) , nStartPos(_Start) , nEndPos(_End) @@ -96,10 +96,10 @@ typedef std::deque< ScriptTypePosInfo > ScriptTypePosInfos; struct WritingDirectionInfo { sal_uInt8 nType; - sal_uInt16 nStartPos; - sal_uInt16 nEndPos; + sal_Int32 nStartPos; + sal_Int32 nEndPos; - WritingDirectionInfo( sal_uInt8 _Type, sal_uInt16 _Start, sal_uInt16 _End ) + WritingDirectionInfo( sal_uInt8 _Type, sal_Int32 _Start, sal_Int32 _End ) : nType(_Type) , nStartPos(_Start) , nEndPos(_End) @@ -142,10 +142,10 @@ public: SvxColorList(); ~SvxColorList(); - size_t GetId( const SvxColorItem& rColor ); - size_t Count() { return aColorList.size(); }; - void Insert( SvxColorItem* pItem, size_t nIndex ); - SvxColorItem* GetObject( size_t nIndex ); + sal_Int32 GetId( const SvxColorItem& rColor ); + sal_Int32 Count() { return aColorList.size(); }; + void Insert( SvxColorItem* pItem, sal_Int32 nIndex ); + SvxColorItem* GetObject( sal_Int32 nIndex ); }; // ---------------------------------------------------------------------- @@ -157,13 +157,13 @@ class ItemList private: typedef std::vector<const SfxPoolItem*> DummyItemList; DummyItemList aItemPool; - size_t CurrentItem; + sal_Int32 CurrentItem; public: ItemList(); const SfxPoolItem* First(); const SfxPoolItem* Next(); - size_t Count() { return aItemPool.size(); }; + sal_Int32 Count() { return aItemPool.size(); }; void Insert( const SfxPoolItem* pItem ); void Clear() { aItemPool.clear(); }; }; @@ -215,18 +215,18 @@ public: void DeleteEmptyAttribs( SfxItemPool& rItemPool ); void RemoveItemsFromPool( SfxItemPool* pItemPool ); - const EditCharAttrib* FindAttrib( sal_uInt16 nWhich, sal_uInt16 nPos ) const; - EditCharAttrib* FindAttrib( sal_uInt16 nWhich, sal_uInt16 nPos ); - const EditCharAttrib* FindNextAttrib( sal_uInt16 nWhich, sal_uInt16 nFromPos ) const; - const EditCharAttrib* FindEmptyAttrib( sal_uInt16 nWhich, sal_uInt16 nPos ) const; - EditCharAttrib* FindEmptyAttrib( sal_uInt16 nWhich, sal_uInt16 nPos ); - const EditCharAttrib* FindFeature( sal_uInt16 nPos ) const; + const EditCharAttrib* FindAttrib( sal_uInt16 nWhich, sal_Int32 nPos ) const; + EditCharAttrib* FindAttrib( sal_uInt16 nWhich, sal_Int32 nPos ); + const EditCharAttrib* FindNextAttrib( sal_uInt16 nWhich, sal_Int32 nFromPos ) const; + const EditCharAttrib* FindEmptyAttrib( sal_uInt16 nWhich, sal_Int32 nPos ) const; + EditCharAttrib* FindEmptyAttrib( sal_uInt16 nWhich, sal_Int32 nPos ); + const EditCharAttrib* FindFeature( sal_Int32 nPos ) const; void ResortAttribs(); void OptimizeRanges( SfxItemPool& rItemPool ); - size_t Count() const; + sal_Int32 Count() const; void InsertAttrib( EditCharAttrib* pAttrib ); @@ -234,14 +234,14 @@ public: bool HasEmptyAttribs() const { return bHasEmptyAttribs; } void SetHasEmptyAttribs(bool b); - bool HasBoundingAttrib( sal_uInt16 nBound ) const; - bool HasAttrib( sal_uInt16 nStartPos, sal_uInt16 nEndPos ) const; + bool HasBoundingAttrib( sal_Int32 nBound ) const; + bool HasAttrib( sal_Int32 nStartPos, sal_Int32 nEndPos ) const; AttribsType& GetAttribs(); const AttribsType& GetAttribs() const; void Remove(const EditCharAttrib* p); - void Remove(size_t nPos); + void Remove(sal_Int32 nPos); void Release(const EditCharAttrib* p); #if OSL_DEBUG_LEVEL > 2 @@ -271,8 +271,8 @@ public: CharAttribList& GetCharAttribs() { return aCharAttribList; } const CharAttribList& GetCharAttribs() const { return aCharAttribList; } - void ExpandAttribs( sal_uInt16 nIndex, sal_uInt16 nNewChars, SfxItemPool& rItemPool ); - void CollapsAttribs( sal_uInt16 nIndex, sal_uInt16 nDelChars, SfxItemPool& rItemPool ); + void ExpandAttribs( sal_Int32 nIndex, sal_Int32 nNewChars, SfxItemPool& rItemPool ); + void CollapsAttribs( sal_Int32 nIndex, sal_Int32 nDelChars, SfxItemPool& rItemPool ); void AppendAttribs( ContentNode* pNextNode ); void CopyAndCutAttribs( ContentNode* pPrevNode, SfxItemPool& rPool, sal_Bool bKeepEndingAttribs ); @@ -291,19 +291,19 @@ public: void CreateWrongList(); void DestroyWrongList(); - bool IsFeature( sal_uInt16 nPos ) const; + bool IsFeature( sal_Int32 nPos ) const; - sal_uInt16 Len() const; + sal_Int32 Len() const; const OUString& GetString() const; - void SetChar(sal_uInt16 nPos, sal_Unicode c); - void Insert(const OUString& rStr, sal_uInt16 nPos); + void SetChar(sal_Int32 nPos, sal_Unicode c); + void Insert(const OUString& rStr, sal_Int32 nPos); void Append(const OUString& rStr); - void Erase(sal_uInt16 nPos); - void Erase(sal_uInt16 nPos, sal_uInt16 nCount); - OUString Copy(sal_uInt16 nPos) const; - OUString Copy(sal_uInt16 nPos, sal_uInt16 nCount) const; - sal_Unicode GetChar(sal_uInt16 nPos) const; + void Erase(sal_Int32 nPos); + void Erase(sal_Int32 nPos, sal_Int32 nCount); + OUString Copy(sal_Int32 nPos) const; + OUString Copy(sal_Int32 nPos, sal_Int32 nCount) const; + sal_Unicode GetChar(sal_Int32 nPos) const; }; // ------------------------------------------------------------------------- @@ -372,7 +372,7 @@ struct ExtraPortionInfo ExtraPortionInfo(); ~ExtraPortionInfo(); - void SaveOrgDXArray( const sal_Int32* pDXArray, sal_uInt16 nLen ); + void SaveOrgDXArray( const sal_Int32* pDXArray, sal_Int32 nLen ); }; @@ -383,7 +383,7 @@ class TextPortion { private: ExtraPortionInfo* pExtraInfos; - sal_uInt16 nLen; + sal_Int32 nLen; Size aOutSz; sal_uInt8 nKind; sal_uInt8 nRightToLeft; @@ -401,7 +401,7 @@ private: } public: - TextPortion( sal_uInt16 nL ) + TextPortion( sal_Int32 nL ) : pExtraInfos( NULL ) , nLen( nL ) , aOutSz( -1, -1 ) @@ -422,8 +422,8 @@ public: } - sal_uInt16 GetLen() const { return nLen; } - void SetLen( sal_uInt16 nL ) { nLen = nL; } + sal_Int32 GetLen() const { return nLen; } + void SetLen( sal_Int32 nL ) { nLen = nL; } Size& GetSize() { return aOutSz; } const Size& GetSize() const { return aOutSz; } @@ -457,18 +457,18 @@ public: ~TextPortionList(); void Reset(); - size_t FindPortion( - sal_uInt16 nCharPos, sal_uInt16& rPortionStart, bool bPreferStartingPortion = false) const; - sal_uInt16 GetStartPos(size_t nPortion); - void DeleteFromPortion(size_t nDelFrom); - size_t Count() const; - const TextPortion* operator[](size_t nPos) const; - TextPortion* operator[](size_t nPos); + sal_Int32 FindPortion( + sal_Int32 nCharPos, sal_Int32& rPortionStart, bool bPreferStartingPortion = false) const; + sal_Int32 GetStartPos(sal_Int32 nPortion); + void DeleteFromPortion(sal_Int32 nDelFrom); + sal_Int32 Count() const; + const TextPortion* operator[](sal_Int32 nPos) const; + TextPortion* operator[](sal_Int32 nPos); void Append(TextPortion* p); - void Insert(size_t nPos, TextPortion* p); - void Remove(size_t nPos); - size_t GetPos(const TextPortion* p) const; + void Insert(sal_Int32 nPos, TextPortion* p); + void Remove(sal_Int32 nPos); + sal_Int32 GetPos(const TextPortion* p) const; }; class ParaPortion; @@ -485,10 +485,10 @@ private: CharPosArrayType aPositions; long nTxtWidth; sal_uInt16 nStartPosX; - sal_uInt16 nStart; // could be replaced by nStartPortion - sal_uInt16 nEnd; // could be replaced by nEndPortion - sal_uInt16 nStartPortion; - sal_uInt16 nEndPortion; + sal_Int32 nStart; // could be replaced by nStartPortion + sal_Int32 nEnd; // could be replaced by nEndPortion + sal_Int32 nStartPortion; + sal_Int32 nEndPortion; sal_uInt16 nHeight; // Total height of the line sal_uInt16 nTxtHeight; // Pure Text height sal_uInt16 nCrsrHeight; // For contour flow high lines => cursor is large. @@ -501,27 +501,27 @@ public: EditLine( const EditLine& ); ~EditLine(); - sal_Bool IsIn( sal_uInt16 nIndex ) const + sal_Bool IsIn( sal_Int32 nIndex ) const { return ( (nIndex >= nStart ) && ( nIndex < nEnd ) ); } - sal_Bool IsIn( sal_uInt16 nIndex, sal_Bool bInclEnd ) const + sal_Bool IsIn( sal_Int32 nIndex, sal_Bool bInclEnd ) const { return ( ( nIndex >= nStart ) && ( bInclEnd ? ( nIndex <= nEnd ) : ( nIndex < nEnd ) ) ); } - void SetStart( sal_uInt16 n ) { nStart = n; } - sal_uInt16 GetStart() const { return nStart; } - sal_uInt16& GetStart() { return nStart; } + void SetStart( sal_Int32 n ) { nStart = n; } + sal_Int32 GetStart() const { return nStart; } + sal_Int32& GetStart() { return nStart; } - void SetEnd( sal_uInt16 n ) { nEnd = n; } - sal_uInt16 GetEnd() const { return nEnd; } - sal_uInt16& GetEnd() { return nEnd; } + void SetEnd( sal_Int32 n ) { nEnd = n; } + sal_Int32 GetEnd() const { return nEnd; } + sal_Int32& GetEnd() { return nEnd; } - void SetStartPortion( sal_uInt16 n ) { nStartPortion = n; } - sal_uInt16 GetStartPortion() const { return nStartPortion; } - sal_uInt16& GetStartPortion() { return nStartPortion; } + void SetStartPortion( sal_Int32 n ) { nStartPortion = n; } + sal_Int32 GetStartPortion() const { return nStartPortion; } + sal_Int32& GetStartPortion() { return nStartPortion; } - void SetEndPortion( sal_uInt16 n ) { nEndPortion = n; } - sal_uInt16 GetEndPortion() const { return nEndPortion; } - sal_uInt16& GetEndPortion() { return nEndPortion; } + void SetEndPortion( sal_Int32 n ) { nEndPortion = n; } + sal_Int32 GetEndPortion() const { return nEndPortion; } + sal_Int32& GetEndPortion() { return nEndPortion; } void SetHeight( sal_uInt16 nH, sal_uInt16 nTxtH = 0, sal_uInt16 nCrsrH = 0 ); sal_uInt16 GetHeight() const { return nHeight; } @@ -537,7 +537,7 @@ public: void SetHangingPunctuation( bool b ) { bHangingPunctuation = b; } bool IsHangingPunctuation() const { return bHangingPunctuation; } - sal_uInt16 GetLen() const { return nEnd - nStart; } + sal_Int32 GetLen() const { return nEnd - nStart; } sal_uInt16 GetStartPosX() const { return nStartPosX; } void SetStartPosX( long start ); @@ -574,14 +574,14 @@ public: ~EditLineList(); void Reset(); - void DeleteFromLine(size_t nDelFrom); - size_t FindLine(sal_uInt16 nChar, bool bInclEnd); - size_t Count() const; - const EditLine* operator[](size_t nPos) const; - EditLine* operator[](size_t nPos); + void DeleteFromLine(sal_Int32 nDelFrom); + sal_Int32 FindLine(sal_Int32 nChar, bool bInclEnd); + sal_Int32 Count() const; + const EditLine* operator[](sal_Int32 nPos) const; + EditLine* operator[](sal_Int32 nPos); void Append(EditLine* p); - void Insert(size_t nPos, EditLine* p); + void Insert(sal_Int32 nPos, EditLine* p); }; // ------------------------------------------------------------------------- @@ -599,10 +599,10 @@ private: ScriptTypePosInfos aScriptInfos; WritingDirectionInfos aWritingDirectionInfos; - sal_uInt16 nInvalidPosStart; - sal_uInt16 nFirstLineOffset; // For Writer-LineSpacing-Interpretation - sal_uInt16 nBulletX; - short nInvalidDiff; + sal_Int32 nInvalidPosStart; + sal_Int32 nFirstLineOffset; // For Writer-LineSpacing-Interpretation + sal_uInt16 nBulletX; + sal_Int32 nInvalidDiff; sal_Bool bInvalid : 1; sal_Bool bSimple : 1; // only linear Tap @@ -615,7 +615,7 @@ public: ParaPortion( ContentNode* pNode ); ~ParaPortion(); - sal_uInt16 GetLineNumber( sal_uInt16 nIndex ) const; + sal_Int32 GetLineNumber( sal_Int32 nIndex ) const; EditLineList& GetLines() { return aLineList; } const EditLineList& GetLines() const { return aLineList; } @@ -630,8 +630,8 @@ public: sal_uInt16 GetBulletX() const { return nBulletX; } void SetBulletX( sal_uInt16 n ) { nBulletX = n; } - void MarkInvalid( sal_uInt16 nStart, short nDiff); - void MarkSelectionInvalid( sal_uInt16 nStart, sal_uInt16 nEnd ); + void MarkInvalid( sal_Int32 nStart, sal_Int32 nDiff); + void MarkSelectionInvalid( sal_Int32 nStart, sal_Int32 nEnd ); void SetVisible( sal_Bool bVisible ); bool IsVisible() const { return bVisible; } @@ -639,17 +639,17 @@ public: sal_Bool IsEmpty() { return GetTextPortions().Count() == 1 && GetTextPortions()[0]->GetLen() == 0; } long GetHeight() const { return ( bVisible ? nHeight : 0 ); } - sal_uInt16 GetFirstLineOffset() const { return ( bVisible ? nFirstLineOffset : 0 ); } + sal_Int32 GetFirstLineOffset() const { return ( bVisible ? nFirstLineOffset : 0 ); } void ResetHeight() { nHeight = 0; nFirstLineOffset = 0; } ContentNode* GetNode() const { return pNode; } TextPortionList& GetTextPortions() { return aTextPortionList; } const TextPortionList& GetTextPortions() const { return aTextPortionList; } - sal_uInt16 GetInvalidPosStart() const { return nInvalidPosStart; } + sal_Int32 GetInvalidPosStart() const { return nInvalidPosStart; } short GetInvalidDiff() const { return nInvalidDiff; } - void CorrectValuesBehindLastFormattedLine( sal_uInt16 nLastFormattedLine ); + void CorrectValuesBehindLastFormattedLine( sal_Int32 nLastFormattedLine ); #if OSL_DEBUG_LEVEL > 2 sal_Bool DbgCheckTextPortions(); #endif @@ -660,7 +660,7 @@ public: // ------------------------------------------------------------------------- class ParaPortionList { - mutable size_t nLastCache; + mutable sal_Int32 nLastCache; boost::ptr_vector<ParaPortion> maPortions; public: ParaPortionList(); @@ -749,7 +749,7 @@ public: class EditDoc { private: - mutable size_t nLastCache; + mutable sal_Int32 nLastCache; boost::ptr_vector<ContentNode> maContents; SfxItemPool* pItemPool; @@ -792,7 +792,7 @@ public: EditPaM Clear(); EditPaM RemoveText(); - EditPaM RemoveChars( EditPaM aPaM, sal_uInt16 nChars ); + EditPaM RemoveChars( EditPaM aPaM, sal_Int32 nChars ); EditPaM InsertText( EditPaM aPaM, const OUString& rStr ); EditPaM InsertParaBreak( EditPaM aPaM, sal_Bool bKeepEndingAttribs ); EditPaM InsertFeature( EditPaM aPaM, const SfxPoolItem& rItem ); @@ -802,7 +802,7 @@ public: sal_uLong GetTextLen() const; OUString GetParaAsString( sal_Int32 nNode ) const; - OUString GetParaAsString(const ContentNode* pNode, sal_uInt16 nStartPos = 0, sal_uInt16 nEndPos = 0xFFFF, bool bResolveFields = true) const; + OUString GetParaAsString(const ContentNode* pNode, sal_Int32 nStartPos = 0, sal_Int32 nEndPos = -1, bool bResolveFields = true) const; EditPaM GetStartPaM() const; EditPaM GetEndPaM() const; @@ -812,12 +812,12 @@ public: void RemoveItemsFromPool(const ContentNode& rNode); - void InsertAttrib( const SfxPoolItem& rItem, ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd ); - void InsertAttrib( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd, const SfxPoolItem& rPoolItem ); - void InsertAttribInSelection( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd, const SfxPoolItem& rPoolItem ); - sal_Bool RemoveAttribs( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd, sal_uInt16 nWhich = 0 ); - sal_Bool RemoveAttribs( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd, EditCharAttrib*& rpStarting, EditCharAttrib*& rpEnding, sal_uInt16 nWhich = 0 ); - void FindAttribs( ContentNode* pNode, sal_uInt16 nStartPos, sal_uInt16 nEndPos, SfxItemSet& rCurSet ); + void InsertAttrib( const SfxPoolItem& rItem, ContentNode* pNode, sal_Int32 nStart, sal_Int32 nEnd ); + void InsertAttrib( ContentNode* pNode, sal_Int32 nStart, sal_Int32 nEnd, const SfxPoolItem& rPoolItem ); + void InsertAttribInSelection( ContentNode* pNode, sal_Int32 nStart, sal_Int32 nEnd, const SfxPoolItem& rPoolItem ); + sal_Bool RemoveAttribs( ContentNode* pNode, sal_Int32 nStart, sal_Int32 nEnd, sal_uInt16 nWhich = 0 ); + sal_Bool RemoveAttribs( ContentNode* pNode, sal_Int32 nStart, sal_Int32 nEnd, EditCharAttrib*& rpStarting, EditCharAttrib*& rpEnding, sal_uInt16 nWhich = 0 ); + void FindAttribs( ContentNode* pNode, sal_Int32 nStartPos, sal_Int32 nEndPos, SfxItemSet& rCurSet ); sal_Int32 GetPos(const ContentNode* pNode) const; const ContentNode* GetObject(sal_Int32 nPos) const; @@ -834,9 +834,9 @@ public: static OUString GetSepStr( LineEnd eEnd ); }; -inline EditCharAttrib* GetAttrib(CharAttribList::AttribsType& rAttribs, size_t nAttr) +inline EditCharAttrib* GetAttrib(CharAttribList::AttribsType& rAttribs, sal_Int32 nAttr) { - return (nAttr < rAttribs.size()) ? &rAttribs[nAttr] : NULL; + return (nAttr < (sal_Int32)rAttribs.size()) ? &rAttribs[nAttr] : NULL; } bool CheckOrderedList(const CharAttribList::AttribsType& rAttribs, bool bStart); diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index 1ba33296193c..9e6807f86de0 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -477,7 +477,7 @@ LanguageType EditEngine::GetLanguage(const EditPaM& rPaM) const return pImpEditEngine->GetLanguage(rPaM); } -LanguageType EditEngine::GetLanguage( sal_Int32 nPara, sal_uInt16 nPos ) const +LanguageType EditEngine::GetLanguage( sal_Int32 nPara, sal_Int32 nPos ) const { ContentNode* pNode = pImpEditEngine->GetEditDoc().GetObject( nPara ); DBG_ASSERT( pNode, "GetLanguage - nPara is invalid!" ); @@ -579,35 +579,35 @@ sal_Int32 EditEngine::GetParagraphCount() const return pImpEditEngine->aEditDoc.Count(); } -sal_uInt16 EditEngine::GetLineCount( sal_Int32 nParagraph ) const +sal_Int32 EditEngine::GetLineCount( sal_Int32 nParagraph ) const { if ( !pImpEditEngine->IsFormatted() ) pImpEditEngine->FormatDoc(); return pImpEditEngine->GetLineCount( nParagraph ); } -sal_uInt16 EditEngine::GetLineLen( sal_Int32 nParagraph, sal_uInt16 nLine ) const +sal_Int32 EditEngine::GetLineLen( sal_Int32 nParagraph, sal_Int32 nLine ) const { if ( !pImpEditEngine->IsFormatted() ) pImpEditEngine->FormatDoc(); return pImpEditEngine->GetLineLen( nParagraph, nLine ); } -void EditEngine::GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_Int32 nParagraph, sal_uInt16 nLine ) const +void EditEngine::GetLineBoundaries( /*out*/sal_Int32& rStart, /*out*/sal_Int32& rEnd, sal_Int32 nParagraph, sal_Int32 nLine ) const { if ( !pImpEditEngine->IsFormatted() ) pImpEditEngine->FormatDoc(); return pImpEditEngine->GetLineBoundaries( rStart, rEnd, nParagraph, nLine ); } -sal_uInt16 EditEngine::GetLineNumberAtIndex( sal_Int32 nPara, sal_uInt16 nIndex ) const +sal_Int32 EditEngine::GetLineNumberAtIndex( sal_Int32 nPara, sal_Int32 nIndex ) const { if ( !pImpEditEngine->IsFormatted() ) pImpEditEngine->FormatDoc(); return pImpEditEngine->GetLineNumberAtIndex( nPara, nIndex ); } -sal_uInt32 EditEngine::GetLineHeight( sal_Int32 nParagraph, sal_uInt16 nLine ) +sal_uInt32 EditEngine::GetLineHeight( sal_Int32 nParagraph, sal_Int32 nLine ) { // If someone calls GetLineHeight() with an empty Engine. if ( !pImpEditEngine->IsFormatted() ) @@ -625,7 +625,7 @@ sal_uInt32 EditEngine::GetTextHeight( sal_Int32 nParagraph ) const return nHeight; } -OUString EditEngine::GetWord( sal_Int32 nPara, sal_uInt16 nIndex ) +OUString EditEngine::GetWord( sal_Int32 nPara, sal_Int32 nIndex ) { ESelection aESel( nPara, nIndex, nPara, nIndex ); EditSelection aSel( pImpEditEngine->CreateSel( aESel ) ); @@ -708,7 +708,7 @@ void EditEngine::InsertContent(ContentNode* pNode, sal_Int32 nPos) pImpEditEngine->InsertContent(pNode, nPos); } -EditPaM EditEngine::SplitContent(sal_Int32 nNode, sal_uInt16 nSepPos) +EditPaM EditEngine::SplitContent(sal_Int32 nNode, sal_Int32 nSepPos) { return pImpEditEngine->SplitContent(nNode, nSepPos); } @@ -828,7 +828,7 @@ EditSelection EditEngine::SelectWord( } long EditEngine::GetXPos( - const ParaPortion* pParaPortion, const EditLine* pLine, sal_uInt16 nIndex, bool bPreferPortionStart) const + const ParaPortion* pParaPortion, const EditLine* pLine, sal_Int32 nIndex, bool bPreferPortionStart) const { return pImpEditEngine->GetXPos(pParaPortion, pLine, nIndex, bPreferPortionStart); } @@ -885,7 +885,7 @@ const ParaPortionList& EditEngine::GetParaPortions() const } void EditEngine::SeekCursor( - ContentNode* pNode, sal_uInt16 nPos, SvxFont& rFont, OutputDevice* pOut, sal_uInt16 nIgnoreWhich) + ContentNode* pNode, sal_Int32 nPos, SvxFont& rFont, OutputDevice* pOut, sal_uInt16 nIgnoreWhich) { pImpEditEngine->SeekCursor(pNode, nPos, rFont, pOut, nIgnoreWhich); } @@ -1377,7 +1377,7 @@ sal_Bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditVie ( !IsVertical() && ( nCode != KEY_LEFT ) && ( nCode != KEY_RIGHT ) ) || ( IsVertical() && ( nCode != KEY_UP ) && ( nCode != KEY_DOWN ) )) { - pEditView->pImpEditView->SetCursorBidiLevel( 0xFFFF ); + pEditView->pImpEditView->SetCursorBidiLevel( CURSOR_BIDILEVEL_DONTKNOW ); } if ( bSetCursorFlags ) @@ -1601,7 +1601,7 @@ void EditEngine::RemoveParagraph( sal_Int32 nPara ) } } -sal_uInt16 EditEngine::GetTextLen( sal_Int32 nPara ) const +sal_Int32 EditEngine::GetTextLen( sal_Int32 nPara ) const { ContentNode* pNode = pImpEditEngine->GetEditDoc().GetObject( nPara ); DBG_ASSERT( pNode, "Paragraph not found: GetTextLen" ); @@ -1736,7 +1736,7 @@ SfxItemSet EditEngine::GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAtt return pImpEditEngine->GetAttribs( aSel, bOnlyHardAttrib ); } -SfxItemSet EditEngine::GetAttribs( sal_Int32 nPara, sal_uInt16 nStart, sal_uInt16 nEnd, sal_uInt8 nFlags ) const +SfxItemSet EditEngine::GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, sal_uInt8 nFlags ) const { return pImpEditEngine->GetAttribs( nPara, nStart, nEnd, nFlags ); } @@ -1774,7 +1774,7 @@ void EditEngine::StripPortions() pImpEditEngine->Paint( &aTmpDev, aBigRect, Point(), sal_True ); } -void EditEngine::GetPortions( sal_Int32 nPara, std::vector<sal_uInt16>& rList ) +void EditEngine::GetPortions( sal_Int32 nPara, std::vector<sal_Int32>& rList ) { if ( !pImpEditEngine->IsFormatted() ) pImpEditEngine->FormatFullDoc(); @@ -1782,9 +1782,9 @@ void EditEngine::GetPortions( sal_Int32 nPara, std::vector<sal_uInt16>& rList ) const ParaPortion* pParaPortion = pImpEditEngine->GetParaPortions().SafeGetObject( nPara ); if ( pParaPortion ) { - sal_uInt16 nEnd = 0; - sal_uInt16 nTextPortions = pParaPortion->GetTextPortions().Count(); - for ( sal_uInt16 n = 0; n < nTextPortions; n++ ) + sal_Int32 nEnd = 0; + sal_Int32 nTextPortions = pParaPortion->GetTextPortions().Count(); + for ( sal_Int32 n = 0; n < nTextPortions; n++ ) { nEnd = nEnd + pParaPortion->GetTextPortions()[n]->GetLen(); rList.push_back( nEnd ); @@ -1977,7 +1977,7 @@ sal_Bool EditEngine::IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder ) const ParaPortion* pParaPortion = pImpEditEngine->FindParaPortion( aPaM.GetNode() ); DBG_ASSERT( pParaPortion, "ParaPortion?" ); - sal_uInt16 nLine = pParaPortion->GetLineNumber( aPaM.GetIndex() ); + sal_Int32 nLine = pParaPortion->GetLineNumber( aPaM.GetIndex() ); const EditLine* pLine = pParaPortion->GetLines()[nLine]; Range aLineXPosStartEnd = pImpEditEngine->GetLineXPosStartEnd( pParaPortion, pLine ); if ( ( aDocPos.X() >= aLineXPosStartEnd.Min() - nBorder ) && @@ -2232,7 +2232,7 @@ void EditEngine::GetGlobalCharStretching( sal_uInt16& rX, sal_uInt16& rY ) const sal_Bool EditEngine::ShouldCreateBigTextObject() const { - sal_uInt32 nTextPortions = 0; + sal_Int32 nTextPortions = 0; sal_Int32 nParas = pImpEditEngine->GetEditDoc().Count(); for ( sal_Int32 nPara = 0; nPara < nParas; nPara++ ) { @@ -2428,8 +2428,8 @@ ParagraphInfos EditEngine::GetParagraphInfos( sal_Int32 nPara ) // ===================================================================== // ====================== Virtual Methods ======================== // ===================================================================== -void EditEngine::DrawingText( const Point&, const OUString&, sal_uInt16, sal_uInt16, - const sal_Int32*, const SvxFont&, sal_Int32, sal_uInt16, sal_uInt8, +void EditEngine::DrawingText( const Point&, const OUString&, sal_Int32, sal_Int32, + const sal_Int32*, const SvxFont&, sal_Int32, sal_Int32, sal_uInt8, const EEngineData::WrongSpellVector*, const SvxFieldData*, bool, bool, bool, const ::com::sun::star::lang::Locale*, const Color&, const Color&) @@ -2438,7 +2438,7 @@ void EditEngine::DrawingText( const Point&, const OUString&, sal_uInt16, sal_uIn void EditEngine::DrawingTab( const Point& /*rStartPos*/, long /*nWidth*/, const OUString& /*rChar*/, const SvxFont& /*rFont*/, - sal_Int32 /*nPara*/, xub_StrLen /*nIndex*/, + sal_Int32 /*nPara*/, sal_Int32 /*nIndex*/, sal_uInt8 /*nRightToLeft*/, bool /*bEndOfLine*/, bool /*bEndOfParagraph*/, const Color& /*rOverlineColor*/, const Color& /*rTextLineColor*/) @@ -2559,16 +2559,16 @@ Rectangle EditEngine::GetBulletArea( sal_Int32 ) return Rectangle( Point(), Point() ); } -OUString EditEngine::CalcFieldValue( const SvxFieldItem&, sal_Int32, sal_uInt16, Color*&, Color*& ) +OUString EditEngine::CalcFieldValue( const SvxFieldItem&, sal_Int32, sal_Int32, Color*&, Color*& ) { return OUString(' '); } -void EditEngine::FieldClicked( const SvxFieldItem&, sal_Int32, sal_uInt16 ) +void EditEngine::FieldClicked( const SvxFieldItem&, sal_Int32, sal_Int32 ) { } -void EditEngine::FieldSelected( const SvxFieldItem&, sal_Int32, sal_uInt16 ) +void EditEngine::FieldSelected( const SvxFieldItem&, sal_Int32, sal_Int32 ) { } @@ -2781,7 +2781,7 @@ EFieldInfo::EFieldInfo() } -EFieldInfo::EFieldInfo( const SvxFieldItem& rFieldItem, sal_Int32 nPara, sal_uInt16 nPos ) : aPosition( nPara, nPos ) +EFieldInfo::EFieldInfo( const SvxFieldItem& rFieldItem, sal_Int32 nPara, sal_Int32 nPos ) : aPosition( nPara, nPos ) { pFieldItem = new SvxFieldItem( rFieldItem ); } diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx index e812547eb73e..24cc1a868fa1 100644 --- a/editeng/source/editeng/editobj.cxx +++ b/editeng/source/editeng/editobj.cxx @@ -892,9 +892,9 @@ namespace { class FindByParagraph : std::unary_function<editeng::Section, bool> { - size_t mnPara; + sal_Int32 mnPara; public: - FindByParagraph(size_t nPara) : mnPara(nPara) {} + FindByParagraph(sal_Int32 nPara) : mnPara(nPara) {} bool operator() (const editeng::Section& rAttr) const { return rAttr.mnParagraph == mnPara; @@ -903,10 +903,10 @@ public: class FindBySectionStart : std::unary_function<editeng::Section, bool> { - size_t mnPara; - size_t mnStart; + sal_Int32 mnPara; + sal_Int32 mnStart; public: - FindBySectionStart(size_t nPara, size_t nStart) : mnPara(nPara), mnStart(nStart) {} + FindBySectionStart(sal_Int32 nPara, sal_Int32 nStart) : mnPara(nPara), mnStart(nStart) {} bool operator() (const editeng::Section& rAttr) const { return rAttr.mnParagraph == mnPara && rAttr.mnStart == mnStart; @@ -982,7 +982,7 @@ void EditTextObjectImpl::GetAllSections( std::vector<editeng::Section>& rAttrs ) // Go through all formatted paragraphs, and store format items. std::vector<editeng::Section>::iterator itAttr = aAttrs.begin(); - for (size_t nPara = 0; nPara < aContents.size(); ++nPara) + for (sal_Int32 nPara = 0; nPara < (sal_Int32)aContents.size(); ++nPara) { const ContentInfo& rC = aContents[nPara]; @@ -998,7 +998,7 @@ void EditTextObjectImpl::GetAllSections( std::vector<editeng::Section>& rAttrs ) if (!pItem) continue; - size_t nStart = rXAttr.GetStart(), nEnd = rXAttr.GetEnd(); + sal_Int32 nStart = rXAttr.GetStart(), nEnd = rXAttr.GetEnd(); std::vector<editeng::Section>::iterator itCurAttr = itAttr; // Find the container whose start position matches. diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index b32e3f6008a1..fdedb5fff5df 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -717,7 +717,7 @@ void EditView::StartTextConversion( } -sal_uInt16 EditView::StartSearchAndReplace( const SvxSearchItem& rSearchItem ) +sal_Int32 EditView::StartSearchAndReplace( const SvxSearchItem& rSearchItem ) { return PIMPEE->StartSearchAndReplace( this, rSearchItem ); } @@ -1047,16 +1047,16 @@ void EditView::InsertField( const SvxFieldItem& rFld ) const SvxFieldItem* EditView::GetFieldUnderMousePointer() const { sal_Int32 nPara; - sal_uInt16 nPos; + sal_Int32 nPos; return GetFieldUnderMousePointer( nPara, nPos ); } -const SvxFieldItem* EditView::GetField( const Point& rPos, sal_Int32* pPara, sal_uInt16* pPos ) const +const SvxFieldItem* EditView::GetField( const Point& rPos, sal_Int32* pPara, sal_Int32* pPos ) const { return pImpEditView->GetField( rPos, pPara, pPos ); } -const SvxFieldItem* EditView::GetFieldUnderMousePointer( sal_Int32& nPara, sal_uInt16& nPos ) const +const SvxFieldItem* EditView::GetFieldUnderMousePointer( sal_Int32& nPara, sal_Int32& nPos ) const { Point aPos = pImpEditView->GetWindow()->GetPointerPosPixel(); aPos = pImpEditView->GetWindow()->PixelToLogic( aPos ); @@ -1133,19 +1133,19 @@ void EditView::ChangeFontSize( bool bGrow, const FontList* pFontList ) { for( sal_Int32 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ ) { - std::vector<sal_uInt16> aPortions; + std::vector<sal_Int32> aPortions; rEditEngine.GetPortions( nPara, aPortions ); if( aPortions.empty() ) aPortions.push_back( rEditEngine.GetTextLen(nPara) ); - const sal_uInt16 nBeginPos = (nPara == aSel.nStartPara) ? aSel.nStartPos : 0; - const sal_uInt16 nEndPos = (nPara == aSel.nEndPara) ? aSel.nEndPos : EE_TEXTPOS_ALL; + const sal_Int32 nBeginPos = (nPara == aSel.nStartPara) ? aSel.nStartPos : 0; + const sal_Int32 nEndPos = (nPara == aSel.nEndPara) ? aSel.nEndPos : EE_TEXTPOS_ALL; for ( size_t nPos = 0; nPos < aPortions.size(); ++nPos ) { - sal_uInt16 nPortionEnd = aPortions[ nPos ]; - sal_uInt16 nPortionStart = nPos > 0 ? aPortions[ nPos - 1 ] : 0; + sal_Int32 nPortionEnd = aPortions[ nPos ]; + sal_Int32 nPortionStart = nPos > 0 ? aPortions[ nPos - 1 ] : 0; if( (nPortionEnd < nBeginPos) || (nPortionStart > nEndPos) ) continue; diff --git a/editeng/source/editeng/edtspell.cxx b/editeng/source/editeng/edtspell.cxx index e838c4e38b29..160a77ea8cc0 100644 --- a/editeng/source/editeng/edtspell.cxx +++ b/editeng/source/editeng/edtspell.cxx @@ -197,7 +197,7 @@ void EditSpellWrapper::CheckSpellTo() } } -size_t WrongList::Valid = std::numeric_limits<size_t>::max(); +sal_Int32 WrongList::Valid = std::numeric_limits<sal_Int32>::max(); WrongList::WrongList() : mnInvalidStart(0), mnInvalidEnd(Valid) {} @@ -229,7 +229,7 @@ void WrongList::SetValid() mnInvalidEnd = 0; } -void WrongList::SetInvalidRange( size_t nStart, size_t nEnd ) +void WrongList::SetInvalidRange( sal_Int32 nStart, sal_Int32 nEnd ) { if (mnInvalidStart == Valid || nStart < mnInvalidStart) mnInvalidStart = nStart; @@ -238,13 +238,13 @@ void WrongList::SetInvalidRange( size_t nStart, size_t nEnd ) mnInvalidEnd = nEnd; } -void WrongList::ResetInvalidRange( size_t nStart, size_t nEnd ) +void WrongList::ResetInvalidRange( sal_Int32 nStart, sal_Int32 nEnd ) { mnInvalidStart = nStart; mnInvalidEnd = nEnd; } -void WrongList::TextInserted( size_t nPos, size_t nLength, bool bPosIsSep ) +void WrongList::TextInserted( sal_Int32 nPos, sal_Int32 nLength, bool bPosIsSep ) { if (IsValid()) { @@ -261,7 +261,7 @@ void WrongList::TextInserted( size_t nPos, size_t nLength, bool bPosIsSep ) mnInvalidEnd = nPos + nLength; } - for (size_t i = 0, n = maRanges.size(); i < n; ++i) + for (sal_Int32 i = 0, n = (sal_Int32)maRanges.size(); i < n; ++i) { editeng::MisspellRange& rWrong = maRanges[i]; bool bRefIsValid = true; @@ -313,9 +313,9 @@ void WrongList::TextInserted( size_t nPos, size_t nLength, bool bPosIsSep ) SAL_WARN_IF(DbgIsBuggy(), "editeng", "InsertWrong: WrongList broken!"); } -void WrongList::TextDeleted( size_t nPos, size_t nLength ) +void WrongList::TextDeleted( sal_Int32 nPos, sal_Int32 nLength ) { - size_t nEndPos = nPos + nLength; + sal_Int32 nEndPos = nPos + nLength; if (IsValid()) { sal_uInt16 nNewInvalidStart = nPos ? nPos - 1 : 0; @@ -381,7 +381,7 @@ void WrongList::TextDeleted( size_t nPos, size_t nLength ) SAL_WARN_IF(DbgIsBuggy(), "editeng", "TextDeleted: WrongList broken!"); } -bool WrongList::NextWrong( size_t& rnStart, size_t& rnEnd ) const +bool WrongList::NextWrong( sal_Int32& rnStart, sal_Int32& rnEnd ) const { /* rnStart get the start position, is possibly adjusted wrt. Wrong start @@ -399,7 +399,7 @@ bool WrongList::NextWrong( size_t& rnStart, size_t& rnEnd ) const return false; } -bool WrongList::HasWrong( size_t nStart, size_t nEnd ) const +bool WrongList::HasWrong( sal_Int32 nStart, sal_Int32 nEnd ) const { for (WrongList::const_iterator i = begin(); i != end(); ++i) { @@ -411,7 +411,7 @@ bool WrongList::HasWrong( size_t nStart, size_t nEnd ) const return false; } -bool WrongList::HasAnyWrong( size_t nStart, size_t nEnd ) const +bool WrongList::HasAnyWrong( sal_Int32 nStart, sal_Int32 nEnd ) const { for (WrongList::const_iterator i = begin(); i != end(); ++i) { @@ -423,12 +423,16 @@ bool WrongList::HasAnyWrong( size_t nStart, size_t nEnd ) const return false; } -void WrongList::ClearWrongs( size_t nStart, size_t nEnd, - const ContentNode* pNode ) +void WrongList::ClearWrongs( sal_Int32 nStart, sal_Int32 nEnd, + const ContentNode* pNode ) { + if(nEnd < 0) + { + nEnd = SAL_MAX_INT32; + } for (WrongList::iterator i = begin(); i != end(); ) { - if (i->mnEnd > nStart && i->mnStart < nEnd) + if ((i->mnEnd > nStart) && (i->mnStart < nEnd)) { if (i->mnEnd > nEnd) // Runs out { @@ -457,7 +461,7 @@ void WrongList::ClearWrongs( size_t nStart, size_t nEnd, SAL_WARN_IF(DbgIsBuggy(), "editeng", "ClearWrongs: WrongList broken!"); } -void WrongList::InsertWrong( size_t nStart, size_t nEnd ) +void WrongList::InsertWrong( sal_Int32 nStart, sal_Int32 nEnd ) { WrongList::iterator nPos = end(); for (WrongList::iterator i = begin(); i != end(); ++i) diff --git a/editeng/source/editeng/edtspell.hxx b/editeng/source/editeng/edtspell.hxx index 4951e791b49e..2af8d1f813eb 100644 --- a/editeng/source/editeng/edtspell.hxx +++ b/editeng/source/editeng/edtspell.hxx @@ -70,11 +70,11 @@ public: */ class WrongList { - static size_t Valid; + static sal_Int32 Valid; std::vector<editeng::MisspellRange> maRanges; - size_t mnInvalidStart; - size_t mnInvalidEnd; + sal_Int32 mnInvalidStart; + sal_Int32 mnInvalidEnd; bool DbgIsBuggy() const; @@ -91,20 +91,20 @@ public: bool IsValid() const; void SetValid(); - void SetInvalidRange( size_t nStart, size_t nEnd ); - void ResetInvalidRange( size_t nStart, size_t nEnd ); + void SetInvalidRange( sal_Int32 nStart, sal_Int32 nEnd ); + void ResetInvalidRange( sal_Int32 nStart, sal_Int32 nEnd ); - size_t GetInvalidStart() const { return mnInvalidStart; } - size_t GetInvalidEnd() const { return mnInvalidEnd; } + sal_Int32 GetInvalidStart() const { return mnInvalidStart; } + sal_Int32 GetInvalidEnd() const { return mnInvalidEnd; } - void TextInserted( size_t nPos, size_t nLength, bool bPosIsSep ); - void TextDeleted( size_t nPos, size_t nLength ); + void TextInserted( sal_Int32 nPos, sal_Int32 nLength, bool bPosIsSep ); + void TextDeleted( sal_Int32 nPos, sal_Int32 nLength ); - void InsertWrong( size_t nStart, size_t nEnd ); - bool NextWrong( size_t& rnStart, size_t& rnEnd ) const; - bool HasWrong( size_t nStart, size_t nEnd ) const; - bool HasAnyWrong( size_t nStart, size_t nEnd ) const; - void ClearWrongs( size_t nStart, size_t nEnd, const ContentNode* pNode ); + void InsertWrong( sal_Int32 nStart, sal_Int32 nEnd ); + bool NextWrong( sal_Int32& rnStart, sal_Int32& rnEnd ) const; + bool HasWrong( sal_Int32 nStart, sal_Int32 nEnd ) const; + bool HasAnyWrong( sal_Int32 nStart, sal_Int32 nEnd ) const; + void ClearWrongs( sal_Int32 nStart, sal_Int32 nEnd, const ContentNode* pNode ); void MarkWrongsInvalid(); WrongList* Clone() const; diff --git a/editeng/source/editeng/eertfpar.cxx b/editeng/source/editeng/eertfpar.cxx index c336a532b4a1..ce5bbcf010ba 100644 --- a/editeng/source/editeng/eertfpar.cxx +++ b/editeng/source/editeng/eertfpar.cxx @@ -268,7 +268,7 @@ void EditRTFParser::MovePos( int bForward ) } void EditRTFParser::SetEndPrevPara( SvxNodeIdx*& rpNodePos, - sal_uInt16& rCntPos ) + sal_Int32& rCntPos ) { // The Intention is to: determine the current insert position of the // previous paragraph and set the end from this. @@ -285,7 +285,7 @@ void EditRTFParser::SetEndPrevPara( SvxNodeIdx*& rpNodePos, rCntPos = pPrevNode->Len(); } -bool EditRTFParser::IsEndPara( SvxNodeIdx* pNd, sal_uInt16 nCnt ) const +bool EditRTFParser::IsEndPara( SvxNodeIdx* pNd, sal_Int32 nCnt ) const { return ( nCnt == ( ((EditNodeIdx*)pNd)->GetNode()->Len()) ); } @@ -622,7 +622,7 @@ sal_Int32 EditPosition::GetNodeIdx() const return mpEditEngine->GetEditDoc().GetPos(pN); } -sal_uInt16 EditPosition::GetCntIdx() const +sal_Int32 EditPosition::GetCntIdx() const { return mpCurSel->Max().GetIndex(); } diff --git a/editeng/source/editeng/eertfpar.hxx b/editeng/source/editeng/eertfpar.hxx index 206a2622da14..df7d7d791338 100644 --- a/editeng/source/editeng/eertfpar.hxx +++ b/editeng/source/editeng/eertfpar.hxx @@ -50,7 +50,7 @@ public: EditPosition(EditEngine* pIEE, EditSelection* pSel); virtual sal_Int32 GetNodeIdx() const; - virtual sal_uInt16 GetCntIdx() const; + virtual sal_Int32 GetCntIdx() const; // clone virtual SvxPosition* Clone() const; @@ -81,12 +81,12 @@ protected: virtual void InsertText(); virtual void MovePos( int bForward = sal_True ); virtual void SetEndPrevPara( SvxNodeIdx*& rpNodePos, - sal_uInt16& rCntPos ); + sal_Int32& rCntPos ); virtual void UnknownAttrToken( int nToken, SfxItemSet* pSet ); virtual void NextToken( int nToken ); virtual void SetAttrInDoc( SvxRTFItemStackType &rSet ); - virtual bool IsEndPara( SvxNodeIdx* pNd, sal_uInt16 nCnt ) const; + virtual bool IsEndPara( SvxNodeIdx* pNd, sal_Int32 nCnt ) const; virtual void CalcValue(); void CreateStyleSheets(); SfxStyleSheet* CreateStyleSheet( SvxRTFStyleType* pRTFStyle ); diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index 5b5017080cc4..b91f9b1d4a16 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -256,8 +256,8 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, Region* pRegion, OutputD } else { - sal_uInt16 nTmpStartIndex = nStartIndex; - sal_uInt16 nWritingDirStart, nTmpEndIndex; + sal_Int32 nTmpStartIndex = nStartIndex; + sal_Int32 nWritingDirStart, nTmpEndIndex; while ( nTmpStartIndex < nEndIndex ) { @@ -652,7 +652,7 @@ void ImpEditView::ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, sa EditPaM aPaM( aEditSelection.Max() ); - sal_uInt16 nTextPortionStart = 0; + sal_Int32 nTextPortionStart = 0; sal_Int32 nPara = pEditEngine->GetEditDoc().GetPos( aPaM.GetNode() ); if (nPara == EE_PARA_NOT_FOUND) // #i94322 return; @@ -680,7 +680,7 @@ void ImpEditView::ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, sa // If we are behind a portion, and the next portion has other direction, we must change position... aEditCursor.Left() = aEditCursor.Right() = pEditEngine->pImpEditEngine->PaMtoEditCursor( aPaM, GETCRSR_TXTONLY|GETCRSR_PREFERPORTIONSTART ).Left(); - sal_uInt16 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nTextPortionStart, true ); + sal_Int32 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nTextPortionStart, true ); const TextPortion* pTextPortion = pParaPortion->GetTextPortions()[nTextPortion]; if ( pTextPortion->GetKind() == PORTIONKIND_TAB ) { @@ -1173,7 +1173,7 @@ void ImpEditView::DeleteSelected() ShowCursor( DoAutoScroll(), sal_True ); } -const SvxFieldItem* ImpEditView::GetField( const Point& rPos, sal_Int32* pPara, sal_uInt16* pPos ) const +const SvxFieldItem* ImpEditView::GetField( const Point& rPos, sal_Int32* pPara, sal_Int32* pPos ) const { if( !GetOutputArea().IsInside( rPos ) ) return 0; @@ -1547,7 +1547,7 @@ void ImpEditView::dragGestureRecognized( const ::com::sun::star::datatransfer::d { // Field?! sal_Int32 nPara; - sal_uInt16 nPos; + sal_Int32 nPos; Point aMousePos = GetWindow()->PixelToLogic( aMousePosPixel ); const SvxFieldItem* pField = GetField( aMousePos, &nPara, &nPos ); if ( pField ) diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index dc3211bbbaa5..08a2e7826a1d 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -135,7 +135,7 @@ struct ImplIMEInfos OUString aOldTextAfterStartPos; sal_uInt16* pAttribs; EditPaM aPos; - sal_uInt16 nLen; + sal_Int32 nLen; sal_Bool bCursor; sal_Bool bWasCursorOverwrite; @@ -359,7 +359,7 @@ public: sal_Bool IsWrongSpelledWord( const EditPaM& rPaM, sal_Bool bMarkIfWrong ); OUString SpellIgnoreOrAddWord( sal_Bool bAdd ); - const SvxFieldItem* GetField( const Point& rPos, sal_Int32* pPara, sal_uInt16* pPos ) const; + const SvxFieldItem* GetField( const Point& rPos, sal_Int32* pPara, sal_Int32* pPos ) const; void DeleteSelected(); // If possible invalidate more than OutputArea, for the DrawingEngine text frame @@ -429,7 +429,7 @@ private: EEHorizontalTextDirection eDefaultHorizontalTextDirection; - sal_uInt16 nBigTextObjectStart; + sal_Int32 nBigTextObjectStart; ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSpellChecker1 > xSpeller; ::com::sun::star::uno::Reference< @@ -511,9 +511,9 @@ private: EditPaM GetPaM( Point aDocPos, sal_Bool bSmart = sal_True ); EditPaM GetPaM( ParaPortion* pPortion, Point aPos, sal_Bool bSmart = sal_True ); - long GetXPos(const ParaPortion* pParaPortion, const EditLine* pLine, sal_uInt16 nIndex, bool bPreferPortionStart = false) const; - long GetPortionXOffset(const ParaPortion* pParaPortion, const EditLine* pLine, sal_uInt16 nTextPortion) const; - sal_uInt16 GetChar(const ParaPortion* pParaPortion, const EditLine* pLine, long nX, bool bSmart = true); + long GetXPos(const ParaPortion* pParaPortion, const EditLine* pLine, sal_Int32 nIndex, bool bPreferPortionStart = false) const; + long GetPortionXOffset(const ParaPortion* pParaPortion, const EditLine* pLine, sal_Int32 nTextPortion) const; + sal_Int32 GetChar(const ParaPortion* pParaPortion, const EditLine* pLine, long nX, bool bSmart = true); Range GetInvalidYOffsets( ParaPortion* pPortion ); Range GetLineXPosStartEnd( const ParaPortion* pParaPortion, const EditLine* pLine ) const; @@ -523,7 +523,7 @@ private: void ParaAttribsToCharAttribs( ContentNode* pNode ); void GetCharAttribs( sal_Int32 nPara, std::vector<EECharAttrib>& rLst ) const; - EditTextObject* CreateTextObject( EditSelection aSelection, SfxItemPool*, sal_Bool bAllowBigObjects = sal_False, sal_uInt16 nBigObjStart = 0 ); + EditTextObject* CreateTextObject( EditSelection aSelection, SfxItemPool*, sal_Bool bAllowBigObjects = sal_False, sal_Int32 nBigObjStart = 0 ); EditSelection InsertTextObject( const EditTextObject&, EditPaM aPaM ); EditSelection InsertText( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& rxDataObj, const OUString& rBaseURL, const EditPaM& rPaM, sal_Bool bUseSpecial ); @@ -534,14 +534,14 @@ private: void CreateAndInsertEmptyLine( ParaPortion* pParaPortion, sal_uInt32 nStartPosY ); sal_Bool FinishCreateLines( ParaPortion* pParaPortion ); void CalcCharPositions( ParaPortion* pParaPortion ); - void CreateTextPortions( ParaPortion* pParaPortion, sal_uInt16& rStartPos /*, sal_Bool bCreateBlockPortions */ ); - void RecalcTextPortion( ParaPortion* pParaPortion, sal_uInt16 nStartPos, short nNewChars ); - sal_uInt16 SplitTextPortion( ParaPortion* pParaPortion, sal_uInt16 nPos, EditLine* pCurLine = 0 ); - void SeekCursor( ContentNode* pNode, sal_uInt16 nPos, SvxFont& rFont, OutputDevice* pOut = NULL, sal_uInt16 nIgnoreWhich = 0 ); + void CreateTextPortions( ParaPortion* pParaPortion, sal_Int32& rStartPos /*, sal_Bool bCreateBlockPortions */ ); + void RecalcTextPortion( ParaPortion* pParaPortion, sal_Int32 nStartPos, sal_Int32 nNewChars ); + sal_Int32 SplitTextPortion( ParaPortion* pParaPortion, sal_Int32 nPos, EditLine* pCurLine = 0 ); + void SeekCursor( ContentNode* pNode, sal_Int32 nPos, SvxFont& rFont, OutputDevice* pOut = NULL, sal_uInt16 nIgnoreWhich = 0 ); void RecalcFormatterFontMetrics( FormatterFontMetric& rCurMetrics, SvxFont& rFont ); void CheckAutoPageSize(); - void ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, TextPortion* pPortion, sal_uInt16 nPortionStart, long nRemainingWidth, sal_Bool bCanHyphenate ); + void ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, TextPortion* pPortion, sal_Int32 nPortionStart, long nRemainingWidth, sal_Bool bCanHyphenate ); void ImpAdjustBlocks( ParaPortion* pParaPortion, EditLine* pLine, long nRemainingSpace ); EditPaM ImpConnectParagraphs( ContentNode* pLeft, ContentNode* pRight, sal_Bool bBackward = sal_False ); EditPaM ImpDeleteSelection(const EditSelection& rCurSel); @@ -549,7 +549,7 @@ private: EditPaM ImpInsertParaBreak( const EditSelection& rEditSelection, bool bKeepEndingAttribs = true ); EditPaM ImpInsertText(const EditSelection& aCurEditSelection, const OUString& rStr); EditPaM ImpInsertFeature(const EditSelection& rCurSel, const SfxPoolItem& rItem); - void ImpRemoveChars( const EditPaM& rPaM, sal_uInt16 nChars, EditUndoRemoveChars* pCurUndo = 0 ); + void ImpRemoveChars( const EditPaM& rPaM, sal_Int32 nChars, EditUndoRemoveChars* pCurUndo = 0 ); void ImpRemoveParagraph( sal_Int32 nPara ); EditSelection ImpMoveParagraphs( Range aParagraphs, sal_Int32 nNewPos ); @@ -560,10 +560,10 @@ private: bool ImplHasText() const; - void ImpFindKashidas( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd, std::vector<sal_uInt16>& rArray ); + void ImpFindKashidas( ContentNode* pNode, sal_Int32 nStart, sal_Int32 nEnd, std::vector<sal_Int32>& rArray ); void InsertContent( ContentNode* pNode, sal_Int32 nPos ); - EditPaM SplitContent( sal_Int32 nNode, sal_uInt16 nSepPos ); + EditPaM SplitContent( sal_Int32 nNode, sal_Int32 nSepPos ); EditPaM ConnectContents( sal_Int32 nLeftNode, sal_Bool bBackward ); void ShowParagraph( sal_Int32 nParagraph, bool bShow ); @@ -591,15 +591,15 @@ private: void InitScriptTypes( sal_Int32 nPara ); - sal_uInt16 GetI18NScriptType( const EditPaM& rPaM, sal_uInt16* pEndPos = NULL ) const; + sal_uInt16 GetI18NScriptType( const EditPaM& rPaM, sal_Int32* pEndPos = NULL ) const; sal_uInt16 GetItemScriptType( const EditSelection& rSel ) const; sal_Bool IsScriptChange( const EditPaM& rPaM ) const; sal_Bool HasScriptType( sal_Int32 nPara, sal_uInt16 nType ) const; - bool ImplCalcAsianCompression( ContentNode* pNode, TextPortion* pTextPortion, sal_uInt16 nStartPos, sal_Int32* pDXArray, sal_uInt16 n100thPercentFromMax, sal_Bool bManipulateDXArray ); + bool ImplCalcAsianCompression( ContentNode* pNode, TextPortion* pTextPortion, sal_Int32 nStartPos, sal_Int32* pDXArray, sal_uInt16 n100thPercentFromMax, sal_Bool bManipulateDXArray ); void ImplExpandCompressedPortions( EditLine* pLine, ParaPortion* pParaPortion, long nRemainingWidth ); - void ImplInitLayoutMode( OutputDevice* pOutDev, sal_Int32 nPara, sal_uInt16 nIndex ); + void ImplInitLayoutMode( OutputDevice* pOutDev, sal_Int32 nPara, sal_Int32 nIndex ); LanguageType ImplCalcDigitLang(LanguageType eCurLang) const; void ImplInitDigitMode(OutputDevice* pOutDev, LanguageType eLang); OUString convertDigits(const OUString &rString, sal_Int32 nStt, sal_Int32 nLen, LanguageType eDigitLang) const; @@ -615,9 +615,9 @@ private: sal_uInt32 WriteHTML( SvStream& rOutput, EditSelection aSel ); sal_uInt32 WriteBin( SvStream& rOutput, EditSelection aSel, bool bStoreUnicode = false ); - void WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, sal_Int32 nPara, sal_uInt16 nPos, + void WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, sal_Int32 nPara, sal_Int32 nPos, std::vector<SvxFontItem*>& rFontTable, SvxColorList& rColorList ); - sal_Bool WriteItemListAsRTF( ItemList& rLst, SvStream& rOutput, sal_Int32 nPara, sal_uInt16 nPos, + sal_Bool WriteItemListAsRTF( ItemList& rLst, SvStream& rOutput, sal_Int32 nPara, sal_Int32 nPos, std::vector<SvxFontItem*>& rFontTable, SvxColorList& rColorList ); sal_Int32 LogicToTwips( sal_Int32 n ); @@ -709,7 +709,7 @@ public: void InitWritingDirections( sal_Int32 nPara ); sal_Bool IsRightToLeft( sal_Int32 nPara ) const; - sal_uInt8 GetRightToLeft( sal_Int32 nPara, sal_uInt16 nChar, sal_uInt16* pStart = NULL, sal_uInt16* pEnd = NULL ); + sal_uInt8 GetRightToLeft( sal_Int32 nPara, sal_Int32 nChar, sal_Int32* pStart = NULL, sal_Int32* pEnd = NULL ); sal_Bool HasDifferentRTLLevels( const ContentNode* pNode ); void SetTextRanger( TextRanger* pRanger ); @@ -786,14 +786,14 @@ public: sal_uInt32 GetTextHeightNTP() const; sal_uInt32 CalcTextWidth( sal_Bool bIgnoreExtraSpace ); sal_uInt32 CalcLineWidth( ParaPortion* pPortion, EditLine* pLine, sal_Bool bIgnoreExtraSpace ); - sal_uInt16 GetLineCount( sal_Int32 nParagraph ) const; - sal_uInt16 GetLineLen( sal_Int32 nParagraph, sal_uInt16 nLine ) const; - void GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_Int32 nParagraph, sal_uInt16 nLine ) const; - sal_uInt16 GetLineNumberAtIndex( sal_Int32 nPara, sal_uInt16 nIndex ) const; - sal_uInt16 GetLineHeight( sal_Int32 nParagraph, sal_uInt16 nLine ); + sal_Int32 GetLineCount( sal_Int32 nParagraph ) const; + sal_Int32 GetLineLen( sal_Int32 nParagraph, sal_Int32 nLine ) const; + void GetLineBoundaries( /*out*/sal_Int32& rStart, /*out*/sal_Int32& rEnd, sal_Int32 nParagraph, sal_Int32 nLine ) const; + sal_Int32 GetLineNumberAtIndex( sal_Int32 nPara, sal_Int32 nIndex ) const; + sal_uInt16 GetLineHeight( sal_Int32 nParagraph, sal_Int32 nLine ); sal_uInt32 GetParaHeight( sal_Int32 nParagraph ); - SfxItemSet GetAttribs( sal_Int32 nPara, sal_uInt16 nStart, sal_uInt16 nEnd, sal_uInt8 nFlags = 0xFF ) const; + SfxItemSet GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, sal_uInt8 nFlags = 0xFF ) const; SfxItemSet GetAttribs( EditSelection aSel, sal_Bool bOnlyHardAttrib = sal_False ); void SetAttribs( EditSelection aSel, const SfxItemSet& rSet, sal_uInt8 nSpecial = 0 ); void RemoveCharAttribs( EditSelection aSel, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich = 0 ); @@ -807,7 +807,7 @@ public: const SfxPoolItem& GetParaAttrib( sal_Int32 nPara, sal_uInt16 nWhich ) const; Rectangle PaMtoEditCursor( EditPaM aPaM, sal_uInt16 nFlags = 0 ); - Rectangle GetEditCursor( ParaPortion* pPortion, sal_uInt16 nIndex, sal_uInt16 nFlags = 0 ); + Rectangle GetEditCursor( ParaPortion* pPortion, sal_Int32 nIndex, sal_uInt16 nFlags = 0 ); sal_Bool IsModified() const { return aEditDoc.IsModified(); } void SetModifyFlag( sal_Bool b ) { aEditDoc.SetModified( b ); } @@ -841,7 +841,7 @@ public: sal_Bool IsVisualCursorTravelingEnabled(); sal_Bool DoVisualCursorTraveling( const ContentNode* pNode ); - EditSelection ConvertSelection( sal_Int32 nStartPara, sal_uInt16 nStartPos, sal_Int32 nEndPara, sal_uInt16 nEndPos ); + EditSelection ConvertSelection( sal_Int32 nStartPara, sal_Int32 nStartPos, sal_Int32 nEndPara, sal_Int32 nEndPos ); inline EPaM CreateEPaM( const EditPaM& rPaM ); inline EditPaM CreateEditPaM( const EPaM& rEPaM ); inline ESelection CreateESel( const EditSelection& rSel ); @@ -903,7 +903,7 @@ public: LanguageType GetLanguage( const EditSelection &rSelection ) const; - LanguageType GetLanguage( const EditPaM& rPaM, sal_uInt16* pEndPos = NULL ) const; + LanguageType GetLanguage( const EditPaM& rPaM, sal_Int32* pEndPos = NULL ) const; ::com::sun::star::lang::Locale GetLocale( const EditPaM& rPaM ) const; void DoOnlineSpelling( ContentNode* pThisNodeOnly = 0, bool bSpellAtCursorPos = false, bool bInteruptable = true ); @@ -955,7 +955,7 @@ public: sal_Bool Search( const SvxSearchItem& rSearchItem, EditView* pView ); sal_Bool ImpSearch( const SvxSearchItem& rSearchItem, const EditSelection& rSearchSelection, const EditPaM& rStartPos, EditSelection& rFoundSel ); - sal_uInt16 StartSearchAndReplace( EditView* pEditView, const SvxSearchItem& rSearchItem ); + sal_Int32 StartSearchAndReplace( EditView* pEditView, const SvxSearchItem& rSearchItem ); sal_Bool HasText( const SvxSearchItem& rSearchItem ); void SetEditTextObjectPool( SfxItemPool* pP ) { pTextObjectPool = pP; } @@ -972,8 +972,8 @@ public: void SetCharStretching( sal_uInt16 nX, sal_uInt16 nY ); inline void GetCharStretching( sal_uInt16& rX, sal_uInt16& rY ) const; - void SetBigTextObjectStart( sal_uInt16 nStartAtPortionCount ) { nBigTextObjectStart = nStartAtPortionCount; } - sal_uInt16 GetBigTextObjectStart() const { return nBigTextObjectStart; } + void SetBigTextObjectStart( sal_Int32 nStartAtPortionCount ) { nBigTextObjectStart = nStartAtPortionCount; } + sal_Int32 GetBigTextObjectStart() const { return nBigTextObjectStart; } inline EditEngine* GetEditEnginePtr() const { return pEditEngine; } @@ -984,7 +984,7 @@ public: void SetAutoCompleteText(const OUString& rStr, bool bUpdateTipWindow); EditSelection TransliterateText( const EditSelection& rSelection, sal_Int32 nTransliterationMode ); - short ReplaceTextOnly( ContentNode* pNode, sal_uInt16 nCurrentStart, xub_StrLen nLen, const OUString& rText, const ::com::sun::star::uno::Sequence< sal_Int32 >& rOffsets ); + short ReplaceTextOnly( ContentNode* pNode, sal_Int32 nCurrentStart, sal_Int32 nLen, const OUString& rText, const ::com::sun::star::uno::Sequence< sal_Int32 >& rOffsets ); void SetAsianCompressionMode( sal_uInt16 n ); diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 44c77158d93a..d9884c673033 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -432,7 +432,7 @@ void ImpEditEngine::Command( const CommandEvent& rCEvt, EditView* pView ) ( nOldIMETextLen < mpIMEInfos->aOldTextAfterStartPos.getLength() ) ) { // overwrite - sal_uInt16 nOverwrite = nNewIMETextLen - nOldIMETextLen; + sal_Int32 nOverwrite = nNewIMETextLen - nOldIMETextLen; if ( ( nOldIMETextLen + nOverwrite ) > mpIMEInfos->aOldTextAfterStartPos.getLength() ) nOverwrite = mpIMEInfos->aOldTextAfterStartPos.getLength() - nOldIMETextLen; OSL_ENSURE( nOverwrite && (nOverwrite < 0xFF00), "IME Overwrite?!" ); @@ -479,13 +479,13 @@ void ImpEditEngine::Command( const CommandEvent& rCEvt, EditView* pView ) EditPaM aPaM( pView->pImpEditView->GetEditSelection().Max() ); Rectangle aR1 = PaMtoEditCursor( aPaM, 0 ); - sal_uInt16 nInputEnd = mpIMEInfos->aPos.GetIndex() + mpIMEInfos->nLen; + sal_Int32 nInputEnd = mpIMEInfos->aPos.GetIndex() + mpIMEInfos->nLen; if ( !IsFormatted() ) FormatDoc(); ParaPortion* pParaPortion = GetParaPortions().SafeGetObject( GetEditDoc().GetPos( aPaM.GetNode() ) ); - sal_uInt16 nLine = pParaPortion->GetLines().FindLine( aPaM.GetIndex(), true ); + sal_Int32 nLine = pParaPortion->GetLines().FindLine( aPaM.GetIndex(), true ); const EditLine* pLine = pParaPortion->GetLines()[nLine]; if ( pLine && ( nInputEnd > pLine->GetEnd() ) ) nInputEnd = pLine->GetEnd(); @@ -527,7 +527,7 @@ void ImpEditEngine::Command( const CommandEvent& rCEvt, EditView* pView ) if ( aSelection.nStartPara != aSelection.nEndPara ) { - xub_StrLen aParaLen = pEditEngine->GetTextLen( aSelection.nStartPara ); + sal_Int32 aParaLen = pEditEngine->GetTextLen( aSelection.nStartPara ); aSelection.nEndPara = aSelection.nStartPara; aSelection.nEndPos = aParaLen; pView->SetSelection( aSelection ); @@ -543,14 +543,14 @@ void ImpEditEngine::Command( const CommandEvent& rCEvt, EditView* pView ) FormatDoc(); ParaPortion* pParaPortion = GetParaPortions().SafeGetObject( GetEditDoc().GetPos( aPaM.GetNode() ) ); - sal_uInt16 nLine = pParaPortion->GetLines().FindLine( aPaM.GetIndex(), true ); + sal_Int32 nLine = pParaPortion->GetLines().FindLine( aPaM.GetIndex(), true ); const EditLine* pLine = pParaPortion->GetLines()[nLine]; if ( pLine ) { Rectangle* aRects = new Rectangle[ mpIMEInfos->nLen ]; - for (sal_uInt16 i = 0; i < mpIMEInfos->nLen; ++i) + for (sal_Int32 i = 0; i < mpIMEInfos->nLen; ++i) { - sal_uInt16 nInputPos = mpIMEInfos->aPos.GetIndex() + i; + sal_Int32 nInputPos = mpIMEInfos->aPos.GetIndex() + i; if ( nInputPos > pLine->GetEnd() ) nInputPos = pLine->GetEnd(); Rectangle aR2 = GetEditCursor( pParaPortion, nInputPos ); @@ -914,7 +914,7 @@ EditPaM ImpEditEngine::CursorVisualStartEnd( EditView* pEditView, const EditPaM& sal_Int32 nPara = GetEditDoc().GetPos( aPaM.GetNode() ); ParaPortion* pParaPortion = GetParaPortions().SafeGetObject( nPara ); - sal_uInt16 nLine = pParaPortion->GetLines().FindLine( aPaM.GetIndex(), false ); + sal_Int32 nLine = pParaPortion->GetLines().FindLine( aPaM.GetIndex(), false ); const EditLine* pLine = pParaPortion->GetLines()[nLine]; bool bEmptyLine = pLine->GetStart() == pLine->GetEnd(); @@ -939,10 +939,10 @@ EditPaM ImpEditEngine::CursorVisualStartEnd( EditView* pEditView, const EditPaM& aPaM.SetIndex( nLogPos + pLine->GetStart() ); - sal_uInt16 nTmp; - sal_uInt16 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nTmp, true ); + sal_Int32 nTmp; + sal_Int32 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nTmp, true ); const TextPortion* pTextPortion = pParaPortion->GetTextPortions()[nTextPortion]; - sal_uInt16 nRTLLevel = pTextPortion->GetRightToLeft(); + sal_Int32 nRTLLevel = pTextPortion->GetRightToLeft(); sal_Bool bPortionRTL = (nRTLLevel%2) ? sal_True : sal_False; if ( bStart ) @@ -970,7 +970,7 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView* pEditView, const EditPaM sal_Int32 nPara = GetEditDoc().GetPos( aPaM.GetNode() ); ParaPortion* pParaPortion = GetParaPortions().SafeGetObject( nPara ); - sal_uInt16 nLine = pParaPortion->GetLines().FindLine( aPaM.GetIndex(), false ); + sal_Int32 nLine = pParaPortion->GetLines().FindLine( aPaM.GetIndex(), false ); const EditLine* pLine = pParaPortion->GetLines()[nLine]; bool bEmptyLine = pLine->GetStart() == pLine->GetEnd(); @@ -1003,19 +1003,19 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView* pEditView, const EditPaM if ( !bDone && pEditView->IsInsertMode() ) { // Check if we are within a portion and don't have overwrite mode, then it's easy... - sal_uInt16 nPortionStart; - sal_uInt16 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nPortionStart, false ); + sal_Int32 nPortionStart; + sal_Int32 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nPortionStart, false ); const TextPortion* pTextPortion = pParaPortion->GetTextPortions()[nTextPortion]; sal_Bool bPortionBoundary = ( aPaM.GetIndex() == nPortionStart ) || ( aPaM.GetIndex() == (nPortionStart+pTextPortion->GetLen()) ); sal_uInt16 nRTLLevel = pTextPortion->GetRightToLeft(); // Portion boundary doesn't matter if both have same RTL level - sal_uInt16 nRTLLevelNextPortion = 0xFFFF; + sal_Int32 nRTLLevelNextPortion = -1; if ( bPortionBoundary && aPaM.GetIndex() && ( aPaM.GetIndex() < aPaM.GetNode()->Len() ) ) { - sal_uInt16 nTmp; - sal_uInt16 nNextTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex()+1, nTmp, bLogicalBackward ? sal_False : sal_True ); + sal_Int32 nTmp; + sal_Int32 nNextTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex()+1, nTmp, bLogicalBackward ? sal_False : sal_True ); const TextPortion* pNextTextPortion = pParaPortion->GetTextPortions()[nNextTextPortion]; nRTLLevelNextPortion = pNextTextPortion->GetRightToLeft(); } @@ -1082,8 +1082,8 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView* pEditView, const EditPaM if ( nPosInLine && ( !bBeforePortion ) ) // before the next portion bWasBehind = sal_True; // step one back, otherwise visual will be unusable when rtl portion follows. - sal_uInt16 nPortionStart; - sal_uInt16 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nPortionStart, bBeforePortion ); + sal_Int32 nPortionStart; + sal_Int32 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nPortionStart, bBeforePortion ); const TextPortion* pTextPortion = pParaPortion->GetTextPortions()[nTextPortion]; sal_Bool bRTLPortion = (pTextPortion->GetRightToLeft() % 2) != 0; @@ -1108,9 +1108,9 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView* pEditView, const EditPaM aPaM.SetIndex( pLine->GetStart() + ubidi_getLogicalIndex( pBidi, nVisPos, &nError ) ); // RTL portion, stay visually on the left side. - sal_uInt16 _nPortionStart; + sal_Int32 _nPortionStart; // sal_uInt16 nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), nPortionStart, !bRTLPortion ); - sal_uInt16 _nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), _nPortionStart, true ); + sal_Int32 _nTextPortion = pParaPortion->GetTextPortions().FindPortion( aPaM.GetIndex(), _nPortionStart, true ); const TextPortion* _pTextPortion = pParaPortion->GetTextPortions()[_nTextPortion]; if ( bVisualToLeft && !bRTLPortion && ( _pTextPortion->GetRightToLeft() % 2 ) ) aPaM.SetIndex( aPaM.GetIndex()+1 ); @@ -1200,7 +1200,7 @@ EditPaM ImpEditEngine::CursorUp( const EditPaM& rPaM, EditView* pView ) const ParaPortion* pPPortion = FindParaPortion( rPaM.GetNode() ); OSL_ENSURE( pPPortion, "No matching portion found: CursorUp "); - sal_uInt16 nLine = pPPortion->GetLineNumber( rPaM.GetIndex() ); + sal_Int32 nLine = pPPortion->GetLineNumber( rPaM.GetIndex() ); const EditLine* pLine = pPPortion->GetLines()[nLine]; long nX; @@ -1245,7 +1245,7 @@ EditPaM ImpEditEngine::CursorDown( const EditPaM& rPaM, EditView* pView ) const ParaPortion* pPPortion = FindParaPortion( rPaM.GetNode() ); OSL_ENSURE( pPPortion, "No matching portion found: CursorDown" ); - sal_uInt16 nLine = pPPortion->GetLineNumber( rPaM.GetIndex() ); + sal_Int32 nLine = pPPortion->GetLineNumber( rPaM.GetIndex() ); long nX; if ( pView->pImpEditView->nTravelXPos == TRAVEL_X_DONTKNOW ) @@ -1289,7 +1289,7 @@ EditPaM ImpEditEngine::CursorStartOfLine( const EditPaM& rPaM ) { const ParaPortion* pCurPortion = FindParaPortion( rPaM.GetNode() ); OSL_ENSURE( pCurPortion, "No Portion for the PaM ?" ); - sal_uInt16 nLine = pCurPortion->GetLineNumber( rPaM.GetIndex() ); + sal_Int32 nLine = pCurPortion->GetLineNumber( rPaM.GetIndex() ); const EditLine* pLine = pCurPortion->GetLines()[nLine]; OSL_ENSURE( pLine, "Current line not found ?!" ); @@ -1302,7 +1302,7 @@ EditPaM ImpEditEngine::CursorEndOfLine( const EditPaM& rPaM ) { const ParaPortion* pCurPortion = FindParaPortion( rPaM.GetNode() ); OSL_ENSURE( pCurPortion, "No Portion for the PaM ?" ); - sal_uInt16 nLine = pCurPortion->GetLineNumber( rPaM.GetIndex() ); + sal_Int32 nLine = pCurPortion->GetLineNumber( rPaM.GetIndex() ); const EditLine* pLine = pCurPortion->GetLines()[nLine]; OSL_ENSURE( pLine, "Current line not found ?!" ); @@ -1612,7 +1612,7 @@ void ImpEditEngine::InitScriptTypes( sal_Int32 nPara ) aText = aText.replaceAt( pField->GetStart(), 1, aFldText.copy(0,1) ); short nFldScriptType = _xBI->getScriptType( aFldText, 0 ); - for ( sal_uInt16 nCharInField = 1; nCharInField < aFldText.getLength(); nCharInField++ ) + for ( sal_Int32 nCharInField = 1; nCharInField < aFldText.getLength(); nCharInField++ ) { short nTmpType = _xBI->getScriptType( aFldText, nCharInField ); @@ -1637,15 +1637,15 @@ void ImpEditEngine::InitScriptTypes( sal_Int32 nPara ) } OUString aOUText( aText ); - sal_uInt16 nTextLen = (sal_uInt16)aOUText.getLength(); + sal_Int32 nTextLen = aOUText.getLength(); sal_Int32 nPos = 0; short nScriptType = _xBI->getScriptType( aOUText, nPos ); - rTypes.push_back( ScriptTypePosInfo( nScriptType, (sal_uInt16)nPos, nTextLen ) ); + rTypes.push_back( ScriptTypePosInfo( nScriptType, nPos, nTextLen ) ); nPos = _xBI->endOfScript( aOUText, nPos, nScriptType ); while ( ( nPos != (-1) ) && ( nPos < nTextLen ) ) { - rTypes.back().nEndPos = (sal_uInt16)nPos; + rTypes.back().nEndPos = nPos; nScriptType = _xBI->getScriptType( aOUText, nPos ); long nEndPos = _xBI->endOfScript( aOUText, nPos, nScriptType ); @@ -1653,7 +1653,7 @@ void ImpEditEngine::InitScriptTypes( sal_Int32 nPara ) if ( ( nScriptType == i18n::ScriptType::WEAK ) || ( nScriptType == rTypes.back().nScriptType ) ) { // Expand last ScriptTypePosInfo, don't create weak or unecessary portions - rTypes.back().nEndPos = (sal_uInt16)nEndPos; + rTypes.back().nEndPos = nEndPos; } else { @@ -1668,7 +1668,7 @@ void ImpEditEngine::InitScriptTypes( sal_Int32 nPara ) break; } } - rTypes.push_back( ScriptTypePosInfo( nScriptType, (sal_uInt16)nPos, nTextLen ) ); + rTypes.push_back( ScriptTypePosInfo( nScriptType, nPos, nTextLen ) ); } nPos = nEndPos; @@ -1685,8 +1685,8 @@ void ImpEditEngine::InitScriptTypes( sal_Int32 nPara ) WritingDirectionInfos& rDirInfos = pParaPortion->aWritingDirectionInfos; for ( size_t n = 0; n < rDirInfos.size(); ++n ) { - const xub_StrLen nStart = rDirInfos[n].nStartPos; - const xub_StrLen nEnd = rDirInfos[n].nEndPos; + const sal_Int32 nStart = rDirInfos[n].nStartPos; + const sal_Int32 nEnd = rDirInfos[n].nEndPos; const sal_uInt8 nCurrDirType = rDirInfos[n].nType; if ( nCurrDirType % 2 == UBIDI_RTL || // text in RTL run @@ -1705,14 +1705,14 @@ void ImpEditEngine::InitScriptTypes( sal_Int32 nPara ) // special case: if(nIdx < rTypes.size() && rTypes[nIdx].nStartPos < nStart && rTypes[nIdx].nEndPos > nEnd) { - rTypes.insert( rTypes.begin()+nIdx, ScriptTypePosInfo( rTypes[nIdx].nScriptType, (sal_uInt16)nEnd, rTypes[nIdx].nEndPos ) ); + rTypes.insert( rTypes.begin()+nIdx, ScriptTypePosInfo( rTypes[nIdx].nScriptType, nEnd, rTypes[nIdx].nEndPos ) ); rTypes[nIdx].nEndPos = nStart; } if( nIdx ) rTypes[nIdx - 1].nEndPos = nStart; - rTypes.insert( rTypes.begin()+nIdx, ScriptTypePosInfo( i18n::ScriptType::COMPLEX, (sal_uInt16)nStart, (sal_uInt16)nEnd) ); + rTypes.insert( rTypes.begin()+nIdx, ScriptTypePosInfo( i18n::ScriptType::COMPLEX, nStart, nEnd) ); ++nIdx; if( nIdx < rTypes.size() ) @@ -1726,7 +1726,7 @@ namespace { struct FindByPos { - FindByPos(sal_uInt16 nPos): + FindByPos(sal_Int32 nPos): mnPos(nPos) {} bool operator()(const ScriptTypePosInfos::value_type& rValue) @@ -1735,12 +1735,12 @@ struct FindByPos } private: - sal_uInt16 mnPos; + sal_Int32 mnPos; }; } -sal_uInt16 ImpEditEngine::GetI18NScriptType( const EditPaM& rPaM, sal_uInt16* pEndPos ) const +sal_uInt16 ImpEditEngine::GetI18NScriptType( const EditPaM& rPaM, sal_Int32* pEndPos ) const { sal_uInt16 nScriptType = 0; @@ -1787,8 +1787,8 @@ sal_uInt16 ImpEditEngine::GetItemScriptType( const EditSelection& rSel ) const const ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos; // find all the scripts of this range - sal_uInt16 nS = ( nPara == nStartPara ) ? aSel.Min().GetIndex() : 0; - sal_uInt16 nE = ( nPara == nEndPara ) ? aSel.Max().GetIndex() : pParaPortion->GetNode()->Len(); + sal_Int32 nS = ( nPara == nStartPara ) ? aSel.Min().GetIndex() : 0; + sal_Int32 nE = ( nPara == nEndPara ) ? aSel.Max().GetIndex() : pParaPortion->GetNode()->Len(); //no selection, just bare cursor if (nStartPara == nEndPara && nS == nE) @@ -1904,7 +1904,7 @@ void ImpEditEngine::InitWritingDirections( sal_Int32 nPara ) for (int32_t nIdx = 0; nIdx < nCount; ++nIdx) { ubidi_getLogicalRun( pBidi, nStart, &nEnd, &nCurrDir ); - rInfos.push_back( WritingDirectionInfo( nCurrDir, (sal_uInt16)nStart, (sal_uInt16)nEnd ) ); + rInfos.push_back( WritingDirectionInfo( nCurrDir, nStart, nEnd ) ); nStart = nEnd; } } @@ -1914,7 +1914,7 @@ void ImpEditEngine::InitWritingDirections( sal_Int32 nPara ) // No infos mean no CTL and default dir is L2R... if ( rInfos.empty() ) - rInfos.push_back( WritingDirectionInfo( 0, 0, (sal_uInt16)pParaPortion->GetNode()->Len() ) ); + rInfos.push_back( WritingDirectionInfo( 0, 0, pParaPortion->GetNode()->Len() ) ); } @@ -1956,7 +1956,7 @@ sal_Bool ImpEditEngine::HasDifferentRTLLevels( const ContentNode* pNode ) sal_Bool bHasDifferentRTLLevels = sal_False; sal_uInt16 nRTLLevel = IsRightToLeft( nPara ) ? 1 : 0; - for ( sal_uInt16 n = 0; n < pParaPortion->GetTextPortions().Count(); n++ ) + for ( sal_Int32 n = 0; n < (sal_Int32)pParaPortion->GetTextPortions().Count(); n++ ) { const TextPortion* pTextPortion = pParaPortion->GetTextPortions()[n]; if ( pTextPortion->GetRightToLeft() != nRTLLevel ) @@ -1969,7 +1969,7 @@ sal_Bool ImpEditEngine::HasDifferentRTLLevels( const ContentNode* pNode ) } -sal_uInt8 ImpEditEngine::GetRightToLeft( sal_Int32 nPara, sal_uInt16 nPos, sal_uInt16* pStart, sal_uInt16* pEnd ) +sal_uInt8 ImpEditEngine::GetRightToLeft( sal_Int32 nPara, sal_Int32 nPos, sal_Int32* pStart, sal_Int32* pEnd ) { sal_uInt8 nRightToLeft = 0; @@ -1984,7 +1984,7 @@ sal_uInt8 ImpEditEngine::GetRightToLeft( sal_Int32 nPara, sal_uInt16 nPos, sal_u for ( size_t n = 0; n < rDirInfos.size(); n++ ) { if ( ( rDirInfos[n].nStartPos <= nPos ) && ( rDirInfos[n].nEndPos >= nPos ) ) - { + { nRightToLeft = rDirInfos[n].nType; if ( pStart ) *pStart = rDirInfos[n].nStartPos; @@ -2034,7 +2034,7 @@ SvxCellVerJustify ImpEditEngine::GetVerJustification( sal_Int32 nPara ) const // Text changes // ---------------------------------------------------------------------- -void ImpEditEngine::ImpRemoveChars( const EditPaM& rPaM, sal_uInt16 nChars, EditUndoRemoveChars* pCurUndo ) +void ImpEditEngine::ImpRemoveChars( const EditPaM& rPaM, sal_Int32 nChars, EditUndoRemoveChars* pCurUndo ) { if ( IsUndoEnabled() && !IsInUndo() ) { @@ -2109,7 +2109,7 @@ EditSelection ImpEditEngine::ImpMoveParagraphs( Range aOldPositions, sal_Int32 n pRecalc3 = GetParaPortions()[0]; pRecalc4 = GetParaPortions()[aOldPositions.Max()+1]; } - else if ( (sal_uInt16)aOldPositions.Max() == (nParaCount-1) ) + else if ( aOldPositions.Max() == (nParaCount-1) ) { pRecalc3 = GetParaPortions()[aOldPositions.Max()]; pRecalc4 = GetParaPortions()[aOldPositions.Min()-1]; @@ -2229,9 +2229,9 @@ EditPaM ImpEditEngine::ImpConnectParagraphs( ContentNode* pLeft, ContentNode* pR if ( GetStatus().DoOnlineSpelling() ) { - xub_StrLen nEnd = pLeft->Len(); - xub_StrLen nInv = nEnd ? nEnd-1 : nEnd; - pLeft->GetWrongList()->ClearWrongs( nInv, 0xFFFF, pLeft ); // Possibly remove one + sal_Int32 nEnd = pLeft->Len(); + sal_Int32 nInv = nEnd ? nEnd-1 : nEnd; + pLeft->GetWrongList()->ClearWrongs( nInv, -1, pLeft ); // Possibly remove one pLeft->GetWrongList()->SetInvalidRange(nInv, nEnd+1); // Take over misspelled words WrongList* pRWrongs = pRight->GetWrongList(); @@ -2806,7 +2806,7 @@ EditPaM ImpEditEngine::ImpInsertParaBreak( EditPaM& rPaM, bool bKeepEndingAttrib if ( GetStatus().DoOnlineSpelling() ) { - xub_StrLen nEnd = rPaM.GetNode()->Len(); + sal_Int32 nEnd = rPaM.GetNode()->Len(); aPaM.GetNode()->CreateWrongList(); WrongList* pLWrongs = rPaM.GetNode()->GetWrongList(); WrongList* pRWrongs = aPaM.GetNode()->GetWrongList(); @@ -2825,12 +2825,12 @@ EditPaM ImpEditEngine::ImpInsertParaBreak( EditPaM& rPaM, bool bKeepEndingAttrib else if (i->mnStart < nEnd && i->mnEnd > nEnd) i->mnEnd = nEnd; } - sal_uInt16 nInv = nEnd ? nEnd-1 : nEnd; + sal_Int32 nInv = nEnd ? nEnd-1 : nEnd; if ( nEnd ) pLWrongs->SetInvalidRange(nInv, nEnd); else pLWrongs->SetValid(); - pRWrongs->SetValid(); // otherwise 0 - 0xFFFF + pRWrongs->SetValid(); pRWrongs->SetInvalidRange(0, 1); // Only test the first word } @@ -3072,8 +3072,8 @@ sal_uInt32 ImpEditEngine::CalcTextWidth( sal_Bool bIgnoreExtraSpace ) // -------------------------------------------------- // On the lines of the paragraph ... // -------------------------------------------------- - sal_uLong nLines = pPortion->GetLines().Count(); - for ( sal_uInt16 nLine = 0; nLine < nLines; nLine++ ) + sal_Int32 nLines = (sal_Int32)pPortion->GetLines().Count(); + for ( sal_Int32 nLine = 0; nLine < nLines; nLine++ ) { pLine = pPortion->GetLines()[nLine]; OSL_ENSURE( pLine, "NULL-Pointer in the line iterator in CalcWidth" ); @@ -3118,14 +3118,14 @@ sal_uInt32 ImpEditEngine::CalcLineWidth( ParaPortion* pPortion, EditLine* pLine, // potentially changing both) GetRefDevice()->Push( PUSH_TEXTLAYOUTMODE|PUSH_TEXTLANGUAGE ); - ImplInitLayoutMode( GetRefDevice(), nPara, 0xFFFF ); + ImplInitLayoutMode( GetRefDevice(), nPara, -1 ); SvxAdjust eJustification = GetJustification( nPara ); // Calculation of the width without the Indents ... sal_uInt32 nWidth = 0; - sal_uInt16 nPos = pLine->GetStart(); - for ( sal_uInt16 nTP = pLine->GetStartPortion(); nTP <= pLine->GetEndPortion(); nTP++ ) + sal_Int32 nPos = pLine->GetStart(); + for ( sal_Int32 nTP = pLine->GetStartPortion(); nTP <= pLine->GetEndPortion(); nTP++ ) { const TextPortion* pTextPortion = pPortion->GetTextPortions()[nTP]; switch ( pTextPortion->GetKind() ) @@ -3193,7 +3193,7 @@ sal_uInt32 ImpEditEngine::CalcTextHeight( sal_uInt32* pHeightNTP ) return nY; } -sal_uInt16 ImpEditEngine::GetLineCount( sal_Int32 nParagraph ) const +sal_Int32 ImpEditEngine::GetLineCount( sal_Int32 nParagraph ) const { OSL_ENSURE( 0 <= nParagraph && nParagraph < GetParaPortions().Count(), "GetLineCount: Out of range" ); const ParaPortion* pPPortion = GetParaPortions().SafeGetObject( nParagraph ); @@ -3201,10 +3201,10 @@ sal_uInt16 ImpEditEngine::GetLineCount( sal_Int32 nParagraph ) const if ( pPPortion ) return pPPortion->GetLines().Count(); - return 0xFFFF; + return -1; } -xub_StrLen ImpEditEngine::GetLineLen( sal_Int32 nParagraph, sal_uInt16 nLine ) const +sal_Int32 ImpEditEngine::GetLineLen( sal_Int32 nParagraph, sal_Int32 nLine ) const { OSL_ENSURE( 0 <= nParagraph && nParagraph < GetParaPortions().Count(), "GetLineLen: Out of range" ); const ParaPortion* pPPortion = GetParaPortions().SafeGetObject( nParagraph ); @@ -3216,15 +3216,15 @@ xub_StrLen ImpEditEngine::GetLineLen( sal_Int32 nParagraph, sal_uInt16 nLine ) c return pLine->GetLen(); } - return 0xFFFF; + return -1; } -void ImpEditEngine::GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_Int32 nParagraph, sal_uInt16 nLine ) const +void ImpEditEngine::GetLineBoundaries( /*out*/sal_Int32 &rStart, /*out*/sal_Int32 &rEnd, sal_Int32 nParagraph, sal_Int32 nLine ) const { OSL_ENSURE( 0 <= nParagraph && nParagraph < GetParaPortions().Count(), "GetLineCount: Out of range" ); const ParaPortion* pPPortion = GetParaPortions().SafeGetObject( nParagraph ); OSL_ENSURE( pPPortion, "Paragraph not found: GetLineBoundaries" ); - rStart = rEnd = 0xFFFF; // default values in case of error + rStart = rEnd = -1; // default values in case of error if ( pPPortion && ( nLine < pPPortion->GetLines().Count() ) ) { const EditLine* pLine = pPPortion->GetLines()[nLine]; @@ -3234,9 +3234,9 @@ void ImpEditEngine::GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uIn } } -sal_uInt16 ImpEditEngine::GetLineNumberAtIndex( sal_Int32 nPara, sal_uInt16 nIndex ) const +sal_Int32 ImpEditEngine::GetLineNumberAtIndex( sal_Int32 nPara, sal_Int32 nIndex ) const { - sal_uInt16 nLineNo = 0xFFFF; + sal_Int32 nLineNo = -1; const ContentNode* pNode = GetEditDoc().GetObject( nPara ); OSL_ENSURE( pNode, "GetLineNumberAtIndex: invalid paragraph index" ); if (pNode) @@ -3244,16 +3244,16 @@ sal_uInt16 ImpEditEngine::GetLineNumberAtIndex( sal_Int32 nPara, sal_uInt16 nInd // we explicitly allow for the index to point at the character right behind the text const bool bValidIndex = /*0 <= nIndex &&*/ nIndex <= pNode->Len(); OSL_ENSURE( bValidIndex, "GetLineNumberAtIndex: invalid index" ); - const sal_uInt16 nLineCount = GetLineCount( nPara ); + const sal_Int32 nLineCount = GetLineCount( nPara ); if (nIndex == pNode->Len()) nLineNo = nLineCount > 0 ? nLineCount - 1 : 0; else if (bValidIndex) // nIndex < pNode->Len() { - sal_uInt16 nStart = USHRT_MAX, nEnd = USHRT_MAX; - for (sal_uInt16 i = 0; i < nLineCount && nLineNo == 0xFFFF; ++i) + sal_Int32 nStart = -1, nEnd = -1; + for (sal_Int32 i = 0; i < nLineCount && nLineNo == -1; ++i) { GetLineBoundaries( nStart, nEnd, nPara, i ); - if (nStart <= nIndex && nIndex < nEnd) + if (nStart >= 0 && nStart <= nIndex && nEnd >= 0 && nIndex < nEnd) nLineNo = i; } } @@ -3261,7 +3261,7 @@ sal_uInt16 ImpEditEngine::GetLineNumberAtIndex( sal_Int32 nPara, sal_uInt16 nInd return nLineNo; } -sal_uInt16 ImpEditEngine::GetLineHeight( sal_Int32 nParagraph, sal_uInt16 nLine ) +sal_uInt16 ImpEditEngine::GetLineHeight( sal_Int32 nParagraph, sal_Int32 nLine ) { OSL_ENSURE( 0 <= nParagraph && nParagraph < GetParaPortions().Count(), "GetLineCount: Out of range" ); ParaPortion* pPPortion = GetParaPortions().SafeGetObject( nParagraph ); @@ -3354,13 +3354,13 @@ void ImpEditEngine::UpdateSelections() } EditSelection ImpEditEngine::ConvertSelection( - sal_Int32 nStartPara, sal_uInt16 nStartPos, sal_Int32 nEndPara, sal_uInt16 nEndPos ) + sal_Int32 nStartPara, sal_Int32 nStartPos, sal_Int32 nEndPara, sal_Int32 nEndPos ) { EditSelection aNewSelection; // Start... ContentNode* pNode = aEditDoc.GetObject( nStartPara ); - sal_uInt16 nIndex = nStartPos; + sal_Int32 nIndex = nStartPos; if ( !pNode ) { pNode = aEditDoc[ aEditDoc.Count()-1 ]; @@ -3558,8 +3558,8 @@ Range ImpEditEngine::GetInvalidYOffsets( ParaPortion* pPortion ) ? GetYValue( rLSItem.GetInterLineSpace() ) : 0; // only from the top ... - sal_uInt16 nFirstInvalid = 0xFFFF; - sal_uInt16 nLine; + sal_Int32 nFirstInvalid = -1; + sal_Int32 nLine; for ( nLine = 0; nLine < pPortion->GetLines().Count(); nLine++ ) { const EditLine* pL = pPortion->GetLines()[nLine]; @@ -3572,42 +3572,44 @@ Range ImpEditEngine::GetInvalidYOffsets( ParaPortion* pPortion ) aRange.Min() += nSBL; aRange.Min() += pL->GetHeight(); } - OSL_ENSURE( nFirstInvalid != 0xFFFF, "No invalid line found in GetInvalidYOffset(1)" ); + OSL_ENSURE( nFirstInvalid != -1, "No invalid line found in GetInvalidYOffset(1)" ); // Syndicate and more ... aRange.Max() = aRange.Min(); aRange.Max() += pPortion->GetFirstLineOffset(); - if ( nFirstInvalid != 0 ) // Only if the first line is invalid + if ( nFirstInvalid > 0 ) // Only if the first line is invalid aRange.Min() = aRange.Max(); - sal_uInt16 nLastInvalid = pPortion->GetLines().Count()-1; - for ( nLine = nFirstInvalid; nLine < pPortion->GetLines().Count(); nLine++ ) + sal_Int32 nLastInvalid = pPortion->GetLines().Count()-1; + if(nFirstInvalid > 0) { - const EditLine* pL = pPortion->GetLines()[nLine]; - if ( pL->IsValid() ) + for ( nLine = nFirstInvalid; nLine < pPortion->GetLines().Count(); nLine++ ) { - nLastInvalid = nLine; - break; + const EditLine* pL = pPortion->GetLines()[nLine]; + if ( pL->IsValid() ) + { + nLastInvalid = nLine; + break; + } + if ( nLine && !aStatus.IsOutliner() ) + aRange.Max() += nSBL; + aRange.Max() += pL->GetHeight(); } - if ( nLine && !aStatus.IsOutliner() ) - aRange.Max() += nSBL; - aRange.Max() += pL->GetHeight(); - } + if( ( rLSItem.GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_PROP ) && rLSItem.GetPropLineSpace() && + ( rLSItem.GetPropLineSpace() < 100 ) ) + { + const EditLine* pL = pPortion->GetLines()[nFirstInvalid]; + long n = pL->GetTxtHeight() * ( 100 - rLSItem.GetPropLineSpace() ); + n /= 100; + aRange.Min() -= n; + aRange.Max() += n; + } - if( ( rLSItem.GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_PROP ) && rLSItem.GetPropLineSpace() && - ( rLSItem.GetPropLineSpace() < 100 ) ) - { - const EditLine* pL = pPortion->GetLines()[nFirstInvalid]; - long n = pL->GetTxtHeight() * ( 100 - rLSItem.GetPropLineSpace() ); - n /= 100; - aRange.Min() -= n; - aRange.Max() += n; + if ( ( nLastInvalid == pPortion->GetLines().Count()-1 ) && ( !aStatus.IsOutliner() ) ) + aRange.Max() += GetYValue( rULSpace.GetLower() ); } - - if ( ( nLastInvalid == pPortion->GetLines().Count()-1 ) && ( !aStatus.IsOutliner() ) ) - aRange.Max() += GetYValue( rULSpace.GetLower() ); } return aRange; } @@ -3617,7 +3619,7 @@ EditPaM ImpEditEngine::GetPaM( ParaPortion* pPortion, Point aDocPos, sal_Bool bS OSL_ENSURE( pPortion->IsVisible(), "Why GetPaM() for an invisible paragraph?" ); OSL_ENSURE( IsFormatted(), "GetPaM: Not formatted" ); - sal_uInt16 nCurIndex = 0; + sal_Int32 nCurIndex = 0; EditPaM aPaM; aPaM.SetNode( pPortion->GetNode() ); @@ -3630,7 +3632,7 @@ EditPaM ImpEditEngine::GetPaM( ParaPortion* pPortion, Point aDocPos, sal_Bool bS OSL_ENSURE( pPortion->GetLines().Count(), "Empty ParaPortion in GetPaM!" ); const EditLine* pLine = NULL; - for ( sal_uInt16 nLine = 0; nLine < pPortion->GetLines().Count(); nLine++ ) + for ( sal_Int32 nLine = 0; nLine < pPortion->GetLines().Count(); nLine++ ) { const EditLine* pTmpLine = pPortion->GetLines()[nLine]; nY += pTmpLine->GetHeight(); @@ -3668,17 +3670,17 @@ EditPaM ImpEditEngine::GetPaM( ParaPortion* pPortion, Point aDocPos, sal_Bool bS return aPaM; } -sal_uInt16 ImpEditEngine::GetChar( +sal_Int32 ImpEditEngine::GetChar( const ParaPortion* pParaPortion, const EditLine* pLine, long nXPos, bool bSmart) { OSL_ENSURE( pLine, "No line received: GetChar" ); - sal_uInt16 nChar = 0xFFFF; - sal_uInt16 nCurIndex = pLine->GetStart(); + sal_Int32 nChar = -1; + sal_Int32 nCurIndex = pLine->GetStart(); // Search best matching portion with GetPortionXOffset() - for ( sal_uInt16 i = pLine->GetStartPortion(); i <= pLine->GetEndPortion(); i++ ) + for ( sal_Int32 i = pLine->GetStartPortion(); i <= pLine->GetEndPortion(); i++ ) { const TextPortion* pPortion = pParaPortion->GetTextPortions()[i]; long nXLeft = GetPortionXOffset( pParaPortion, pLine, i ); @@ -3703,16 +3705,16 @@ sal_uInt16 ImpEditEngine::GetChar( } else { - sal_uInt16 nMax = pPortion->GetLen(); - sal_uInt16 nOffset = 0xFFFF; - sal_uInt16 nTmpCurIndex = nChar - pLine->GetStart(); + sal_Int32 nMax = pPortion->GetLen(); + sal_Int32 nOffset = -1; + sal_Int32 nTmpCurIndex = nChar - pLine->GetStart(); long nXInPortion = nXPos - nXLeft; if ( pPortion->IsRightToLeft() ) nXInPortion = nXRight - nXPos; // Search in Array... - for ( sal_uInt16 x = 0; x < nMax; x++ ) + for ( sal_Int32 x = 0; x < nMax; x++ ) { long nTmpPosMax = pLine->GetCharPosArray()[nTmpCurIndex+x]; if ( nTmpPosMax > nXInPortion ) @@ -3740,7 +3742,7 @@ sal_uInt16 ImpEditEngine::GetChar( // There should not be any inaccuracies when using the // CharPosArray! Maybe for kerning? // 0xFFF happens for example for Outline-Font when at the very end. - if ( nOffset == 0xFFFF ) + if ( nOffset < 0 ) nOffset = nMax; OSL_ENSURE( nOffset <= nMax, "nOffset > nMax" ); @@ -3757,9 +3759,9 @@ sal_uInt16 ImpEditEngine::GetChar( uno::Reference < i18n::XBreakIterator > _xBI( ImplGetBreakIterator() ); sal_Int32 nCount = 1; lang::Locale aLocale = GetLocale( aPaM ); - sal_uInt16 nRight = (sal_uInt16)_xBI->nextCharacters( + sal_Int32 nRight = _xBI->nextCharacters( pParaPortion->GetNode()->GetString(), nChar, aLocale, ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL, nCount, nCount ); - sal_uInt16 nLeft = (sal_uInt16)_xBI->previousCharacters( + sal_Int32 nLeft = _xBI->previousCharacters( pParaPortion->GetNode()->GetString(), nRight, aLocale, ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL, nCount, nCount ); if ( ( nLeft != nChar ) && ( nRight != nChar ) ) { @@ -3773,7 +3775,7 @@ sal_uInt16 ImpEditEngine::GetChar( nCurIndex = nCurIndex + pPortion->GetLen(); } - if ( nChar == 0xFFFF ) + if ( nChar == -1 ) { nChar = ( nXPos <= pLine->GetStartPosX() ) ? pLine->GetStart() : pLine->GetEnd(); } @@ -3802,11 +3804,11 @@ Range ImpEditEngine::GetLineXPosStartEnd( const ParaPortion* pParaPortion, const } long ImpEditEngine::GetPortionXOffset( - const ParaPortion* pParaPortion, const EditLine* pLine, sal_uInt16 nTextPortion) const + const ParaPortion* pParaPortion, const EditLine* pLine, sal_Int32 nTextPortion) const { long nX = pLine->GetStartPosX(); - for ( sal_uInt16 i = pLine->GetStartPortion(); i < nTextPortion; i++ ) + for ( sal_Int32 i = pLine->GetStartPortion(); i < nTextPortion; i++ ) { const TextPortion* pPortion = pParaPortion->GetTextPortions()[i]; switch ( pPortion->GetKind() ) @@ -3831,7 +3833,7 @@ long ImpEditEngine::GetPortionXOffset( if ( !bR2LPara && pDestPortion->GetRightToLeft() ) { // Portions behind must be added, visual before this portion - sal_uInt16 nTmpPortion = nTextPortion+1; + sal_Int32 nTmpPortion = nTextPortion+1; while ( nTmpPortion <= pLine->GetEndPortion() ) { const TextPortion* pNextTextPortion = pParaPortion->GetTextPortions()[nTmpPortion]; @@ -3856,7 +3858,7 @@ long ImpEditEngine::GetPortionXOffset( else if ( bR2LPara && !pDestPortion->IsRightToLeft() ) { // Portions behind must be removed, visual behind this portion - sal_uInt16 nTmpPortion = nTextPortion+1; + sal_Int32 nTmpPortion = nTextPortion+1; while ( nTmpPortion <= pLine->GetEndPortion() ) { const TextPortion* pNextTextPortion = pParaPortion->GetTextPortions()[nTmpPortion]; @@ -3892,7 +3894,7 @@ long ImpEditEngine::GetPortionXOffset( } long ImpEditEngine::GetXPos( - const ParaPortion* pParaPortion, const EditLine* pLine, sal_uInt16 nIndex, bool bPreferPortionStart) const + const ParaPortion* pParaPortion, const EditLine* pLine, sal_Int32 nIndex, bool bPreferPortionStart) const { OSL_ENSURE( pLine, "No line received: GetXPos" ); OSL_ENSURE( ( nIndex >= pLine->GetStart() ) && ( nIndex <= pLine->GetEnd() ) , "GetXPos has to be called properly!" ); @@ -3904,8 +3906,8 @@ long ImpEditEngine::GetXPos( else if ( nIndex == pLine->GetEnd() ) bDoPreferPortionStart = sal_False; - sal_uInt16 nTextPortionStart = 0; - sal_uInt16 nTextPortion = pParaPortion->GetTextPortions().FindPortion( nIndex, nTextPortionStart, bDoPreferPortionStart ); + sal_Int32 nTextPortionStart = 0; + sal_Int32 nTextPortion = pParaPortion->GetTextPortions().FindPortion( nIndex, nTextPortionStart, bDoPreferPortionStart ); OSL_ENSURE( ( nTextPortion >= pLine->GetStartPortion() ) && ( nTextPortion <= pLine->GetEndPortion() ), "GetXPos: Portion not in current line! " ); @@ -3927,7 +3929,7 @@ long ImpEditEngine::GetXPos( // End of Portion if ( pPortion->GetKind() == PORTIONKIND_TAB ) { - if ( static_cast<size_t>(nTextPortion+1) < pParaPortion->GetTextPortions().Count() ) + if ( nTextPortion+1 < pParaPortion->GetTextPortions().Count() ) { const TextPortion* pNextPortion = pParaPortion->GetTextPortions()[nTextPortion+1]; if ( pNextPortion->GetKind() != PORTIONKIND_TAB ) @@ -3955,8 +3957,8 @@ long ImpEditEngine::GetXPos( if( pLine->GetCharPosArray().size() ) { - sal_uInt16 nPos = nIndex - 1 - pLine->GetStart(); - if( nPos >= pLine->GetCharPosArray().size() ) + sal_Int32 nPos = nIndex - 1 - pLine->GetStart(); + if( nPos >= (sal_Int32)pLine->GetCharPosArray().size() ) { nPos = pLine->GetCharPosArray().size()-1; OSL_FAIL("svx::ImpEditEngine::GetXPos(), index out of range!"); @@ -3982,7 +3984,7 @@ long ImpEditEngine::GetXPos( sal_uInt8 nType = GetCharTypeForCompression( pParaPortion->GetNode()->GetChar( nIndex ) ); if ( nType == CHAR_PUNCTUATIONRIGHT ) { - sal_uInt16 n = nIndex - nTextPortionStart; + sal_Int32 n = nIndex - nTextPortionStart; const sal_Int32* pDXArray = NULL; if (!pLine->GetCharPosArray().empty()) pDXArray = &pLine->GetCharPosArray()[0]+( nTextPortionStart-pLine->GetStart() ); @@ -4032,7 +4034,7 @@ void ImpEditEngine::CalcHeight( ParaPortion* pPortion ) if ( pPortion->IsVisible() ) { OSL_ENSURE( pPortion->GetLines().Count(), "Paragraph with no lines in ParaPortion::CalcHeight" ); - for (size_t nLine = 0; nLine < pPortion->GetLines().Count(); ++nLine) + for (sal_Int32 nLine = 0; nLine < pPortion->GetLines().Count(); ++nLine) pPortion->nHeight += pPortion->GetLines()[nLine]->GetHeight(); if ( !aStatus.IsOutliner() ) @@ -4122,7 +4124,7 @@ void ImpEditEngine::CalcHeight( ParaPortion* pPortion ) } } -Rectangle ImpEditEngine::GetEditCursor( ParaPortion* pPortion, sal_uInt16 nIndex, sal_uInt16 nFlags ) +Rectangle ImpEditEngine::GetEditCursor( ParaPortion* pPortion, sal_Int32 nIndex, sal_uInt16 nFlags ) { OSL_ENSURE( pPortion->IsVisible(), "Why GetEditCursor() for an invisible paragraph?" ); OSL_ENSURE( IsFormatted() || GetTextRanger(), "GetEditCursor: Not formatted" ); @@ -4140,14 +4142,14 @@ Rectangle ImpEditEngine::GetEditCursor( ParaPortion* pPortion, sal_uInt16 nIndex sal_uInt16 nSBL = ( rLSItem.GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_FIX ) ? GetYValue( rLSItem.GetInterLineSpace() ) : 0; - sal_uInt16 nCurIndex = 0; - size_t nLineCount = pPortion->GetLines().Count(); + sal_Int32 nCurIndex = 0; + sal_Int32 nLineCount = pPortion->GetLines().Count(); OSL_ENSURE( nLineCount, "Empty ParaPortion in GetEditCursor!" ); if (nLineCount == 0) return Rectangle(); const EditLine* pLine = NULL; sal_Bool bEOL = ( nFlags & GETCRSR_ENDOFLINE ) ? sal_True : sal_False; - for (size_t nLine = 0; nLine < nLineCount; ++nLine) + for (sal_Int32 nLine = 0; nLine < nLineCount; ++nLine) { const EditLine* pTmpLine = pPortion->GetLines()[nLine]; if ( ( pTmpLine->GetStart() == nIndex ) || ( pTmpLine->IsIn( nIndex, bEOL ) ) ) diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index c16adb7806bb..aa9727b2f06d 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -90,8 +90,8 @@ struct TabInfo bool bValid; SvxTabStop aTabStop; - xub_StrLen nCharPos; - sal_uInt16 nTabPortion; + sal_Int32 nCharPos; + sal_Int32 nTabPortion; long nStartPosX; long nTabPos; @@ -148,8 +148,8 @@ static void lcl_DrawRedLines( OutputDevice* pOutDev, long nFontHeight, const Point& rPnt, - sal_uInt16 nIndex, - sal_uInt16 nMaxEnd, + sal_Int32 nIndex, + sal_Int32 nMaxEnd, const sal_Int32* pDXArray, WrongList* pWrongs, short nOrientation, @@ -169,7 +169,7 @@ static void lcl_DrawRedLines( else nStyle = WAVE_FLAT; - size_t nEnd, nStart = nIndex; + sal_Int32 nEnd, nStart = nIndex; bool bWrong = pWrongs->NextWrong( nStart, nEnd ); while ( bWrong ) { @@ -630,8 +630,8 @@ sal_Bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) const sal_Bool bScriptSpace = ((const SvxScriptSpaceItem&) pNode->GetContentAttribs().GetItem( EE_PARA_ASIANCJKSPACING )).GetValue(); const short nInvalidDiff = pParaPortion->GetInvalidDiff(); - const sal_uInt16 nInvalidStart = pParaPortion->GetInvalidPosStart(); - const sal_uInt16 nInvalidEnd = nInvalidStart + std::abs( nInvalidDiff ); + const sal_Int32 nInvalidStart = pParaPortion->GetInvalidPosStart(); + const sal_Int32 nInvalidEnd = nInvalidStart + std::abs( nInvalidDiff ); bool bQuickFormat = false; if ( !bEmptyNodeWithPolygon && !HasScriptType( nPara, i18n::ScriptType::COMPLEX ) ) @@ -644,12 +644,12 @@ sal_Bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) else if ( ( pParaPortion->IsSimpleInvalid() ) && ( nInvalidDiff < 0 ) ) { // check if delete over the portion boundaries was done ... - sal_uInt16 nStart = nInvalidStart; // DOUBLE !!!!!!!!!!!!!!! - sal_uInt16 nEnd = nStart - nInvalidDiff; // negative + sal_Int32 nStart = nInvalidStart; // DOUBLE !!!!!!!!!!!!!!! + sal_Int32 nEnd = nStart - nInvalidDiff; // negative bQuickFormat = true; - sal_uInt16 nPos = 0; - sal_uInt16 nPortions = pParaPortion->GetTextPortions().Count(); - for ( sal_uInt16 nTP = 0; nTP < nPortions; nTP++ ) + sal_Int32 nPos = 0; + sal_Int32 nPortions = pParaPortion->GetTextPortions().Count(); + for ( sal_Int32 nTP = 0; nTP < nPortions; nTP++ ) { // There must be no start / end in the deleted area. TextPortion* const pTP = pParaPortion->GetTextPortions()[ nTP ]; @@ -668,9 +668,9 @@ sal_Bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) // Saving both layout mode and language (since I'm potentially changing both) GetRefDevice()->Push( PUSH_TEXTLAYOUTMODE|PUSH_TEXTLANGUAGE ); - ImplInitLayoutMode( GetRefDevice(), nPara, 0xFFFF ); + ImplInitLayoutMode( GetRefDevice(), nPara, -1 ); - sal_uInt16 nRealInvalidStart = nInvalidStart; + sal_Int32 nRealInvalidStart = nInvalidStart; if ( bEmptyNodeWithPolygon ) { @@ -694,8 +694,8 @@ sal_Bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) // Flag the line => do not remove it ! // --------------------------------------------------------------- - sal_uInt16 nLine = pParaPortion->GetLines().Count()-1; - for ( sal_uInt16 nL = 0; nL <= nLine; nL++ ) + sal_Int32 nLine = pParaPortion->GetLines().Count()-1; + for ( sal_Int32 nL = 0; nL <= nLine; nL++ ) { EditLine* pLine = pParaPortion->GetLines()[nL]; if ( pLine->GetEnd() > nRealInvalidStart ) // not nInvalidStart! @@ -726,10 +726,10 @@ sal_Bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) // --------------------------------------------------------------- // Reformat all lines from here ... // --------------------------------------------------------------- - sal_uInt16 nDelFromLine = 0xFFFF; + sal_Int32 nDelFromLine = -1; bool bLineBreak = false; - sal_uInt16 nIndex = pLine->GetStart(); + sal_Int32 nIndex = pLine->GetStart(); EditLine aSaveLine( *pLine ); SvxFont aTmpFont( pNode->GetCharAttribs().GetDefFont() ); @@ -748,8 +748,8 @@ sal_Bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) bool bEOL = false; bool bEOC = false; - sal_uInt16 nPortionStart = 0; - sal_uInt16 nPortionEnd = 0; + sal_Int32 nPortionStart = 0; + sal_Int32 nPortionEnd = 0; long nStartX = GetXValue( rLRItem.GetTxtLeft() + nSpaceBeforeAndMinLabelWidth ); if ( nIndex == 0 ) @@ -790,8 +790,8 @@ sal_Bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) if ( bCalcCharPositions ) pLine->GetCharPosArray().clear(); - sal_uInt16 nTmpPos = nIndex; - sal_uInt16 nTmpPortion = pLine->GetStartPortion(); + sal_Int32 nTmpPos = nIndex; + sal_Int32 nTmpPortion = pLine->GetStartPortion(); long nTmpWidth = 0; long nXWidth = nMaxLineWidth; if ( nXWidth <= nTmpWidth ) // while has to be looped once @@ -845,9 +845,8 @@ sal_Bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) // is the first one. Best with gaps. if ( pTextRanges->size() ) { - sal_uInt16 n = 0; - long nA = pTextRanges->at(n++); - long nB = pTextRanges->at(n++); + long nA = pTextRanges->at(0); + long nB = pTextRanges->at(0); DBG_ASSERT( nA <= nB, "TextRange distorted?" ); long nW = nB - nA; if ( nW > nMaxRangeWidth ) @@ -887,7 +886,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) { // Throw away a Portion, if necessary correct the one before, // if the Hyph portion has swallowed a character ... - sal_uInt16 nTmpLen = pPortion->GetLen(); + sal_Int32 nTmpLen = pPortion->GetLen(); pParaPortion->GetTextPortions().Remove( nTmpPortion ); if (nTmpPortion && nTmpLen) { @@ -1069,7 +1068,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) } if ( bCalcCharPositions ) { - sal_uInt16 nLen = pPortion->GetLen(); + sal_Int32 nLen = pPortion->GetLen(); // The array is generally flattened at the beginning // => Always simply quick inserts. size_t nPos = nTmpPos - pLine->GetStart(); @@ -1090,7 +1089,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) pPortion->SetRightToLeft( GetRightToLeft( nPara, nTmpPos+1 ) ); - sal_uInt16 _nPortionEnd = nTmpPos + pPortion->GetLen(); + sal_Int32 _nPortionEnd = nTmpPos + pPortion->GetLen(); if( bScriptSpace && ( _nPortionEnd < pNode->Len() ) && ( nTmpWidth < nXWidth ) && IsScriptChange( EditPaM( pNode, _nPortionEnd ) ) ) { bool bAllow = false; @@ -1113,7 +1112,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) if ( aCurrentTab.bValid && ( nTmpPortion != aCurrentTab.nTabPortion ) ) { long nWidthAfterTab = 0; - for ( sal_uInt16 n = aCurrentTab.nTabPortion+1; n <= nTmpPortion; n++ ) + for ( sal_Int32 n = aCurrentTab.nTabPortion+1; n <= nTmpPortion; n++ ) { const TextPortion* pTP = pParaPortion->GetTextPortions()[n]; nWidthAfterTab += pTP->GetSize().Width(); @@ -1186,7 +1185,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) { DBG_ASSERT( pPortion->GetKind() == PORTIONKIND_TEXT, "Len>1, but no TextPortion?" ); nTmpWidth -= pPortion->GetSize().Width(); - sal_uInt16 nP = SplitTextPortion( pParaPortion, nTmpPos, pLine ); + sal_Int32 nP = SplitTextPortion( pParaPortion, nTmpPos, pLine ); const TextPortion* p = pParaPortion->GetTextPortions()[nP]; DBG_ASSERT( p, "Portion ?!" ); nTmpWidth += p->GetSize().Width(); @@ -1230,7 +1229,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) bEOC = true; pLine->SetEnd( nPortionEnd ); DBG_ASSERT( pParaPortion->GetTextPortions().Count(), "No TextPortions?" ); - pLine->SetEndPortion( (sal_uInt16)pParaPortion->GetTextPortions().Count() - 1 ); + pLine->SetEndPortion( pParaPortion->GetTextPortions().Count() - 1 ); } if ( aStatus.OneCharPerLine() ) @@ -1292,8 +1291,8 @@ sal_Bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) // set anyway, because a large font only after wrapping suddenly ends // up in the next line => Font metrics too big. FormatterFontMetric aFormatterMetrics; - sal_uInt16 nTPos = pLine->GetStart(); - for ( sal_uInt16 nP = pLine->GetStartPortion(); nP <= pLine->GetEndPortion(); nP++ ) + sal_Int32 nTPos = pLine->GetStart(); + for ( sal_Int32 nP = pLine->GetStartPortion(); nP <= pLine->GetEndPortion(); nP++ ) { const TextPortion* pTP = pParaPortion->GetTextPortions()[nP]; // problem with hard font height attribute, when everthing but the line break has this attribute @@ -1392,7 +1391,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) // check for rel width now, maybe create compression... long n = nMaxLineWidth - aTextSize.Width(); TextPortion* const pTP = pParaPortion->GetTextPortions()[pLine->GetEndPortion()]; - sal_uInt16 nPosInArray = pLine->GetEnd()-1-pLine->GetStart(); + sal_Int32 nPosInArray = pLine->GetEnd()-1-pLine->GetStart(); long nNewValue = ( nPosInArray ? pLine->GetCharPosArray()[ nPosInArray-1 ] : 0 ) + n; pLine->GetCharPosArray()[ nPosInArray ] = nNewValue; pTP->GetSize().Width() += n; @@ -1475,8 +1474,8 @@ sal_Bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) } else { - sal_uInt16 nStart = pLine->GetStart(); - sal_uInt16 nEnd = pLine->GetEnd(); + sal_Int32 nStart = pLine->GetStart(); + sal_Int32 nEnd = pLine->GetEnd(); if ( nStart > nInvalidEnd ) { @@ -1514,7 +1513,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) nIndex = pLine->GetEnd(); // next line start = last line end // as nEnd points to the last character! - sal_uInt16 nEndPortion = pLine->GetEndPortion(); + sal_Int32 nEndPortion = pLine->GetEndPortion(); // Next line or maybe a new line.... pLine = 0; @@ -1555,7 +1554,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) } } // while ( Index < Len ) - if ( nDelFromLine != 0xFFFF ) + if ( nDelFromLine >= 0 ) pParaPortion->GetLines().DeleteFromLine( nDelFromLine ); DBG_ASSERT( pParaPortion->GetLines().Count(), "No line after CreateLines!" ); @@ -1712,7 +1711,7 @@ void ImpEditEngine::CreateAndInsertEmptyLine( ParaPortion* pParaPortion, sal_uIn DBG_ASSERT( pLastLine, "soft wrap no line?!" ); DBG_ASSERT( pLastLine->GetEnd() == pParaPortion->GetNode()->Len(), "different anyway?" ); #endif - sal_uInt16 nPos = (sal_uInt16) pParaPortion->GetTextPortions().Count() - 1 ; + sal_Int32 nPos = pParaPortion->GetTextPortions().Count() - 1 ; pTmpLine->SetStartPortion( nPos ); pTmpLine->SetEndPortion( nPos ); } @@ -1730,17 +1729,17 @@ sal_Bool ImpEditEngine::FinishCreateLines( ParaPortion* pParaPortion ) return bRet; } -void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, TextPortion* pPortion, sal_uInt16 nPortionStart, long nRemainingWidth, sal_Bool bCanHyphenate ) +void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, TextPortion* pPortion, sal_Int32 nPortionStart, long nRemainingWidth, sal_Bool bCanHyphenate ) { ContentNode* const pNode = pParaPortion->GetNode(); - sal_uInt16 nBreakInLine = nPortionStart - pLine->GetStart(); - sal_uInt16 nMax = nBreakInLine + pPortion->GetLen(); + sal_Int32 nBreakInLine = nPortionStart - pLine->GetStart(); + sal_Int32 nMax = nBreakInLine + pPortion->GetLen(); while ( ( nBreakInLine < nMax ) && ( pLine->GetCharPosArray()[nBreakInLine] < nRemainingWidth ) ) nBreakInLine++; - sal_uInt16 nMaxBreakPos = nBreakInLine + pLine->GetStart(); - sal_uInt16 nBreakPos = 0xFFFF; + sal_Int32 nMaxBreakPos = nBreakInLine + pLine->GetStart(); + sal_Int32 nBreakPos = SAL_MAX_INT32; sal_Bool bCompressBlank = sal_False; sal_Bool bHyphenated = sal_False; @@ -1759,7 +1758,7 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te } else { - sal_uInt16 nMinBreakPos = pLine->GetStart(); + sal_Int32 nMinBreakPos = pLine->GetStart(); const CharAttribList::AttribsType& rAttrs = pNode->GetCharAttribs().GetAttribs(); for (size_t nAttr = rAttrs.size(); nAttr; ) { @@ -1789,7 +1788,7 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te i18n::LineBreakResults aLBR = _xBI->getLineBreak( pNode->GetString(), nMaxBreakPos, aLocale, nMinBreakPos, aHyphOptions, aUserOptions ); - nBreakPos = (sal_uInt16)aLBR.breakIndex; + nBreakPos = aLBR.breakIndex; // BUG in I18N - under special condition (break behind field, #87327#) breakIndex is < nMinBreakPos if ( nBreakPos < nMinBreakPos ) @@ -1827,23 +1826,23 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te { i18n::Boundary aBoundary = _xBI->getWordBoundary( pNode->GetString(), nBreakPos, GetLocale( EditPaM( pNode, nBreakPos ) ), ::com::sun::star::i18n::WordType::DICTIONARY_WORD, true); - sal_uInt16 nWordStart = nBreakPos; - sal_uInt16 nWordEnd = (sal_uInt16) aBoundary.endPos; + sal_Int32 nWordStart = nBreakPos; + sal_Int32 nWordEnd = aBoundary.endPos; DBG_ASSERT( nWordEnd > nWordStart, "ImpBreakLine: Start >= End?" ); - sal_uInt16 nWordLen = nWordEnd - nWordStart; + sal_Int32 nWordLen = nWordEnd - nWordStart; if ( ( nWordEnd >= nMaxBreakPos ) && ( nWordLen > 3 ) ) { // May happen, because getLineBreak may differ from getWordBoudary with DICTIONARY_WORD OUString aWord = pNode->GetString().copy(nWordStart, nWordLen); - sal_uInt16 nMinTrail = nWordEnd-nMaxBreakPos+1; //+1: Before the dickey letter + sal_Int32 nMinTrail = nWordEnd-nMaxBreakPos+1; //+1: Before the dickey letter Reference< XHyphenatedWord > xHyphWord; if (xHyphenator.is()) xHyphWord = xHyphenator->hyphenate( aWord, aLocale, aWord.getLength() - nMinTrail, Sequence< PropertyValue >() ); if (xHyphWord.is()) { sal_Bool bAlternate = xHyphWord->isAlternativeSpelling(); - sal_uInt16 _nWordLen = 1 + xHyphWord->getHyphenPos(); + sal_Int32 _nWordLen = 1 + xHyphWord->getHyphenPos(); if ( ( _nWordLen >= 2 ) && ( (nWordStart+_nWordLen) >= (pLine->GetStart() + 2 ) ) ) { @@ -1877,10 +1876,10 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te // We can thus actually not directly connect the index of the // AlternativeWord to aWord. The whole issue will be simplified // by a function in the Hyphenator as soon as AMA builds this in... - sal_uInt16 nAltStart = _nWordLen - 1; - sal_uInt16 nTxtStart = nAltStart - (aAlt.getLength() - aWord.getLength()); - sal_uInt16 nTxtEnd = nTxtStart; - sal_uInt16 nAltEnd = nAltStart; + sal_Int32 nAltStart = _nWordLen - 1; + sal_Int32 nTxtStart = nAltStart - (aAlt.getLength() - aWord.getLength()); + sal_Int32 nTxtEnd = nTxtStart; + sal_Int32 nAltEnd = nAltStart; // The regions between the nStart and nEnd is the // difference between alternative and original string. @@ -1930,7 +1929,7 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te // the dickey portion is the end portion pLine->SetEnd( nBreakPos ); - sal_uInt16 nEndPortion = SplitTextPortion( pParaPortion, nBreakPos, pLine ); + sal_Int32 nEndPortion = SplitTextPortion( pParaPortion, nBreakPos, pLine ); if ( !bCompressBlank && !bHangingPunctuation ) { @@ -1947,7 +1946,7 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te TextPortion* const pTP = pParaPortion->GetTextPortions()[nEndPortion]; DBG_ASSERT( pTP->GetKind() == PORTIONKIND_TEXT, "BlankRubber: No TextPortion!" ); DBG_ASSERT( nBreakPos > pLine->GetStart(), "SplitTextPortion at the beginning of the line?" ); - sal_uInt16 nPosInArray = nBreakPos - 1 - pLine->GetStart(); + sal_Int32 nPosInArray = nBreakPos - 1 - pLine->GetStart(); pTP->GetSize().Width() = ( nPosInArray && ( pTP->GetLen() > 1 ) ) ? pLine->GetCharPosArray()[ nPosInArray-1 ] : 0; pLine->GetCharPosArray()[ nPosInArray ] = pTP->GetSize().Width(); } @@ -1995,7 +1994,7 @@ void ImpEditEngine::ImpAdjustBlocks( ParaPortion* pParaPortion, EditLine* pLine, DBG_ASSERT( nLastChar < pNode->Len(), "AdjustBlocks: Out of range!" ); // Search blanks or Kashidas... - std::vector<sal_uInt16> aPositions; + std::vector<sal_Int32> aPositions; sal_uInt16 nLastScript = i18n::ScriptType::LATIN; for ( sal_Int32 nChar = nFirstChar; nChar <= nLastChar; nChar++ ) { @@ -2042,7 +2041,7 @@ void ImpEditEngine::ImpAdjustBlocks( ParaPortion* pParaPortion, EditLine* pLine, ( MsLangId::getPrimaryLanguage( GetLanguage( EditPaM( pNode, nLastChar ) ) ) != LANGUAGE_ARABIC_PRIMARY_ONLY ) ) { aPositions.pop_back(); - sal_uInt16 nPortionStart, nPortion; + sal_Int32 nPortionStart, nPortion; nPortion = pParaPortion->GetTextPortions().FindPortion( nLastChar+1, nPortionStart ); TextPortion* pLastPortion = pParaPortion->GetTextPortions()[ nPortion ]; long nRealWidth = pLine->GetCharPosArray()[nLastChar-nFirstChar]; @@ -2070,12 +2069,12 @@ void ImpEditEngine::ImpAdjustBlocks( ParaPortion* pParaPortion, EditLine* pLine, // Correct the positions in the Array and the portion widths: // Last character won't be considered ... - for ( std::vector<sal_uInt16>::const_iterator it(aPositions.begin()); it != aPositions.end(); ++it ) + for ( std::vector<sal_Int32>::const_iterator it(aPositions.begin()); it != aPositions.end(); ++it ) { - sal_uInt16 nChar = *it; + sal_Int32 nChar = *it; if ( nChar < nLastChar ) { - sal_uInt16 nPortionStart, nPortion; + sal_Int32 nPortionStart, nPortion; nPortion = pParaPortion->GetTextPortions().FindPortion( nChar, nPortionStart, true ); TextPortion* pLastPortion = pParaPortion->GetTextPortions()[ nPortion ]; @@ -2086,8 +2085,8 @@ void ImpEditEngine::ImpAdjustBlocks( ParaPortion* pParaPortion, EditLine* pLine, // Correct positions in array // Even for kashidas just change positions, VCL will then draw the kashida automaticly - sal_uInt16 nPortionEnd = nPortionStart + pLastPortion->GetLen(); - for ( sal_uInt16 _n = nChar; _n < nPortionEnd; _n++ ) + sal_Int32 nPortionEnd = nPortionStart + pLastPortion->GetLen(); + for ( sal_Int32 _n = nChar; _n < nPortionEnd; _n++ ) { pLine->GetCharPosArray()[_n-nFirstChar] += nMore4Everyone; if ( nSomeExtraSpace ) @@ -2103,7 +2102,7 @@ void ImpEditEngine::ImpAdjustBlocks( ParaPortion* pParaPortion, EditLine* pLine, pLine->SetTextWidth( pLine->GetTextWidth() + nRemainingSpace ); } -void ImpEditEngine::ImpFindKashidas( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd, std::vector<sal_uInt16>& rArray ) +void ImpEditEngine::ImpFindKashidas( ContentNode* pNode, sal_Int32 nStart, sal_Int32 nEnd, std::vector<sal_Int32>& rArray ) { // the search has to be performed on a per word base @@ -2220,7 +2219,7 @@ void ImpEditEngine::ImpFindKashidas( ContentNode* pNode, sal_uInt16 nStart, sal_ } } -sal_uInt16 ImpEditEngine::SplitTextPortion( ParaPortion* pPortion, sal_uInt16 nPos, EditLine* pCurLine ) +sal_Int32 ImpEditEngine::SplitTextPortion( ParaPortion* pPortion, sal_Int32 nPos, EditLine* pCurLine ) { DBG_ASSERT( pPortion, "SplitTextPortion: Which ?" ); @@ -2228,10 +2227,10 @@ sal_uInt16 ImpEditEngine::SplitTextPortion( ParaPortion* pPortion, sal_uInt16 nP if ( nPos == 0 ) return 0; - sal_uInt16 nSplitPortion; - sal_uInt16 nTmpPos = 0; + sal_Int32 nSplitPortion; + sal_Int32 nTmpPos = 0; TextPortion* pTextPortion = NULL; - sal_uInt16 nPortions = pPortion->GetTextPortions().Count(); + sal_Int32 nPortions = pPortion->GetTextPortions().Count(); for ( nSplitPortion = 0; nSplitPortion < nPortions; nSplitPortion++ ) { TextPortion* pTP = pPortion->GetTextPortions()[nSplitPortion]; @@ -2250,7 +2249,7 @@ sal_uInt16 ImpEditEngine::SplitTextPortion( ParaPortion* pPortion, sal_uInt16 nP DBG_ASSERT( pTextPortion, "Position outside the area!" ); DBG_ASSERT( pTextPortion->GetKind() == PORTIONKIND_TEXT, "SplitTextPortion: No TextPortion!" ); - sal_uInt16 nOverlapp = nTmpPos - nPos; + sal_Int32 nOverlapp = nTmpPos - nPos; pTextPortion->SetLen( pTextPortion->GetLen() - nOverlapp ); TextPortion* pNewPortion = new TextPortion( nOverlapp ); pPortion->GetTextPortions().Insert(nSplitPortion+1, pNewPortion); @@ -2264,7 +2263,7 @@ sal_uInt16 ImpEditEngine::SplitTextPortion( ParaPortion* pPortion, sal_uInt16 nP if ( pTextPortion->GetExtraInfos() && pTextPortion->GetExtraInfos()->bCompressed ) { // We need the original size from the portion - sal_uInt16 nTxtPortionStart = pPortion->GetTextPortions().GetStartPos( nSplitPortion ); + sal_Int32 nTxtPortionStart = pPortion->GetTextPortions().GetStartPos( nSplitPortion ); SvxFont aTmpFont( pPortion->GetNode()->GetCharAttribs().GetDefFont() ); SeekCursor( pPortion->GetNode(), nTxtPortionStart+1, aTmpFont ); aTmpFont.SetPhysFont( GetRefDevice() ); @@ -2281,13 +2280,13 @@ sal_uInt16 ImpEditEngine::SplitTextPortion( ParaPortion* pPortion, sal_uInt16 nP return nSplitPortion; } -void ImpEditEngine::CreateTextPortions( ParaPortion* pParaPortion, sal_uInt16& rStart ) +void ImpEditEngine::CreateTextPortions( ParaPortion* pParaPortion, sal_Int32& rStart ) { - sal_uInt16 nStartPos = rStart; + sal_Int32 nStartPos = rStart; ContentNode* pNode = pParaPortion->GetNode(); DBG_ASSERT( pNode->Len(), "CreateTextPortions should not be used for empty paragraphs!" ); - ::std::set< sal_uInt32 > aPositions; + ::std::set< sal_Int32 > aPositions; aPositions.insert( 0 ); sal_uInt16 nAttr = 0; @@ -2331,10 +2330,10 @@ void ImpEditEngine::CreateTextPortions( ParaPortion* pParaPortion, sal_uInt16& r // From ... Delete: // Unfortunately, the number of text portions does not have to match // aPositions.Count(), since there might be line breaks... - sal_uInt16 nPortionStart = 0; - sal_uInt16 nInvPortion = 0; - sal_uInt16 nP; - for ( nP = 0; nP < pParaPortion->GetTextPortions().Count(); nP++ ) + sal_Int32 nPortionStart = 0; + sal_Int32 nInvPortion = 0; + sal_Int32 nP; + for ( nP = 0; nP < (sal_Int32)pParaPortion->GetTextPortions().Count(); nP++ ) { const TextPortion* pTmpPortion = pParaPortion->GetTextPortions()[nP]; nPortionStart = nPortionStart + pTmpPortion->GetLen(); @@ -2360,14 +2359,14 @@ void ImpEditEngine::CreateTextPortions( ParaPortion* pParaPortion, sal_uInt16& r // A portion may also have been formed by a line break: aPositions.insert( nPortionStart ); - ::std::set< sal_uInt32 >::iterator nInvPos = aPositions.find( nPortionStart ); + ::std::set< sal_Int32 >::iterator nInvPos = aPositions.find( nPortionStart ); DBG_ASSERT( (nInvPos != aPositions.end()), "InvPos ?!" ); - ::std::set< sal_uInt32 >::iterator i = nInvPos; + ::std::set< sal_Int32 >::iterator i = nInvPos; ++i; while ( i != aPositions.end() ) { - TextPortion* pNew = new TextPortion( static_cast<sal_uInt16>(*i++) - static_cast<sal_uInt16>(*nInvPos++) ); + TextPortion* pNew = new TextPortion( (*i++) - *nInvPos++ ); pParaPortion->GetTextPortions().Append(pNew); } @@ -2377,7 +2376,7 @@ void ImpEditEngine::CreateTextPortions( ParaPortion* pParaPortion, sal_uInt16& r #endif } -void ImpEditEngine::RecalcTextPortion( ParaPortion* pParaPortion, sal_uInt16 nStartPos, short nNewChars ) +void ImpEditEngine::RecalcTextPortion( ParaPortion* pParaPortion, sal_Int32 nStartPos, sal_Int32 nNewChars ) { DBG_ASSERT( pParaPortion->GetTextPortions().Count(), "No Portions!" ); DBG_ASSERT( nNewChars, "RecalcTextPortion with Diff == 0" ); @@ -2389,13 +2388,13 @@ void ImpEditEngine::RecalcTextPortion( ParaPortion* pParaPortion, sal_uInt16 nSt // otherwise the portion is extended at nStartPos. if ( pNode->GetCharAttribs().HasBoundingAttrib( nStartPos ) || IsScriptChange( EditPaM( pNode, nStartPos ) ) ) { - sal_uInt16 nNewPortionPos = 0; + sal_Int32 nNewPortionPos = 0; if ( nStartPos ) nNewPortionPos = SplitTextPortion( pParaPortion, nStartPos ) + 1; // A blank portion may be here, if the paragraph was empty, // or if a line was created by a hard line break. - if ( ( nNewPortionPos < pParaPortion->GetTextPortions().Count() ) && + if ( ( nNewPortionPos < (sal_Int32)pParaPortion->GetTextPortions().Count() ) && !pParaPortion->GetTextPortions()[nNewPortionPos]->GetLen() ) { TextPortion* const pTP = pParaPortion->GetTextPortions()[nNewPortionPos]; @@ -2410,8 +2409,8 @@ void ImpEditEngine::RecalcTextPortion( ParaPortion* pParaPortion, sal_uInt16 nSt } else { - sal_uInt16 nPortionStart; - const sal_uInt16 nTP = pParaPortion->GetTextPortions(). + sal_Int32 nPortionStart; + const sal_Int32 nTP = pParaPortion->GetTextPortions(). FindPortion( nStartPos, nPortionStart ); TextPortion* const pTP = pParaPortion->GetTextPortions()[ nTP ]; DBG_ASSERT( pTP, "RecalcTextPortion: Portion not found" ); @@ -2428,10 +2427,10 @@ void ImpEditEngine::RecalcTextPortion( ParaPortion* pParaPortion, sal_uInt16 nSt // There must be no portions extending into the area or portions starting in // the area, so it must be: // nStartPos <= nPos <= nStartPos - nNewChars(neg.) - sal_uInt16 nPortion = 0; - sal_uInt16 nPos = 0; - sal_uInt16 nEnd = nStartPos-nNewChars; - sal_uInt16 nPortions = pParaPortion->GetTextPortions().Count(); + sal_Int32 nPortion = 0; + sal_Int32 nPos = 0; + sal_Int32 nEnd = nStartPos-nNewChars; + sal_Int32 nPortions = pParaPortion->GetTextPortions().Count(); TextPortion* pTP = 0; for ( nPortion = 0; nPortion < nPortions; nPortion++ ) { @@ -2466,12 +2465,12 @@ void ImpEditEngine::RecalcTextPortion( ParaPortion* pParaPortion, sal_uInt16 nSt pTP->SetLen( pTP->GetLen() + nNewChars ); } - sal_uInt16 nPortionCount = pParaPortion->GetTextPortions().Count(); + sal_Int32 nPortionCount = pParaPortion->GetTextPortions().Count(); assert( nPortionCount ); if (nPortionCount) { // No HYPHENATOR portion is allowed to get stuck right at the end... - sal_uInt16 nLastPortion = nPortionCount - 1; + sal_Int32 nLastPortion = nPortionCount - 1; pTP = pParaPortion->GetTextPortions()[nLastPortion]; if ( pTP->GetKind() == PORTIONKIND_HYPHENATOR ) { @@ -2542,7 +2541,7 @@ void ImpEditEngine::SetFixedCellHeight( sal_Bool bUseFixedCellHeight ) } } -void ImpEditEngine::SeekCursor( ContentNode* pNode, sal_uInt16 nPos, SvxFont& rFont, OutputDevice* pOut, sal_uInt16 nIgnoreWhich ) +void ImpEditEngine::SeekCursor( ContentNode* pNode, sal_Int32 nPos, SvxFont& rFont, OutputDevice* pOut, sal_uInt16 nIgnoreWhich ) { // It was planned, SeekCursor( nStartPos, nEndPos, ... ), so that it would // only be searched anew at the StartPosition. @@ -2884,7 +2883,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt pPDFExtOutDevData->BeginStructureElement( vcl::PDFWriter::Paragraph ); long nParaHeight = pPortion->GetHeight(); - sal_uInt16 nIndex = 0; + sal_Int32 nIndex = 0; if ( pPortion->IsVisible() && ( ( !IsVertical() && ( ( aStartPos.Y() + nParaHeight ) > aClipRect.Top() ) ) || ( IsVertical() && ( ( aStartPos.X() - nParaHeight ) < aClipRect.Right() ) ) ) ) @@ -2893,8 +2892,8 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt // -------------------------------------------------- // Over the lines of the paragraph ... // -------------------------------------------------- - sal_uInt16 nLines = pPortion->GetLines().Count(); - sal_uInt16 nLastLine = nLines-1; + sal_Int32 nLines = pPortion->GetLines().Count(); + sal_Int32 nLastLine = nLines-1; // #108052# bool bEndOfParagraphWritten(false); @@ -2911,7 +2910,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt ? GetYValue( rLSItem.GetInterLineSpace() ) : 0; bool bPaintBullet (false); - for ( sal_uInt16 nLine = 0; nLine < nLines; nLine++ ) + for ( sal_Int32 nLine = 0; nLine < nLines; nLine++ ) { pLine = pPortion->GetLines()[nLine]; nIndex = pLine->GetStart(); @@ -2959,7 +2958,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt bool bParsingFields = false; ::std::vector< sal_Int32 >::iterator itSubLines; - for ( sal_uInt16 nPortion = pLine->GetStartPortion(); nPortion <= pLine->GetEndPortion(); nPortion++ ) + for ( sal_Int32 nPortion = pLine->GetStartPortion(); nPortion <= pLine->GetEndPortion(); nPortion++ ) { DBG_ASSERT( pPortion->GetTextPortions().Count(), "Line without Textportion in Paint!" ); const TextPortion* pTextPortion = pPortion->GetTextPortions()[nPortion]; @@ -3025,8 +3024,8 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt ImplInitDigitMode(pOutDev, aTmpFont.GetLanguage()); OUString aText; - sal_uInt16 nTextStart = 0; - sal_uInt16 nTextLen = 0; + sal_Int32 nTextStart = 0; + sal_Int32 nTextLen = 0; const sal_Int32* pDXArray = 0; sal_Int32* pTmpDXArray = 0; @@ -3041,8 +3040,8 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt // Paint control characters (#i55716#) if ( aStatus.MarkFields() ) { - xub_StrLen nTmpIdx; - const xub_StrLen nTmpEnd = nTextStart + pTextPortion->GetLen(); + sal_Int32 nTmpIdx; + const sal_Int32 nTmpEnd = nTextStart + pTextPortion->GetLen(); for ( nTmpIdx = nTextStart; nTmpIdx <= nTmpEnd ; ++nTmpIdx ) { @@ -3230,9 +3229,9 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt if(pWrongs && !pWrongs->empty()) { - size_t nStart = nIndex, nEnd = 0; + sal_Int32 nStart = nIndex, nEnd = 0; bool bWrong = pWrongs->NextWrong(nStart, nEnd); - const sal_uInt16 nMaxEnd(nIndex + pTextPortion->GetLen()); + const sal_Int32 nMaxEnd(nIndex + pTextPortion->GetLen()); while(bWrong) { @@ -3851,7 +3850,7 @@ void ImpEditEngine::SetUpdateModeForAcc(bool bUp) bUpdateForAcc = bUp; } -EditPaM ImpEditEngine::SplitContent( sal_Int32 nNode, sal_uInt16 nSepPos ) +EditPaM ImpEditEngine::SplitContent( sal_Int32 nNode, sal_Int32 nSepPos ) { ContentNode* pNode = aEditDoc.GetObject( nNode ); DBG_ASSERT( pNode, "Invalid Node in SplitContent" ); @@ -4063,7 +4062,7 @@ const ParaPortion* ImpEditEngine::GetNextVisPortion( const ParaPortion* pCurPort long ImpEditEngine::CalcVertLineSpacing(Point& rStartPos) const { long nTotalOccupiedHeight = 0; - sal_uInt16 nTotalLineCount = 0; + sal_Int32 nTotalLineCount = 0; const ParaPortionList& rParaPortions = GetParaPortions(); sal_Int32 nParaCount = rParaPortions.Count(); @@ -4084,9 +4083,9 @@ long ImpEditEngine::CalcVertLineSpacing(Point& rStartPos) const long nUL = GetYValue( rULItem.GetLower() ); const EditLineList& rLines = pPortion->GetLines(); - sal_uInt16 nLineCount = rLines.Count(); + sal_Int32 nLineCount = rLines.Count(); nTotalLineCount += nLineCount; - for (sal_uInt16 j = 0; j < nLineCount; ++j) + for (sal_Int32 j = 0; j < nLineCount; ++j) { const EditLine* pLine = rLines[j]; nTotalOccupiedHeight += pLine->GetHeight(); @@ -4293,11 +4292,11 @@ void ImpEditEngine::ImplInitDigitMode(OutputDevice* pOutDev, LanguageType eCurLa pOutDev->SetDigitLanguage(ImplCalcDigitLang(eCurLang)); } -void ImpEditEngine::ImplInitLayoutMode( OutputDevice* pOutDev, sal_Int32 nPara, sal_uInt16 nIndex ) +void ImpEditEngine::ImplInitLayoutMode( OutputDevice* pOutDev, sal_Int32 nPara, sal_Int32 nIndex ) { sal_Bool bCTL = sal_False; sal_Bool bR2L = sal_False; - if ( nIndex == 0xFFFF ) + if ( nIndex == -1 ) { bCTL = HasScriptType( nPara, i18n::ScriptType::COMPLEX ); bR2L = IsRightToLeft( nPara ); @@ -4377,7 +4376,7 @@ Color ImpEditEngine::GetAutoColor() const bool ImpEditEngine::ImplCalcAsianCompression(ContentNode* pNode, - TextPortion* pTextPortion, sal_uInt16 nStartPos, sal_Int32* pDXArray, + TextPortion* pTextPortion, sal_Int32 nStartPos, sal_Int32* pDXArray, sal_uInt16 n100thPercentFromMax, sal_Bool bManipulateDXArray) { DBG_ASSERT( GetAsianCompressionMode(), "ImplCalcAsianCompression - Why?" ); @@ -4392,8 +4391,8 @@ bool ImpEditEngine::ImplCalcAsianCompression(ContentNode* pNode, if ( GetI18NScriptType( EditPaM( pNode, nStartPos+1 ) ) == i18n::ScriptType::ASIAN ) { long nNewPortionWidth = pTextPortion->GetSize().Width(); - sal_uInt16 nPortionLen = pTextPortion->GetLen(); - for ( sal_uInt16 n = 0; n < nPortionLen; n++ ) + sal_Int32 nPortionLen = pTextPortion->GetLen(); + for ( sal_Int32 n = 0; n < nPortionLen; n++ ) { sal_uInt8 nType = GetCharTypeForCompression( pNode->GetChar( n+nStartPos ) ); @@ -4464,7 +4463,7 @@ bool ImpEditEngine::ImplCalcAsianCompression(ContentNode* pNode, if ( n ) { // -1: No entry for the last character - for ( sal_uInt16 i = n-1; i < (nPortionLen-1); i++ ) + for ( sal_Int32 i = n-1; i < (nPortionLen-1); i++ ) pDXArray[i] -= nCompress; } else @@ -4476,7 +4475,7 @@ bool ImpEditEngine::ImplCalcAsianCompression(ContentNode* pNode, else { // -1: No entry for the last character - for ( sal_uInt16 i = n; i < (nPortionLen-1); i++ ) + for ( sal_Int32 i = n; i < (nPortionLen-1); i++ ) pDXArray[i] -= nCompress; } } @@ -4510,7 +4509,7 @@ void ImpEditEngine::ImplExpandCompressedPortions( EditLine* pLine, ParaPortion* long nCompressed = 0; std::vector<TextPortion*> aCompressedPortions; - sal_uInt16 nPortion = pLine->GetEndPortion(); + sal_Int32 nPortion = pLine->GetEndPortion(); TextPortion* pTP = pParaPortion->GetTextPortions()[ nPortion ]; while ( pTP && ( pTP->GetKind() == PORTIONKIND_TEXT ) ) { @@ -4541,8 +4540,8 @@ void ImpEditEngine::ImplExpandCompressedPortions( EditLine* pLine, ParaPortion* pTP->GetSize().Width() = pTP->GetExtraInfos()->nOrgWidth; if ( nCompressPercent ) { - size_t nTxtPortion = pParaPortion->GetTextPortions().GetPos( pTP ); - sal_uInt16 nTxtPortionStart = pParaPortion->GetTextPortions().GetStartPos( nTxtPortion ); + sal_Int32 nTxtPortion = pParaPortion->GetTextPortions().GetPos( pTP ); + sal_Int32 nTxtPortionStart = pParaPortion->GetTextPortions().GetStartPos( nTxtPortion ); DBG_ASSERT( nTxtPortionStart >= pLine->GetStart(), "Portion doesn't belong to the line!!!" ); sal_Int32* pDXArray = NULL; if (!pLine->GetCharPosArray().empty()) diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index 50713cfcbd73..7a6181067efa 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -84,12 +84,6 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::linguistic2; -void Swapsal_uIt16s( sal_uInt16& rX, sal_uInt16& rY ) -{ - sal_uInt16 n = rX; - rX = rY; - rY = n; -} EditPaM ImpEditEngine::Read( SvStream& rInput, const OUString& rBaseURL, EETextFormat eFormat, EditSelection aSel, SvKeyValueIterator* pHTTPHeaderAttrs ) { @@ -267,7 +261,7 @@ sal_uInt32 ImpEditEngine::WriteText( SvStream& rOutput, EditSelection aSel ) return rOutput.GetError(); } -sal_Bool ImpEditEngine::WriteItemListAsRTF( ItemList& rLst, SvStream& rOutput, sal_Int32 nPara, sal_uInt16 nPos, +sal_Bool ImpEditEngine::WriteItemListAsRTF( ItemList& rLst, SvStream& rOutput, sal_Int32 nPara, sal_Int32 nPos, std::vector<SvxFontItem*>& rFontTable, SvxColorList& rColorList ) { const SfxPoolItem* pAttrItem = rLst.First(); @@ -279,7 +273,7 @@ sal_Bool ImpEditEngine::WriteItemListAsRTF( ItemList& rLst, SvStream& rOutput, s return ( rLst.Count() ? sal_True : sal_False ); } -static void lcl_FindValidAttribs( ItemList& rLst, ContentNode* pNode, sal_uInt16 nIndex, sal_uInt16 nScriptType ) +static void lcl_FindValidAttribs( ItemList& rLst, ContentNode* pNode, sal_Int32 nIndex, sal_uInt16 nScriptType ) { sal_uInt16 nAttr = 0; EditCharAttrib* pAttr = GetAttrib( pNode->GetCharAttribs().GetAttribs(), nAttr ); @@ -585,13 +579,13 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) ParaPortion* pParaPortion = FindParaPortion( pNode ); DBG_ASSERT( pParaPortion, "Portion not found: WriteRTF" ); - sal_uInt16 nIndex = 0; - sal_uInt16 nStartPos = 0; - sal_uInt16 nEndPos = pNode->Len(); - sal_uInt16 nStartPortion = 0; - sal_uInt16 nEndPortion = (sal_uInt16)pParaPortion->GetTextPortions().Count() - 1; + sal_Int32 nIndex = 0; + sal_Int32 nStartPos = 0; + sal_Int32 nEndPos = pNode->Len(); + sal_Int32 nStartPortion = 0; + sal_Int32 nEndPortion = pParaPortion->GetTextPortions().Count() - 1; sal_Bool bFinishPortion = sal_False; - sal_uInt16 nPortionStart; + sal_Int32 nPortionStart; if ( nNode == nStartNode ) { @@ -619,7 +613,7 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) const EditCharAttrib* pNextFeature = pNode->GetCharAttribs().FindFeature(nIndex); // start at 0, so the index is right ... - for ( sal_uInt16 n = 0; n <= nEndPortion; n++ ) + for ( sal_Int32 n = 0; n <= nEndPortion; n++ ) { const TextPortion* pTextPortion = pParaPortion->GetTextPortions()[n]; if ( n < nStartPortion ) @@ -653,8 +647,8 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) if ( WriteItemListAsRTF( aAttribItems, rOutput, nNode, nIndex, aFontTable, aColorList ) ) rOutput.WriteChar( ' ' ); - sal_uInt16 nS = nIndex; - sal_uInt16 nE = nIndex + pTextPortion->GetLen(); + sal_Int32 nS = nIndex; + sal_Int32 nE = nIndex + pTextPortion->GetLen(); if ( n == nStartPortion ) nS = nStartPos; if ( n == nEndPortion ) @@ -688,7 +682,7 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) } -void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, sal_Int32 nPara, sal_uInt16 nPos, +void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, sal_Int32 nPara, sal_Int32 nPos, std::vector<SvxFontItem*>& rFontTable, SvxColorList& rColorList ) { sal_uInt16 nWhich = rItem.Which(); @@ -1009,7 +1003,7 @@ EditTextObject* ImpEditEngine::CreateTextObject( EditSelection aSel ) return CreateTextObject( aSel, GetEditTextObjectPool(), aStatus.AllowBigObjects(), nBigTextObjectStart ); } -EditTextObject* ImpEditEngine::CreateTextObject( EditSelection aSel, SfxItemPool* pPool, sal_Bool bAllowBigObjects, sal_uInt16 nBigObjectStart ) +EditTextObject* ImpEditEngine::CreateTextObject( EditSelection aSel, SfxItemPool* pPool, sal_Bool bAllowBigObjects, sal_Int32 nBigObjectStart ) { EditTextObject* pTxtObj = new EditTextObject(pPool); pTxtObj->SetVertical( IsVertical() ); @@ -1019,7 +1013,7 @@ EditTextObject* ImpEditEngine::CreateTextObject( EditSelection aSel, SfxItemPool pTxtObj->mpImpl->GetPool()->SetDefaultMetric( (SfxMapUnit) eMapUnit ); sal_Int32 nStartNode, nEndNode; - sal_uInt32 nTextPortions = 0; + sal_Int32 nTextPortions = 0; aSel.Adjust( aEditDoc ); nStartNode = aEditDoc.GetPos( aSel.Min().GetNode() ); @@ -1046,8 +1040,8 @@ EditTextObject* ImpEditEngine::CreateTextObject( EditSelection aSel, SfxItemPool nTextPortions += pParaPortion->GetTextPortions().Count(); } - sal_uInt16 nStartPos = 0; - sal_uInt16 nEndPos = pNode->Len(); + sal_Int32 nStartPos = 0; + sal_Int32 nEndPos = pNode->Len(); sal_Bool bEmptyPara = nEndPos ? sal_False : sal_True; @@ -1414,7 +1408,7 @@ void ImpEditEngine::SetAllMisspellRanges( const std::vector<editeng::MisspellRan } } -LanguageType ImpEditEngine::GetLanguage( const EditPaM& rPaM, sal_uInt16* pEndPos ) const +LanguageType ImpEditEngine::GetLanguage( const EditPaM& rPaM, sal_Int32* pEndPos ) const { short nScriptType = GetI18NScriptType( rPaM, pEndPos ); // pEndPos will be valid now, pointing to ScriptChange or NodeLen sal_uInt16 nLangId = GetScriptItemId( EE_CHAR_LANGUAGE, nScriptType ); @@ -1512,12 +1506,12 @@ sal_Bool ImpEditEngine::HasConvertibleTextPortion( LanguageType nSrcLang ) sal_Int32 nParas = pEditEngine->GetParagraphCount(); for (sal_Int32 k = 0; k < nParas; ++k) { - std::vector<sal_uInt16> aPortions; + std::vector<sal_Int32> aPortions; pEditEngine->GetPortions( k, aPortions ); for ( size_t nPos = 0; nPos < aPortions.size(); ++nPos ) { - sal_uInt16 nEnd = aPortions[ nPos ]; - sal_uInt16 nStart = nPos > 0 ? aPortions[ nPos - 1 ] : 0; + sal_Int32 nEnd = aPortions[ nPos ]; + sal_Int32 nStart = nPos > 0 ? aPortions[ nPos - 1 ] : 0; // if the paragraph is not empty we need to increase the index // by one since the attribute of the character left to the @@ -1703,7 +1697,7 @@ void ImpEditEngine::ImpConvert( OUString &rConvTxt, LanguageType &rConvTxtLang, sal_Int32 nAttribEnd = -1; sal_Int32 nCurPos = -1; EPaM aCurStart = CreateEPaM( aCurSel.Min() ); - std::vector<sal_uInt16> aPortions; + std::vector<sal_Int32> aPortions; pEditEngine->GetPortions( aCurStart.nPara, aPortions ); for ( size_t nPos = 0; nPos < aPortions.size(); ++nPos ) { @@ -2066,7 +2060,7 @@ void ImpEditEngine::AddPortionIterated( pFieldAttr->GetStart() == aCursor.GetIndex() && pFieldAttr->GetStart() != pFieldAttr->GetEnd() && pFieldAttr->Which() == EE_FEATURE_FIELD; - sal_uInt16 nEndField = bIsField ? pFieldAttr->GetEnd() : USHRT_MAX; + sal_Int32 nEndField = bIsField ? pFieldAttr->GetEnd() : USHRT_MAX; bool bIsEndField = false; do { @@ -2117,7 +2111,7 @@ void ImpEditEngine::ApplyChangedSentence(EditView& rEditView, // get current paragraph length to calculate later on how the sentence length changed, // in order to place the cursor at the end of the sentence again EditSelection aOldSel( rEditView.pImpEditView->GetEditSelection() ); - xub_StrLen nOldLen = aOldSel.Max().GetNode()->Len(); + sal_Int32 nOldLen = aOldSel.Max().GetNode()->Len(); UndoActionStart( EDITUNDO_INSERT ); if(pSpellInfo->aLastSpellPortions.size() == rNewPortions.size()) @@ -2503,9 +2497,9 @@ EESpellState ImpEditEngine::StartThesaurus( EditView* pEditView ) return EE_SPELL_OK; } -sal_uInt16 ImpEditEngine::StartSearchAndReplace( EditView* pEditView, const SvxSearchItem& rSearchItem ) +sal_Int32 ImpEditEngine::StartSearchAndReplace( EditView* pEditView, const SvxSearchItem& rSearchItem ) { - sal_uInt16 nFound = 0; + sal_Int32 nFound = 0; EditSelection aCurSel( pEditView->pImpEditView->GetEditSelection() ); @@ -2699,8 +2693,8 @@ namespace { struct eeTransliterationChgData { - sal_uInt16 nStart; - xub_StrLen nLen; + sal_Int32 nStart; + sal_Int32 nLen; EditSelection aSelection; OUString aNewText; uno::Sequence< sal_Int32 > aOffsets; @@ -2738,8 +2732,8 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, const sal_Int32 nStartPos = nNode==nStartNode ? aSel.Min().GetIndex() : 0; const sal_Int32 nEndPos = nNode==nEndNode ? aSel.Max().GetIndex() : aNodeStr.getLength(); // can also be == nStart! - sal_uInt16 nCurrentStart = nStartPos; - sal_uInt16 nCurrentEnd = nEndPos; + sal_Int32 nCurrentStart = nStartPos; + sal_Int32 nCurrentEnd = nEndPos; sal_uInt16 nLanguage = LANGUAGE_SYSTEM; // since we don't use Hiragana/Katakana or half-width/full-width transliterations here @@ -2793,8 +2787,8 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, i18n::Boundary aCurWordBndry( aSttBndry ); while (aCurWordBndry.startPos <= aEndBndry.startPos) { - nCurrentStart = (xub_StrLen)aCurWordBndry.startPos; - nCurrentEnd = (xub_StrLen)aCurWordBndry.endPos; + nCurrentStart = aCurWordBndry.startPos; + nCurrentEnd = aCurWordBndry.endPos; sal_Int32 nLen = nCurrentEnd - nCurrentStart; DBG_ASSERT( nLen > 0, "invalid word length of 0" ); #if OSL_DEBUG_LEVEL > 1 @@ -2997,7 +2991,7 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, sal_Int32 nSelNode = aEditDoc.GetPos( rData.aSelection.Min().GetNode() ); ParaPortion* pParaPortion = GetParaPortions()[nSelNode]; pParaPortion->MarkSelectionInvalid( rData.nStart, - std::max< sal_uInt16 >( rData.nStart + rData.nLen, + std::max< sal_Int32 >( rData.nStart + rData.nLen, rData.nStart + rData.aNewText.getLength() ) ); } } @@ -3025,20 +3019,19 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, short ImpEditEngine::ReplaceTextOnly( ContentNode* pNode, - sal_uInt16 nCurrentStart, xub_StrLen nLen, + sal_Int32 nCurrentStart, sal_Int32 nLen, const OUString& rNewText, const uno::Sequence< sal_Int32 >& rOffsets ) { (void) nLen; // Change text without loosing the attributes - sal_uInt16 nCharsAfterTransliteration = - sal::static_int_cast< sal_uInt16 >(rOffsets.getLength()); + sal_Int32 nCharsAfterTransliteration = rOffsets.getLength(); const sal_Int32* pOffsets = rOffsets.getConstArray(); short nDiffs = 0; - for ( sal_uInt16 n = 0; n < nCharsAfterTransliteration; n++ ) + for ( sal_Int32 n = 0; n < nCharsAfterTransliteration; n++ ) { - sal_uInt16 nCurrentPos = nCurrentStart+n; + sal_Int32 nCurrentPos = nCurrentStart+n; sal_Int32 nDiff = (nCurrentPos-nDiffs) - pOffsets[n]; if ( !nDiff ) @@ -3053,7 +3046,7 @@ short ImpEditEngine::ReplaceTextOnly( pNode->SetChar( nCurrentPos, rNewText[n] ); DBG_ASSERT( (nCurrentPos+1) < pNode->Len(), "TransliterateText - String smaller than expected!" ); - GetEditDoc().RemoveChars( EditPaM( pNode, nCurrentPos+1 ), sal::static_int_cast< sal_uInt16 >(-nDiff) ); + GetEditDoc().RemoveChars( EditPaM( pNode, nCurrentPos+1 ), -nDiff); } else { diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx index 8a1cbf757537..3c6938ea92f6 100644 --- a/editeng/source/editeng/impedit5.cxx +++ b/editeng/source/editeng/impedit5.cxx @@ -391,7 +391,7 @@ SfxItemSet ImpEditEngine::GetAttribs( EditSelection aSel, sal_Bool bOnlyHardAttr } -SfxItemSet ImpEditEngine::GetAttribs( sal_Int32 nPara, sal_uInt16 nStart, sal_uInt16 nEnd, sal_uInt8 nFlags ) const +SfxItemSet ImpEditEngine::GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, sal_uInt8 nFlags ) const { // Optimized function with less Puts(), which cause unnecessary cloning from default items. // If this works, change GetAttribs( EditSelection ) to use this for each paragraph and merge the results! @@ -434,7 +434,7 @@ SfxItemSet ImpEditEngine::GetAttribs( sal_Int32 nPara, sal_uInt16 nStart, sal_uI if ( nStart == nEnd ) { - sal_uInt16 nCursorPos = nStart; + sal_Int32 nCursorPos = nStart; if ( ( rAttr.GetStart() <= nCursorPos ) && ( rAttr.GetEnd() >= nCursorPos ) ) { // To be used the attribute has to start BEFORE the position, or it must be a @@ -744,14 +744,14 @@ void ImpEditEngine::GetCharAttribs( sal_Int32 nPara, std::vector<EECharAttrib>& void ImpEditEngine::ParaAttribsToCharAttribs( ContentNode* pNode ) { pNode->GetCharAttribs().DeleteEmptyAttribs( GetEditDoc().GetItemPool() ); - xub_StrLen nEndPos = pNode->Len(); + sal_Int32 nEndPos = pNode->Len(); for ( sal_uInt16 nWhich = EE_CHAR_START; nWhich <= EE_CHAR_END; nWhich++ ) { if ( pNode->GetContentAttribs().HasItem( nWhich ) ) { const SfxPoolItem& rItem = pNode->GetContentAttribs().GetItem( nWhich ); // Fill the gap: - sal_uInt16 nLastEnd = 0; + sal_Int32 nLastEnd = 0; const EditCharAttrib* pAttr = pNode->GetCharAttribs().FindNextAttrib( nWhich, nLastEnd ); while ( pAttr ) { diff --git a/editeng/source/editeng/misspellrange.cxx b/editeng/source/editeng/misspellrange.cxx index 980a559be791..5e0cf23b70ef 100644 --- a/editeng/source/editeng/misspellrange.cxx +++ b/editeng/source/editeng/misspellrange.cxx @@ -12,9 +12,9 @@ namespace editeng { MisspellRange::MisspellRange() : mnStart(0), mnEnd(0) {} -MisspellRange::MisspellRange(size_t nStart, size_t nEnd) : mnStart(nStart), mnEnd(nEnd) {} +MisspellRange::MisspellRange(sal_Int32 nStart, sal_Int32 nEnd) : mnStart(nStart), mnEnd(nEnd) {} -MisspellRanges::MisspellRanges(size_t nParagraph, const std::vector<MisspellRange>& rRanges) : +MisspellRanges::MisspellRanges(sal_Int32 nParagraph, const std::vector<MisspellRange>& rRanges) : mnParagraph(nParagraph), maRanges(rRanges) {} } diff --git a/editeng/source/editeng/section.cxx b/editeng/source/editeng/section.cxx index 2e19d0db186c..3fc5abbd4316 100644 --- a/editeng/source/editeng/section.cxx +++ b/editeng/source/editeng/section.cxx @@ -13,7 +13,7 @@ namespace editeng { Section::Section() : mnParagraph(0), mnStart(0), mnEnd(0) {} -Section::Section(size_t nPara, size_t nStart, size_t nEnd) : +Section::Section(sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd) : mnParagraph(nPara), mnStart(nStart), mnEnd(nEnd){} } diff --git a/editeng/source/editeng/textconv.cxx b/editeng/source/editeng/textconv.cxx index a204bfc32a36..515f1fe65821 100644 --- a/editeng/source/editeng/textconv.cxx +++ b/editeng/source/editeng/textconv.cxx @@ -287,8 +287,8 @@ void TextConvWrapper::SelectNewUnit_impl( ESelection aSelection = m_pEditView->GetSelection(); DBG_ASSERT( aSelection.nStartPara == aSelection.nEndPara, "paragraph mismatch in selection" ); - aSelection.nStartPos = (sal_uInt16) (m_nLastPos + m_nUnitOffset + nUnitStart); - aSelection.nEndPos = (sal_uInt16) (m_nLastPos + m_nUnitOffset + nUnitEnd); + aSelection.nStartPos = (m_nLastPos + m_nUnitOffset + nUnitStart); + aSelection.nEndPos = (m_nLastPos + m_nUnitOffset + nUnitEnd); m_pEditView->SetSelection( aSelection ); } @@ -370,8 +370,7 @@ void TextConvWrapper::ReplaceUnit( default: OSL_FAIL( "unexpected case" ); } - m_nUnitOffset = sal::static_int_cast< sal_uInt16 >( - m_nUnitOffset + nUnitStart + aNewTxt.getLength()); + m_nUnitOffset = m_nUnitOffset + nUnitStart + aNewTxt.getLength(); // remember current original language for kater use ImpEditEngine *pImpEditEng = m_pEditView->GetImpEditEngine(); @@ -401,8 +400,7 @@ void TextConvWrapper::ReplaceUnit( ESelection aOldSel = m_pEditView->GetSelection(); ESelection aNewSel( aOldSel ); - aNewSel.nStartPos = sal::static_int_cast< xub_StrLen >( - aNewSel.nStartPos - aNewTxt.getLength()); + aNewSel.nStartPos = aNewSel.nStartPos - aNewTxt.getLength(); if (pNewUnitLanguage) { @@ -423,14 +421,12 @@ void TextConvWrapper::ReplaceUnit( { // Note: replacement is always done in the current paragraph // which is the one ConvContinue points to - pConvInfo->aConvContinue.nIndex = sal::static_int_cast< sal_uInt16 >( - pConvInfo->aConvContinue.nIndex + nDelta); + pConvInfo->aConvContinue.nIndex = pConvInfo->aConvContinue.nIndex + nDelta; // if that is the same as the one where the conversions ends // the end needs to be updated also if (pConvInfo->aConvTo.nPara == pConvInfo->aConvContinue.nPara) - pConvInfo->aConvTo.nIndex = sal::static_int_cast< sal_uInt16 >( - pConvInfo->aConvTo.nIndex + nDelta); + pConvInfo->aConvTo.nIndex = pConvInfo->aConvTo.nIndex + nDelta; } } diff --git a/editeng/source/outliner/outleeng.cxx b/editeng/source/outliner/outleeng.cxx index 2b66d3bb96f9..20d783858d64 100644 --- a/editeng/source/outliner/outleeng.cxx +++ b/editeng/source/outliner/outleeng.cxx @@ -146,8 +146,8 @@ OUString OutlinerEditEng::GetUndoComment( sal_uInt16 nUndoId ) const } } -void OutlinerEditEng::DrawingText( const Point& rStartPos, const OUString& rText, sal_uInt16 nTextStart, sal_uInt16 nTextLen, - const sal_Int32* pDXArray, const SvxFont& rFont, sal_Int32 nPara, sal_uInt16 nIndex, sal_uInt8 nRightToLeft, +void OutlinerEditEng::DrawingText( const Point& rStartPos, const OUString& rText, sal_Int32 nTextStart, sal_Int32 nTextLen, + const sal_Int32* pDXArray, const SvxFont& rFont, sal_Int32 nPara, sal_Int32 nIndex, sal_uInt8 nRightToLeft, const EEngineData::WrongSpellVector* pWrongSpellVector, const SvxFieldData* pFieldData, bool bEndOfLine, @@ -162,7 +162,7 @@ void OutlinerEditEng::DrawingText( const Point& rStartPos, const OUString& rText } void OutlinerEditEng::DrawingTab( const Point& rStartPos, long nWidth, const OUString& rChar, - const SvxFont& rFont, sal_Int32 nPara, xub_StrLen nIndex, sal_uInt8 nRightToLeft, + const SvxFont& rFont, sal_Int32 nPara, sal_Int32 nIndex, sal_uInt8 nRightToLeft, bool bEndOfLine, bool bEndOfParagraph, const Color& rOverlineColor, const Color& rTextLineColor) { @@ -170,18 +170,18 @@ void OutlinerEditEng::DrawingTab( const Point& rStartPos, long nWidth, const OUS bEndOfLine, bEndOfParagraph, rOverlineColor, rTextLineColor ); } -void OutlinerEditEng::FieldClicked( const SvxFieldItem& rField, sal_Int32 nPara, sal_uInt16 nPos ) +void OutlinerEditEng::FieldClicked( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos ) { EditEngine::FieldClicked( rField, nPara, nPos ); // If URL pOwner->FieldClicked( rField, nPara, nPos ); } -void OutlinerEditEng::FieldSelected( const SvxFieldItem& rField, sal_Int32 nPara, sal_uInt16 nPos ) +void OutlinerEditEng::FieldSelected( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos ) { pOwner->FieldSelected( rField, nPara, nPos ); } -OUString OutlinerEditEng::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor ) +OUString OutlinerEditEng::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, Color*& rpTxtColor, Color*& rpFldColor ) { return pOwner->CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor ); } diff --git a/editeng/source/outliner/outleeng.hxx b/editeng/source/outliner/outleeng.hxx index 935b355ff7ce..cc1925f9c2d3 100644 --- a/editeng/source/outliner/outleeng.hxx +++ b/editeng/source/outliner/outleeng.hxx @@ -45,8 +45,8 @@ public: virtual void ParagraphConnected( sal_Int32 nLeftParagraph, sal_Int32 nRightParagraph ); virtual void DrawingText( - const Point& rStartPos, const OUString& rText, sal_uInt16 nTextStart, sal_uInt16 nTextLen, const sal_Int32* pDXArray, const SvxFont& rFont, - sal_Int32 nPara, sal_uInt16 nIndex, sal_uInt8 nRightToLeft, + const Point& rStartPos, const OUString& rText, sal_Int32 nTextStart, sal_Int32 nTextLen, const sal_Int32* pDXArray, const SvxFont& rFont, + sal_Int32 nPara, sal_Int32 nIndex, sal_uInt8 nRightToLeft, const EEngineData::WrongSpellVector* pWrongSpellVector, const SvxFieldData* pFieldData, bool bEndOfLine, @@ -58,7 +58,7 @@ public: virtual void DrawingTab( const Point& rStartPos, long nWidth, const OUString& rChar, - const SvxFont& rFont, sal_Int32 nPara, xub_StrLen nIndex, sal_uInt8 nRightToLeft, + const SvxFont& rFont, sal_Int32 nPara, sal_Int32 nIndex, sal_uInt8 nRightToLeft, bool bEndOfLine, bool bEndOfParagraph, const Color& rOverlineColor, @@ -72,9 +72,9 @@ public: // for text conversion virtual sal_Bool ConvertNextDocument(); - virtual void FieldClicked( const SvxFieldItem& rField, sal_Int32 nPara, sal_uInt16 nPos ); - virtual void FieldSelected( const SvxFieldItem& rField, sal_Int32 nPara, sal_uInt16 nPos ); - virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_uInt16 nPos, Color*& rTxtColor, Color*& rFldColor ); + virtual void FieldClicked( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos ); + virtual void FieldSelected( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos ); + virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, Color*& rTxtColor, Color*& rFldColor ); virtual Rectangle GetBulletArea( sal_Int32 nPara ); diff --git a/editeng/source/outliner/outlin2.cxx b/editeng/source/outliner/outlin2.cxx index c1a0b3c517cb..902df8d7ae25 100644 --- a/editeng/source/outliner/outlin2.cxx +++ b/editeng/source/outliner/outlin2.cxx @@ -169,7 +169,7 @@ OUString Outliner::GetWordDelimiters() const return pEditEngine->GetWordDelimiters(); } -OUString Outliner::GetWord( sal_Int32 nPara, sal_uInt16 nIndex ) +OUString Outliner::GetWord( sal_Int32 nPara, sal_Int32 nIndex ) { return pEditEngine->GetWord( nPara, nIndex ); } @@ -324,12 +324,12 @@ sal_uLong Outliner::GetLineCount( sal_Int32 nParagraph ) const return pEditEngine->GetLineCount( nParagraph ); } -sal_uInt16 Outliner::GetLineLen( sal_Int32 nParagraph, sal_uInt16 nLine ) const +sal_Int32 Outliner::GetLineLen( sal_Int32 nParagraph, sal_Int32 nLine ) const { return pEditEngine->GetLineLen( nParagraph, nLine ); } -sal_uLong Outliner::GetLineHeight( sal_Int32 nParagraph, sal_uInt16 nLine ) +sal_uLong Outliner::GetLineHeight( sal_Int32 nParagraph, sal_Int32 nLine ) { return pEditEngine->GetLineHeight( nParagraph, nLine ); } @@ -552,7 +552,7 @@ sal_uInt16 Outliner::GetScriptType( const ESelection& rSelection ) const return pEditEngine->GetScriptType( rSelection ); } -LanguageType Outliner::GetLanguage( sal_Int32 nPara, sal_uInt16 nPos ) const +LanguageType Outliner::GetLanguage( sal_Int32 nPara, sal_Int32 nPos ) const { return pEditEngine->GetLanguage( nPara, nPos ); } diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx index cf1c31a61991..1aaeb248b123 100644 --- a/editeng/source/outliner/outliner.cxx +++ b/editeng/source/outliner/outliner.cxx @@ -435,8 +435,8 @@ void Outliner::SetText( const OUString& rText, Paragraph* pPara ) if (aText.endsWith("\x0A")) aText = aText.copy(0, aText.getLength()-1); // Delete the last break - sal_uInt16 nCount = comphelper::string::getTokenCount(aText, '\x0A'); - sal_uInt16 nPos = 0; + sal_Int32 nCount = comphelper::string::getTokenCount(aText, '\x0A'); + sal_Int32 nPos = 0; sal_Int32 nInsPos = nPara+1; while( nCount > nPos ) { @@ -502,7 +502,7 @@ bool Outliner::ImpConvertEdtToOut( sal_Int32 nPara,EditView* pView) { bool bConverted = false; - sal_uInt16 nTabs = 0; + sal_Int32 nTabs = 0; ESelection aDelSel; OUString aName; @@ -512,8 +512,8 @@ bool Outliner::ImpConvertEdtToOut( sal_Int32 nPara,EditView* pView) OUString aStr( pEditEngine->GetText( nPara ) ); const sal_Unicode* pPtr = aStr.getStr(); - sal_uInt16 nHeadingNumberStart = 0; - sal_uInt16 nNumberingNumberStart = 0; + sal_Int32 nHeadingNumberStart = 0; + sal_Int32 nNumberingNumberStart = 0; SfxStyleSheet* pStyle= pEditEngine->GetStyleSheet( nPara ); if( pStyle ) { @@ -535,7 +535,7 @@ bool Outliner::ImpConvertEdtToOut( sal_Int32 nPara,EditView* pView) aDelSel = ESelection( nPara, 0, nPara, 2 ); } - sal_uInt16 nPos = nHeadingNumberStart ? nHeadingNumberStart : nNumberingNumberStart; + sal_Int32 nPos = nHeadingNumberStart ? nHeadingNumberStart : nNumberingNumberStart; OUString aLevel = comphelper::string::stripStart(aName.copy(nPos), ' '); nTabs = sal::static_int_cast< sal_uInt16 >(aLevel.toInt32()); if( nTabs ) @@ -649,7 +649,7 @@ void Outliner::AddText( const OutlinerParaObject& rPObj ) pEditEngine->SetUpdateMode( bUpdate ); } -void Outliner::FieldClicked( const SvxFieldItem& rField, sal_Int32 nPara, sal_uInt16 nPos ) +void Outliner::FieldClicked( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos ) { if ( aFieldClickedHdl.IsSet() ) @@ -661,7 +661,7 @@ void Outliner::FieldClicked( const SvxFieldItem& rField, sal_Int32 nPara, sal_uI } -void Outliner::FieldSelected( const SvxFieldItem& rField, sal_Int32 nPara, sal_uInt16 nPos ) +void Outliner::FieldSelected( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos ) { if ( !aFieldClickedHdl.IsSet() ) return; @@ -672,7 +672,7 @@ void Outliner::FieldSelected( const SvxFieldItem& rField, sal_Int32 nPara, sal_u } -OUString Outliner::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor ) +OUString Outliner::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, Color*& rpTxtColor, Color*& rpFldColor ) { if ( !aCalcFieldValueHdl.IsSet() ) return OUString( ' ' ); @@ -1018,7 +1018,7 @@ void Outliner::PaintBullet( sal_Int32 nPara, const Point& rStartPos, } DrawingText(aTextPos, pPara->GetText(), 0, pPara->GetText().getLength(), pBuf, - aSvxFont, nPara, 0xFFFF, bRightToLeftPara, 0, 0, false, false, true, 0, Color(), Color()); + aSvxFont, nPara, -1, bRightToLeftPara, 0, 0, false, false, true, 0, Color(), Color()); delete[] pBuf; } @@ -1743,8 +1743,8 @@ void Outliner::StripPortions() bStrippingPortions = sal_False; } -void Outliner::DrawingText( const Point& rStartPos, const OUString& rText, sal_uInt16 nTextStart, sal_uInt16 nTextLen, const sal_Int32* pDXArray,const SvxFont& rFont, - sal_Int32 nPara, sal_uInt16 nIndex, sal_uInt8 nRightToLeft, +void Outliner::DrawingText( const Point& rStartPos, const OUString& rText, sal_Int32 nTextStart, sal_Int32 nTextLen, const sal_Int32* pDXArray,const SvxFont& rFont, + sal_Int32 nPara, sal_Int32 nIndex, sal_uInt8 nRightToLeft, const EEngineData::WrongSpellVector* pWrongSpellVector, const SvxFieldData* pFieldData, bool bEndOfLine, @@ -1765,7 +1765,7 @@ void Outliner::DrawingText( const Point& rStartPos, const OUString& rText, sal_u } void Outliner::DrawingTab( const Point& rStartPos, long nWidth, const OUString& rChar, const SvxFont& rFont, - sal_Int32 nPara, xub_StrLen nIndex, sal_uInt8 nRightToLeft, bool bEndOfLine, bool bEndOfParagraph, + sal_Int32 nPara, sal_Int32 nIndex, sal_uInt8 nRightToLeft, bool bEndOfLine, bool bEndOfParagraph, const Color& rOverlineColor, const Color& rTextLineColor) { if(aDrawPortionHdl.IsSet()) diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index ef7773110ead..6defd3278592 100644 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -374,15 +374,15 @@ sal_Int32 OutlinerView::Select( Paragraph* pParagraph, sal_Bool bSelect, sal_Bool bWithChildren ) { sal_Int32 nPara = pOwner->pParaList->GetAbsPos( pParagraph ); - sal_uInt16 nEnd = 0; + sal_Int32 nEnd = 0; if ( bSelect ) - nEnd = 0xffff; + nEnd = SAL_MAX_INT32; sal_Int32 nChildCount = 0; if ( bWithChildren ) nChildCount = pOwner->pParaList->GetChildCount( pParagraph ); - ESelection aSel( nPara, 0,nPara+nChildCount, nEnd ); + ESelection aSel( nPara, 0, nPara + nChildCount, nEnd ); pEditView->SetSelection( aSel ); return nChildCount+1; } @@ -1287,7 +1287,7 @@ void OutlinerView::StartTextConversion( } -sal_uInt16 OutlinerView::StartSearchAndReplace( const SvxSearchItem& rSearchItem ) +sal_Int32 OutlinerView::StartSearchAndReplace( const SvxSearchItem& rSearchItem ) { return pEditView->StartSearchAndReplace( rSearchItem ); } diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx index cdd6fe81b51e..44c16eee3cc3 100644 --- a/editeng/source/rtf/svxrtf.cxx +++ b/editeng/source/rtf/svxrtf.cxx @@ -1252,7 +1252,7 @@ void SvxRTFItemStackType::Compress( const SvxRTFParser& rParser ) return; SvxNodeIdx* pLastNd = pTmp->pEndNd; - xub_StrLen nLastCnt = pTmp->nEndCnt; + sal_Int32 nLastCnt = pTmp->nEndCnt; SfxItemSet aMrgSet( pTmp->aAttrSet ); for( n = 1; n < pChildList->size(); ++n ) diff --git a/editeng/source/uno/unoedhlp.cxx b/editeng/source/uno/unoedhlp.cxx index cccb8091b28e..da17745587c7 100644 --- a/editeng/source/uno/unoedhlp.cxx +++ b/editeng/source/uno/unoedhlp.cxx @@ -108,7 +108,7 @@ SAL_WNODEPRECATED_DECLARATIONS_PUSH } SAL_WNODEPRECATED_DECLARATIONS_POP -sal_Bool SvxEditSourceHelper::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, const EditEngine& rEE, sal_Int32 nPara, sal_uInt16 nIndex, sal_Bool bInCell ) +sal_Bool SvxEditSourceHelper::GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nEndIndex, const EditEngine& rEE, sal_Int32 nPara, sal_Int32 nIndex, sal_Bool bInCell ) { // IA2 CWS introduced bInCell, but also did many other changes here. // Need to verify implementation with AT (IA2 and ATK) @@ -120,8 +120,8 @@ sal_Bool SvxEditSourceHelper::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt if (!aTempCharAttribs.empty()) { - sal_uInt32 nIndex2 = 0; - sal_uInt32 nParaLen = rEE.GetTextLen(nPara); + sal_Int32 nIndex2 = 0; + sal_Int32 nParaLen = rEE.GetTextLen(nPara); for (size_t nAttr = 0; nAttr < aTempCharAttribs.size(); ++nAttr) { if (nIndex2 < aTempCharAttribs[nAttr].nStart) @@ -143,7 +143,7 @@ sal_Bool SvxEditSourceHelper::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt } } // find closest index in front of nIndex - sal_uInt16 nCurrIndex; + sal_Int32 nCurrIndex; sal_Int32 nClosestStartIndex_s = 0, nClosestStartIndex_e = 0; for(std::vector<EECharAttrib>::iterator i = aCharAttribs.begin(); i < aCharAttribs.end(); ++i) { @@ -184,29 +184,29 @@ sal_Bool SvxEditSourceHelper::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt } sal_Int32 nClosestEndIndex = nClosestEndIndex_s < nClosestEndIndex_e ? nClosestEndIndex_s : nClosestEndIndex_e; - nStartIndex = static_cast<sal_uInt16>( nClosestStartIndex ); - nEndIndex = static_cast<sal_uInt16>( nClosestEndIndex ); + nStartIndex = nClosestStartIndex; + nEndIndex = nClosestEndIndex; if ( bInCell ) { EPosition aStartPos( nPara, nStartIndex ), aEndPos( nPara, nEndIndex ); - sal_uInt32 nParaCount = rEE.GetParagraphCount(); - sal_uInt32 nCrrntParaLen = rEE.GetTextLen(nPara); + sal_Int32 nParaCount = rEE.GetParagraphCount(); + sal_Int32 nCrrntParaLen = rEE.GetTextLen(nPara); //need to find closest index in front of nIndex in the previous paragraphs if ( aStartPos.nIndex == 0 ) { SfxItemSet aCrrntSet = rEE.GetAttribs( nPara, 0, 1, GETATTRIBS_CHARATTRIBS ); for ( sal_Int32 nParaIdx = nPara-1; nParaIdx >= 0; nParaIdx-- ) { - sal_uInt32 nLen = rEE.GetTextLen( sal_uInt16(nParaIdx) ); + sal_uInt32 nLen = rEE.GetTextLen(nParaIdx); if ( nLen ) { - sal_uInt16 nStartIdx, nEndIdx; - GetAttributeRun( nStartIdx, nEndIdx, rEE, sal_uInt16(nParaIdx), sal_uInt16(nLen), sal_False ); - SfxItemSet aSet = rEE.GetAttribs( sal_uInt16(nParaIdx), sal_uInt16(nLen-1), sal_uInt16(nLen), GETATTRIBS_CHARATTRIBS ); + sal_Int32 nStartIdx, nEndIdx; + GetAttributeRun( nStartIdx, nEndIdx, rEE, nParaIdx, nLen, sal_False ); + SfxItemSet aSet = rEE.GetAttribs( nParaIdx, nLen-1, nLen, GETATTRIBS_CHARATTRIBS ); if ( aSet == aCrrntSet ) { - aStartPos.nPara = sal_uInt16(nParaIdx); + aStartPos.nPara = nParaIdx; aStartPos.nIndex = nStartIdx; if ( aStartPos.nIndex != 0 ) { @@ -219,18 +219,18 @@ sal_Bool SvxEditSourceHelper::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt //need find closest index behind nIndex in the following paragrphs if ( aEndPos.nIndex == nCrrntParaLen ) { - SfxItemSet aCrrntSet = rEE.GetAttribs( nPara, sal_uInt16(nCrrntParaLen-1), sal_uInt16(nCrrntParaLen), GETATTRIBS_CHARATTRIBS ); - for ( sal_uInt32 nParaIdx = nPara+1; nParaIdx < nParaCount; nParaIdx++ ) + SfxItemSet aCrrntSet = rEE.GetAttribs( nPara, nCrrntParaLen-1, nCrrntParaLen, GETATTRIBS_CHARATTRIBS ); + for ( sal_Int32 nParaIdx = nPara+1; nParaIdx < nParaCount; nParaIdx++ ) { - sal_uInt32 nLen = rEE.GetTextLen( sal_uInt16(nParaIdx) ); + sal_Int32 nLen = rEE.GetTextLen( nParaIdx ); if ( nLen ) { - sal_uInt16 nStartIdx, nEndIdx; - GetAttributeRun( nStartIdx, nEndIdx, rEE, sal_uInt16(nParaIdx), 0, sal_False ); - SfxItemSet aSet = rEE.GetAttribs( sal_uInt16(nParaIdx), 0, 1, GETATTRIBS_CHARATTRIBS ); + sal_Int32 nStartIdx, nEndIdx; + GetAttributeRun( nStartIdx, nEndIdx, rEE, nParaIdx, 0, sal_False ); + SfxItemSet aSet = rEE.GetAttribs( nParaIdx, 0, 1, GETATTRIBS_CHARATTRIBS ); if ( aSet == aCrrntSet ) { - aEndPos.nPara = sal_uInt16(nParaIdx); + aEndPos.nPara = nParaIdx; aEndPos.nIndex = nEndIdx; if ( aEndPos.nIndex != nLen ) { @@ -243,7 +243,7 @@ sal_Bool SvxEditSourceHelper::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt nStartIndex = 0; if ( aStartPos.nPara > 0 ) { - for ( sal_uInt16 i = 0; i < aStartPos.nPara; i++ ) + for ( sal_Int32 i = 0; i < aStartPos.nPara; i++ ) { nStartIndex += rEE.GetTextLen(i)+1; } @@ -252,7 +252,7 @@ sal_Bool SvxEditSourceHelper::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt nEndIndex = 0; if ( aEndPos.nPara > 0 ) { - for ( sal_uInt16 i = 0; i < aEndPos.nPara; i++ ) + for ( sal_Int32 i = 0; i < aEndPos.nPara; i++ ) { nEndIndex += rEE.GetTextLen(i)+1; } diff --git a/editeng/source/uno/unoedprx.cxx b/editeng/source/uno/unoedprx.cxx index 109e91fcc1d6..eea376645e8f 100644 --- a/editeng/source/uno/unoedprx.cxx +++ b/editeng/source/uno/unoedprx.cxx @@ -187,7 +187,7 @@ void SvxAccessibleTextIndex::SetEEIndex( sal_uInt16 nEEIndex, const SvxTextForwa mnEEIndex = nEEIndex; // calculate unknowns - sal_uInt16 nCurrField, nFieldCount = rTF.GetFieldCount( GetParagraph() ); + sal_Int32 nCurrField, nFieldCount = rTF.GetFieldCount( GetParagraph() ); mnIndex = nEEIndex; @@ -233,7 +233,7 @@ void SvxAccessibleTextIndex::SetIndex( sal_Int32 nIndex, const SvxTextForwarder& mnIndex = nIndex; // calculate unknowns - sal_uInt16 nCurrField, nFieldCount = rTF.GetFieldCount( GetParagraph() ); + sal_Int32 nCurrField, nFieldCount = rTF.GetFieldCount( GetParagraph() ); DBG_ASSERT(nIndex >= 0 && nIndex <= USHRT_MAX, "SvxAccessibleTextIndex::SetIndex: index value overflow"); @@ -445,14 +445,14 @@ sal_Int32 SvxAccessibleTextAdapter::GetParagraphCount() const return mrTextForwarder->GetParagraphCount(); } -sal_uInt16 SvxAccessibleTextAdapter::GetTextLen( sal_Int32 nParagraph ) const +sal_Int32 SvxAccessibleTextAdapter::GetTextLen( sal_Int32 nParagraph ) const { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); SvxAccessibleTextIndex aIndex; aIndex.SetEEIndex( nParagraph, mrTextForwarder->GetTextLen( nParagraph ), *this ); - return static_cast< sal_uInt16 >(aIndex.GetIndex()); + return aIndex.GetIndex(); } OUString SvxAccessibleTextAdapter::GetText( const ESelection& rSel ) const @@ -557,7 +557,7 @@ void SvxAccessibleTextAdapter::RemoveAttribs( const ESelection& , sal_Bool , sal DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); } -void SvxAccessibleTextAdapter::GetPortions( sal_Int32 nPara, std::vector<sal_uInt16>& rList ) const +void SvxAccessibleTextAdapter::GetPortions( sal_Int32 nPara, std::vector<sal_Int32>& rList ) const { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); @@ -647,14 +647,14 @@ SfxItemPool* SvxAccessibleTextAdapter::GetPool() const return mrTextForwarder->GetPool(); } -OUString SvxAccessibleTextAdapter::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor ) +OUString SvxAccessibleTextAdapter::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, Color*& rpTxtColor, Color*& rpFldColor ) { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); return mrTextForwarder->CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor ); } -void SvxAccessibleTextAdapter::FieldClicked( const SvxFieldItem& rField, sal_Int32 nPara, xub_StrLen nPos ) +void SvxAccessibleTextAdapter::FieldClicked( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos ) { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); @@ -682,7 +682,7 @@ sal_Bool SvxAccessibleTextAdapter::IsValid() const return sal_False; } -LanguageType SvxAccessibleTextAdapter::GetLanguage( sal_Int32 nPara, sal_uInt16 nPos ) const +LanguageType SvxAccessibleTextAdapter::GetLanguage( sal_Int32 nPara, sal_Int32 nPos ) const { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); @@ -693,7 +693,7 @@ LanguageType SvxAccessibleTextAdapter::GetLanguage( sal_Int32 nPara, sal_uInt16 return mrTextForwarder->GetLanguage( nPara, aIndex.GetEEIndex() ); } -sal_uInt16 SvxAccessibleTextAdapter::GetFieldCount( sal_Int32 nPara ) const +sal_Int32 SvxAccessibleTextAdapter::GetFieldCount( sal_Int32 nPara ) const { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); @@ -724,7 +724,7 @@ sal_Bool SvxAccessibleTextAdapter::GetUpdateModeForAcc( ) const return mrTextForwarder->GetUpdateModeForAcc(); } -Rectangle SvxAccessibleTextAdapter::GetCharBounds( sal_Int32 nPara, sal_uInt16 nIndex ) const +Rectangle SvxAccessibleTextAdapter::GetCharBounds( sal_Int32 nPara, sal_Int32 nIndex ) const { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); @@ -733,7 +733,7 @@ Rectangle SvxAccessibleTextAdapter::GetCharBounds( sal_Int32 nPara, sal_uInt16 n // preset if anything goes wrong below // n-th char in GetParagraphIndex's paragraph - Rectangle aRect = mrTextForwarder->GetCharBounds( nPara, static_cast< sal_uInt16 >( aIndex.GetEEIndex() ) ); + Rectangle aRect = mrTextForwarder->GetCharBounds( nPara, aIndex.GetEEIndex() ); if( aIndex.InBullet() ) { @@ -771,7 +771,7 @@ Rectangle SvxAccessibleTextAdapter::GetCharBounds( sal_Int32 nPara, sal_uInt16 n aFont, mrTextForwarder->GetText( aSel ) ); - Rectangle aStartRect = mrTextForwarder->GetCharBounds( nPara, static_cast< sal_uInt16 >( aIndex.GetEEIndex() ) ); + Rectangle aStartRect = mrTextForwarder->GetCharBounds( nPara, aIndex.GetEEIndex() ); if( !aStringWrap.GetCharacterBounds( aIndex.GetFieldOffset(), aRect ) ) aRect = aStartRect; @@ -819,7 +819,7 @@ OutputDevice* SvxAccessibleTextAdapter::GetRefDevice() const return mrTextForwarder->GetRefDevice(); } -sal_Bool SvxAccessibleTextAdapter::GetIndexAtPoint( const Point& rPoint, sal_Int32& nPara, sal_uInt16& nIndex ) const +sal_Bool SvxAccessibleTextAdapter::GetIndexAtPoint( const Point& rPoint, sal_Int32& nPara, sal_Int32& nIndex ) const { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); @@ -832,7 +832,7 @@ sal_Bool SvxAccessibleTextAdapter::GetIndexAtPoint( const Point& rPoint, sal_Int DBG_ASSERT(aIndex.GetIndex() >= 0 && aIndex.GetIndex() <= USHRT_MAX, "SvxAccessibleTextIndex::SetIndex: index value overflow"); - nIndex = static_cast< sal_uInt16 > (aIndex.GetIndex()); + nIndex = aIndex.GetIndex(); EBulletInfo aBulletInfo = GetBulletInfo( nPara ); @@ -859,7 +859,7 @@ sal_Bool SvxAccessibleTextAdapter::GetIndexAtPoint( const Point& rPoint, sal_Int aStringWrap.GetIndexAtPoint( aPoint ) <= USHRT_MAX, "SvxAccessibleTextIndex::SetIndex: index value overflow"); - nIndex = static_cast< sal_uInt16 > (aStringWrap.GetIndexAtPoint( aPoint )); + nIndex = aStringWrap.GetIndexAtPoint( aPoint ); return sal_True; } } @@ -887,14 +887,14 @@ sal_Bool SvxAccessibleTextAdapter::GetIndexAtPoint( const Point& rPoint, sal_Int aIndex.GetIndex() + aStringWrap.GetIndexAtPoint( rPoint ) <= USHRT_MAX, "SvxAccessibleTextIndex::SetIndex: index value overflow"); - nIndex = static_cast< sal_uInt16 >(aIndex.GetIndex() + aStringWrap.GetIndexAtPoint( aPoint )); + nIndex = (aIndex.GetIndex() + aStringWrap.GetIndexAtPoint( aPoint )); return sal_True; } return sal_True; } -sal_Bool SvxAccessibleTextAdapter::GetWordIndices( sal_Int32 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const +sal_Bool SvxAccessibleTextAdapter::GetWordIndices( sal_Int32 nPara, sal_Int32 nIndex, sal_Int32& nStart, sal_Int32& nEnd ) const { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); @@ -910,7 +910,7 @@ sal_Bool SvxAccessibleTextAdapter::GetWordIndices( sal_Int32 nPara, sal_uInt16 n // always treat bullet as separate word nStart = 0; - nEnd = static_cast< sal_uInt16 > (aIndex.GetBulletLen()); + nEnd = aIndex.GetBulletLen(); return sal_True; } @@ -925,8 +925,8 @@ sal_Bool SvxAccessibleTextAdapter::GetWordIndices( sal_Int32 nPara, sal_uInt16 n // always treat field as separate word // TODO: to circumvent this, _we_ would have to do the break iterator stuff! - nStart = static_cast< sal_uInt16 > (aIndex.GetIndex() - aIndex.GetFieldOffset()); - nEnd = static_cast< sal_uInt16 > (nStart + aIndex.GetFieldLen()); + nStart = aIndex.GetIndex() - aIndex.GetFieldOffset(); + nEnd = nStart + aIndex.GetFieldLen(); return sal_True; } @@ -938,18 +938,18 @@ sal_Bool SvxAccessibleTextAdapter::GetWordIndices( sal_Int32 nPara, sal_uInt16 n DBG_ASSERT(aIndex.GetIndex() >= 0 && aIndex.GetIndex() <= USHRT_MAX, "SvxAccessibleTextIndex::SetIndex: index value overflow"); - nStart = static_cast< sal_uInt16 > (aIndex.GetIndex()); + nStart = aIndex.GetIndex(); aIndex.SetEEIndex( nPara, nEnd, *this ); DBG_ASSERT(aIndex.GetIndex() >= 0 && aIndex.GetIndex() <= USHRT_MAX, "SvxAccessibleTextIndex::SetIndex: index value overflow"); - nEnd = static_cast< sal_uInt16 > (aIndex.GetIndex()); + nEnd = aIndex.GetIndex(); return sal_True; } -sal_Bool SvxAccessibleTextAdapter::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_Int32 nPara, sal_uInt16 nIndex, sal_Bool /* bInCell */ ) const +sal_Bool SvxAccessibleTextAdapter::GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nEndIndex, sal_Int32 nPara, sal_Int32 nIndex, sal_Bool /* bInCell */ ) const { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); @@ -965,7 +965,7 @@ sal_Bool SvxAccessibleTextAdapter::GetAttributeRun( sal_uInt16& nStartIndex, sal // always treat bullet as distinct attribute nStartIndex = 0; - nEndIndex = static_cast< sal_uInt16 > (aIndex.GetBulletLen()); + nEndIndex = aIndex.GetBulletLen(); return sal_True; } @@ -977,8 +977,8 @@ sal_Bool SvxAccessibleTextAdapter::GetAttributeRun( sal_uInt16& nStartIndex, sal "SvxAccessibleTextIndex::SetIndex: index value overflow"); // always treat field as distinct attribute - nStartIndex = static_cast< sal_uInt16 > (aIndex.GetIndex() - aIndex.GetFieldOffset()); - nEndIndex = static_cast< sal_uInt16 > (nStartIndex + aIndex.GetFieldLen()); + nStartIndex = aIndex.GetIndex() - aIndex.GetFieldOffset(); + nEndIndex = nStartIndex + aIndex.GetFieldLen(); return sal_True; } @@ -990,32 +990,32 @@ sal_Bool SvxAccessibleTextAdapter::GetAttributeRun( sal_uInt16& nStartIndex, sal DBG_ASSERT(aIndex.GetIndex() >= 0 && aIndex.GetIndex() <= USHRT_MAX, "SvxAccessibleTextIndex::SetIndex: index value overflow"); - nStartIndex = static_cast< sal_uInt16 > (aIndex.GetIndex()); + nStartIndex = aIndex.GetIndex(); aIndex.SetEEIndex( nPara, nEndIndex, *this ); DBG_ASSERT(aIndex.GetIndex() >= 0 && aIndex.GetIndex() <= USHRT_MAX, "SvxAccessibleTextIndex::SetIndex: index value overflow"); - nEndIndex = static_cast< sal_uInt16 > (aIndex.GetIndex()); + nEndIndex = aIndex.GetIndex(); return sal_True; } -sal_uInt16 SvxAccessibleTextAdapter::GetLineCount( sal_Int32 nPara ) const +sal_Int32 SvxAccessibleTextAdapter::GetLineCount( sal_Int32 nPara ) const { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); return mrTextForwarder->GetLineCount( nPara ); } -sal_uInt16 SvxAccessibleTextAdapter::GetLineLen( sal_Int32 nPara, sal_uInt16 nLine ) const +sal_Int32 SvxAccessibleTextAdapter::GetLineLen( sal_Int32 nPara, sal_Int32 nLine ) const { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); SvxAccessibleTextIndex aStartIndex; SvxAccessibleTextIndex aEndIndex; - sal_uInt16 nCurrLine; - sal_uInt16 nCurrIndex, nLastIndex; + sal_Int32 nCurrLine; + sal_Int32 nCurrIndex, nLastIndex; for( nCurrLine=0, nCurrIndex=0, nLastIndex=0; nCurrLine<=nLine; ++nCurrLine ) { nLastIndex = nCurrIndex; @@ -1028,18 +1028,18 @@ sal_uInt16 SvxAccessibleTextAdapter::GetLineLen( sal_Int32 nPara, sal_uInt16 nLi { aStartIndex.SetEEIndex( nPara, nLastIndex, *this ); - return static_cast< sal_uInt16 >(aEndIndex.GetIndex() - aStartIndex.GetIndex()); + return aEndIndex.GetIndex() - aStartIndex.GetIndex(); } else - return static_cast< sal_uInt16 >(aEndIndex.GetIndex()); + return aEndIndex.GetIndex(); } -void SvxAccessibleTextAdapter::GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_Int32 nParagraph, sal_uInt16 nLine ) const +void SvxAccessibleTextAdapter::GetLineBoundaries( /*out*/sal_Int32 &rStart, /*out*/sal_Int32 &rEnd, sal_Int32 nParagraph, sal_Int32 nLine ) const { mrTextForwarder->GetLineBoundaries( rStart, rEnd, nParagraph, nLine ); } -sal_uInt16 SvxAccessibleTextAdapter::GetLineNumberAtIndex( sal_Int32 nPara, sal_uInt16 nIndex ) const +sal_Int32 SvxAccessibleTextAdapter::GetLineNumberAtIndex( sal_Int32 nPara, sal_Int32 nIndex ) const { return mrTextForwarder->GetLineNumberAtIndex( nPara, nIndex ); } @@ -1163,7 +1163,7 @@ void SvxAccessibleTextAdapter::AppendParagraph() OSL_FAIL( "not implemented" ); } -sal_uInt16 SvxAccessibleTextAdapter::AppendTextPortion( sal_Int32, const OUString &, const SfxItemSet & ) +sal_Int32 SvxAccessibleTextAdapter::AppendTextPortion( sal_Int32, const OUString &, const SfxItemSet & ) { OSL_FAIL( "not implemented" ); return 0; @@ -1235,8 +1235,8 @@ sal_Bool SvxAccessibleTextEditViewAdapter::GetSelection( ESelection& rSel ) cons aEndIndex.GetIndex() >= 0 && aEndIndex.GetIndex() <= USHRT_MAX, "SvxAccessibleTextEditViewAdapter::GetSelection: index value overflow"); - rSel = ESelection( aStartIndex.GetParagraph(), static_cast< sal_uInt16 > (aStartIndex.GetIndex()), - aEndIndex.GetParagraph(), static_cast< sal_uInt16 > (aEndIndex.GetIndex()) ); + rSel = ESelection( aStartIndex.GetParagraph(), aStartIndex.GetIndex(), + aEndIndex.GetParagraph(), aEndIndex.GetIndex() ); return sal_True; } diff --git a/editeng/source/uno/unofored.cxx b/editeng/source/uno/unofored.cxx index 6b5e09a700fd..6b91f88ddf23 100644 --- a/editeng/source/uno/unofored.cxx +++ b/editeng/source/uno/unofored.cxx @@ -51,7 +51,7 @@ sal_Int32 SvxEditEngineForwarder::GetParagraphCount() const return rEditEngine.GetParagraphCount(); } -sal_uInt16 SvxEditEngineForwarder::GetTextLen( sal_Int32 nParagraph ) const +sal_Int32 SvxEditEngineForwarder::GetTextLen( sal_Int32 nParagraph ) const { return rEditEngine.GetTextLen( nParagraph ); } @@ -122,7 +122,7 @@ SfxItemPool* SvxEditEngineForwarder::GetPool() const return rEditEngine.GetEmptyItemSet().GetPool(); } -void SvxEditEngineForwarder::GetPortions( sal_Int32 nPara, std::vector<sal_uInt16>& rList ) const +void SvxEditEngineForwarder::GetPortions( sal_Int32 nPara, std::vector<sal_Int32>& rList ) const { rEditEngine.GetPortions( nPara, rList ); } @@ -154,12 +154,12 @@ sal_Bool SvxEditEngineForwarder::IsValid() const return rEditEngine.GetUpdateMode(); } -OUString SvxEditEngineForwarder::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor ) +OUString SvxEditEngineForwarder::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, Color*& rpTxtColor, Color*& rpFldColor ) { return rEditEngine.CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor ); } -void SvxEditEngineForwarder::FieldClicked( const SvxFieldItem& rField, sal_Int32 nPara, xub_StrLen nPos ) +void SvxEditEngineForwarder::FieldClicked( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos ) { rEditEngine.FieldClicked( rField, nPara, nPos ); } @@ -178,11 +178,11 @@ sal_uInt16 GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& SfxItemState eParaState = SFX_ITEM_DEFAULT; // calculate start and endpos for this paragraph - sal_uInt16 nPos = 0; + sal_Int32 nPos = 0; if( rSel.nStartPara == nPara ) nPos = rSel.nStartPos; - sal_uInt16 nEndPos = rSel.nEndPos; + sal_Int32 nEndPos = rSel.nEndPos; if( rSel.nEndPara != nPara ) nEndPos = rEditEngine.GetTextLen( nPara ); @@ -192,7 +192,7 @@ sal_uInt16 GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& sal_Bool bEmpty = sal_True; // we found no item inside the selektion of this paragraph sal_Bool bGaps = sal_False; // we found items but theire gaps between them - sal_uInt16 nLastEnd = nPos; + sal_Int32 nLastEnd = nPos; const SfxPoolItem* pParaItem = NULL; @@ -268,12 +268,12 @@ sal_uInt16 SvxEditEngineForwarder::GetItemState( sal_Int32 nPara, sal_uInt16 nWh return rSet.GetItemState( nWhich ); } -LanguageType SvxEditEngineForwarder::GetLanguage( sal_Int32 nPara, sal_uInt16 nIndex ) const +LanguageType SvxEditEngineForwarder::GetLanguage( sal_Int32 nPara, sal_Int32 nIndex ) const { return rEditEngine.GetLanguage(nPara, nIndex); } -sal_uInt16 SvxEditEngineForwarder::GetFieldCount( sal_Int32 nPara ) const +sal_Int32 SvxEditEngineForwarder::GetFieldCount( sal_Int32 nPara ) const { return rEditEngine.GetFieldCount(nPara); } @@ -288,7 +288,7 @@ EBulletInfo SvxEditEngineForwarder::GetBulletInfo( sal_Int32 ) const return EBulletInfo(); } -Rectangle SvxEditEngineForwarder::GetCharBounds( sal_Int32 nPara, sal_uInt16 nIndex ) const +Rectangle SvxEditEngineForwarder::GetCharBounds( sal_Int32 nPara, sal_Int32 nIndex ) const { // #101701# // EditEngine's 'internal' methods like GetCharacterBounds() @@ -374,7 +374,7 @@ OutputDevice* SvxEditEngineForwarder::GetRefDevice() const return rEditEngine.GetRefDevice(); } -sal_Bool SvxEditEngineForwarder::GetIndexAtPoint( const Point& rPos, sal_Int32& nPara, sal_uInt16& nIndex ) const +sal_Bool SvxEditEngineForwarder::GetIndexAtPoint( const Point& rPos, sal_Int32& nPara, sal_Int32& nIndex ) const { Size aSize( rEditEngine.CalcTextWidth(), rEditEngine.GetTextHeight() ); ::std::swap( aSize.Width(), aSize.Height() ); @@ -390,7 +390,7 @@ sal_Bool SvxEditEngineForwarder::GetIndexAtPoint( const Point& rPos, sal_Int32& return sal_True; } -sal_Bool SvxEditEngineForwarder::GetWordIndices( sal_Int32 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const +sal_Bool SvxEditEngineForwarder::GetWordIndices( sal_Int32 nPara, sal_Int32 nIndex, sal_Int32& nStart, sal_Int32& nEnd ) const { ESelection aRes = rEditEngine.GetWord( ESelection(nPara, nIndex, nPara, nIndex), com::sun::star::i18n::WordType::DICTIONARY_WORD ); @@ -406,27 +406,27 @@ sal_Bool SvxEditEngineForwarder::GetWordIndices( sal_Int32 nPara, sal_uInt16 nIn return sal_False; } -sal_Bool SvxEditEngineForwarder::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_Int32 nPara, sal_uInt16 nIndex, sal_Bool bInCell ) const +sal_Bool SvxEditEngineForwarder::GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nEndIndex, sal_Int32 nPara, sal_Int32 nIndex, sal_Bool bInCell ) const { return SvxEditSourceHelper::GetAttributeRun( nStartIndex, nEndIndex, rEditEngine, nPara, nIndex, bInCell ); } -sal_uInt16 SvxEditEngineForwarder::GetLineCount( sal_Int32 nPara ) const +sal_Int32 SvxEditEngineForwarder::GetLineCount( sal_Int32 nPara ) const { return rEditEngine.GetLineCount(nPara); } -sal_uInt16 SvxEditEngineForwarder::GetLineLen( sal_Int32 nPara, sal_uInt16 nLine ) const +sal_Int32 SvxEditEngineForwarder::GetLineLen( sal_Int32 nPara, sal_Int32 nLine ) const { return rEditEngine.GetLineLen(nPara, nLine); } -void SvxEditEngineForwarder::GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_Int32 nPara, sal_uInt16 nLine ) const +void SvxEditEngineForwarder::GetLineBoundaries( /*out*/sal_Int32 &rStart, /*out*/sal_Int32 &rEnd, sal_Int32 nPara, sal_Int32 nLine ) const { rEditEngine.GetLineBoundaries(rStart, rEnd, nPara, nLine); } -sal_uInt16 SvxEditEngineForwarder::GetLineNumberAtIndex( sal_Int32 nPara, sal_uInt16 nIndex ) const +sal_Int32 SvxEditEngineForwarder::GetLineNumberAtIndex( sal_Int32 nPara, sal_Int32 nIndex ) const { return rEditEngine.GetLineNumberAtIndex(nPara, nIndex); } @@ -477,9 +477,9 @@ void SvxEditEngineForwarder::AppendParagraph() rEditEngine.InsertParagraph( rEditEngine.GetParagraphCount(), OUString() ); } -sal_uInt16 SvxEditEngineForwarder::AppendTextPortion( sal_Int32 nPara, const OUString &rText, const SfxItemSet & /*rSet*/ ) +sal_Int32 SvxEditEngineForwarder::AppendTextPortion( sal_Int32 nPara, const OUString &rText, const SfxItemSet & /*rSet*/ ) { - sal_uInt16 nLen = 0; + sal_Int32 nLen = 0; sal_Int32 nParaCount = rEditEngine.GetParagraphCount(); DBG_ASSERT( nPara < nParaCount, "paragraph index out of bounds" ); diff --git a/editeng/source/uno/unoforou.cxx b/editeng/source/uno/unoforou.cxx index d671d9e0c025..b7ddc3da8f23 100644 --- a/editeng/source/uno/unoforou.cxx +++ b/editeng/source/uno/unoforou.cxx @@ -58,7 +58,7 @@ sal_Int32 SvxOutlinerForwarder::GetParagraphCount() const return rOutliner.GetParagraphCount(); } -sal_uInt16 SvxOutlinerForwarder::GetTextLen( sal_Int32 nParagraph ) const +sal_Int32 SvxOutlinerForwarder::GetTextLen( sal_Int32 nParagraph ) const { return rOutliner.GetEditEngine().GetTextLen( nParagraph ); } @@ -190,7 +190,7 @@ SfxItemPool* SvxOutlinerForwarder::GetPool() const return rOutliner.GetEmptyItemSet().GetPool(); } -void SvxOutlinerForwarder::GetPortions( sal_Int32 nPara, std::vector<sal_uInt16>& rList ) const +void SvxOutlinerForwarder::GetPortions( sal_Int32 nPara, std::vector<sal_Int32>& rList ) const { ((EditEngine&)rOutliner.GetEditEngine()).GetPortions( nPara, rList ); } @@ -226,12 +226,12 @@ void SvxOutlinerForwarder::QuickSetAttribs( const SfxItemSet& rSet, const ESelec rOutliner.QuickSetAttribs( rSet, rSel ); } -OUString SvxOutlinerForwarder::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor ) +OUString SvxOutlinerForwarder::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, Color*& rpTxtColor, Color*& rpFldColor ) { return rOutliner.CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor ); } -void SvxOutlinerForwarder::FieldClicked( const SvxFieldItem& rField, sal_Int32 nPara, xub_StrLen nPos ) +void SvxOutlinerForwarder::FieldClicked( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos ) { rOutliner.FieldClicked( rField, nPara, nPos ); } @@ -272,12 +272,12 @@ void SvxOutlinerForwarder::flushCache() } } -LanguageType SvxOutlinerForwarder::GetLanguage( sal_Int32 nPara, sal_uInt16 nIndex ) const +LanguageType SvxOutlinerForwarder::GetLanguage( sal_Int32 nPara, sal_Int32 nIndex ) const { return rOutliner.GetLanguage(nPara, nIndex); } -sal_uInt16 SvxOutlinerForwarder::GetFieldCount( sal_Int32 nPara ) const +sal_Int32 SvxOutlinerForwarder::GetFieldCount( sal_Int32 nPara ) const { return rOutliner.GetEditEngine().GetFieldCount(nPara); } @@ -292,7 +292,7 @@ EBulletInfo SvxOutlinerForwarder::GetBulletInfo( sal_Int32 nPara ) const return rOutliner.GetBulletInfo( nPara ); } -Rectangle SvxOutlinerForwarder::GetCharBounds( sal_Int32 nPara, sal_uInt16 nIndex ) const +Rectangle SvxOutlinerForwarder::GetCharBounds( sal_Int32 nPara, sal_Int32 nIndex ) const { // EditEngine's 'internal' methods like GetCharacterBounds() // don't rotate for vertical text. @@ -371,7 +371,7 @@ OutputDevice* SvxOutlinerForwarder::GetRefDevice() const return rOutliner.GetRefDevice(); } -sal_Bool SvxOutlinerForwarder::GetIndexAtPoint( const Point& rPos, sal_Int32& nPara, sal_uInt16& nIndex ) const +sal_Bool SvxOutlinerForwarder::GetIndexAtPoint( const Point& rPos, sal_Int32& nPara, sal_Int32& nIndex ) const { Size aSize( rOutliner.CalcTextSize() ); ::std::swap( aSize.Width(), aSize.Height() ); @@ -387,7 +387,7 @@ sal_Bool SvxOutlinerForwarder::GetIndexAtPoint( const Point& rPos, sal_Int32& nP return sal_True; } -sal_Bool SvxOutlinerForwarder::GetWordIndices( sal_Int32 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const +sal_Bool SvxOutlinerForwarder::GetWordIndices( sal_Int32 nPara, sal_Int32 nIndex, sal_Int32& nStart, sal_Int32& nEnd ) const { ESelection aRes = rOutliner.GetEditEngine().GetWord( ESelection(nPara, nIndex, nPara, nIndex), com::sun::star::i18n::WordType::DICTIONARY_WORD ); @@ -403,27 +403,27 @@ sal_Bool SvxOutlinerForwarder::GetWordIndices( sal_Int32 nPara, sal_uInt16 nInde return sal_False; } -sal_Bool SvxOutlinerForwarder::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_Int32 nPara, sal_uInt16 nIndex, sal_Bool bInCell ) const +sal_Bool SvxOutlinerForwarder::GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nEndIndex, sal_Int32 nPara, sal_Int32 nIndex, sal_Bool bInCell ) const { return SvxEditSourceHelper::GetAttributeRun( nStartIndex, nEndIndex, rOutliner.GetEditEngine(), nPara, nIndex, bInCell ); } -sal_uInt16 SvxOutlinerForwarder::GetLineCount( sal_Int32 nPara ) const +sal_Int32 SvxOutlinerForwarder::GetLineCount( sal_Int32 nPara ) const { - return static_cast < sal_uInt16 >( rOutliner.GetLineCount(nPara) ); + return rOutliner.GetLineCount(nPara); } -sal_uInt16 SvxOutlinerForwarder::GetLineLen( sal_Int32 nPara, sal_uInt16 nLine ) const +sal_Int32 SvxOutlinerForwarder::GetLineLen( sal_Int32 nPara, sal_Int32 nLine ) const { return rOutliner.GetLineLen(nPara, nLine); } -void SvxOutlinerForwarder::GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_Int32 nPara, sal_uInt16 nLine ) const +void SvxOutlinerForwarder::GetLineBoundaries( /*out*/sal_Int32 &rStart, /*out*/sal_Int32 &rEnd, sal_Int32 nPara, sal_Int32 nLine ) const { return rOutliner.GetEditEngine().GetLineBoundaries( rStart, rEnd, nPara, nLine ); } -sal_uInt16 SvxOutlinerForwarder::GetLineNumberAtIndex( sal_Int32 nPara, sal_uInt16 nIndex ) const +sal_Int32 SvxOutlinerForwarder::GetLineNumberAtIndex( sal_Int32 nPara, sal_Int32 nIndex ) const { return rOutliner.GetEditEngine().GetLineNumberAtIndex( nPara, nIndex ); } @@ -489,7 +489,7 @@ sal_Bool SvxOutlinerForwarder::SetDepth( sal_Int32 nPara, sal_Int16 nNewDepth ) return sal_False; } -sal_Int16 SvxOutlinerForwarder::GetNumberingStartValue( sal_Int32 nPara ) +sal_Int32 SvxOutlinerForwarder::GetNumberingStartValue( sal_Int32 nPara ) { if( 0 <= nPara && nPara < GetParagraphCount() ) { @@ -502,7 +502,7 @@ sal_Int16 SvxOutlinerForwarder::GetNumberingStartValue( sal_Int32 nPara ) } } -void SvxOutlinerForwarder::SetNumberingStartValue( sal_Int32 nPara, sal_Int16 nNumberingStartValue ) +void SvxOutlinerForwarder::SetNumberingStartValue( sal_Int32 nPara, sal_Int32 nNumberingStartValue ) { if( 0 <= nPara && nPara < GetParagraphCount() ) { @@ -551,9 +551,9 @@ void SvxOutlinerForwarder::AppendParagraph() rEditEngine.InsertParagraph( rEditEngine.GetParagraphCount(), OUString() ); } -sal_uInt16 SvxOutlinerForwarder::AppendTextPortion( sal_Int32 nPara, const OUString &rText, const SfxItemSet & /*rSet*/ ) +sal_Int32 SvxOutlinerForwarder::AppendTextPortion( sal_Int32 nPara, const OUString &rText, const SfxItemSet & /*rSet*/ ) { - sal_uInt16 nLen = 0; + sal_Int32 nLen = 0; EditEngine& rEditEngine = const_cast< EditEngine& >( rOutliner.GetEditEngine() ); sal_Int32 nParaCount = rEditEngine.GetParagraphCount(); @@ -580,12 +580,12 @@ void SvxOutlinerForwarder::CopyText(const SvxTextForwarder& rSource) //------------------------------------------------------------------------ -sal_Int16 SvxTextForwarder::GetNumberingStartValue( sal_Int32 ) +sal_Int32 SvxTextForwarder::GetNumberingStartValue( sal_Int32 ) { return -1; } -void SvxTextForwarder::SetNumberingStartValue( sal_Int32, sal_Int16 ) +void SvxTextForwarder::SetNumberingStartValue( sal_Int32, sal_Int32 ) { } diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx index ddce2d39f433..192f5fa15af9 100644 --- a/editeng/source/uno/unotext.cxx +++ b/editeng/source/uno/unotext.cxx @@ -403,7 +403,7 @@ void SAL_CALL SvxUnoTextRangeBase::setString(const OUString& aString) //! on QuickInsertText... CollapseToStart(); - sal_uInt16 nLen = aConverted.getLength(); + sal_Int32 nLen = aConverted.getLength(); if (nLen) GoRight( nLen, sal_True ); } @@ -1417,12 +1417,12 @@ sal_Bool SvxUnoTextRangeBase::GoRight(sal_Int16 nCount, sal_Bool Expand) throw( { CheckSelection( maSelection, pForwarder ); - sal_uInt16 nNewPos = maSelection.nEndPos + nCount; //! Overflow??? + sal_Int32 nNewPos = maSelection.nEndPos + nCount; //! Overflow??? sal_Int32 nNewPar = maSelection.nEndPara; sal_Bool bOk = sal_True; sal_Int32 nParCount = pForwarder->GetParagraphCount(); - sal_uInt16 nThisLen = pForwarder->GetTextLen( nNewPar ); + sal_Int32 nThisLen = pForwarder->GetTextLen( nNewPar ); while ( nNewPos > nThisLen && bOk ) { if ( nNewPar + 1 >= nParCount ) @@ -2209,9 +2209,9 @@ uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::appendTextPortion( DBG_ASSERT( nParaCount > 0, "paragraph count is 0 or negative" ); sal_Int32 nPara = nParaCount - 1; SfxItemSet aSet( pTextForwarder->GetParaAttribs( nPara ) ); - sal_uInt16 nStart = pTextForwarder->AppendTextPortion( nPara, rText, aSet ); + sal_Int32 nStart = pTextForwarder->AppendTextPortion( nPara, rText, aSet ); pEditSource->UpdateData(); - xub_StrLen nEnd = pTextForwarder->GetTextLen( nPara ); + sal_Int32 nEnd = pTextForwarder->GetTextLen( nPara ); // set properties for the new text portion ESelection aSel( nPara, nStart, nPara, nEnd ); @@ -2437,7 +2437,7 @@ sal_Int32 SvxDummyTextSource::GetParagraphCount() const return 0; } -sal_uInt16 SvxDummyTextSource::GetTextLen( sal_Int32 ) const +sal_Int32 SvxDummyTextSource::GetTextLen( sal_Int32 ) const { return 0; } @@ -2468,7 +2468,7 @@ void SvxDummyTextSource::RemoveAttribs( const ESelection& , sal_Bool , sal_uInt1 { } -void SvxDummyTextSource::GetPortions( sal_Int32, std::vector<sal_uInt16>& ) const +void SvxDummyTextSource::GetPortions( sal_Int32, std::vector<sal_Int32>& ) const { } @@ -2503,12 +2503,12 @@ void SvxDummyTextSource::QuickInsertLineBreak( const ESelection& ) { }; -OUString SvxDummyTextSource::CalcFieldValue( const SvxFieldItem&, sal_Int32, sal_uInt16, Color*&, Color*& ) +OUString SvxDummyTextSource::CalcFieldValue( const SvxFieldItem&, sal_Int32, sal_Int32, Color*&, Color*& ) { return OUString(); } -void SvxDummyTextSource::FieldClicked( const SvxFieldItem&, sal_Int32, xub_StrLen ) +void SvxDummyTextSource::FieldClicked( const SvxFieldItem&, sal_Int32, sal_Int32 ) { } @@ -2521,12 +2521,12 @@ void SvxDummyTextSource::SetNotifyHdl( const Link& ) { } -LanguageType SvxDummyTextSource::GetLanguage( sal_Int32, sal_uInt16 ) const +LanguageType SvxDummyTextSource::GetLanguage( sal_Int32, sal_Int32 ) const { return LANGUAGE_DONTKNOW; } -sal_uInt16 SvxDummyTextSource::GetFieldCount( sal_Int32 ) const +sal_Int32 SvxDummyTextSource::GetFieldCount( sal_Int32 ) const { return 0; } @@ -2541,7 +2541,7 @@ EBulletInfo SvxDummyTextSource::GetBulletInfo( sal_Int32 ) const return EBulletInfo(); } -Rectangle SvxDummyTextSource::GetCharBounds( sal_Int32, sal_uInt16 ) const +Rectangle SvxDummyTextSource::GetCharBounds( sal_Int32, sal_Int32 ) const { return Rectangle(); } @@ -2561,37 +2561,37 @@ OutputDevice* SvxDummyTextSource::GetRefDevice() const return NULL; } -sal_Bool SvxDummyTextSource::GetIndexAtPoint( const Point&, sal_Int32&, sal_uInt16& ) const +sal_Bool SvxDummyTextSource::GetIndexAtPoint( const Point&, sal_Int32&, sal_Int32& ) const { return sal_False; } -sal_Bool SvxDummyTextSource::GetWordIndices( sal_Int32, sal_uInt16, sal_uInt16&, sal_uInt16& ) const +sal_Bool SvxDummyTextSource::GetWordIndices( sal_Int32, sal_Int32, sal_Int32&, sal_Int32& ) const { return sal_False; } -sal_Bool SvxDummyTextSource::GetAttributeRun( sal_uInt16&, sal_uInt16&, sal_Int32, sal_uInt16, sal_Bool ) const +sal_Bool SvxDummyTextSource::GetAttributeRun( sal_Int32&, sal_Int32&, sal_Int32, sal_Int32, sal_Bool ) const { return sal_False; } -sal_uInt16 SvxDummyTextSource::GetLineCount( sal_Int32 ) const +sal_Int32 SvxDummyTextSource::GetLineCount( sal_Int32 ) const { return 0; } -sal_uInt16 SvxDummyTextSource::GetLineLen( sal_Int32, sal_uInt16 ) const +sal_Int32 SvxDummyTextSource::GetLineLen( sal_Int32, sal_Int32 ) const { return 0; } -void SvxDummyTextSource::GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_Int32 /*nParagraph*/, sal_uInt16 /*nLine*/ ) const +void SvxDummyTextSource::GetLineBoundaries( /*out*/sal_Int32 &rStart, /*out*/sal_Int32 &rEnd, sal_Int32 /*nParagraph*/, sal_Int32 /*nLine*/ ) const { rStart = rEnd = 0; } -sal_uInt16 SvxDummyTextSource::GetLineNumberAtIndex( sal_Int32 /*nPara*/, sal_uInt16 /*nIndex*/ ) const +sal_Int32 SvxDummyTextSource::GetLineNumberAtIndex( sal_Int32 /*nPara*/, sal_Int32 /*nIndex*/ ) const { return 0; } @@ -2630,7 +2630,7 @@ void SvxDummyTextSource::AppendParagraph() { } -sal_uInt16 SvxDummyTextSource::AppendTextPortion( sal_Int32, const OUString &, const SfxItemSet & ) +sal_Int32 SvxDummyTextSource::AppendTextPortion( sal_Int32, const OUString &, const SfxItemSet & ) { return 0; } diff --git a/editeng/source/uno/unotext2.cxx b/editeng/source/uno/unotext2.cxx index 6a44ae92652f..8741bc4da8bb 100644 --- a/editeng/source/uno/unotext2.cxx +++ b/editeng/source/uno/unotext2.cxx @@ -290,7 +290,7 @@ sal_Bool SAL_CALL SvxUnoTextContent::hasElements() SvxTextForwarder* pForwarder = GetEditSource() ? GetEditSource()->GetTextForwarder() : NULL; if( pForwarder ) { - std::vector<sal_uInt16> aPortions; + std::vector<sal_Int32> aPortions; pForwarder->GetPortions( mnParagraph, aPortions ); return !aPortions.empty(); } @@ -395,7 +395,7 @@ SvxUnoTextRangeEnumeration::SvxUnoTextRangeEnumeration( const SvxUnoTextBase& rT if( mpEditSource && mpEditSource->GetTextForwarder() ) { - mpPortions = new std::vector<sal_uInt16>; + mpPortions = new std::vector<sal_Int32>; mpEditSource->GetTextForwarder()->GetPortions( nPara, *mpPortions ); } else |