diff options
author | Jean-Noël Rouvignac <jn.rouvignac@gmail.com> | 2013-01-10 01:52:32 +0100 |
---|---|---|
committer | Ivan Timofeev <timofeev.i.s@gmail.com> | 2013-01-13 11:21:25 +0400 |
commit | 6f3c367f9c2bff7520f2a55f1795fd718abea938 (patch) | |
tree | b2bdabda32fef36b02c4972966490d6bbaa69f40 /svtools | |
parent | d28ccfbcdd459d21f8791cd7a61a52a12d3adbbc (diff) |
fdo#38838 Some removal/replacement of the String/UniString with OUString
Change-Id: Ibce0f8542aa398147d74f7acf53b2898dc3e4eff
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/control/calendar.cxx | 4 | ||||
-rw-r--r-- | svtools/source/control/ruler.cxx | 8 | ||||
-rw-r--r-- | svtools/source/dialogs/filedlg2.cxx | 80 |
3 files changed, 42 insertions, 50 deletions
diff --git a/svtools/source/control/calendar.cxx b/svtools/source/control/calendar.cxx index 2712871324e6..6ddec6892bef 100644 --- a/svtools/source/control/calendar.cxx +++ b/svtools/source/control/calendar.cxx @@ -218,7 +218,7 @@ void Calendar::ImplInit( WinBits nWinStyle ) // Tagestexte anlegen for (sal_Int32 i = 0; i < 31; ++i) - mpDayText[i] = new UniString(rtl::OUString::valueOf(i+1)); + mpDayText[i] = new String(OUString::valueOf(i+1)); maDragScrollTimer.SetTimeoutHdl( STATIC_LINK( this, Calendar, ScrollHdl ) ); maDragScrollTimer.SetTimeout( GetSettings().GetMouseSettings().GetScrollRepeat() ); @@ -1289,7 +1289,7 @@ void Calendar::ImplShowMenu( const Point& rPos, const Date& rDate ) pYearPopupMenus[i]->InsertItem( nYearIdCount+j, maCalendarWrapper.getDisplayName( i18n::CalendarDisplayIndex::MONTH, j-1, 1)); - aPopupMenu.InsertItem( 10+i, UniString::CreateFromInt32( nYear+i ) ); + aPopupMenu.InsertItem( 10+i, OUString::valueOf( static_cast<sal_Int32>(nYear+i) ) ); aPopupMenu.SetPopupMenu( 10+i, pYearPopupMenus[i] ); nYearIdCount += 1000; } diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx index 153e91530aa8..b99b90381a09 100644 --- a/svtools/source/control/ruler.cxx +++ b/svtools/source/control/ruler.cxx @@ -497,7 +497,7 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter ) nMaxWidth /= nTickUnit; else nMaxWidth /= aImplRulerUnitTab[mnUnitIndex].nTickUnit; - UniString aNumStr(rtl::OUString::valueOf(static_cast<sal_Int32>(nMaxWidth))); + OUString aNumStr = OUString::valueOf(static_cast<sal_Int32>(nMaxWidth)); long nTxtWidth = GetTextWidth( aNumStr ); const long nTextOff = 4; if ( nTickWidth < nTxtWidth+nTextOff ) @@ -552,7 +552,7 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter ) // 0 is only painted when Margin1 is not equal to zero if ( (mpData->nMargin1Style & RULER_STYLE_INVISIBLE) || (mpData->nMargin1 != 0) ) { - aNumStr = (sal_Unicode)'0'; + aNumStr = "0"; ImplVDrawText( nStart, nCenter, aNumStr ); } } @@ -570,9 +570,9 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter ) if ( !(nTick % nTick3) ) { if ( ( mnUnitIndex == RULER_UNIT_CHAR ) || ( mnUnitIndex == RULER_UNIT_LINE ) ) - aNumStr = UniString::CreateFromInt32( nTick / nTickUnit ); + aNumStr = OUString::valueOf( static_cast<sal_Int64>( nTick / nTickUnit ) ); else - aNumStr = UniString::CreateFromInt32( nTick / aImplRulerUnitTab[mnUnitIndex].nTickUnit ); + aNumStr = OUString::valueOf( static_cast<sal_Int64>( nTick / aImplRulerUnitTab[mnUnitIndex].nTickUnit ) ); ImplVDrawText( nStart + n, nCenter, aNumStr, nMin, nMax ); ImplVDrawText( nStart - n, nCenter, aNumStr, nMin, nMax ); diff --git a/svtools/source/dialogs/filedlg2.cxx b/svtools/source/dialogs/filedlg2.cxx index bc197bb6db4d..db8913d1f8d3 100644 --- a/svtools/source/dialogs/filedlg2.cxx +++ b/svtools/source/dialogs/filedlg2.cxx @@ -67,21 +67,18 @@ KbdListBox::PreNotify( NotifyEvent& rNEvt ) for ( sal_uInt16 i = 1; i < nEntries; i++ ) { - UniString aEntry = GetEntry ( (i + nCurrentPos) % nEntries ); - aEntry = comphelper::string::stripStart(aEntry, ' '); - aEntry.ToUpperAscii(); - UniString aCompare = rtl::OUString(cCharCode); - aCompare.ToUpperAscii(); + OUString aEntry = GetEntry ( (i + nCurrentPos) % nEntries ); + aEntry = comphelper::string::stripStart(aEntry, ' ').toAsciiUpperCase(); + OUString aCompare = OUString(cCharCode).toAsciiUpperCase(); - if ( aEntry.CompareTo( aCompare, 1 ) == COMPARE_EQUAL ) + if ( aEntry.compareTo( aCompare, 1 ) == COMPARE_EQUAL ) { SelectEntryPos ( (i + nCurrentPos) % nEntries ); break; } } } - else - if ( aKeyEvt.GetKeyCode().GetCode() == KEY_RETURN ) + else if ( aKeyEvt.GetKeyCode().GetCode() == KEY_RETURN ) { DoubleClick(); } @@ -136,7 +133,7 @@ void ImpPathDialog::InitControls() Point aPnt( a6Siz.Width(), a6Siz.Height() ); long nLbH1 = pDlg->LogicToPixel( Size( 0, 93 ), MAP_APPFONT ).Height(); long nH = 0; - UniString aEmptyStr; + OUString aEmptyStr; INITCONTROL( pDirTitel, FixedText, 0, aPnt, aFTSiz, SVT_RESSTR( STR_FILEDLG_DIR ), HID_FILEDLG_DIR ); @@ -243,20 +240,19 @@ IMPL_LINK( ImpPathDialog, SelectHdl, ListBox *, p ) { if( p == pDriveList ) { - UniString aDrive( pDriveList->GetSelectEntry(), 0, 2); - aDrive += '\\'; + OUString aDrive = OUString( pDriveList->GetSelectEntry().Copy(0, 2) ) + "\\"; SetPath( aDrive ); } - else - if( p == pDirList ) + else if( p == pDirList ) { // isolate the pure name of the entry // removing trainling stuff and leading spaces - UniString aEntry( pDirList->GetSelectEntry() ); + OUString aEntry( pDirList->GetSelectEntry() ); aEntry = comphelper::string::stripStart(aEntry, ' '); - sal_uInt16 nPos = aEntry.Search( '/' ); - aEntry.Erase( nPos ); + sal_Int32 nPos = aEntry.indexOf( '/' ); + if (nPos >= 0) + aEntry = aEntry.replaceAt( nPos, aEntry.getLength()-nPos, "" ); // build the absolute path to the selected item DirEntry aNewPath; @@ -268,7 +264,7 @@ IMPL_LINK( ImpPathDialog, SelectHdl, ListBox *, p ) if( nCurPos < nDirCount ) aNewPath = aNewPath[nDirCount-nCurPos-1]; else - aNewPath += aEntry; + aNewPath += String(aEntry); pEdit->SetText( aNewPath.GetFull() ); } @@ -342,11 +338,12 @@ IMPL_LINK( ImpPathDialog, DblClickHdl, ListBox*, pBox ) { // isolate the pure name of the entry // removing trainling stuff and leading spaces - UniString aEntry( pBox->GetSelectEntry() ); + OUString aEntry( pBox->GetSelectEntry() ); aEntry = comphelper::string::stripStart(aEntry, ' '); - sal_uInt16 nPos = aEntry.Search( '/' ); - aEntry.Erase( nPos ); + sal_Int32 nPos = aEntry.indexOf( '/' ); + if (nPos >= 0) + aEntry = aEntry.replaceAt( nPos, aEntry.getLength()-nPos, "" ); // build the absolute path to the selected item DirEntry aNewPath; @@ -363,10 +360,10 @@ IMPL_LINK( ImpPathDialog, DblClickHdl, ListBox*, pBox ) if( nCurPos < nDirCount ) aNewPath = aNewPath[nDirCount-nCurPos-1]; else - aNewPath += aEntry; + aNewPath += String(aEntry); } else - aNewPath += aEntry; + aNewPath += String(aEntry); pSvPathDialog->EnterWait(); @@ -391,7 +388,7 @@ IMPL_LINK( ImpPathDialog, DblClickHdl, ListBox*, pBox ) void ImpPathDialog::UpdateEntries( const sal_Bool ) { - UniString aTabString; + OUString aTabString; DirEntry aTmpPath; aTmpPath.ToAbs(); @@ -402,10 +399,9 @@ void ImpPathDialog::UpdateEntries( const sal_Bool ) for( sal_uInt16 i = nDirCount; i > 0; i-- ) { - UniString aName( aTabString ); - aName += aTmpPath[i-1].GetName(); + OUString aName = aTabString + aTmpPath[i-1].GetName(); pDirList->InsertEntry( aName ); - aTabString.AppendAscii( " ", 2 ); + aTabString += " "; } // scan the directory @@ -465,7 +461,7 @@ void ImpPathDialog::UpdateDirs( const DirEntry& rTmpPath ) pDirList->Invalidate(); pDirList->Update(); - UniString aDirName = rTmpPath.GetFull(); + OUString aDirName = rTmpPath.GetFull(); if( pDirPath ) pDirPath->SetText( aDirName ); else @@ -481,8 +477,8 @@ sal_Bool ImpPathDialog::IsFileOk( const DirEntry& rDirEntry ) // Datei vorhanden ? if( ! rDirEntry.Exists() ) { - UniString aQueryTxt( SVT_RESSTR( STR_FILEDLG_ASKNEWDIR ) ); - aQueryTxt.SearchAndReplaceAscii( "%s", rDirEntry.GetFull() ); + OUString aQueryTxt( SVT_RESSTR( STR_FILEDLG_ASKNEWDIR ) ); + aQueryTxt = aQueryTxt.replaceFirst( "%s", rDirEntry.GetFull() ); QueryBox aQuery( GetPathDialog(), WB_YES_NO | WB_DEF_YES, aQueryTxt ); @@ -493,10 +489,7 @@ sal_Bool ImpPathDialog::IsFileOk( const DirEntry& rDirEntry ) } if( !FileStat( rDirEntry ).IsKind( FSYS_KIND_DIR ) ) { - UniString aBoxText( SVT_RESSTR( STR_FILEDLG_CANTOPENDIR ) ); - aBoxText.AppendAscii( "\n[" ); - aBoxText += rDirEntry.GetFull(); - aBoxText.AppendAscii( "]" ); + OUString aBoxText = SVT_RESSTR( STR_FILEDLG_CANTOPENDIR ) + "\n[" + rDirEntry.GetFull() + "]" ; InfoBox aBox( GetPathDialog(), aBoxText ); aBox.Execute(); return sal_False; @@ -598,26 +591,25 @@ void ImpPathDialog::PreExecute() for( i = 0; i < nCount; ++i ) { DirEntry& rEntry = aDir[i]; - UniString aStr = rEntry.GetFull( FSYS_STYLE_HOST, sal_False ); + OUString aStr = rEntry.GetFull( FSYS_STYLE_HOST, sal_False ); - UniString aVolume = rEntry.GetVolume() ; - aStr.ToUpperAscii(); - if ( aVolume.Len() ) + OUString aVolume = rEntry.GetVolume() ; + aStr = aStr.toAsciiUpperCase(); + if ( aVolume.getLength() ) { - aStr += ' '; - aStr += aVolume; + aStr = aStr + " " + aVolume; } - pDriveList->InsertEntry( aStr ); + pDriveList->InsertEntry( String(aStr) ); } - UniString aPathStr = aPath.GetFull(); + OUString aPathStr = aPath.GetFull(); for ( i = 0; i < pDriveList->GetEntryCount(); ++i ) { - UniString aEntry = pDriveList->GetEntry(i); - xub_StrLen nLen = aEntry.Len(); + OUString aEntry = pDriveList->GetEntry(i); + xub_StrLen nLen = aEntry.getLength(); nLen = nLen > 2 ? 2 : nLen; - if ( aEntry.CompareIgnoreCaseToAscii( aPathStr, nLen ) == COMPARE_EQUAL ) + if ( aEntry.compareTo( aPathStr, nLen ) == COMPARE_EQUAL ) { pDriveList->SelectEntryPos(i); break; |