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 /sc/source/ui | |
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 'sc/source/ui')
-rw-r--r-- | sc/source/ui/app/inputhdl.cxx | 48 | ||||
-rw-r--r-- | sc/source/ui/app/inputwin.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/dbgui/scuiimoptdlg.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/docshell/arealink.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh8.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/docshell/impex.cxx | 21 | ||||
-rw-r--r-- | sc/source/ui/drawfunc/drtxtob.cxx | 11 | ||||
-rw-r--r-- | sc/source/ui/inc/csvcontrol.hxx | 4 | ||||
-rw-r--r-- | sc/source/ui/inc/rfindlst.hxx | 6 | ||||
-rw-r--r-- | sc/source/ui/navipi/navipi.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/pagedlg/scuitphfedit.cxx | 10 | ||||
-rw-r--r-- | sc/source/ui/unoobj/fielduno.cxx | 17 | ||||
-rw-r--r-- | sc/source/ui/view/editsh.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/output2.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/view/viewfun4.cxx | 2 |
16 files changed, 74 insertions, 77 deletions
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 6b710231e8df..531a2443103a 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -315,7 +315,7 @@ static void lcl_Replace( EditView* pView, const OUString& rNewStr, const ESelect // dafuer muss oben die Selektion aufgehoben werden (vor QuickInsertText) pView->InsertText( EMPTY_OUSTRING, false ); - xub_StrLen nLen = pEngine->GetTextLen(0); + sal_Int32 nLen = pEngine->GetTextLen(0); ESelection aSel( 0, nLen, 0, nLen ); pView->SetSelection( aSel ); // Cursor ans Ende } @@ -327,8 +327,8 @@ void ScInputHandler::UpdateRange( sal_uInt16 nIndex, const ScRange& rNew ) if ( pDocView && pRangeFindList && nIndex < pRangeFindList->Count() ) { ScRangeFindData* pData = pRangeFindList->GetObject( nIndex ); - xub_StrLen nOldStart = pData->nSelStart; - xub_StrLen nOldEnd = pData->nSelEnd; + sal_Int32 nOldStart = pData->nSelStart; + sal_Int32 nOldEnd = pData->nSelEnd; ScRange aJustified = rNew; aJustified.Justify(); // Ref in der Formel immer richtigherum anzeigen @@ -349,14 +349,14 @@ void ScInputHandler::UpdateRange( sal_uInt16 nIndex, const ScRange& rNew ) long nDiff = aNewStr.getLength() - (long)(nOldEnd-nOldStart); pData->aRef = rNew; - pData->nSelEnd = (xub_StrLen)(pData->nSelEnd + nDiff); + pData->nSelEnd = pData->nSelEnd + nDiff; sal_uInt16 nCount = (sal_uInt16) pRangeFindList->Count(); for (sal_uInt16 i=nIndex+1; i<nCount; i++) { ScRangeFindData* pNext = pRangeFindList->GetObject( i ); - pNext->nSelStart = (xub_StrLen)(pNext->nSelStart + nDiff); - pNext->nSelEnd = (xub_StrLen)(pNext->nSelEnd + nDiff); + pNext->nSelStart = pNext->nSelStart + nDiff; + pNext->nSelEnd = pNext->nSelEnd + nDiff; } } else @@ -395,7 +395,7 @@ static void lcl_RemoveLineEnd(OUString& rStr) removeChars(rStr, '\n'); } -static sal_Int32 lcl_MatchParenthesis( const OUString& rStr, xub_StrLen nPos ) +static sal_Int32 lcl_MatchParenthesis( const OUString& rStr, sal_Int32 nPos ) { int nDir; sal_Unicode c1, c2 = 0; @@ -820,10 +820,10 @@ void ScInputHandler::ShowTipCursor() { if ( aFormula.getLength() < aSel.nEndPos ) return; - xub_StrLen nPos = aSel.nEndPos; + sal_Int32 nPos = aSel.nEndPos; OUString aSelText = aFormula.copy( 0, nPos ); sal_Int32 nNextFStart = 0; - xub_StrLen nArgPos = 0; + sal_Int32 nArgPos = 0; const IFunctionDescription* ppFDesc; ::std::vector< OUString> aArgs; sal_uInt16 nArgs; @@ -856,7 +856,7 @@ void ScInputHandler::ShowTipCursor() sal_uInt16 nActive = 0; for( sal_uInt16 i=0; i < nArgs; i++ ) { - xub_StrLen nLength = static_cast<xub_StrLen>(aArgs[i].getLength()); + sal_Int32 nLength = aArgs[i].getLength(); if( nArgPos <= aSelText.getLength()-1 ) { nActive = i+1; @@ -953,7 +953,7 @@ void ScInputHandler::ShowTipCursor() } else { - sal_uInt16 nPosition = 0; + sal_Int32 nPosition = 0; OUString aText = pEngine->GetWord( 0, aSel.nEndPos-1 ); /* XXX: dubious, what is this condition supposed to exactly match? */ if (aSel.nEndPos <= aText.getLength() && aText[ aSel.nEndPos-1 ] == '=') @@ -1055,11 +1055,11 @@ void ScInputHandler::UseFormulaData() if ( aSel.nEndPos > 0 ) { - xub_StrLen nPos = aSel.nEndPos; + sal_Int32 nPos = aSel.nEndPos; OUString aFormula = aTotal.copy( 0, nPos );; sal_Int32 nLeftParentPos = 0; sal_Int32 nNextFStart = 0; - xub_StrLen nArgPos = 0; + sal_Int32 nArgPos = 0; const IFunctionDescription* ppFDesc; ::std::vector< OUString> aArgs; sal_uInt16 nArgs; @@ -1107,7 +1107,7 @@ void ScInputHandler::UseFormulaData() sal_uInt16 nActive = 0; for( sal_uInt16 i=0; i < nArgs; i++ ) { - xub_StrLen nLength = static_cast<xub_StrLen>(aArgs[i].getLength()); + sal_Int32 nLength = aArgs[i].getLength(); if( nArgPos <= aFormula.getLength()-1 ) { nActive = i+1; @@ -1237,7 +1237,7 @@ static void lcl_CompleteFunction( EditView* pView, const OUString& rInsert, bool pView->SelectCurrentWord(); OUString aInsStr = rInsert; - xub_StrLen nInsLen = aInsStr.getLength(); + sal_Int32 nInsLen = aInsStr.getLength(); bool bDoParen = ( nInsLen > 1 && aInsStr[nInsLen-2] == '(' && aInsStr[nInsLen-1] == ')' ); if ( bDoParen ) @@ -1409,7 +1409,7 @@ void ScInputHandler::PasteManualTip() if (!pActiveView->HasSelection()) { // nichts selektiert -> alles selektieren - xub_StrLen nOldLen = pEngine->GetTextLen(0); + sal_Int32 nOldLen = pEngine->GetTextLen(0); ESelection aAllSel( 0, 0, 0, nOldLen ); if ( pTopView ) pTopView->SetSelection( aAllSel ); @@ -1427,7 +1427,7 @@ void ScInputHandler::PasteManualTip() // alles selektiert -> Anfuehrungszeichen weglassen if ( aInsert[0] == '"' ) aInsert = aInsert.copy(1); - xub_StrLen nInsLen = aInsert.getLength(); + sal_Int32 nInsLen = aInsert.getLength(); if ( aInsert.endsWith("\"") ) aInsert = aInsert.copy( 0, nInsLen-1 ); } @@ -1473,7 +1473,7 @@ bool ScInputHandler::CursorAtClosingPar() if ( pActiveView && !pActiveView->HasSelection() && bFormulaMode ) { ESelection aSel = pActiveView->GetSelection(); - xub_StrLen nPos = aSel.nStartPos; + sal_Int32 nPos = aSel.nStartPos; OUString aFormula = pEngine->GetText(0); if ( nPos < aFormula.getLength() && aFormula[nPos] == ')' ) return true; @@ -1545,7 +1545,7 @@ void ScInputHandler::UseColData() // beim Tippen sal_Int32 nParCnt = pEngine->GetParagraphCount(); if ( aSel.nEndPara+1 == nParCnt ) { - xub_StrLen nParLen = pEngine->GetTextLen( aSel.nEndPara ); + sal_Int32 nParLen = pEngine->GetTextLen( aSel.nEndPara ); if ( aSel.nEndPos == nParLen ) { OUString aText = GetEditText(pEngine); @@ -1621,8 +1621,8 @@ void ScInputHandler::NextAutoEntry( bool bBack ) if ( aSel.nEndPara+1 == nParCnt && aSel.nStartPara == aSel.nEndPara ) { OUString aText = GetEditText(pEngine); - xub_StrLen nSelLen = aSel.nEndPos - aSel.nStartPos; - xub_StrLen nParLen = pEngine->GetTextLen( aSel.nEndPara ); + sal_Int32 nSelLen = aSel.nEndPos - aSel.nStartPos; + sal_Int32 nParLen = pEngine->GetTextLen( aSel.nEndPara ); if ( aSel.nEndPos == nParLen && aText.getLength() == aAutoSearch.getLength() + nSelLen ) { OUString aNew; @@ -1689,7 +1689,7 @@ void ScInputHandler::UpdateParenthesis() { // Das Zeichen links vom Cursor wird angeschaut - xub_StrLen nPos = aSel.nStartPos - 1; + sal_Int32 nPos = aSel.nStartPos - 1; OUString aFormula = pEngine->GetText(0); sal_Unicode c = aFormula[nPos]; if ( c == '(' || c == ')' ) @@ -2093,7 +2093,7 @@ static void lcl_SetTopSelection( EditView* pEditView, ESelection& rSel ) sal_Int32 nCount = pEngine->GetParagraphCount(); if (nCount > 1) { - xub_StrLen nParLen = pEngine->GetTextLen(rSel.nStartPara); + sal_Int32 nParLen = pEngine->GetTextLen(rSel.nStartPara); while (rSel.nStartPos > nParLen && rSel.nStartPara+1 < nCount) { rSel.nStartPos -= nParLen + 1; // incl. Leerzeichen vom Umbruch @@ -3794,7 +3794,7 @@ bool ScInputHandler::GetTextAndFields( ScEditEngineDefaulter& rDestEngine ) while ( nParCnt > 1 ) { - xub_StrLen nLen = rDestEngine.GetTextLen( 0 ); + sal_Int32 nLen = rDestEngine.GetTextLen( 0 ); ESelection aSel( 0,nLen, 1,0 ); rDestEngine.QuickInsertText( OUString(' '), aSel ); // Umbruch durch Space ersetzen --nParCnt; diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index 3bc555c6122d..b823146aba71 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -483,7 +483,7 @@ void ScInputWindow::Select() //! SetSelection am InputHandler ??? //! bSelIsRef setzen ??? const sal_Int32 nOpen = aFormula.indexOf('('); - const xub_StrLen nLen = aFormula.getLength(); + const sal_Int32 nLen = aFormula.getLength(); if ( nOpen != -1 && nLen > nOpen ) { sal_uInt8 nAdd(1); @@ -758,7 +758,7 @@ void ScInputWindow::SwitchToTextWin() if (pView) { sal_Int32 nPara = pView->GetEditEngine()->GetParagraphCount() ? ( pView->GetEditEngine()->GetParagraphCount() - 1 ) : 0; - xub_StrLen nLen = pView->GetEditEngine()->GetTextLen( nPara ); + sal_Int32 nLen = pView->GetEditEngine()->GetTextLen( nPara ); ESelection aSel( nPara, nLen, nPara, nLen ); pView->SetSelection( aSel ); // set cursor to end of text } diff --git a/sc/source/ui/dbgui/scuiimoptdlg.cxx b/sc/source/ui/dbgui/scuiimoptdlg.cxx index 1fba5ba2fb26..dbb4205bef19 100644 --- a/sc/source/ui/dbgui/scuiimoptdlg.cxx +++ b/sc/source/ui/dbgui/scuiimoptdlg.cxx @@ -53,8 +53,8 @@ public: private: const OUString theDelTab; const sal_Unicode cSep; - const xub_StrLen nCount; - xub_StrLen nIter; + const sal_Int32 nCount; + sal_Int32 nIter; }; //------------------------------------------------------------------------ @@ -65,7 +65,7 @@ sal_uInt16 ScDelimiterTable::GetCode( const OUString& rDel ) const if ( nCount >= 2 ) { - xub_StrLen i = 0; + sal_Int32 i = 0; while ( i<nCount ) { if ( rDel == theDelTab.getToken( i, cSep ) ) @@ -89,7 +89,7 @@ OUString ScDelimiterTable::GetDelimiter( sal_Unicode nCode ) const if ( nCount >= 2 ) { - xub_StrLen i = 0; + sal_Int32 i = 0; while ( i<nCount ) { if ( nCode == (sal_Unicode) theDelTab.getToken( i+1, cSep ).toInt32() ) diff --git a/sc/source/ui/docshell/arealink.cxx b/sc/source/ui/docshell/arealink.cxx index c2bf54e1bd89..c3def988b08b 100644 --- a/sc/source/ui/docshell/arealink.cxx +++ b/sc/source/ui/docshell/arealink.cxx @@ -280,7 +280,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter, SCROW nHeight = 0; sal_Int32 nTokenCnt = comphelper::string::getTokenCount(aTempArea, ';'); sal_Int32 nStringIx = 0; - xub_StrLen nToken; + sal_Int32 nToken; for( nToken = 0; nToken < nTokenCnt; nToken++ ) { diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 5c4e7285927a..101332d1807a 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -323,7 +323,7 @@ void ScDocShell::AfterXMLLoading(sal_Bool bRet) if( *pNameBuffer == SC_COMPILER_FILE_TAB_SEP ) // after the last quote of the docname should be the # char { - xub_StrLen nIndex = nNameLength - nLinkTabNameLength; + sal_Int32 nIndex = nNameLength - nLinkTabNameLength; INetURLObject aINetURLObject(aDocURLBuffer.makeStringAndClear()); if(aName == aLinkTabName.copy(nIndex, nLinkTabNameLength) && (aName[nIndex - 1] == '#') && // before the table name should be the # char diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx index f8585b4179f9..0e97eda57cd4 100644 --- a/sc/source/ui/docshell/docsh8.cxx +++ b/sc/source/ui/docshell/docsh8.cxx @@ -656,7 +656,7 @@ void lcl_GetColumnTypes( } else if ( nDbType == sdbc::DataType::DECIMAL ) { // maximale Feldbreite und Nachkommastellen bestimmen - xub_StrLen nLen; + sal_Int32 nLen; sal_uInt16 nPrec; nLen = pDoc->GetMaxNumberStringLen( nPrec, nTab, nCol, nFirstDataRow, nLastRow ); @@ -668,7 +668,7 @@ void lcl_GetColumnTypes( if ( bPrecDefined && nPrecision != nPrec ) { // Laenge auf vorgegebene Nachkommastellen anpassen if ( nPrecision ) - nLen = sal::static_int_cast<xub_StrLen>( nLen + ( nPrecision - nPrec ) ); + nLen = nLen + ( nPrecision - nPrec ); else nLen -= nPrec+1; // auch den . mit raus } diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index d6ce4f3058d3..737ec547d6a4 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -23,7 +23,6 @@ #include <i18nlangtag/languagetag.hxx> #include <sot/formats.hxx> #include <sfx2/mieclip.hxx> -#include <tools/string.hxx> #include <com/sun/star/i18n/CalendarFieldIndex.hpp> #include "global.hxx" @@ -62,7 +61,7 @@ // times maximum cell content length, 2*1024*64K=128M, and because it's // sal_Unicode that's 256MB. If it's 2GB of data without LF we're out of luck // anyway. -static const sal_Int32 nArbitraryLineLengthLimit = 2 * MAXCOLCOUNT * STRING_MAXLEN; +static const sal_Int32 nArbitraryLineLengthLimit = 2 * MAXCOLCOUNT * 65536; namespace { @@ -354,7 +353,7 @@ bool ScImportExport::ExportByteString( OString& rText, rtl_TextEncoding eEnc, sa eEnc = osl_getThreadTextEncoding(); if (!nSizeLimit) - nSizeLimit = STRING_MAXLEN; + nSizeLimit = SAL_MAX_UINT16; SvMemoryStream aStrm; aStrm.SetStreamCharSet( eEnc ); @@ -365,7 +364,7 @@ bool ScImportExport::ExportByteString( OString& rText, rtl_TextEncoding eEnc, sa aStrm.WriteChar( (sal_Char) 0 ); aStrm.Seek( STREAM_SEEK_TO_END ); // Sicherheits-Check: - if( aStrm.Tell() <= (sal_uLong) STRING_MAXLEN ) + if( aStrm.Tell() <= nSizeLimit ) { rText = (const sal_Char*) aStrm.GetData(); return true; @@ -623,15 +622,15 @@ static QuoteType lcl_isEscapedOrFieldEndQuote( sal_Int32 nQuotes, const sal_Unic */ static bool lcl_appendLineData( OUString& rField, const sal_Unicode* p1, const sal_Unicode* p2 ) { - OSL_ENSURE( rField.getLength() + (p2 - p1) <= STRING_MAXLEN, "lcl_appendLineData: data overflow"); - if (rField.getLength() + (p2 - p1) <= STRING_MAXLEN) + OSL_ENSURE( rField.getLength() + (p2 - p1) <= SAL_MAX_UINT16, "lcl_appendLineData: data overflow"); + if (rField.getLength() + (p2 - p1) <= SAL_MAX_UINT16) { rField += OUString( p1, sal::static_int_cast<sal_Int32>( p2 - p1 ) ); return true; } else { - rField += OUString( p1, STRING_MAXLEN - rField.getLength() ); + rField += OUString( p1, SAL_MAX_UINT16 - rField.getLength() ); return false; } } @@ -1247,26 +1246,26 @@ static OUString lcl_GetFixed( const OUString& rLine, sal_Int32 nStart, sal_Int32 rbIsQuoted = (pStr[nStart] == '"' && pStr[nSpace-1] == '"'); if (rbIsQuoted) { - bool bFits = (nSpace - nStart - 3 <= STRING_MAXLEN); + bool bFits = (nSpace - nStart - 3 <= SAL_MAX_UINT16); OSL_ENSURE( bFits, "lcl_GetFixed: line doesn't fit into data"); if (bFits) return rLine.copy(nStart+1, nSpace-nStart-2); else { rbOverflowCell = true; - return rLine.copy(nStart+1, STRING_MAXLEN); + return rLine.copy(nStart+1, SAL_MAX_UINT16); } } else { - bool bFits = (nSpace - nStart <= STRING_MAXLEN); + bool bFits = (nSpace - nStart <= SAL_MAX_UINT16); OSL_ENSURE( bFits, "lcl_GetFixed: line doesn't fit into data"); if (bFits) return rLine.copy(nStart, nSpace-nStart); else { rbOverflowCell = true; - return rLine.copy(nStart, STRING_MAXLEN); + return rLine.copy(nStart, SAL_MAX_UINT16); } } } diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx index 6d6206ecb916..627182442f4f 100644 --- a/sc/source/ui/drawfunc/drtxtob.cxx +++ b/sc/source/ui/drawfunc/drtxtob.cxx @@ -601,7 +601,7 @@ static void lcl_RemoveFields( OutlinerView& rOutView ) ESelection aOldSel = rOutView.GetSelection(); ESelection aSel = aOldSel; aSel.Adjust(); - xub_StrLen nNewEnd = aSel.nEndPos; + sal_Int32 nNewEnd = aSel.nEndPos; sal_Bool bUpdate = pOutliner->GetUpdateMode(); sal_Bool bChanged = false; @@ -613,15 +613,14 @@ static void lcl_RemoveFields( OutlinerView& rOutView ) for (sal_Int32 nPar=0; nPar<nParCount; nPar++) if ( nPar >= aSel.nStartPara && nPar <= aSel.nEndPara ) { - std::vector<sal_uInt16> aPortions; + std::vector<sal_Int32> aPortions; rEditEng.GetPortions( nPar, aPortions ); - //! GetPortions should use xub_StrLen instead of USHORT for ( size_t nPos = aPortions.size(); nPos; ) { --nPos; - sal_uInt16 nEnd = aPortions[ nPos ]; - sal_uInt16 nStart = nPos ? aPortions[ nPos - 1 ] : 0; + sal_Int32 nEnd = aPortions[ nPos ]; + sal_Int32 nStart = nPos ? aPortions[ nPos - 1 ] : 0; // fields are single characters if ( nEnd == nStart+1 && ( nPar > aSel.nStartPara || nStart >= aSel.nStartPos ) && @@ -644,7 +643,7 @@ static void lcl_RemoveFields( OutlinerView& rOutView ) pOutliner->QuickInsertText( aFieldText, aFieldSel ); if ( nPar == aSel.nEndPara ) { - nNewEnd = sal::static_int_cast<xub_StrLen>( nNewEnd + aFieldText.getLength() ); + nNewEnd = nNewEnd + aFieldText.getLength(); --nNewEnd; } } diff --git a/sc/source/ui/inc/csvcontrol.hxx b/sc/source/ui/inc/csvcontrol.hxx index bbea8e1386a7..6898bd2252ad 100644 --- a/sc/source/ui/inc/csvcontrol.hxx +++ b/sc/source/ui/inc/csvcontrol.hxx @@ -41,7 +41,7 @@ namespace com { namespace sun { namespace star { namespace accessibility { /** Minimum character count for a column in separators mode. */ const sal_Int32 CSV_MINCOLWIDTH = 8; /** Maximum length of a cell string. */ -const xub_StrLen CSV_MAXSTRLEN = 0x7FFF; +const sal_Int32 CSV_MAXSTRLEN = 0x7FFF; /** Transparency for header color of selected columns. */ const sal_uInt16 CSV_HDR_TRANSPARENCY = 85; /** Minimum distance to border for auto scroll. */ @@ -78,7 +78,7 @@ struct ScCsvExpData sal_uInt8 mnType; /// External type of the column. inline ScCsvExpData() : mnIndex( 0 ), mnType( SC_COL_STANDARD ) {} - inline ScCsvExpData( xub_StrLen nIndex, sal_uInt8 nType ) : + inline ScCsvExpData( sal_Int32 nIndex, sal_uInt8 nType ) : mnIndex( nIndex ), mnType( nType ) {} }; diff --git a/sc/source/ui/inc/rfindlst.hxx b/sc/source/ui/inc/rfindlst.hxx index ba20555699e1..090ea65603c7 100644 --- a/sc/source/ui/inc/rfindlst.hxx +++ b/sc/source/ui/inc/rfindlst.hxx @@ -30,10 +30,10 @@ struct ScRangeFindData { ScRange aRef; sal_uInt16 nFlags; - xub_StrLen nSelStart; - xub_StrLen nSelEnd; + sal_Int32 nSelStart; + sal_Int32 nSelEnd; - ScRangeFindData( const ScRange& rR, sal_uInt16 nF, xub_StrLen nS, xub_StrLen nE ) : + ScRangeFindData( const ScRange& rR, sal_uInt16 nF, sal_Int32 nS, sal_Int32 nE ) : aRef(rR), nFlags(nF), nSelStart(nS), nSelEnd(nE) {} }; diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx index 4263a618d89d..b1e3e51e6bee 100644 --- a/sc/source/ui/navipi/navipi.cxx +++ b/sc/source/ui/navipi/navipi.cxx @@ -57,7 +57,7 @@ // maximum values for UI #define SCNAV_MAXCOL (MAXCOLCOUNT) // macro is sufficient since only used in ctor -#define SCNAV_COLDIGITS (static_cast<xub_StrLen>( floor( log10( static_cast<double>(SCNAV_MAXCOL)))) + 1) // 1...256...18278 +#define SCNAV_COLDIGITS (static_cast<sal_Int32>( floor( log10( static_cast<double>(SCNAV_MAXCOL)))) + 1) // 1...256...18278 // precomputed constant because it is used in every change of spin button field static const sal_Int32 SCNAV_COLLETTERS = ::ScColToAlpha(SCNAV_MAXCOL).getLength(); // A...IV...ZZZ diff --git a/sc/source/ui/pagedlg/scuitphfedit.cxx b/sc/source/ui/pagedlg/scuitphfedit.cxx index 2a71c5d42668..ba6140272ac1 100644 --- a/sc/source/ui/pagedlg/scuitphfedit.cxx +++ b/sc/source/ui/pagedlg/scuitphfedit.cxx @@ -495,7 +495,7 @@ bool ScHFEditPage::IsPageEntry(EditEngine*pEngine, EditTextObject* pTextObj) if(!pTextObj->IsFieldObject()) { - std::vector<sal_uInt16> aPosList; + std::vector<sal_Int32> aPosList; pEngine->GetPortions(0,aPosList); if(aPosList.size() == 2) { @@ -601,7 +601,7 @@ void ScHFEditPage::ProcessDefinedListSel(ScHFEntryId eSel, bool bTravelling) OUString aPageOfEntry(" " + m_pFtOf->GetText() + " "); m_pWndCenter->GetEditEngine()->QuickInsertText(aPageOfEntry,ESelection(aSel.nEndPara,aSel.nEndPos, aSel.nEndPara, aSel.nEndPos)); - aSel.nEndPos = sal::static_int_cast<xub_StrLen>( aSel.nEndPos + aPageOfEntry.getLength() ); + aSel.nEndPos = aSel.nEndPos + aPageOfEntry.getLength(); m_pWndCenter->GetEditEngine()->QuickInsertField(SvxFieldItem(SvxPagesField(), EE_FEATURE_FIELD), ESelection(aSel.nEndPara,aSel.nEndPos, aSel.nEndPara, aSel.nEndPos)); pTextObj.reset(m_pWndCenter->GetEditEngine()->CreateTextObject()); m_pWndCenter->SetText(*pTextObj); @@ -641,7 +641,7 @@ void ScHFEditPage::ProcessDefinedListSel(ScHFEntryId eSel, bool bTravelling) OUString aPageEntry(", " + m_pFtPage->GetText() + " "); m_pWndCenter->GetEditEngine()->QuickInsertText(aPageEntry, ESelection(aSel.nEndPara,aSel.nEndPos, aSel.nEndPara, aSel.nEndPos)); aSel.nStartPos = aSel.nEndPos; - aSel.nEndPos = sal::static_int_cast<xub_StrLen>( aSel.nEndPos + aPageEntry.getLength() ); + aSel.nEndPos = aSel.nEndPos + aPageEntry.getLength(); m_pWndCenter->GetEditEngine()->QuickInsertField(SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(aSel.nEndPara,aSel.nEndPos, aSel.nEndPara, aSel.nEndPos)); pTextObj.reset(m_pWndCenter->GetEditEngine()->CreateTextObject()); m_pWndCenter->SetText(*pTextObj); @@ -670,7 +670,7 @@ void ScHFEditPage::ProcessDefinedListSel(ScHFEntryId eSel, bool bTravelling) OUString aCommaSpace(", "); m_pWndCenter->GetEditEngine()->QuickInsertText(aCommaSpace,ESelection(aSel.nEndPara, aSel.nEndPos, aSel.nEndPara, aSel.nEndPos)); - aSel.nEndPos = sal::static_int_cast<xub_StrLen>( aSel.nEndPos + aCommaSpace.getLength() ); + aSel.nEndPos = aSel.nEndPos + aCommaSpace.getLength(); m_pWndCenter->GetEditEngine()->QuickInsertField( SvxFieldItem(SvxTableField(), EE_FEATURE_FIELD), ESelection(aSel.nEndPara, aSel.nEndPos, aSel.nEndPara, aSel.nEndPos)); pTextObj.reset(m_pWndCenter->GetEditEngine()->CreateTextObject()); m_pWndCenter->SetText(*pTextObj); @@ -690,7 +690,7 @@ void ScHFEditPage::ProcessDefinedListSel(ScHFEntryId eSel, bool bTravelling) ++aSel.nEndPos; OUString aCommaSpace(", "); m_pWndCenter->GetEditEngine()->QuickInsertText(aCommaSpace,ESelection(aSel.nEndPara, aSel.nEndPos, aSel.nEndPara, aSel.nEndPos)); - aSel.nEndPos = sal::static_int_cast<xub_StrLen>( aSel.nEndPos + aCommaSpace.getLength() ); + aSel.nEndPos = aSel.nEndPos + aCommaSpace.getLength(); m_pWndCenter->GetEditEngine()->QuickInsertField( SvxFieldItem(SvxFileField(), EE_FEATURE_FIELD), ESelection(aSel.nEndPara, aSel.nEndPos, aSel.nEndPara, aSel.nEndPos)); pTextObj.reset(m_pWndCenter->GetEditEngine()->CreateTextObject()); m_pWndCenter->SetText(*pTextObj); diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx index 6f77905e6a25..c10cc72a3625 100644 --- a/sc/source/ui/unoobj/fielduno.cxx +++ b/sc/source/ui/unoobj/fielduno.cxx @@ -173,23 +173,22 @@ class ScUnoEditEngine : public ScEditEngineDefaulter sal_Int32 mnFieldType; SvxFieldData* pFound; // lokale Kopie sal_Int32 nFieldPar; - xub_StrLen nFieldPos; + sal_Int32 nFieldPos; sal_uInt16 nFieldIndex; public: ScUnoEditEngine(ScEditEngineDefaulter* pSource); ~ScUnoEditEngine(); - //! nPos should be xub_StrLen - virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_uInt16 nPos, + virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, Color*& rTxtColor, Color*& rFldColor ); sal_uInt16 CountFields(); SvxFieldData* FindByIndex(sal_uInt16 nIndex); - SvxFieldData* FindByPos(sal_Int32 nPar, xub_StrLen nPos, sal_Int32 nType); + SvxFieldData* FindByPos(sal_Int32 nPar, sal_Int32 nPos, sal_Int32 nType); sal_Int32 GetFieldPar() const { return nFieldPar; } - xub_StrLen GetFieldPos() const { return nFieldPos; } + sal_Int32 GetFieldPos() const { return nFieldPos; } }; ScUnoEditEngine::ScUnoEditEngine(ScEditEngineDefaulter* pSource) : @@ -213,7 +212,7 @@ ScUnoEditEngine::~ScUnoEditEngine() } OUString ScUnoEditEngine::CalcFieldValue( const SvxFieldItem& rField, - sal_Int32 nPara, sal_uInt16 nPos, Color*& rTxtColor, Color*& rFldColor ) + sal_Int32 nPara, sal_Int32 nPos, Color*& rTxtColor, Color*& rFldColor ) { OUString aRet(EditEngine::CalcFieldValue( rField, nPara, nPos, rTxtColor, rFldColor )); if (eMode != SC_UNO_COLLECT_NONE) @@ -265,7 +264,7 @@ SvxFieldData* ScUnoEditEngine::FindByIndex(sal_uInt16 nIndex) return pFound; } -SvxFieldData* ScUnoEditEngine::FindByPos(sal_Int32 nPar, xub_StrLen nPos, sal_Int32 nType) +SvxFieldData* ScUnoEditEngine::FindByPos(sal_Int32 nPar, sal_Int32 nPos, sal_Int32 nType) { eMode = SC_UNO_COLLECT_FINDPOS; nFieldPar = nPar; @@ -343,7 +342,7 @@ uno::Reference<text::XTextField> ScCellFieldsObj::GetObjectByIndex_Impl(sal_Int3 return uno::Reference<text::XTextField>(); sal_Int32 nPar = aTempEngine.GetFieldPar(); - xub_StrLen nPos = aTempEngine.GetFieldPos(); + sal_Int32 nPos = aTempEngine.GetFieldPos(); ESelection aSelection( nPar, nPos, nPar, nPos+1 ); // Feld ist 1 Zeichen sal_Int32 eType = pData->GetClassId(); @@ -524,7 +523,7 @@ uno::Reference<text::XTextField> ScHeaderFieldsObj::GetObjectByIndex_Impl(sal_In xTextRange = xTemp; sal_Int32 nPar = aTempEngine.GetFieldPar(); - xub_StrLen nPos = aTempEngine.GetFieldPos(); + sal_Int32 nPos = aTempEngine.GetFieldPos(); ESelection aSelection( nPar, nPos, nPar, nPos+1 ); // Field is 1 character sal_Int32 eRealType = pData->GetClassId(); diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index 16398a2aeabb..67d18419cf8e 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -309,7 +309,7 @@ void ScEditShell::Execute( SfxRequest& rReq ) sal_Int32 nPar = pEngine->GetParagraphCount(); if (nPar) { - xub_StrLen nLen = pEngine->GetTextLen(nPar-1); + sal_Int32 nLen = pEngine->GetTextLen(nPar-1); pTableView->SetSelection(ESelection(0,0,nPar-1,nLen)); if (pTopView) pTopView->SetSelection(ESelection(0,0,nPar-1,nLen)); diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index 8d55bb9a8e19..38b1e08ec6f8 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -2138,13 +2138,13 @@ static void lcl_ScaleFonts( EditEngine& rEngine, long nPercent ) sal_Int32 nParCount = rEngine.GetParagraphCount(); for (sal_Int32 nPar=0; nPar<nParCount; nPar++) { - std::vector<sal_uInt16> aPortions; + std::vector<sal_Int32> aPortions; rEngine.GetPortions( nPar, aPortions ); - sal_uInt16 nStart = 0; - for ( std::vector<sal_uInt16>::const_iterator it(aPortions.begin()); it != aPortions.end(); ++it ) + sal_Int32 nStart = 0; + for ( std::vector<sal_Int32>::const_iterator it(aPortions.begin()); it != aPortions.end(); ++it ) { - sal_uInt16 nEnd = *it; + sal_Int32 nEnd = *it; ESelection aSel( nPar, nStart, nPar, nEnd ); SfxItemSet aAttribs = rEngine.GetAttribs( aSel ); diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx index 3269d1cb000b..eb7504d3f84c 100644 --- a/sc/source/ui/view/viewfun4.cxx +++ b/sc/source/ui/view/viewfun4.cxx @@ -737,7 +737,7 @@ void ScViewFunc::InsertBookmark( const OUString& rDescription, const OUString& r sal_Int32 nPara = aEngine.GetParagraphCount(); if (nPara) --nPara; - xub_StrLen nTxtLen = aEngine.GetTextLen(nPara); + sal_Int32 nTxtLen = aEngine.GetTextLen(nPara); ESelection aInsSel( nPara, nTxtLen, nPara, nTxtLen ); if ( bTryReplace && HasBookmarkAtCursor( NULL ) ) |