summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-09-25 11:42:42 +0200
committerNoel Grandin <noel@peralex.com>2013-10-01 10:08:39 +0200
commitc82d932510c88a12b260b1684522efbc69f07b26 (patch)
tree31749d5dc0a28789092ea5b009d77f17f57f9e28 /sfx2
parent4805c2f499d66c3397958efed1663ad1ac16e1cf (diff)
convert remnants of String to OUString in SFX2 module
Change-Id: Ie07684f2b8b902b0ce0844eabc8174482e02d8db
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/appl/newhelp.cxx80
-rw-r--r--sfx2/source/dialog/dinfdlg.cxx8
-rw-r--r--sfx2/source/dialog/filedlghelper.cxx53
-rw-r--r--sfx2/source/dialog/filtergrouping.cxx2
-rw-r--r--sfx2/source/dialog/templdlg.cxx4
-rw-r--r--sfx2/source/dialog/versdlg.cxx2
-rw-r--r--sfx2/source/doc/docfile.cxx2
-rw-r--r--sfx2/source/doc/frmdescr.cxx2
8 files changed, 94 insertions, 59 deletions
diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx
index 9fcf95674542..06383d852283 100644
--- a/sfx2/source/appl/newhelp.cxx
+++ b/sfx2/source/appl/newhelp.cxx
@@ -1946,7 +1946,7 @@ sal_Bool SfxHelpIndexWindow_Impl::HasFocusOnEdit() const
OUString SfxHelpIndexWindow_Impl::GetSearchText() const
{
- String sRet;
+ OUString sRet;
if ( aTabCtrl.GetCurPageId() == HELP_INDEX_PAGE_SEARCH && pSPage )
sRet = pSPage->GetSearchText();
return sRet;
@@ -2182,7 +2182,7 @@ void SfxHelpTextWindow_Impl::InitOnStartupBox( bool bOnlyText )
else
{
// detect module name
- String sModuleName;
+ OUString sModuleName;
if ( xConfiguration.is() )
{
@@ -2197,14 +2197,14 @@ void SfxHelpTextWindow_Impl::InitOnStartupBox( bool bOnlyText )
{
SAL_WARN( "sfx.appl", "SfxHelpTextWindow_Impl::InitOnStartupBox(): unexpected exception" );
}
- sModuleName = String( sTemp );
+ sModuleName = sTemp;
}
- if ( sModuleName.Len() > 0 )
+ if ( !sModuleName.isEmpty() )
{
// set module name in checkbox text
- String sText( aOnStartupText );
- sText.SearchAndReplace( OUString("%MODULENAME"), sModuleName );
+ OUString sText( aOnStartupText );
+ sText = sText.replaceFirst( "%MODULENAME", sModuleName );
aOnStartupCB.SetText( sText );
// and show it
aOnStartupCB.Show();
@@ -2213,7 +2213,7 @@ void SfxHelpTextWindow_Impl::InitOnStartupBox( bool bOnlyText )
aOnStartupCB.SaveValue();
// calculate and set optimal width of the onstartup checkbox
- String sCBText( "XXX" );
+ OUString sCBText( "XXX" );
sCBText += aOnStartupCB.GetText();
long nTextWidth = aOnStartupCB.GetTextWidth( sCBText );
Size aSize = aOnStartupCB.GetSizePixel();
@@ -2333,7 +2333,7 @@ IMPL_LINK_NOARG(SfxHelpTextWindow_Impl, SelectHdl)
xSrchDesc->setPropertyValue( "SearchWords",
makeAny( sal_Bool( sal_True ) ) );
- String sSearchString = sfx2::PrepareSearchString( aSearchText, GetBreakIterator(), false );
+ OUString sSearchString = sfx2::PrepareSearchString( aSearchText, GetBreakIterator(), false );
xSrchDesc->setSearchString( sSearchString );
Reference< XIndexAccess > xSelection = xSearchable->findAll( xSrchDesc );
@@ -2375,7 +2375,7 @@ IMPL_LINK( SfxHelpTextWindow_Impl, FindHdl, sfx2::SearchDialog*, pDlg )
if ( bWrapAround )
pDlg = pSrchDlg;
DBG_ASSERT( pDlg, "invalid search dialog" );
- String sSearchText = pDlg->GetSearchText();
+ OUString sSearchText = pDlg->GetSearchText();
try
{
// select the words, which are equal to the search text of the search page
@@ -2778,8 +2778,8 @@ void SfxHelpTextWindow_Impl::DoSearch()
Reference< XTextRange > xCursor = getCursor();
if ( xCursor.is() )
{
- String sText = xCursor->getString();
- if ( sText.Len() > 0 )
+ OUString sText = xCursor->getString();
+ if ( !sText.isEmpty() )
pSrchDlg->SetSearchText( sText );
}
pSrchDlg->Show();
@@ -2921,20 +2921,20 @@ void SfxHelpWindow_Impl::LoadConfig()
if ( aViewOpt.Exists() )
{
bIndex = aViewOpt.IsVisible();
- String aUserData;
+ OUString aUserData;
Any aUserItem = aViewOpt.GetUserItem( USERITEM_NAME );
OUString aTemp;
if ( aUserItem >>= aTemp )
{
- aUserData = String( aTemp );
+ aUserData = aTemp;
DBG_ASSERT( comphelper::string::getTokenCount(aUserData, ';') == 6, "invalid user data" );
sal_Int32 nIdx = 0;
- nIndexSize = aUserData.GetToken( 0, ';', nIdx ).ToInt32();
- nTextSize = aUserData.GetToken( 0, ';', nIdx ).ToInt32();
- sal_Int32 nWidth = aUserData.GetToken( 0, ';', nIdx ).ToInt32();
- nHeight = aUserData.GetToken( 0, ';', nIdx ).ToInt32();
- aWinPos.X() = aUserData.GetToken( 0, ';', nIdx ).ToInt32();
- aWinPos.Y() = aUserData.GetToken( 0, ';', nIdx ).ToInt32();
+ nIndexSize = aUserData.getToken( 0, ';', nIdx ).toInt32();
+ nTextSize = aUserData.getToken( 0, ';', nIdx ).toInt32();
+ sal_Int32 nWidth = aUserData.getToken( 0, ';', nIdx ).toInt32();
+ nHeight = aUserData.getToken( 0, ';', nIdx ).toInt32();
+ aWinPos.X() = aUserData.getToken( 0, ';', nIdx ).toInt32();
+ aWinPos.Y() = aUserData.getToken( 0, ';', nIdx ).toInt32();
if ( bIndex )
{
nExpandWidth = nWidth;
@@ -2966,19 +2966,19 @@ void SfxHelpWindow_Impl::SaveConfig()
}
aViewOpt.SetVisible( bIndex );
- String aUserData = OUString::number( nIndexSize );
- aUserData += ';';
+ OUString aUserData = OUString::number( nIndexSize );
+ aUserData += ";";
aUserData += OUString::number( nTextSize );
- aUserData += ';';
+ aUserData += ";";
aUserData += OUString::number( nW );
- aUserData += ';';
+ aUserData += ";";
aUserData += OUString::number( nH );
- Window* pScreenWin = VCLUnoHelper::GetWindow( xWindow );
+ Window* pScreenWin = VCLUnoHelper::GetWindow( xWindow );
aWinPos = pScreenWin->GetWindowExtentsRelative( NULL ).TopLeft();
- aUserData += ';';
+ aUserData += ";";
aUserData += OUString::number( aWinPos.X() );
- aUserData += ';';
+ aUserData += ";";
aUserData += OUString::number( aWinPos.Y() );
aViewOpt.SetUserItem( USERITEM_NAME, makeAny( OUString( aUserData ) ) );
@@ -3013,30 +3013,30 @@ IMPL_LINK( SfxHelpWindow_Impl, SelectHdl, ToolBox* , pToolBox )
IMPL_LINK_NOARG(SfxHelpWindow_Impl, OpenHdl)
{
pIndexWin->SelectExecutableEntry();
- String aEntry = pIndexWin->GetSelectEntry();
+ OUString aEntry = pIndexWin->GetSelectEntry();
- if ( aEntry.Len() < 1 )
+ if ( aEntry.isEmpty() )
return 0;
OUString sHelpURL;
- bool bComplete = OUString(aEntry).toAsciiLowerCase().match(OUString("vnd.sun.star.help"),0);
+ bool bComplete = OUString(aEntry).toAsciiLowerCase().match("vnd.sun.star.help");
if (bComplete)
sHelpURL = OUString(aEntry);
else
{
- String aId;
- String aAnchor = OUString('#');
+ OUString aId;
+ OUString aAnchor = OUString('#');
if ( comphelper::string::getTokenCount(aEntry, '#') == 2 )
{
- aId = aEntry.GetToken( 0, '#' );
- aAnchor += aEntry.GetToken( 1, '#' );
+ aId = aEntry.getToken( 0, '#' );
+ aAnchor += aEntry.getToken( 1, '#' );
}
else
aId = aEntry;
- aEntry = '/';
+ aEntry = "/";
aEntry += aId;
sHelpURL = SfxHelpWindow_Impl::buildHelpURL(pIndexWin->GetFactory(),
@@ -3123,8 +3123,8 @@ void SfxHelpWindow_Impl::openDone(const OUString& sURL ,
}
// When the SearchPage opens the help doc, then select all words, which are equal to its text
- String sSearchText = comphelper::string::strip(pIndexWin->GetSearchText(), ' ');
- if ( sSearchText.Len() > 0 )
+ OUString sSearchText = comphelper::string::strip(pIndexWin->GetSearchText(), ' ');
+ if ( !sSearchText.isEmpty() )
pTextWin->SelectSearchText( sSearchText, pIndexWin->IsFullWordSearch() );
// no page style header -> this prevents a print output of the URL
@@ -3294,7 +3294,7 @@ void SfxHelpWindow_Impl::DoAction( sal_uInt16 nActionId )
else
aURL.Complete = ".uno:SearchDialog";
PARSE_URL( aURL );
- Reference < XDispatch > xDisp = xProv->queryDispatch( aURL, String(), 0 );
+ Reference < XDispatch > xDisp = xProv->queryDispatch( aURL, OUString(), 0 );
if ( xDisp.is() )
xDisp->dispatch( aURL, Sequence < PropertyValue >() );
}
@@ -3303,8 +3303,8 @@ void SfxHelpWindow_Impl::DoAction( sal_uInt16 nActionId )
case TBI_BOOKMARKS :
{
- String aURL = pHelpInterceptor->GetCurrentURL();
- if ( aURL.Len() > 0 )
+ OUString aURL = pHelpInterceptor->GetCurrentURL();
+ if ( !aURL.isEmpty() )
{
try
{
@@ -3316,7 +3316,7 @@ void SfxHelpWindow_Impl::DoAction( sal_uInt16 nActionId )
OUString aValue;
if ( aAny >>= aValue )
{
- String aTitle( aValue );
+ OUString aTitle( aValue );
SfxAddHelpBookmarkDialog_Impl aDlg( this, sal_False );
aDlg.SetTitle( aTitle );
if ( aDlg.Execute() == RET_OK )
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index ffaf425da32e..1cc97a90d4c2 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -118,7 +118,7 @@ static const char DOCUMENT_SIGNATURE_MENU_CMD[] = "Signature";
//------------------------------------------------------------------------
namespace {
-String CreateSizeText( sal_Int64 nSize )
+OUString CreateSizeText( sal_Int64 nSize )
{
OUString aUnitStr(" ");
aUnitStr += SfxResId(STR_BYTES).toString();
@@ -173,7 +173,7 @@ String CreateSizeText( sal_Int64 nSize )
return aSizeStr;
}
-String ConvertDateTime_Impl( const OUString& rName,
+OUString ConvertDateTime_Impl( const OUString& rName,
const util::DateTime& uDT, const LocaleDataWrapper& rWrapper )
{
Date aD(uDT.Day, uDT.Month, uDT.Year);
@@ -2379,8 +2379,8 @@ Sequence< document::CmisProperty > CmisPropertiesWindow::GetCmisProperties() con
aPropertiesSeq[i].OpenChoice = pLine->m_bOpenChoice;
aPropertiesSeq[i].MultiValued = pLine->m_bMultiValued;
- String sPropertyName = pLine->m_aName->GetText();
- if ( sPropertyName.Len() > 0 )
+ OUString sPropertyName = pLine->m_aName->GetText();
+ if ( !sPropertyName.isEmpty() )
{
aPropertiesSeq[i].Name = sPropertyName;
OUString sType = pLine->m_aType->GetText( );
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index 81bf474b8a02..a8479732382d 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -1902,6 +1902,41 @@ void FileDialogHelper_Impl::addGraphicFilter()
#define GRF_CONFIG_STR " "
#define STD_CONFIG_STR "1 "
+static void SetToken( OUString rOrigStr, sal_Int32 nToken, sal_Unicode cTok, const OUString& rStr)
+{
+ const sal_Unicode* pStr = rOrigStr.getStr();
+ sal_Int32 nLen = rOrigStr.getLength();
+ sal_Int32 nTok = 0;
+ sal_Int32 nFirstChar = 0;
+ sal_Int32 i = nFirstChar;
+
+ // Determine token position and length
+ pStr += i;
+ while ( i < nLen )
+ {
+ // Increase token count if match
+ if ( *pStr == cTok )
+ {
+ ++nTok;
+
+ if ( nTok == nToken )
+ nFirstChar = i+1;
+ else
+ {
+ if ( nTok > nToken )
+ break;
+ }
+ }
+
+ ++pStr,
+ ++i;
+ }
+
+ if ( nTok >= nToken )
+ rOrigStr = rOrigStr.replaceAt( nFirstChar, i-nFirstChar, rStr );
+}
+
+
void FileDialogHelper_Impl::saveConfig()
{
uno::Reference < XFilePickerControlAccess > xDlg( mxFileDlg, UNO_QUERY );
@@ -1913,25 +1948,25 @@ void FileDialogHelper_Impl::saveConfig()
if ( mbHasPreview )
{
SvtViewOptions aDlgOpt( E_DIALOG, IMPGRF_CONFIGNAME );
- String aUserData(GRF_CONFIG_STR);
+ OUString aUserData(GRF_CONFIG_STR);
try
{
aValue = xDlg->getValue( ExtendedFilePickerElementIds::CHECKBOX_PREVIEW, 0 );
sal_Bool bValue = sal_False;
aValue >>= bValue;
- aUserData.SetToken( 1, ' ', OUString::number( (sal_Int32) bValue ) );
+ SetToken( aUserData, 1, ' ', OUString::number( (sal_Int32) bValue ) );
INetURLObject aObj( getPath() );
if ( aObj.GetProtocol() == INET_PROT_FILE )
- aUserData.SetToken( 2, ' ', aObj.GetMainURL( INetURLObject::NO_DECODE ) );
+ SetToken( aUserData, 2, ' ', aObj.GetMainURL( INetURLObject::NO_DECODE ) );
OUString aFilter = getFilter();
aFilter = EncodeSpaces_Impl( aFilter );
- aUserData.SetToken( 3, ' ', aFilter );
+ SetToken( aUserData, 3, ' ', aFilter );
- aDlgOpt.SetUserItem( USERITEM_NAME, makeAny( OUString( aUserData ) ) );
+ aDlgOpt.SetUserItem( USERITEM_NAME, makeAny( aUserData ) );
}
catch( const IllegalArgumentException& ){}
}
@@ -1939,7 +1974,7 @@ void FileDialogHelper_Impl::saveConfig()
{
sal_Bool bWriteConfig = sal_False;
SvtViewOptions aDlgOpt( E_DIALOG, IODLG_CONFIGNAME );
- String aUserData(STD_CONFIG_STR);
+ OUString aUserData(STD_CONFIG_STR);
if ( aDlgOpt.Exists() )
{
@@ -1956,7 +1991,7 @@ void FileDialogHelper_Impl::saveConfig()
aValue = xDlg->getValue( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION, 0 );
sal_Bool bAutoExt = sal_True;
aValue >>= bAutoExt;
- aUserData.SetToken( 0, ' ', OUString::number( (sal_Int32) bAutoExt ) );
+ SetToken( aUserData, 0, ' ', OUString::number( (sal_Int32) bAutoExt ) );
bWriteConfig = sal_True;
}
catch( const IllegalArgumentException& ){}
@@ -1968,7 +2003,7 @@ void FileDialogHelper_Impl::saveConfig()
if ( !aPath.isEmpty() &&
utl::LocalFileHelper::IsLocalFile( aPath ) )
{
- aUserData.SetToken( 1, ' ', aPath );
+ SetToken( aUserData, 1, ' ', aPath );
bWriteConfig = sal_True;
}
}
@@ -1982,7 +2017,7 @@ void FileDialogHelper_Impl::saveConfig()
aValue >>= bSelection;
if ( comphelper::string::getTokenCount(aUserData, ' ') < 3 )
aUserData += " ";
- aUserData.SetToken( 2, ' ', OUString::number( (sal_Int32) bSelection ) );
+ SetToken( aUserData, 2, ' ', OUString::number( (sal_Int32) bSelection ) );
bWriteConfig = sal_True;
}
catch( const IllegalArgumentException& ){}
diff --git a/sfx2/source/dialog/filtergrouping.cxx b/sfx2/source/dialog/filtergrouping.cxx
index aaab0808d168..dcea1f6bf386 100644
--- a/sfx2/source/dialog/filtergrouping.cxx
+++ b/sfx2/source/dialog/filtergrouping.cxx
@@ -903,7 +903,7 @@ namespace sfx2
const OUString& sFilterName = m_lFilters[nIndex];
if (sFilterName.isEmpty())
return 0;
- return SfxFilter::GetFilterByName(String(sFilterName));
+ return SfxFilter::GetFilterByName(sFilterName);
}
//--------------------------------------------------------------------
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index ebc4101cd916..4b6c8f69960f 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -1048,11 +1048,11 @@ SfxCommonTemplateDialog_Impl::~SfxCommonTemplateDialog_Impl()
{
OUString aEmpty;
Execute_Impl(SID_STYLE_END_PREVIEW,
- String(), String(),
+ OUString(), OUString(),
0, 0, 0, 0 );
#if defined STYLESPREVIEW
Execute_Impl(SID_STYLE_END_PREVIEW,
- String(), String(),
+ OUString(), OUString(),
0, 0, 0, 0 );
#endif
if ( bIsWater )
diff --git a/sfx2/source/dialog/versdlg.cxx b/sfx2/source/dialog/versdlg.cxx
index c36540cada09..ad153589d448 100644
--- a/sfx2/source/dialog/versdlg.cxx
+++ b/sfx2/source/dialog/versdlg.cxx
@@ -293,7 +293,7 @@ SfxVersionDialog::SfxVersionDialog ( SfxViewFrame* pVwFrame, sal_Bool bIsSaveVer
m_pVersionBox->setColSizes();
}
-String ConvertWhiteSpaces_Impl( const OUString& rText )
+OUString ConvertWhiteSpaces_Impl( const OUString& rText )
{
// converted linebreaks and tabs to blanks; it's necessary for the display
OUStringBuffer sConverted;
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 329cfb8aee5c..49cb292f50ef 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -3135,7 +3135,7 @@ sal_uInt16 SfxMedium::AddVersion_Impl( util::RevisionTag& rRevision )
sal_Int32 nLength = pImp->aVersions.getLength();
for ( sal_Int32 m=0; m<nLength; m++ )
{
- sal_uInt32 nVer = static_cast<sal_uInt32>(String( pImp->aVersions[m].Identifier ).Copy(7).ToInt32());
+ sal_uInt32 nVer = static_cast<sal_uInt32>( pImp->aVersions[m].Identifier.copy(7).toInt32());
size_t n;
for ( n=0; n<aLongs.size(); ++n )
if ( nVer<aLongs[n] )
diff --git a/sfx2/source/doc/frmdescr.cxx b/sfx2/source/doc/frmdescr.cxx
index 94ad20b687a4..2d1a9f4cf368 100644
--- a/sfx2/source/doc/frmdescr.cxx
+++ b/sfx2/source/doc/frmdescr.cxx
@@ -87,7 +87,7 @@ void SfxFrameDescriptor::SetActualURL( const OUString& rURL )
void SfxFrameDescriptor::SetActualURL( const INetURLObject& rURL )
{
- SetActualURL(String(rURL.GetMainURL( INetURLObject::DECODE_TO_IURI )));
+ SetActualURL(rURL.GetMainURL( INetURLObject::DECODE_TO_IURI ));
}
void SfxFrameDescriptor::SetEditable( sal_Bool bSet )