diff options
author | Noel Grandin <noel@peralex.com> | 2013-10-14 13:13:34 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-10-15 12:25:47 +0200 |
commit | cb61b3c1b4495d0ebd5a5addf72fb63e86004166 (patch) | |
tree | 434d15dc4538859b99d762ad9f6e9e97142f72a9 /sw/source | |
parent | c1bc91fc4889e74a6edb38ba7690be6ab1e9dbb1 (diff) |
convert sw/source/ui/dbui/*.cxx from String to OUString
Change-Id: I302fc2630f22a9d7a050b666cad0eb2cea0f5663
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/ui/dbui/addresslistdialog.cxx | 34 | ||||
-rw-r--r-- | sw/source/ui/dbui/createaddresslistdialog.cxx | 46 | ||||
-rw-r--r-- | sw/source/ui/dbui/createaddresslistdialog.hxx | 10 | ||||
-rw-r--r-- | sw/source/ui/dbui/customizeaddresslistdialog.cxx | 8 | ||||
-rw-r--r-- | sw/source/ui/dbui/dbinsdlg.cxx | 91 | ||||
-rw-r--r-- | sw/source/ui/dbui/dbmgr.cxx | 126 | ||||
-rw-r--r-- | sw/source/ui/dbui/dbtree.cxx | 20 | ||||
-rw-r--r-- | sw/source/ui/dbui/mailmergechildwindow.cxx | 24 | ||||
-rw-r--r-- | sw/source/ui/dbui/mailmergehelper.cxx | 28 | ||||
-rw-r--r-- | sw/source/ui/dbui/mmaddressblockpage.cxx | 99 | ||||
-rw-r--r-- | sw/source/ui/dbui/mmaddressblockpage.hxx | 4 | ||||
-rw-r--r-- | sw/source/ui/dbui/mmconfigitem.cxx | 19 | ||||
-rw-r--r-- | sw/source/ui/dbui/mmdocselectpage.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/dbui/mmgreetingspage.cxx | 6 | ||||
-rw-r--r-- | sw/source/ui/dbui/mmlayoutpage.cxx | 91 | ||||
-rw-r--r-- | sw/source/ui/dbui/mmmergepage.cxx | 4 | ||||
-rw-r--r-- | sw/source/ui/dbui/mmoutputpage.cxx | 51 | ||||
-rw-r--r-- | sw/source/ui/dbui/selectdbtabledialog.cxx | 8 |
18 files changed, 318 insertions, 353 deletions
diff --git a/sw/source/ui/dbui/addresslistdialog.cxx b/sw/source/ui/dbui/addresslistdialog.cxx index 93e7d07a702d..ab31828fd496 100644 --- a/sw/source/ui/dbui/addresslistdialog.cxx +++ b/sw/source/ui/dbui/addresslistdialog.cxx @@ -338,8 +338,8 @@ IMPL_LINK_NOARG(SwAddressListDialog, FilterHdl_Impl) IMPL_LINK_NOARG(SwAddressListDialog, LoadHdl_Impl) { - String sNewSource = SwNewDBMgr::LoadAndRegisterDataSource(); - if(sNewSource.Len()) + OUString sNewSource = SwNewDBMgr::LoadAndRegisterDataSource(); + if(!sNewSource.isEmpty()) { SvTreeListEntry* pNewSource = m_pListLB->InsertEntry(sNewSource); pNewSource->SetUserData(new AddressUserData_Impl()); @@ -350,7 +350,7 @@ IMPL_LINK_NOARG(SwAddressListDialog, LoadHdl_Impl) IMPL_LINK(SwAddressListDialog, CreateHdl_Impl, PushButton*, pButton) { - String sInputURL; + OUString sInputURL; SwCreateAddressListDialog* pDlg = new SwCreateAddressListDialog( pButton, @@ -406,7 +406,7 @@ IMPL_LINK(SwAddressListDialog, CreateHdl_Impl, PushButton*, pButton) uno::Reference<sdb::XDocumentDataSource> xDS(xNewInstance, UNO_QUERY_THROW); uno::Reference<frame::XStorable> xStore(xDS->getDatabaseDocument(), UNO_QUERY_THROW); OUString const sExt(".odb"); - String sTmpName; + OUString sTmpName; { OUString sHomePath(SvtPathOptions().GetWorkPath()); utl::TempFile aTempFile(sFind , &sExt, &sHomePath); @@ -419,9 +419,9 @@ IMPL_LINK(SwAddressListDialog, CreateHdl_Impl, PushButton*, pButton) uno::Reference<XNamingService> xNaming(m_xDBContext, UNO_QUERY); xNaming->registerObject( sFind, xNewInstance ); //now insert the new source into the ListBox - String sEntry(sFind); - sEntry += '\t'; - sEntry += String(aFilters[0]); + OUString sEntry(sFind); + sEntry += "\t"; + sEntry += aFilters[0]; m_pCreatedDataSource = m_pListLB->InsertEntry(sEntry); AddressUserData_Impl* pUserData = new AddressUserData_Impl(); pUserData->sURL = sURL; @@ -488,8 +488,8 @@ IMPL_STATIC_LINK(SwAddressListDialog, StaticListBoxSelectHdl_Impl, SvTreeListEnt AddressUserData_Impl* pUserData = 0; if(pSelect) { - String sTable = pThis->m_pListLB->GetEntryText(pSelect, ITEMID_TABLE - 1); - if(!sTable.Len()) + OUString sTable = pThis->m_pListLB->GetEntryText(pSelect, ITEMID_TABLE - 1); + if(sTable.isEmpty()) { pThis->m_pListLB->SetEntryText(pThis->m_sConnecting, pSelect, ITEMID_TABLE - 1); // allow painting of the new entry @@ -513,7 +513,7 @@ IMPL_STATIC_LINK(SwAddressListDialog, StaticListBoxSelectHdl_Impl, SvTreeListEnt * here. */ pThis->m_pListLB->EndSelection(); - pThis->DetectTablesAndQueries(pSelect, !sTable.Len()); + pThis->DetectTablesAndQueries(pSelect, sTable.isEmpty()); } else { @@ -579,8 +579,8 @@ void SwAddressListDialog::DetectTablesAndQueries( { //now call the table select dialog - if more than one table exists SwSelectDBTableDialog* pDlg = new SwSelectDBTableDialog(this, pUserData->xConnection); - String sTable = m_pListLB->GetEntryText(pSelect, ITEMID_TABLE - 1); - if(sTable.Len()) + OUString sTable = m_pListLB->GetEntryText(pSelect, ITEMID_TABLE - 1); + if(!sTable.isEmpty()) pDlg->SetSelectedTable(sTable, pUserData->nCommandType == CommandType::TABLE); if(RET_OK == pDlg->Execute()) { @@ -621,9 +621,9 @@ void SwAddressListDialog::DetectTablesAndQueries( else m_pListLB->SetEntryText(String(), pSelect, ITEMID_TABLE - 1); } - String sCommand = m_pListLB->GetEntryText(pSelect, ITEMID_TABLE - 1); - m_pOK->Enable(pSelect && sCommand.Len()); - m_pFilterPB->Enable( pUserData->xConnection.is() && sCommand.Len() ); + OUString sCommand = m_pListLB->GetEntryText(pSelect, ITEMID_TABLE - 1); + m_pOK->Enable(pSelect && !sCommand.isEmpty()); + m_pFilterPB->Enable( pUserData->xConnection.is() && !sCommand.isEmpty() ); m_pTablePB->Enable( pUserData->nTableAndQueryCount > 1 ); } catch (const Exception&) @@ -642,10 +642,10 @@ IMPL_LINK(SwAddressListDialog, TableSelectHdl_Impl, PushButton*, pButton) AddressUserData_Impl* pUserData = static_cast<AddressUserData_Impl*>(pSelect->GetUserData()); //only call the table select dialog if tables have not been searched for or there //are more than 1 - String sTable = m_pListLB->GetEntryText(pSelect, ITEMID_TABLE - 1); + OUString sTable = m_pListLB->GetEntryText(pSelect, ITEMID_TABLE - 1); if( pUserData->nTableAndQueryCount > 1 || pUserData->nTableAndQueryCount == -1) { - DetectTablesAndQueries(pSelect, (pButton != 0) || (!sTable.Len())); + DetectTablesAndQueries(pSelect, (pButton != 0) || sTable.isEmpty()); } } diff --git a/sw/source/ui/dbui/createaddresslistdialog.cxx b/sw/source/ui/dbui/createaddresslistdialog.cxx index 02bcac334547..00f576138263 100644 --- a/sw/source/ui/dbui/createaddresslistdialog.cxx +++ b/sw/source/ui/dbui/createaddresslistdialog.cxx @@ -349,7 +349,7 @@ long SwAddressControl_Impl::PreNotify( NotifyEvent& rNEvt ) } SwCreateAddressListDialog::SwCreateAddressListDialog( - Window* pParent, const String& rURL, SwMailMergeConfigItem& rConfig) : + Window* pParent, const OUString& rURL, SwMailMergeConfigItem& rConfig) : SfxModalDialog(pParent, SW_RES(DLG_MM_CREATEADDRESSLIST)), #ifdef _MSC_VER #pragma warning (disable : 4355) @@ -395,7 +395,7 @@ SwCreateAddressListDialog::SwCreateAddressListDialog( m_aNextPB.SetClickHdl(aLk); m_aEndPB.SetClickHdl(aLk); - if(m_sURL.Len()) + if(!m_sURL.isEmpty()) { //file exists, has to be loaded here SfxMedium aMedium( m_sURL, STREAM_READ ); @@ -406,8 +406,8 @@ SwCreateAddressListDialog::SwCreateAddressListDialog( pStream->SetStreamCharSet(RTL_TEXTENCODING_UTF8); OUString sQuote('"'); - String sTempMiddle(sQuote); - sTempMiddle += sal_Unicode(9); + OUString sTempMiddle(sQuote); + sTempMiddle += OUString(sal_Unicode(9)); OUString sLine; bool bRead = pStream->ReadByteStringLine( sLine, RTL_TEXTENCODING_UTF8 ); @@ -419,13 +419,13 @@ SwCreateAddressListDialog::SwCreateAddressListDialog( sal_Int32 nIndex = 0; for( sal_Int32 nToken = 0; nToken < nHeaders; ++nToken) { - String sHeader = sLine.getToken( 0, '\t', nIndex ); - OSL_ENSURE(sHeader.Len() > 2 && - sHeader.GetChar(0) == '\"' && sHeader.GetChar(sHeader.Len() - 1) == '\"', + OUString sHeader = sLine.getToken( 0, '\t', nIndex ); + OSL_ENSURE(sHeader.getLength() > 2 && + sHeader[0] == '\"' && sHeader[sHeader.getLength() - 1] == '\"', "Wrong format of header"); - if(sHeader.Len() > 2) + if(sHeader.getLength() > 2) { - m_pCSVData->aDBColumnHeaders.push_back( sHeader.Copy(1, sHeader.Len() -2)); + m_pCSVData->aDBColumnHeaders.push_back( sHeader.copy(1, sHeader.getLength() -2)); } } } @@ -437,12 +437,12 @@ SwCreateAddressListDialog::SwCreateAddressListDialog( sal_Int32 nIndex = 0; for( sal_Int32 nToken = 0; nToken < nDataCount; ++nToken) { - String sData = sLine.getToken( 0, '\t', nIndex ); - OSL_ENSURE(sData.Len() >= 2 && - sData.GetChar(0) == '\"' && sData.GetChar(sData.Len() - 1) == '\"', + OUString sData = sLine.getToken( 0, '\t', nIndex ); + OSL_ENSURE(sData.getLength() >= 2 && + sData[0] == '\"' && sData[sData.getLength() - 1] == '\"', "Wrong format of line"); - if(sData.Len() >= 2) - aNewData.push_back(sData.Copy(1, sData.Len() - 2)); + if(sData.getLength() >= 2) + aNewData.push_back(sData.copy(1, sData.getLength() - 2)); else aNewData.push_back(sData); } @@ -458,7 +458,7 @@ SwCreateAddressListDialog::SwCreateAddressListDialog( for(sal_uInt16 nHeader = 0; nHeader < nCount; ++nHeader) m_pCSVData->aDBColumnHeaders.push_back( rAddressHeader.GetString(nHeader)); ::std::vector<OUString> aNewData; - String sTemp; + OUString sTemp; aNewData.insert(aNewData.begin(), nCount, sTemp); m_pCSVData->aDBData.push_back(aNewData); } @@ -480,7 +480,7 @@ IMPL_LINK_NOARG(SwCreateAddressListDialog, NewHdl_Impl) { sal_uInt32 nCurrent = m_pAddressControl->GetCurrentDataSet(); ::std::vector<OUString> aNewData; - String sTemp; + OUString sTemp; aNewData.insert(aNewData.begin(), m_pCSVData->aDBColumnHeaders.size(), sTemp); m_pCSVData->aDBData.insert(m_pCSVData->aDBData.begin() + ++nCurrent, aNewData); m_aSetNoNF.SetMax(m_pCSVData->aDBData.size()); @@ -504,7 +504,7 @@ IMPL_LINK_NOARG(SwCreateAddressListDialog, DeleteHdl_Impl) else { // if only one set is available then clear the data - String sTemp; + OUString sTemp; m_pCSVData->aDBData[0].assign(m_pCSVData->aDBData[0].size(), sTemp); m_aDeletePB.Enable(sal_False); } @@ -561,12 +561,12 @@ IMPL_LINK(SwCreateAddressListDialog, CustomizeHdl_Impl, PushButton*, pButton) IMPL_LINK_NOARG(SwCreateAddressListDialog, OkHdl_Impl) { - if(!m_sURL.Len()) + if(m_sURL.isEmpty()) { sfx2::FileDialogHelper aDlgHelper( TemplateDescription::FILESAVE_SIMPLE, 0 ); uno::Reference < XFilePicker > xFP = aDlgHelper.GetFilePicker(); - String sPath( SvtPathOptions().SubstituteVariable( + OUString sPath( SvtPathOptions().SubstituteVariable( OUString("$(userurl)/database") )); aDlgHelper.SetDisplayDirectory( sPath ); uno::Reference< XFilterManager > xFltMgr(xFP, uno::UNO_QUERY); @@ -582,7 +582,7 @@ IMPL_LINK_NOARG(SwCreateAddressListDialog, OkHdl_Impl) m_sURL = aResult.GetMainURL(INetURLObject::NO_DECODE); } } - if(m_sURL.Len()) + if(!m_sURL.isEmpty()) { SfxMedium aMedium( m_sURL, STREAM_READWRITE|STREAM_TRUNC ); SvStream* pStream = aMedium.GetOutStream(); @@ -590,8 +590,8 @@ IMPL_LINK_NOARG(SwCreateAddressListDialog, OkHdl_Impl) pStream->SetStreamCharSet(RTL_TEXTENCODING_UTF8); OUString sQuote('"'); - String sTempMiddle(sQuote); - sTempMiddle += sal_Unicode(9); + OUString sTempMiddle(sQuote); + sTempMiddle += OUString(sal_Unicode(9)); OUString sMiddle(sTempMiddle); sMiddle += sQuote; @@ -674,7 +674,7 @@ void SwCreateAddressListDialog::UpdateButtons() m_aDeletePB.Enable(nSize > 0); } -void SwCreateAddressListDialog::Find(const String& rSearch, sal_Int32 nColumn) +void SwCreateAddressListDialog::Find(const OUString& rSearch, sal_Int32 nColumn) { OUString sSearch = OUString(rSearch).toAsciiLowerCase(); sal_uInt32 nCurrent = m_pAddressControl->GetCurrentDataSet(); diff --git a/sw/source/ui/dbui/createaddresslistdialog.hxx b/sw/source/ui/dbui/createaddresslistdialog.hxx index 78c6b7884680..0eecf58cc6f8 100644 --- a/sw/source/ui/dbui/createaddresslistdialog.hxx +++ b/sw/source/ui/dbui/createaddresslistdialog.hxx @@ -61,8 +61,8 @@ class SwCreateAddressListDialog : public SfxModalDialog CancelButton m_aCancel; HelpButton m_aHelp; - String m_sAddressListFilterName; - String m_sURL; + OUString m_sAddressListFilterName; + OUString m_sURL; SwCSVData* m_pCSVData; SwFindEntryDialog* m_pFindDlg; @@ -79,11 +79,11 @@ class SwCreateAddressListDialog : public SfxModalDialog public: SwCreateAddressListDialog( - Window* pParent, const String& rURL, SwMailMergeConfigItem& rConfig); + Window* pParent, const OUString& rURL, SwMailMergeConfigItem& rConfig); ~SwCreateAddressListDialog(); - const String& GetURL() const { return m_sURL; } - void Find( const String& rSearch, sal_Int32 nColumn); + const OUString& GetURL() const { return m_sURL; } + void Find( const OUString& rSearch, sal_Int32 nColumn); }; class SwFindEntryDialog : public ModelessDialog diff --git a/sw/source/ui/dbui/customizeaddresslistdialog.cxx b/sw/source/ui/dbui/customizeaddresslistdialog.cxx index fcea7c22c667..d2cd6285086b 100644 --- a/sw/source/ui/dbui/customizeaddresslistdialog.cxx +++ b/sw/source/ui/dbui/customizeaddresslistdialog.cxx @@ -82,12 +82,12 @@ IMPL_LINK(SwCustomizeAddressListDialog, AddRenameHdl_Impl, PushButton*, pButton) pDlg = new SwAddEntryDialog(pButton, m_pNewData->aDBColumnHeaders); if(bRename) { - String aTemp = m_pFieldsLB->GetEntry(nPos); + OUString aTemp = m_pFieldsLB->GetEntry(nPos); pDlg->SetFieldName(aTemp); } if(RET_OK == pDlg->Execute()) { - String sNew = pDlg->GetFieldName(); + OUString sNew = pDlg->GetFieldName(); if(bRename) { m_pNewData->aDBColumnHeaders[nPos] = sNew; @@ -100,7 +100,7 @@ IMPL_LINK(SwCustomizeAddressListDialog, AddRenameHdl_Impl, PushButton*, pButton) //add the new column m_pNewData->aDBColumnHeaders.insert(m_pNewData->aDBColumnHeaders.begin() + nPos, sNew); //add a new entry into all data arrays - String sTemp; + OUString sTemp; std::vector< std::vector< OUString > >::iterator aDataIter; for( aDataIter = m_pNewData->aDBData.begin(); aDataIter != m_pNewData->aDBData.end(); ++aDataIter) aDataIter->insert(aDataIter->begin() + nPos, sTemp); @@ -136,7 +136,7 @@ IMPL_LINK(SwCustomizeAddressListDialog, UpDownHdl_Impl, PushButton*, pButton) { sal_uInt16 nPos; sal_uInt16 nOldPos = nPos = m_pFieldsLB->GetSelectEntryPos(); - String aTemp = m_pFieldsLB->GetEntry(nPos); + OUString aTemp = m_pFieldsLB->GetEntry(nPos); m_pFieldsLB->RemoveEntry( nPos ); if(pButton == m_pUpPB) --nPos; diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index 051b0a6b6163..cd8d8688b984 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -115,7 +115,7 @@ struct _DB_Column enum ColType { DB_FILLTEXT, DB_COL_FIELD, DB_COL_TEXT, DB_SPLITPARA } eColType; union { - String* pText; + OUString* pText; SwField* pField; sal_uLong nFormat; } DB_ColumnData; @@ -128,10 +128,10 @@ struct _DB_Column eColType = DB_SPLITPARA; } - _DB_Column( const String& rTxt ) + _DB_Column( const OUString& rTxt ) { pColInfo = 0; - DB_ColumnData.pText = new String( rTxt ); + DB_ColumnData.pText = new OUString( rTxt ); eColType = DB_FILLTEXT; } @@ -396,7 +396,7 @@ SwInsertDBColAutoPilot::SwInsertDBColAutoPilot( SwView& rView, for( sal_uInt16 n = 0; n < aDBColumns.size(); ++n ) { - const String& rS = aDBColumns[ n ]->sColumn; + const OUString& rS = aDBColumns[ n ]->sColumn; m_pLbTblDbColumn->InsertEntry( rS, n ); m_pLbTxtDbColumn->InsertEntry( rS, n ); } @@ -530,7 +530,7 @@ IMPL_LINK( SwInsertDBColAutoPilot, TblToFromHdl, Button*, pButton ) nInsPos = LISTBOX_ENTRY_NOTFOUND; while( ++it != aDBColumns.end() && LISTBOX_ENTRY_NOTFOUND == (nInsPos = m_pLbTblDbColumn-> - GetEntryPos( String( (*it)->sColumn ))) ) + GetEntryPos( OUString( (*it)->sColumn ))) ) ; } @@ -565,37 +565,36 @@ IMPL_LINK( SwInsertDBColAutoPilot, TblToFromHdl, Button*, pButton ) { bChgEnable = sal_False; // move data to Edit: - String aFld( m_pLbTxtDbColumn->GetSelectEntry() ); - if( aFld.Len() ) + OUString aFld( m_pLbTxtDbColumn->GetSelectEntry() ); + if( !aFld.isEmpty() ) { - String aStr( m_pEdDbText->GetText() ); + OUString aStr( m_pEdDbText->GetText() ); sal_uInt16 nPos = (sal_uInt16)m_pEdDbText->GetSelection().Min(); sal_uInt16 nSel = sal_uInt16(m_pEdDbText->GetSelection().Max()) - nPos; if( nSel ) // first delete the existing selection - aStr.Erase( nPos, nSel ); + aStr = aStr.replaceAt( nPos, nSel, "" ); - aFld.Insert( cDBFldStart, 0 ); - aFld += cDBFldEnd; - if( aStr.Len() ) + aFld = OUString(cDBFldStart) + aFld + OUString(cDBFldEnd); + if( !aStr.isEmpty() ) { if( nPos ) // one blank in front { - sal_Unicode c = aStr.GetChar( nPos-1 ); + sal_Unicode c = aStr[ nPos-1 ]; if( '\n' != c && '\r' != c ) - aFld.Insert( ' ', 0 ); + aFld = " " + aFld; } - if( nPos < aStr.Len() ) // one blank behind + if( nPos < aStr.getLength() ) // one blank behind { - sal_Unicode c = aStr.GetChar( nPos ); + sal_Unicode c = aStr[ nPos ]; if( '\n' != c && '\r' != c ) - aFld += ' '; + aFld += " "; } } - aStr.Insert( aFld, nPos ); + aStr = aStr.replaceAt( nPos, 0, aFld ); m_pEdDbText->SetText( aStr ); - nPos = nPos + aFld.Len(); + nPos = nPos + aFld.getLength(); m_pEdDbText->SetSelection( Selection( nPos )); } } @@ -791,7 +790,7 @@ IMPL_LINK( SwInsertDBColAutoPilot, SelectHdl, ListBox*, pBox ) { // set the selected FieldName at the FormatGroupBox, so that // it's clear what field is configured by the format! - String sTxt( m_pFormatFrame->get_label().copy( 0, nGBFmtLen )); + OUString sTxt( m_pFormatFrame->get_label().copy( 0, nGBFmtLen )); if( aSrch.sColumn.isEmpty() ) { m_pRbDbFmtFromDb->Enable( sal_False ); @@ -806,7 +805,7 @@ IMPL_LINK( SwInsertDBColAutoPilot, SelectHdl, ListBox*, pBox ) if( bEnableFmt ) { - (( sTxt += OUString(" (" )) += String(aSrch.sColumn) ) += (sal_Unicode)')'; + sTxt = sTxt + " (" + aSrch.sColumn + ")"; } sal_Bool bIsDBFmt = (*it)->bIsDBFmt; @@ -839,24 +838,24 @@ IMPL_LINK( SwInsertDBColAutoPilot, HeaderHdl, Button*, pButton ) return 0; } -static void lcl_InsTextInArr( const String& rTxt, _DB_Columns& rColArr ) +static void lcl_InsTextInArr( const OUString& rTxt, _DB_Columns& rColArr ) { _DB_Column* pNew; - sal_uInt16 nSttPos = 0, nFndPos; - while( STRING_NOTFOUND != ( nFndPos = rTxt.Search( '\x0A', nSttPos )) ) + sal_Int32 nSttPos = 0, nFndPos; + while( -1 != ( nFndPos = rTxt.indexOf( '\x0A', nSttPos )) ) { if( 1 < nFndPos ) { - pNew = new _DB_Column( rTxt.Copy( nSttPos, nFndPos -1 ) ); + pNew = new _DB_Column( rTxt.copy( nSttPos, nFndPos -1 ) ); rColArr.push_back( pNew ); } pNew = new _DB_Column; rColArr.push_back( pNew ); nSttPos = nFndPos + 1; } - if( nSttPos < rTxt.Len() ) + if( nSttPos < rTxt.getLength() ) { - pNew = new _DB_Column( rTxt.Copy( nSttPos ) ); + pNew = new _DB_Column( rTxt.copy( nSttPos ) ); rColArr.push_back( pNew ); } } @@ -868,16 +867,16 @@ bool SwInsertDBColAutoPilot::SplitTextToColArr( const OUString& rTxt, // create each of the database columns from the text again // and then save in an array // database columns are in <> and must be present in the columns' array: - String sTxt( rTxt ); - sal_uInt16 nFndPos, nEndPos, nSttPos = 0; + OUString sTxt( rTxt ); + sal_Int32 nFndPos, nEndPos, nSttPos = 0; - while( STRING_NOTFOUND != ( nFndPos = sTxt.Search( cDBFldStart, nSttPos ))) + while( -1 != ( nFndPos = sTxt.indexOf( cDBFldStart, nSttPos ))) { nSttPos = nFndPos + 1; - if( STRING_NOTFOUND != ( nEndPos = sTxt.Search( cDBFldEnd, nSttPos+1 ))) + if( -1 != ( nEndPos = sTxt.indexOf( cDBFldEnd, nSttPos+1 ))) { // Text in <> brackets found: what is it: - SwInsDBColumn aSrch( sTxt.Copy( nSttPos, nEndPos - nSttPos ), 0); + SwInsDBColumn aSrch( sTxt.copy( nSttPos, nEndPos - nSttPos ), 0); SwInsDBColumns::const_iterator it = aDBColumns.find( &aSrch ); if( it != aDBColumns.end() ) { @@ -889,11 +888,11 @@ bool SwInsertDBColAutoPilot::SplitTextToColArr( const OUString& rTxt, if( 1 < nSttPos ) { - ::lcl_InsTextInArr( sTxt.Copy( 0, nSttPos-1 ), rColArr ); - sTxt.Erase( 0, nSttPos-1 ); + ::lcl_InsTextInArr( sTxt.copy( 0, nSttPos-1 ), rColArr ); + sTxt = sTxt.copy( nSttPos-1 ); } - sTxt.Erase( 0, (xub_StrLen)(rFndCol.sColumn.getLength() + 2) ); + sTxt = sTxt.copy( rFndCol.sColumn.getLength() + 2 ); nSttPos = 0; sal_uInt16 nSubType = 0; @@ -931,7 +930,7 @@ bool SwInsertDBColAutoPilot::SplitTextToColArr( const OUString& rTxt, } // don't forget the last text - if( sTxt.Len() ) + if( !sTxt.isEmpty() ) ::lcl_InsTextInArr( sTxt, rColArr ); return !rColArr.empty(); @@ -1188,7 +1187,7 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection, SwTxtFmtColl* pColl = 0; { - String sTmplNm( m_pLbDbParaColl->GetSelectEntry() ); + OUString sTmplNm( m_pLbDbParaColl->GetSelectEntry() ); if( sNoTmpl != sTmplNm ) { pColl = rSh.FindTxtFmtCollByName( sTmplNm ); @@ -1600,12 +1599,12 @@ void SwInsertDBColAutoPilot::Commit() { OUString sColumnNode = sNewNode; SwInsDBColumn* pColumn = aDBColumns[nCol]; - String sColumnInsertNode(sColumnNode); + OUString sColumnInsertNode(sColumnNode); sColumnInsertNode += sDelim; if( nCol < 100 ) - sColumnInsertNode += '0'; + sColumnInsertNode += "0"; if( nCol < 10 ) - sColumnInsertNode += '0'; + sColumnInsertNode += "0"; sColumnInsertNode += OUString::number( nCol ); Sequence <OUString> aSubNodeNames = lcl_CreateSubNames(sColumnInsertNode); @@ -1740,18 +1739,18 @@ void SwInsertDBColAutoPilot::Load() pNewData->aDBColumns.insert(pInsDBColumn); } sal_Int32 n = 0; - String sTmp( pNewData->sTblList ); - if( sTmp.Len() ) + OUString sTmp( pNewData->sTblList ); + if( !sTmp.isEmpty() ) { do { - String sEntry( sTmp.GetToken( 0, '\x0a', n ) ); + OUString sEntry( sTmp.getToken( 0, '\x0a', n ) ); //preselect column - if they still exist! if(m_pLbTblDbColumn->GetEntryPos(sEntry) != LISTBOX_ENTRY_NOTFOUND) { m_pLbTableCol->InsertEntry( sEntry ); m_pLbTblDbColumn->RemoveEntry( sEntry ); } - } while( n < sTmp.Len() ); + } while( n < sTmp.getLength() ); if( !m_pLbTblDbColumn->GetEntryCount() ) { @@ -1764,14 +1763,14 @@ void SwInsertDBColAutoPilot::Load() m_pEdDbText->SetText( pNewData->sEdit ); sTmp = pNewData->sTmplNm; - if( sTmp.Len() ) + if( !sTmp.isEmpty() ) m_pLbDbParaColl->SelectEntry( sTmp ); else m_pLbDbParaColl->SelectEntryPos( 0 ); delete pTAutoFmt, pTAutoFmt = 0; sTmp = pNewData->sTAutoFmtNm; - if( sTmp.Len() ) + if( !sTmp.isEmpty() ) { // then load the AutoFmt file and look for Autoformat first SwTableAutoFmtTbl aAutoFmtTbl; diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx index 09983e4b3e06..a9466e648545 100644 --- a/sw/source/ui/dbui/dbmgr.cxx +++ b/sw/source/ui/dbui/dbmgr.cxx @@ -275,7 +275,7 @@ static sal_Bool lcl_MoveAbsolute(SwDSParam* pParam, long nAbsPos) } static sal_Bool lcl_GetColumnCnt(SwDSParam* pParam, - const String& rColumnName, long nLanguage, OUString& rResult, double* pNumber) + const OUString& rColumnName, long nLanguage, OUString& rResult, double* pNumber) { uno::Reference< XColumnsSupplier > xColsSupp( pParam->xResultSet, UNO_QUERY ); uno::Reference<XNameAccess> xCols; @@ -494,14 +494,14 @@ void SwNewDBMgr::ImportFromConnection( SwWrtShell* pSh ) } } -static String lcl_FindColumn(const String& sFormatStr,sal_uInt16 &nUsedPos, sal_uInt8 &nSeparator) +static OUString lcl_FindColumn(const OUString& sFormatStr,sal_uInt16 &nUsedPos, sal_uInt8 &nSeparator) { - String sReturn; - sal_uInt16 nLen = sFormatStr.Len(); + OUString sReturn; + sal_uInt16 nLen = sFormatStr.getLength(); nSeparator = 0xff; while(nUsedPos < nLen && nSeparator == 0xff) { - sal_Unicode cAkt = sFormatStr.GetChar(nUsedPos); + sal_Unicode cAkt = sFormatStr[nUsedPos]; switch(cAkt) { case ',': @@ -517,7 +517,7 @@ static String lcl_FindColumn(const String& sFormatStr,sal_uInt16 &nUsedPos, sa nSeparator = DB_SEP_NEWLINE; break; default: - sReturn += cAkt; + sReturn += OUString(cAkt); } nUsedPos++; @@ -531,16 +531,16 @@ void SwNewDBMgr::ImportDBEntry(SwWrtShell* pSh) { uno::Reference< XColumnsSupplier > xColsSupp( pImpl->pMergeData->xResultSet, UNO_QUERY ); uno::Reference<XNameAccess> xCols = xColsSupp->getColumns(); - String sFormatStr; - sal_uInt16 nFmtLen = sFormatStr.Len(); + OUString sFormatStr; + sal_uInt16 nFmtLen = sFormatStr.getLength(); if( nFmtLen ) { const char cSpace = ' '; const char cTab = '\t'; sal_uInt16 nUsedPos = 0; sal_uInt8 nSeparator; - String sColumn = lcl_FindColumn(sFormatStr, nUsedPos, nSeparator); - while( sColumn.Len() ) + OUString sColumn = lcl_FindColumn(sFormatStr, nUsedPos, nSeparator); + while( !sColumn.isEmpty() ) { if(!xCols->hasByName(sColumn)) return; @@ -550,11 +550,11 @@ void SwNewDBMgr::ImportDBEntry(SwWrtShell* pSh) if(xColumnProp.is()) { SwDBFormatData aDBFormat; - String sInsert = GetDBField( xColumnProp, aDBFormat); + OUString sInsert = GetDBField( xColumnProp, aDBFormat); if( DB_SEP_SPACE == nSeparator ) - sInsert += cSpace; + sInsert += OUString(cSpace); else if( DB_SEP_TAB == nSeparator) - sInsert += cTab; + sInsert += OUString(cTab); pSh->Insert(sInsert); if( DB_SEP_RETURN == nSeparator) pSh->SplitNode(); @@ -574,7 +574,7 @@ void SwNewDBMgr::ImportDBEntry(SwWrtShell* pSh) } else { - String sStr; + OUString sStr; Sequence<OUString> aColNames = xCols->getElementNames(); const OUString* pColNames = aColNames.getConstArray(); long nLength = aColNames.getLength(); @@ -586,7 +586,7 @@ void SwNewDBMgr::ImportDBEntry(SwWrtShell* pSh) SwDBFormatData aDBFormat; sStr += GetDBField( xColumnProp, aDBFormat); if (i < nLength - 1) - sStr += '\t'; + sStr += "\t"; } pSh->SwEditShell::Insert2(sStr); pSh->SwFEShell::SplitNode(); // line feed @@ -600,7 +600,7 @@ void SwNewDBMgr::ImportDBEntry(SwWrtShell* pSh) sal_Bool SwNewDBMgr::GetTableNames(ListBox* pListBox, const OUString& rDBName) { sal_Bool bRet = sal_False; - String sOldTableName(pListBox->GetSelectEntry()); + OUString sOldTableName(pListBox->GetSelectEntry()); pListBox->Clear(); SwDSParam* pParam = FindDSConnection(rDBName, sal_False); uno::Reference< XConnection> xConnection; @@ -638,7 +638,7 @@ sal_Bool SwNewDBMgr::GetTableNames(ListBox* pListBox, const OUString& rDBName) pListBox->SetEntryData(nEntry, (void*)1); } } - if (sOldTableName.Len()) + if (!sOldTableName.isEmpty()) pListBox->SelectEntry(sOldTableName); bRet = sal_True; } @@ -741,11 +741,11 @@ SwNewDBMgr::~SwNewDBMgr() /*-------------------------------------------------------------------- Description: save bulk letters as single documents --------------------------------------------------------------------*/ -static String lcl_FindUniqueName(SwWrtShell* pTargetShell, const String& rStartingPageDesc, sal_uLong nDocNo ) +static OUString lcl_FindUniqueName(SwWrtShell* pTargetShell, const OUString& rStartingPageDesc, sal_uLong nDocNo ) { do { - String sTest = rStartingPageDesc; + OUString sTest = rStartingPageDesc; sTest += OUString::number( nDocNo ); if( !pTargetShell->FindPageDescByName( sTest ) ) return sTest; @@ -790,11 +790,11 @@ static void lcl_CopyFollowPageDesc( { //now copy the follow page desc, too const SwPageDesc* pFollowPageDesc = rSourcePageDesc.GetFollow(); - String sFollowPageDesc = pFollowPageDesc->GetName(); + OUString sFollowPageDesc = pFollowPageDesc->GetName(); if( sFollowPageDesc != rSourcePageDesc.GetName() ) { SwDoc* pTargetDoc = rTargetShell.GetDoc(); - String sNewFollowPageDesc = lcl_FindUniqueName(&rTargetShell, sFollowPageDesc, nDocNo ); + OUString sNewFollowPageDesc = lcl_FindUniqueName(&rTargetShell, sFollowPageDesc, nDocNo ); sal_uInt16 nNewDesc = pTargetDoc->MakePageDesc( sNewFollowPageDesc ); SwPageDesc& rTargetFollowPageDesc = pTargetDoc->GetPageDesc( nNewDesc ); @@ -815,7 +815,7 @@ static void lcl_RemoveSectionLinks( SwWrtShell& rWorkShell ) if( aSectionData.GetType() == FILE_LINK_SECTION ) { aSectionData.SetType( CONTENT_SECTION ); - aSectionData.SetLinkFileName( String() ); + aSectionData.SetLinkFileName( OUString() ); rWorkShell.UpdateSection( nSection, aSectionData ); } } @@ -872,7 +872,7 @@ sal_Bool SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell, if( !pSourrceDocSh->IsModified() ) { SfxMedium* pOrig = pSourceShell->GetView().GetDocShell()->GetMedium(); - String sSourceDocumentURL(pOrig->GetURLObject().GetMainURL( INetURLObject::NO_DECODE )); + OUString sSourceDocumentURL(pOrig->GetURLObject().GetMainURL( INetURLObject::NO_DECODE )); const SfxFilter* pSfxFlt = SwIoSystem::GetFileFilter( sSourceDocumentURL, ::aEmptyStr ); const SfxFilter* pStoreToFilter = pSfxFlt; @@ -907,7 +907,7 @@ sal_Bool SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell, SwView* pTargetView = 0; std::auto_ptr< utl::TempFile > aTempFile; OUString sModifiedStartingPageDesc; - String sStartingPageDesc; + OUString sStartingPageDesc; sal_uInt16 nStartingPageNo = 0; bool bPageStylesWithHeaderFooter = false; if(bAsSingleFile || rMergeDescriptor.bCreateSingleFile) @@ -969,22 +969,22 @@ sal_Bool SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell, long nStartRow, nEndRow; // collect temporary files - ::std::vector< String> aFilesToRemove; + ::std::vector< OUString> aFilesToRemove; do { nStartRow = pImpl->pMergeData ? pImpl->pMergeData->xResultSet->getRow() : 0; { OUString sPath(sSubject); - String sAddress; + OUString sAddress; if( !bEMail && bColumnName ) { SwDBFormatData aDBFormat; aDBFormat.xFormatter = pImpl->pMergeData->xFormatter; aDBFormat.aNullDate = pImpl->pMergeData->aNullDate; sAddress = GetDBField( xColumnProp, aDBFormat); - if (!sAddress.Len()) - sAddress = '_'; + if (sAddress.isEmpty()) + sAddress = "_"; sPath += sAddress; } @@ -992,9 +992,9 @@ sal_Bool SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell, if( 1 == nDocNo || (!rMergeDescriptor.bCreateSingleFile && !bAsSingleFile) ) { INetURLObject aEntry(sPath); - String sLeading; + OUString sLeading; //#i97667# if the name is from a database field then it will be used _as is_ - if( sAddress.Len() ) + if( !sAddress.isEmpty() ) sLeading = sAddress; else sLeading = aEntry.GetBase(); @@ -1017,8 +1017,8 @@ sal_Bool SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell, { INetURLObject aTempFileURL(aTempFile->GetURL()); aPrtMonDlg.m_pPrinter->SetText( aTempFileURL.GetBase() ); - String sStat(SW_RES(STR_STATSTR_LETTER)); // Brief - sStat += ' '; + OUString sStat(SW_RES(STR_STATSTR_LETTER)); // Brief + sStat += " "; sStat += OUString::number( nDocNo ); aPrtMonDlg.m_pPrintInfo->SetText(sStat); @@ -1086,7 +1086,7 @@ sal_Bool SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell, SwDoc* pTargetDoc = pTargetShell->GetDoc(); SwPageDesc* pSourcePageDesc = rWorkShell.FindPageDescByName( sStartingPageDesc ); - String sNewPageDescName = lcl_FindUniqueName(pTargetShell, sStartingPageDesc, nDocNo ); + OUString sNewPageDescName = lcl_FindUniqueName(pTargetShell, sStartingPageDesc, nDocNo ); pTargetDoc->MakePageDesc( sNewPageDescName ); SwPageDesc* pTargetPageDesc = pTargetShell->FindPageDescByName( sNewPageDescName ); if(pSourcePageDesc && pTargetPageDesc) @@ -1124,7 +1124,7 @@ sal_Bool SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell, } else { - String sFileURL = aTempFileURL.GetMainURL( INetURLObject::NO_DECODE ); + OUString sFileURL = aTempFileURL.GetMainURL( INetURLObject::NO_DECODE ); SfxMedium* pDstMed = new SfxMedium( sFileURL, STREAM_STD_READWRITE ); @@ -1155,7 +1155,7 @@ sal_Bool SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell, SwDBFormatData aDBFormat; aDBFormat.xFormatter = pImpl->pMergeData->xFormatter; aDBFormat.aNullDate = pImpl->pMergeData->aNullDate; - String sMailAddress = GetDBField( xColumnProp, aDBFormat); + OUString sMailAddress = GetDBField( xColumnProp, aDBFormat); if(!SwMailMergeHelper::CheckMailAddress( sMailAddress )) { OSL_FAIL("invalid e-Mail address in database column"); @@ -1314,7 +1314,7 @@ sal_Bool SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell, } //remove the temporary files - ::std::vector<String>::iterator aFileIter; + ::std::vector<OUString>::iterator aFileIter; for(aFileIter = aFilesToRemove.begin(); aFileIter != aFilesToRemove.end(); ++aFileIter) SWUnoHelper::UCB_DeleteFile( *aFileIter ); @@ -1637,7 +1637,7 @@ OUString SwNewDBMgr::GetDBField(uno::Reference<XPropertySet> xColumnProps, double* pNumber) { uno::Reference< XColumn > xColumn(xColumnProps, UNO_QUERY); - String sRet; + OUString sRet; OSL_ENSURE(xColumn.is(), "SwNewDBMgr::::ImportDBField: illegal arguments"); if(!xColumn.is()) return sRet; @@ -1719,8 +1719,8 @@ sal_Bool SwNewDBMgr::IsDataSourceOpen(const OUString& rDataSource, if(pImpl->pMergeData) { return !bMergeLock && - ((rDataSource == (String)pImpl->pMergeData->sDataSource && - rTableOrQuery == (String)pImpl->pMergeData->sCommand) + ((rDataSource == pImpl->pMergeData->sDataSource && + rTableOrQuery == pImpl->pMergeData->sCommand) ||(rDataSource.isEmpty() && rTableOrQuery.isEmpty())) && pImpl->pMergeData->xResultSet.is(); @@ -1747,8 +1747,8 @@ sal_Bool SwNewDBMgr::GetColumnCnt(const OUString& rSourceName, const OUString& r SwDSParam* pFound = 0; //check if it's the merge data source if(pImpl->pMergeData && - rSourceName == (String)pImpl->pMergeData->sDataSource && - rTableName == (String)pImpl->pMergeData->sCommand) + rSourceName == pImpl->pMergeData->sDataSource && + rTableName == pImpl->pMergeData->sCommand) { pFound = pImpl->pMergeData; } @@ -1829,8 +1829,8 @@ sal_Bool SwNewDBMgr::ToNextRecord( { SwDSParam* pFound = 0; if(pImpl->pMergeData && - rDataSource == (String)pImpl->pMergeData->sDataSource && - rCommand == (String)pImpl->pMergeData->sCommand) + rDataSource == pImpl->pMergeData->sDataSource && + rCommand == pImpl->pMergeData->sCommand) pFound = pImpl->pMergeData; else { @@ -2015,8 +2015,8 @@ sal_uInt32 SwNewDBMgr::GetSelectedRecordId( { sal_uInt32 nRet = 0xffffffff; //check for merge data source first - if(pImpl->pMergeData && rDataSource == (String)pImpl->pMergeData->sDataSource && - rTableOrQuery == (String)pImpl->pMergeData->sCommand && + if(pImpl->pMergeData && rDataSource == pImpl->pMergeData->sDataSource && + rTableOrQuery == pImpl->pMergeData->sCommand && (nCommandType == -1 || nCommandType == pImpl->pMergeData->nCommandType) && pImpl->pMergeData->xResultSet.is()) nRet = GetSelectedRecordId(); @@ -2182,17 +2182,17 @@ OUString SwNewDBMgr::LoadAndRegisterDataSource() Reference<XFilterManager> xFltMgr(xFP, UNO_QUERY); - String sFilterAll(SW_RES(STR_FILTER_ALL)); - String sFilterAllData(SW_RES(STR_FILTER_ALL_DATA)); - String sFilterSXB(SW_RES(STR_FILTER_SXB)); - String sFilterSXC(SW_RES(STR_FILTER_SXC)); - String sFilterDBF(SW_RES(STR_FILTER_DBF)); - String sFilterXLS(SW_RES(STR_FILTER_XLS)); - String sFilterTXT(SW_RES(STR_FILTER_TXT)); - String sFilterCSV(SW_RES(STR_FILTER_CSV)); + OUString sFilterAll(SW_RES(STR_FILTER_ALL)); + OUString sFilterAllData(SW_RES(STR_FILTER_ALL_DATA)); + OUString sFilterSXB(SW_RES(STR_FILTER_SXB)); + OUString sFilterSXC(SW_RES(STR_FILTER_SXC)); + OUString sFilterDBF(SW_RES(STR_FILTER_DBF)); + OUString sFilterXLS(SW_RES(STR_FILTER_XLS)); + OUString sFilterTXT(SW_RES(STR_FILTER_TXT)); + OUString sFilterCSV(SW_RES(STR_FILTER_CSV)); #ifdef WNT - String sFilterMDB(SW_RES(STR_FILTER_MDB)); - String sFilterACCDB(SW_RES(STR_FILTER_ACCDB)); + OUString sFilterMDB(SW_RES(STR_FILTER_MDB)); + OUString sFilterACCDB(SW_RES(STR_FILTER_ACCDB)); #endif xFltMgr->appendFilter( sFilterAll, "*" ); xFltMgr->appendFilter( sFilterAllData, "*.ods;*.sxc;*.dbf;*.xls;*.txt;*.csv"); @@ -2209,11 +2209,11 @@ OUString SwNewDBMgr::LoadAndRegisterDataSource() #endif xFltMgr->setCurrentFilter( sFilterAll ) ; - String sFind; + OUString sFind; bool bTextConnection = false; if( ERRCODE_NONE == aDlgHelper.Execute() ) { - String sURL = xFP->getFiles().getConstArray()[0]; + OUString sURL = xFP->getFiles().getConstArray()[0]; //data sources have to be registered depending on their extensions INetURLObject aURL( sURL ); OUString sExt( aURL.GetExtension() ); @@ -2283,12 +2283,12 @@ OUString SwNewDBMgr::LoadAndRegisterDataSource() Reference<XComponentContext> xContext( ::comphelper::getProcessComponentContext() ); Reference<XDatabaseContext> xDBContext = DatabaseContext::create(xContext); - String sNewName = INetURLObject::decode( aURL.getName(), + OUString sNewName = INetURLObject::decode( aURL.getName(), INET_HEX_ESCAPE, INetURLObject::DECODE_UNAMBIGUOUS, RTL_TEXTENCODING_UTF8 ); - xub_StrLen nExtLen = static_cast< xub_StrLen >(aURL.GetExtension().getLength()); - sNewName.Erase( sNewName.Len() - nExtLen - 1, nExtLen + 1 ); + sal_Int32 nExtLen = aURL.GetExtension().getLength(); + sNewName = sNewName.replaceAt( sNewName.getLength() - nExtLen - 1, nExtLen + 1, "" ); //find a unique name if sNewName already exists sFind = sNewName; @@ -2338,7 +2338,7 @@ OUString SwNewDBMgr::LoadAndRegisterDataSource() Reference<XDocumentDataSource> xDS(xNewInstance, UNO_QUERY_THROW); Reference<XStorable> xStore(xDS->getDatabaseDocument(), UNO_QUERY_THROW); OUString sOutputExt = OUString(".odb"); - String sTmpName; + OUString sTmpName; { utl::TempFile aTempFile(sNewName , &sOutputExt, &sHomePath); aTempFile.EnableKillingFile(sal_True); @@ -2718,7 +2718,7 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig, rSourceShell.SttEndDoc(sal_True); sal_uInt16 nStartingPageNo = rSourceShell.GetVirtPageNum(); OUString sModifiedStartingPageDesc; - String sStartingPageDesc = sModifiedStartingPageDesc = rSourceShell.GetPageDesc( + OUString sStartingPageDesc = sModifiedStartingPageDesc = rSourceShell.GetPageDesc( rSourceShell.GetCurPageDesc()).GetName(); try @@ -2834,7 +2834,7 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig, //copy the pagedesc from the current document to the new document and change the name of the to-be-applied style SwDoc* pTargetDoc = pTargetShell->GetDoc(); - String sNewPageDescName = lcl_FindUniqueName(pTargetShell, sStartingPageDesc, nDocNo ); + OUString sNewPageDescName = lcl_FindUniqueName(pTargetShell, sStartingPageDesc, nDocNo ); pTargetShell->GetDoc()->MakePageDesc( sNewPageDescName ); SwPageDesc* pTargetPageDesc = pTargetShell->FindPageDescByName( sNewPageDescName ); const SwPageDesc* pWorkPageDesc = rWorkShell.FindPageDescByName( sStartingPageDesc ); diff --git a/sw/source/ui/dbui/dbtree.cxx b/sw/source/ui/dbui/dbtree.cxx index 0f0a3a987f43..dbe1365abc43 100644 --- a/sw/source/ui/dbui/dbtree.cxx +++ b/sw/source/ui/dbui/dbtree.cxx @@ -222,12 +222,12 @@ void SwDBTreeList::InitTreeList() Image aImg = aImageList.GetImage(IMG_DB); for(long i = 0; i < nCount; i++) { - String sDBName(pDBNames[i]); + OUString sDBName(pDBNames[i]); InsertEntry(sDBName, aImg, aImg, NULL, sal_True); } - String sDBName(sDefDBName.getToken(0, DB_DELIM)); - String sTableName(sDefDBName.getToken(1, DB_DELIM)); - String sColumnName(sDefDBName.getToken(2, DB_DELIM)); + OUString sDBName(sDefDBName.getToken(0, DB_DELIM)); + OUString sTableName(sDefDBName.getToken(1, DB_DELIM)); + OUString sColumnName(sDefDBName.getToken(2, DB_DELIM)); Select(sDBName, sTableName, sColumnName); bInitialized = true; @@ -282,8 +282,8 @@ void SwDBTreeList::RequestingChildren(SvTreeListEntry* pParent) try { - String sSourceName = GetEntryText(GetParent(pParent)); - String sTableName = GetEntryText(pParent); + OUString sSourceName = GetEntryText(GetParent(pParent)); + OUString sTableName = GetEntryText(pParent); if(!pImpl->GetContext()->hasByName(sSourceName)) return; @@ -337,7 +337,7 @@ void SwDBTreeList::RequestingChildren(SvTreeListEntry* pParent) long nCount = aColNames.getLength(); for (long i = 0; i < nCount; i++) { - String sName = pColNames[i]; + OUString sName = pColNames[i]; InsertEntry(sName, pParent); } } @@ -350,7 +350,7 @@ void SwDBTreeList::RequestingChildren(SvTreeListEntry* pParent) { try { - String sSourceName = GetEntryText(pParent); + OUString sSourceName = GetEntryText(pParent); if(!pImpl->GetContext()->hasByName(sSourceName)) return; Reference<XConnection> xConnection = pImpl->GetConnection(sSourceName); @@ -361,7 +361,7 @@ void SwDBTreeList::RequestingChildren(SvTreeListEntry* pParent) { Reference<XNameAccess> xTbls = xTSupplier->getTables(); Sequence< OUString> aTblNames = xTbls->getElementNames(); - String sTableName; + OUString sTableName; long nCount = aTblNames.getLength(); const OUString* pTblNames = aTblNames.getConstArray(); Image aImg = aImageList.GetImage(IMG_DBTABLE); @@ -379,7 +379,7 @@ void SwDBTreeList::RequestingChildren(SvTreeListEntry* pParent) { Reference<XNameAccess> xQueries = xQSupplier->getQueries(); Sequence< OUString> aQueryNames = xQueries->getElementNames(); - String sQueryName; + OUString sQueryName; long nCount = aQueryNames.getLength(); const OUString* pQueryNames = aQueryNames.getConstArray(); Image aImg = aImageList.GetImage(IMG_DBQUERY); diff --git a/sw/source/ui/dbui/mailmergechildwindow.cxx b/sw/source/ui/dbui/mailmergechildwindow.cxx index 0216245d9280..7164f0f6317d 100644 --- a/sw/source/ui/dbui/mailmergechildwindow.cxx +++ b/sw/source/ui/dbui/mailmergechildwindow.cxx @@ -246,10 +246,10 @@ class SwSendWarningBox_Impl : public MessageDialog { VclMultiLineEdit *m_pDetailED; public: - SwSendWarningBox_Impl(Window* pParent, const String& rDetails); + SwSendWarningBox_Impl(Window* pParent, const OUString& rDetails); }; -SwSendWarningBox_Impl::SwSendWarningBox_Impl(Window* pParent, const String& rDetails) +SwSendWarningBox_Impl::SwSendWarningBox_Impl(Window* pParent, const OUString& rDetails) : MessageDialog(pParent, "WarnEmailDialog", "modules/swriter/ui/warnemaildialog.ui") { get(m_pDetailED, "errors"); @@ -303,8 +303,8 @@ SwSendMailDialog::SwSendMailDialog(Window *pParent, SwMailMergeConfigItem& rConf m_nErrorCount(0) { m_nStatusHeight = m_aSeparatorFL.GetPosPixel().Y() - m_aStatusLB.GetPosPixel().Y(); - String sTask(SW_RES(ST_TASK)); - String sStatus(SW_RES(ST_STATUS)); + OUString sTask(SW_RES(ST_TASK)); + OUString sStatus(SW_RES(ST_STATUS)); m_aStatusLB.SetHelpId(HID_MM_SENDMAILS_STATUSLB); FreeResource(); @@ -534,8 +534,8 @@ void SwSendMailDialog::IterateMails() Image aInsertImg = m_aImageList.GetImage( FN_FORMULA_CANCEL ); OUString sMessage = m_sSendingTo; - String sTmp(pCurrentMailDescriptor->sEMail); - sTmp += '\t'; + OUString sTmp(pCurrentMailDescriptor->sEMail); + sTmp += "\t"; sTmp += m_sFailed; m_aStatusLB.InsertEntry( sMessage.replaceFirst("%1", sTmp), aInsertImg, aInsertImg); ++m_nSendCount; @@ -572,25 +572,25 @@ void SwSendMailDialog::IterateMails() //CC and BCC are tokenized by ';' if(!pCurrentMailDescriptor->sCC.isEmpty()) { - String sTokens( pCurrentMailDescriptor->sCC ); + OUString sTokens( pCurrentMailDescriptor->sCC ); sal_uInt16 nTokens = comphelper::string::getTokenCount(sTokens, ';'); sal_Int32 nPos = 0; for( sal_uInt16 nToken = 0; nToken < nTokens; ++nToken) { - String sTmp = sTokens.GetToken( 0, ';', nPos); - if( sTmp.Len() ) + OUString sTmp = sTokens.getToken( 0, ';', nPos); + if( !sTmp.isEmpty() ) pMessage->addCcRecipient( sTmp ); } } if(!pCurrentMailDescriptor->sBCC.isEmpty()) { - String sTokens( pCurrentMailDescriptor->sBCC ); + OUString sTokens( pCurrentMailDescriptor->sBCC ); sal_uInt16 nTokens = comphelper::string::getTokenCount(sTokens, ';'); sal_Int32 nPos = 0; for( sal_uInt16 nToken = 0; nToken < nTokens; ++nToken) { - String sTmp = sTokens.GetToken( 0, ';', nPos); - if( sTmp.Len() ) + OUString sTmp = sTokens.getToken( 0, ';', nPos); + if( !sTmp.isEmpty() ) pMessage->addBccRecipient( sTmp ); } } diff --git a/sw/source/ui/dbui/mailmergehelper.cxx b/sw/source/ui/dbui/mailmergehelper.cxx index 39265ac49aea..d876c965e298 100644 --- a/sw/source/ui/dbui/mailmergehelper.cxx +++ b/sw/source/ui/dbui/mailmergehelper.cxx @@ -74,13 +74,13 @@ OUString CallSaveAsDialog(OUString& rFilter) */ bool CheckMailAddress( const OUString& rMailAddress ) { - String sAddress(rMailAddress); + OUString sAddress(rMailAddress); if (!(comphelper::string::getTokenCount(sAddress, '@') == 2)) return false; - sAddress = sAddress.GetToken(1, '@'); + sAddress = sAddress.getToken(1, '@'); if (comphelper::string::getTokenCount(sAddress, '.') < 2) return false; - if(sAddress.GetToken( 0, '.').Len() < 2 || sAddress.GetToken( 1, '.').Len() < 2) + if(sAddress.getToken( 0, '.').getLength() < 2 || sAddress.getToken( 1, '.').getLength() < 2) return false; return true; } @@ -112,7 +112,7 @@ uno::Reference< mail::XSmtpService > ConnectToSmtpServer( rConfigItem.IsInServerPOP() ? mail::MailServiceType_POP3 : mail::MailServiceType_IMAP); //authenticate at the POP or IMAP server first - String sPasswd = rConfigItem.GetInServerPassword(); + OUString sPasswd = rConfigItem.GetInServerPassword(); if(!rInMailServerPassword.isEmpty()) sPasswd = rInMailServerPassword; uno::Reference<mail::XAuthenticator> xAuthenticator = @@ -136,7 +136,7 @@ uno::Reference< mail::XSmtpService > ConnectToSmtpServer( !rConfigItem.IsSMTPAfterPOP() && !rConfigItem.GetMailUserName().isEmpty()) { - String sPasswd = rConfigItem.GetMailPassword(); + OUString sPasswd = rConfigItem.GetMailPassword(); if(!rOutMailServerPassword.isEmpty()) sPasswd = rOutMailServerPassword; xAuthenticator = @@ -455,14 +455,14 @@ void SwAddressPreview::DrawText_Impl( DrawRect(Rectangle(rTopLeft, rSize)); } sal_Int32 nHeight = GetTextHeight(); - String sAddress(rAddress); + OUString sAddress(rAddress); sal_uInt16 nTokens = comphelper::string::getTokenCount(sAddress, '\n'); Point aStart = rTopLeft; //put it away from the border aStart.Move( 2, 2); for(sal_uInt16 nToken = 0; nToken < nTokens; nToken++) { - DrawText( aStart, sAddress.GetToken(nToken, '\n') ); + DrawText( aStart, sAddress.getToken(nToken, '\n') ); aStart.Y() += nHeight; } } @@ -483,15 +483,13 @@ OUString SwAddressPreview::FillData( rConfigItem.GetCurrentDBData() ); const OUString* pAssignment = aAssignment.getConstArray(); const ResStringArray& rDefHeaders = rConfigItem.GetDefaultAddressHeaders(); - String sAddress(rAddress); - String sNotAssigned(SW_RES(STR_NOTASSIGNED)); - sNotAssigned.Insert('<', 0); - sNotAssigned += '>'; + OUString sAddress(rAddress); + OUString sNotAssigned = "<" + OUString(SW_RES(STR_NOTASSIGNED)) + ">"; sal_Bool bIncludeCountry = rConfigItem.IsIncludeCountry(); const OUString rExcludeCountry = rConfigItem.GetExcludeCountry(); bool bSpecialReplacementForCountry = (!bIncludeCountry || !rExcludeCountry.isEmpty()); - String sCountryColumn; + OUString sCountryColumn; if( bSpecialReplacementForCountry ) { sCountryColumn = rDefHeaders.GetString(MM_PART_COUNTRY); @@ -502,7 +500,7 @@ OUString SwAddressPreview::FillData( } SwAddressIterator aIter(sAddress); - sAddress.Erase(); + sAddress = ""; while(aIter.HasMore()) { SwMergeAddressItem aItem = aIter.Next(); @@ -511,7 +509,7 @@ OUString SwAddressPreview::FillData( //get the default column name //find the appropriate assignment - String sConvertedColumn = aItem.sText; + OUString sConvertedColumn = aItem.sText; for(sal_uInt16 nColumn = 0; nColumn < rDefHeaders.Count() && nColumn < aAssignment.getLength(); ++nColumn) @@ -523,7 +521,7 @@ OUString SwAddressPreview::FillData( break; } } - if(sConvertedColumn.Len() && + if(!sConvertedColumn.isEmpty() && xColAccess.is() && xColAccess->hasByName(sConvertedColumn)) { diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx index 2dcfcd449e0c..e9ead95be476 100644 --- a/sw/source/ui/dbui/mmaddressblockpage.cxx +++ b/sw/source/ui/dbui/mmaddressblockpage.cxx @@ -265,7 +265,7 @@ IMPL_LINK_NOARG(SwMailMergeAddressBlockPage, AddressBlockSelectHdl_Impl) sal_uInt16 nSel = m_aSettingsWIN.GetSelectedAddress(); const uno::Sequence< OUString> aBlocks = m_pWizard->GetConfigItem().GetAddressBlocks(); - String sPreview = SwAddressPreview::FillData(aBlocks[nSel], m_pWizard->GetConfigItem()); + OUString sPreview = SwAddressPreview::FillData(aBlocks[nSel], m_pWizard->GetConfigItem()); m_aPreviewWIN.SetAddress(sPreview); m_pWizard->GetConfigItem().SetCurrentAddressBlockIndex( nSel ); GetWizard()->UpdateRoadmap(); @@ -312,7 +312,7 @@ IMPL_LINK(SwMailMergeAddressBlockPage, InsertDataHdl_Impl, ImageButton*, pButton sal_uInt16 nSel = m_aSettingsWIN.GetSelectedAddress(); const uno::Sequence< OUString> aBlocks = m_pWizard->GetConfigItem().GetAddressBlocks(); - String sPreview = SwAddressPreview::FillData(aBlocks[nSel], rConfig); + OUString sPreview = SwAddressPreview::FillData(aBlocks[nSel], rConfig); m_aPreviewWIN.SetAddress(sPreview); } } @@ -565,11 +565,11 @@ SwCustomizeAddressBlockDialog::SwCustomizeAddressBlockDialog( { m_pFieldFT->Show(); m_pFieldCB->Show(); - SvTreeListEntry* pEntry = m_pAddressElementsLB->InsertEntry(String(SW_RES(ST_SALUTATION ))); + SvTreeListEntry* pEntry = m_pAddressElementsLB->InsertEntry(OUString(SW_RES(ST_SALUTATION ))); pEntry->SetUserData((void*)(sal_Int32)USER_DATA_SALUTATION ); - pEntry = m_pAddressElementsLB->InsertEntry(String(SW_RES(ST_PUNCTUATION))); + pEntry = m_pAddressElementsLB->InsertEntry(OUString(SW_RES(ST_PUNCTUATION))); pEntry->SetUserData((void*)(sal_Int32)USER_DATA_PUNCTUATION ); - pEntry = m_pAddressElementsLB->InsertEntry(String(SW_RES(ST_TEXT ))); + pEntry = m_pAddressElementsLB->InsertEntry(OUString(SW_RES(ST_TEXT ))); pEntry->SetUserData((void*)(sal_Int32)USER_DATA_TEXT ); ResStringArray aSalutArr(SW_RES( eType == GREETING_MALE ? RA_SALUTATION_MALE : RA_SALUTATION_FEMALE)); @@ -580,16 +580,16 @@ SwCustomizeAddressBlockDialog::SwCustomizeAddressBlockDialog( for(i = 0; i < aPunctArr.Count(); ++i) m_aPunctuations.push_back(aPunctArr.GetString(i)); m_pDragED->SetText(OUString(" ")); - SetText( String( SW_RES( eType == GREETING_MALE ? ST_TITLE_MALE : ST_TITLE_FEMALE))); - m_pAddressElementsFT->SetText(String(SW_RES(ST_SALUTATIONELEMENTS))); - m_pInsertFieldIB->SetQuickHelpText(String(SW_RES(ST_INSERTSALUTATIONFIELD))); - m_pRemoveFieldIB->SetQuickHelpText(String(SW_RES(ST_REMOVESALUTATIONFIELD))); - m_pDragFT->SetText(String(SW_RES(ST_DRAGSALUTATION))); + SetText( OUString( SW_RES( eType == GREETING_MALE ? ST_TITLE_MALE : ST_TITLE_FEMALE))); + m_pAddressElementsFT->SetText(OUString(SW_RES(ST_SALUTATIONELEMENTS))); + m_pInsertFieldIB->SetQuickHelpText(OUString(SW_RES(ST_INSERTSALUTATIONFIELD))); + m_pRemoveFieldIB->SetQuickHelpText(OUString(SW_RES(ST_REMOVESALUTATIONFIELD))); + m_pDragFT->SetText(OUString(SW_RES(ST_DRAGSALUTATION))); } else { if(eType == ADDRESSBLOCK_EDIT) - SetText(String(SW_RES(ST_TITLE_EDIT))); + SetText(OUString(SW_RES(ST_TITLE_EDIT))); m_pDragED->SetText(OUString("\n\n\n\n\n")); } @@ -637,7 +637,7 @@ IMPL_LINK(SwCustomizeAddressBlockDialog, ListBoxSelectHdl_Impl, DDListBox*, pBox IMPL_LINK_NOARG(SwCustomizeAddressBlockDialog, EditModifyHdl_Impl) { - String sAddress = SwAddressPreview::FillData( + OUString sAddress = SwAddressPreview::FillData( GetAddress(), m_rConfigItem); m_pPreviewWIN->SetAddress(sAddress); @@ -652,9 +652,7 @@ IMPL_LINK(SwCustomizeAddressBlockDialog, ImageButtonHdl_Impl, ImageButton*, pBut SvTreeListEntry* pEntry = m_pAddressElementsLB->GetCurEntry(); if(pEntry) { - String sEntry = m_pAddressElementsLB->GetEntryText(pEntry); - sEntry.Insert('<', 0); - sEntry += '>'; + OUString sEntry = "<" + m_pAddressElementsLB->GetEntryText(pEntry) + ">"; m_pDragED->InsertNewEntry(sEntry); } } @@ -680,13 +678,13 @@ IMPL_LINK(SwCustomizeAddressBlockDialog, ImageButtonHdl_Impl, ImageButton*, pBut sal_Int32 SwCustomizeAddressBlockDialog::GetSelectedItem_Impl() { sal_Int32 nRet = USER_DATA_NONE; - String sSelected = m_pDragED->GetCurrentItem(); - if(sSelected.Len()) + OUString sSelected = m_pDragED->GetCurrentItem(); + if(!sSelected.isEmpty()) for(sal_uLong i = 0; i < m_pAddressElementsLB->GetEntryCount(); ++i) { SvTreeListEntry* pEntry = m_pAddressElementsLB->GetEntry(i); - String sEntry = m_pAddressElementsLB->GetEntryText(pEntry); - if( sSelected.Equals( sEntry, 1, sSelected.Len() - 2 ) ) + OUString sEntry = m_pAddressElementsLB->GetEntryText(pEntry); + if( sSelected == sEntry.copy( 1, sSelected.getLength() - 2 ) ) { nRet = (sal_Int32)(sal_IntPtr)pEntry->GetUserData(); break; @@ -698,7 +696,7 @@ sal_Int32 SwCustomizeAddressBlockDialog::GetSelectedItem_Impl() bool SwCustomizeAddressBlockDialog::HasItem_Impl(sal_Int32 nUserData) { //get the entry from the ListBox - String sEntry; + OUString sEntry; for(sal_uLong i = 0; i < m_pAddressElementsLB->GetEntryCount(); ++i) { SvTreeListEntry* pEntry = m_pAddressElementsLB->GetEntry(i); @@ -709,11 +707,10 @@ bool SwCustomizeAddressBlockDialog::HasItem_Impl(sal_Int32 nUserData) } } //put it into '<>' - sEntry += '>'; - sEntry.Insert( '<', 0); + sEntry = "<" + sEntry + ">"; //search for this entry in the content - String sText = m_pDragED->GetText(); - bool bRet = sText.Search(sEntry) != STRING_NOTFOUND; + OUString sText = m_pDragED->GetText(); + bool bRet = sText.indexOf(sEntry) != -1; return bRet; } @@ -734,8 +731,8 @@ IMPL_LINK(SwCustomizeAddressBlockDialog, SelectionChangedHdl_Impl, AddressMultiL if(m_pFieldCB->IsVisible() && (USER_DATA_NONE != nSelected) && (nSelected < 0)) { //search in ListBox if it's one of the first entries - String sSelect; - ::std::vector<String>* pVector = 0; + OUString sSelect; + ::std::vector<OUString>* pVector = 0; switch(nSelected) { case USER_DATA_SALUTATION: sSelect = m_sCurrentSalutation; @@ -751,7 +748,7 @@ IMPL_LINK(SwCustomizeAddressBlockDialog, SelectionChangedHdl_Impl, AddressMultiL } m_pFieldCB->Clear(); if(pVector) { - ::std::vector<String>::iterator aIterator; + ::std::vector<OUString>::iterator aIterator; for( aIterator = pVector->begin(); aIterator != pVector->end(); ++aIterator) m_pFieldCB->InsertEntry(*aIterator); } @@ -774,7 +771,7 @@ IMPL_LINK_NOARG(SwCustomizeAddressBlockDialog, FieldChangeHdl_Impl) { //changing the field content changes the related members, too sal_Int32 nSelected = GetSelectedItem_Impl(); - String sContent = m_pFieldCB->GetText(); + OUString sContent = m_pFieldCB->GetText(); switch(nSelected) { case USER_DATA_SALUTATION: m_sCurrentSalutation = sContent; @@ -814,22 +811,20 @@ void SwCustomizeAddressBlockDialog::SetAddress(const OUString& rAddress) OUString SwCustomizeAddressBlockDialog::GetAddress() { - String sAddress(m_pDragED->GetAddress()); + OUString sAddress(m_pDragED->GetAddress()); //remove placeholders by the actual content if(m_pFieldFT->IsVisible()) { for(sal_uLong i = 0; i < m_pAddressElementsLB->GetEntryCount(); ++i) { SvTreeListEntry* pEntry = m_pAddressElementsLB->GetEntry(i); - String sEntry = m_pAddressElementsLB->GetEntryText(pEntry); - sEntry += '>'; - sEntry.Insert('<', 0); + OUString sEntry = "<" + m_pAddressElementsLB->GetEntryText(pEntry) + ">"; sal_Int32 nUserData = (sal_Int32)(sal_IntPtr)pEntry->GetUserData(); switch(nUserData) { - case USER_DATA_SALUTATION : sAddress.SearchAndReplace(sEntry, m_sCurrentSalutation); break; - case USER_DATA_PUNCTUATION: sAddress.SearchAndReplace(sEntry, m_sCurrentPunctuation); break; - case USER_DATA_TEXT : sAddress.SearchAndReplace(sEntry, m_sCurrentText); break; + case USER_DATA_SALUTATION : sAddress = sAddress.replaceFirst(sEntry, m_sCurrentSalutation); break; + case USER_DATA_PUNCTUATION: sAddress = sAddress.replaceFirst(sEntry, m_sCurrentPunctuation); break; + case USER_DATA_TEXT : sAddress = sAddress.replaceFirst(sEntry, m_sCurrentText); break; } } } @@ -1279,15 +1274,9 @@ void DDListBox::StartDrag( sal_Int8 /*nAction*/, const Point& /*rPosPixel*/ ) //special entries can only be once in the address / greeting if(nUserData >= 0 || !m_pParentDialog->HasItem_Impl(nUserData)) { - String sEntry; - sEntry = GetEntryText(pEntry); - sEntry.Insert('<', 0); - sEntry += '>'; - if(sEntry.Len()) - { - pContainer->CopyString( sEntry ); - pContainer->StartDrag( this, DND_ACTION_COPY, GetDragFinishedHdl() ); - } + OUString sEntry = "<" + GetEntryText(pEntry) + ">"; + pContainer->CopyString( sEntry ); + pContainer->StartDrag( this, DND_ACTION_COPY, GetDragFinishedHdl() ); } } } @@ -1365,18 +1354,18 @@ void AddressMultiLineEdit::SetText( const OUString& rStr ) for(sal_uLong nPara = 0; nPara < nParaCount; ++nPara) { xub_StrLen nIndex = 0; - String sPara = pTextEngine->GetText( nPara ); - if(sPara.Len() && sPara.GetChar(sPara.Len() - 1) != ' ') + OUString sPara = pTextEngine->GetText( nPara ); + if(!sPara.isEmpty() && sPara[sPara.getLength() - 1] != ' ') { - TextPaM aPaM(nPara, sPara.Len()); + TextPaM aPaM(nPara, sPara.getLength()); pTextEngine->ReplaceText(TextSelection( aPaM ), OUString(' ')); } while(true) { - sal_uInt16 nStart = sPara.Search( '<', nIndex ); - sal_uInt16 nEnd = sPara.Search( '>', nStart ); + sal_Int32 nStart = sPara.indexOf( '<', nIndex ); + sal_Int32 nEnd = sPara.indexOf( '>', nStart ); nIndex = nEnd; - if(nStart != STRING_NOTFOUND && nEnd != STRING_NOTFOUND) + if(nStart != -1 && nEnd != -1) pTextEngine->SetAttrib( aProtectAttr, nPara, nStart, nEnd + 1, sal_False ); else break; @@ -1447,7 +1436,7 @@ void AddressMultiLineEdit::RemoveCurrentEntry() { sal_uLong nPara = rSelection.GetStart().GetPara(); TextSelection aEntrySel(TextPaM( nPara, pBeginAttrib->GetStart()), TextPaM(nPara, pBeginAttrib->GetEnd())); - pTextEngine->ReplaceText(aEntrySel, String()); + pTextEngine->ReplaceText(aEntrySel, OUString()); //restore the attributes SetText( GetAddress() ); Modify(); @@ -1468,9 +1457,9 @@ void AddressMultiLineEdit::MoveCurrentItem(sal_uInt16 nMove) sal_uLong nPara = rSelection.GetStart().GetPara(); sal_uInt16 nIndex = pBeginAttrib->GetStart(); TextSelection aEntrySel(TextPaM( nPara, pBeginAttrib->GetStart()), TextPaM(nPara, pBeginAttrib->GetEnd())); - String sCurrentItem = pTextEngine->GetText(aEntrySel); + OUString sCurrentItem = pTextEngine->GetText(aEntrySel); pTextEngine->RemoveAttrib( nPara, *pBeginAttrib ); - pTextEngine->ReplaceText(aEntrySel, String()); + pTextEngine->ReplaceText(aEntrySel, OUString()); switch(nMove) { case MOVE_ITEM_LEFT : @@ -1601,9 +1590,9 @@ OUString AddressMultiLineEdit::GetAddress() sal_uLong nParaCount = pTextEngine->GetParagraphCount(); for(sal_uLong nPara = nParaCount; nPara; --nPara) { - String sPara = comphelper::string::stripEnd(pTextEngine->GetText(nPara - 1), ' '); + OUString sPara = comphelper::string::stripEnd(pTextEngine->GetText(nPara - 1), ' '); //don't add empty trailing paragraphs - if(!sRet.isEmpty() || sPara.Len()) + if(!sRet.isEmpty() || !sPara.isEmpty()) { sRet = sPara + sRet; //insert the para break diff --git a/sw/source/ui/dbui/mmaddressblockpage.hxx b/sw/source/ui/dbui/mmaddressblockpage.hxx index 929cfe288c81..4e7f9aba939d 100644 --- a/sw/source/ui/dbui/mmaddressblockpage.hxx +++ b/sw/source/ui/dbui/mmaddressblockpage.hxx @@ -234,8 +234,8 @@ private: OKButton* m_pOK; - ::std::vector<String> m_aSalutations; - ::std::vector<String> m_aPunctuations; + ::std::vector<OUString> m_aSalutations; + ::std::vector<OUString> m_aPunctuations; OUString m_sCurrentSalutation; OUString m_sCurrentPunctuation; diff --git a/sw/source/ui/dbui/mmconfigitem.cxx b/sw/source/ui/dbui/mmconfigitem.cxx index ad5052e72605..89b15ee271e8 100644 --- a/sw/source/ui/dbui/mmconfigitem.cxx +++ b/sw/source/ui/dbui/mmconfigitem.cxx @@ -297,10 +297,10 @@ SwMailMergeConfigItem_Impl::SwMailMergeConfigItem_Impl() : sal_Int32 nAssign; for(nAssign = 0; nAssign < aAssignProperties.getLength(); nAssign += 4) { - String sAssignPath = OUString::createFromAscii(cAddressDataAssignments); - sAssignPath += '/'; - sAssignPath += String(pAssignments[nAssign / 4]); - sAssignPath += '/'; + OUString sAssignPath = OUString::createFromAscii(cAddressDataAssignments); + sAssignPath += "/"; + sAssignPath += pAssignments[nAssign / 4]; + sAssignPath += "/"; pAssignProperties[nAssign] = sAssignPath; pAssignProperties[nAssign] += OUString::createFromAscii(cDataSourceName); pAssignProperties[nAssign + 1] = sAssignPath; @@ -393,11 +393,8 @@ static void lcl_ConvertToNumbers(OUString& rBlock, const ResStringArray& rHeader OUString sBlock(rBlock.replaceAll("\n", OUString("\\n"))); for(sal_uInt16 i = 0; i < rHeaders.Count(); ++i) { - String sHeader = rHeaders.GetString( i ); - sHeader.Insert('<', 0); - sHeader += '>'; - String sReplace("<>"); - sReplace.Insert('0' + i, 1); + OUString sHeader = "<" + rHeaders.GetString( i ) + ">"; + OUString sReplace = "<" + OUString('0' + i) + ">"; sBlock = sBlock.replaceAll(sHeader, sReplace); } rBlock = sBlock; @@ -1308,7 +1305,7 @@ bool SwMailMergeConfigItem::IsAddressFieldsAssigned() const SwMergeAddressItem aItem = aIter.Next(); if(aItem.bIsColumn) { - String sConvertedColumn = aItem.sText; + OUString sConvertedColumn = aItem.sText; for(sal_uInt16 nColumn = 0; nColumn < rHeaders.Count() && nColumn < aAssignment.getLength(); ++nColumn) @@ -1367,7 +1364,7 @@ bool SwMailMergeConfigItem::IsGreetingFieldsAssigned() const SwMergeAddressItem aItem = aIter.Next(); if(aItem.bIsColumn) { - String sConvertedColumn = aItem.sText; + OUString sConvertedColumn = aItem.sText; for(sal_uInt16 nColumn = 0; nColumn < rHeaders.Count() && nColumn < aAssignment.getLength(); ++nColumn) diff --git a/sw/source/ui/dbui/mmdocselectpage.cxx b/sw/source/ui/dbui/mmdocselectpage.cxx index de3b9599e43a..43ea2e41e986 100644 --- a/sw/source/ui/dbui/mmdocselectpage.cxx +++ b/sw/source/ui/dbui/mmdocselectpage.cxx @@ -137,7 +137,7 @@ IMPL_LINK(SwMailMergeDocSelectPage, FileSelectHdl, PushButton*, pButton) { if( pFlt && pFlt->IsAllowedAsTemplate() ) { - const String sWild = pFlt->GetWildcard().getGlob(); + const OUString sWild = pFlt->GetWildcard().getGlob(); xFltMgr->appendFilter( pFlt->GetUIName(), sWild ); // #i40125 diff --git a/sw/source/ui/dbui/mmgreetingspage.cxx b/sw/source/ui/dbui/mmgreetingspage.cxx index d5d6f1a7c621..08f14ea52c74 100644 --- a/sw/source/ui/dbui/mmgreetingspage.cxx +++ b/sw/source/ui/dbui/mmgreetingspage.cxx @@ -132,8 +132,8 @@ void SwGreetingsHandler::UpdatePreview() IMPL_LINK(SwMailMergeGreetingsPage, AssignHdl_Impl, PushButton*, pButton) { - String sPreview = m_aFemaleLB.GetSelectEntry(); - sPreview += '\n'; + OUString sPreview = m_aFemaleLB.GetSelectEntry(); + sPreview += "\n"; sPreview += m_aMaleLB.GetSelectEntry(); SwAssignFieldsDialog* pDlg = new SwAssignFieldsDialog(pButton, m_pWizard->GetConfigItem(), sPreview, false); @@ -201,7 +201,7 @@ void SwMailMergeGreetingsPage::UpdatePreview() } } - String sPreview = bFemale ? OUString(m_aFemaleLB.GetSelectEntry()) : + OUString sPreview = bFemale ? OUString(m_aFemaleLB.GetSelectEntry()) : bNoValue ? m_aNeutralCB.GetText() : OUString(m_aMaleLB.GetSelectEntry()); sPreview = SwAddressPreview::FillData(sPreview, m_pWizard->GetConfigItem()); diff --git a/sw/source/ui/dbui/mmlayoutpage.cxx b/sw/source/ui/dbui/mmlayoutpage.cxx index a3edf7842e9c..13dfa038d541 100644 --- a/sw/source/ui/dbui/mmlayoutpage.cxx +++ b/sw/source/ui/dbui/mmlayoutpage.cxx @@ -315,14 +315,14 @@ SwFrmFmt* SwMailMergeLayoutPage::InsertAddressFrame( SwFldMgr aFldMgr(&rShell); //create a database string source.command.commandtype.column const SwDBData& rData = rConfigItem.GetCurrentDBData(); - String sDBName(rData.sDataSource); - sDBName += DB_DELIM; - sDBName += String(rData.sCommand); - sDBName += DB_DELIM; + OUString sDBName(rData.sDataSource); + sDBName += OUString(DB_DELIM); + sDBName += rData.sCommand; + sDBName += OUString(DB_DELIM); OUString sDatabaseConditionPrefix(sDBName); sDatabaseConditionPrefix = sDatabaseConditionPrefix.replace(DB_DELIM, '.'); sDBName += OUString::number(rData.nCommandType); - sDBName += DB_DELIM; + sDBName += OUString(DB_DELIM); // if only the country is in an address line the // paragraph has to be hidden depending on the @@ -334,7 +334,7 @@ SwFrmFmt* SwMailMergeLayoutPage::InsertAddressFrame( bool bSpecialReplacementForCountry = (!bIncludeCountry || !rExcludeCountry.isEmpty()); const ResStringArray& rHeaders = rConfigItem.GetDefaultAddressHeaders(); - String sCountryColumn = rHeaders.GetString(MM_PART_COUNTRY); + OUString sCountryColumn = rHeaders.GetString(MM_PART_COUNTRY); Sequence< OUString> aAssignment = rConfigItem.GetColumnAssignment( rConfigItem.GetCurrentDBData() ); const OUString* pAssignment = aAssignment.getConstArray(); @@ -348,7 +348,7 @@ SwFrmFmt* SwMailMergeLayoutPage::InsertAddressFrame( SwMergeAddressItem aItem = aIter.Next(); if(aItem.bIsColumn) { - String sConvertedColumn = aItem.sText; + OUString sConvertedColumn = aItem.sText; for(sal_uInt16 nColumn = 0; nColumn < rHeaders.Count() && nColumn < aAssignment.getLength(); ++nColumn) @@ -360,32 +360,22 @@ SwFrmFmt* SwMailMergeLayoutPage::InsertAddressFrame( break; } } - String sDB(sDBName); + OUString sDB(sDBName); sDB += sConvertedColumn; - if (!sHideParagraphsExpression.isEmpty()) + if(!sHideParagraphsExpression.isEmpty()) sHideParagraphsExpression += " AND "; - sHideParagraphsExpression += "!"; - sHideParagraphsExpression += "["; - sHideParagraphsExpression += sDatabaseConditionPrefix; - sHideParagraphsExpression += sConvertedColumn; - sHideParagraphsExpression += "]"; + sHideParagraphsExpression += "![" + sDatabaseConditionPrefix + sConvertedColumn + "]"; if( bSpecialReplacementForCountry && sCountryColumn == sConvertedColumn ) { // now insert a hidden paragraph field - String sExpression; + OUString sExpression; if( !rExcludeCountry.isEmpty() ) { - sExpression = sDatabaseConditionPrefix; - sExpression.Insert('[', 0); - sExpression += sCountryColumn; - sExpression += "]"; + sExpression = "[" + sDatabaseConditionPrefix + sCountryColumn + "]"; - OUString sCondition(sExpression); - sCondition += " != \""; - sCondition += rExcludeCountry; - sCondition += "\""; + OUString sCondition = sExpression + " != \"" + rExcludeCountry + "\""; SwInsertFld_Data aData(TYP_CONDTXTFLD, 0, sCondition, sExpression, 0, &rShell ); aFldMgr.InsertFld( aData ); @@ -484,7 +474,7 @@ void SwMailMergeLayoutPage::InsertGreeting(SwWrtShell& rShell, SwMailMergeConfig } //now insert the greeting text - if we have any? const sal_Bool bIndividual = rConfigItem.IsIndividualGreeting(sal_False); - String sGreeting; + OUString sGreeting; if(bIndividual) { //lock expression fields - prevents hiding of the paragraph to insert into @@ -512,38 +502,38 @@ void SwMailMergeLayoutPage::InsertGreeting(SwWrtShell& rShell, SwMailMergeConfig //are to be inserted //name of the gender column - String sGenderColumn = rConfigItem.GetAssignedColumn(MM_PART_GENDER); - String sNameColumn = rConfigItem.GetAssignedColumn(MM_PART_LASTNAME); + OUString sGenderColumn = rConfigItem.GetAssignedColumn(MM_PART_GENDER); + OUString sNameColumn = rConfigItem.GetAssignedColumn(MM_PART_LASTNAME); const OUString& rFemaleGenderValue = rConfigItem.GetFemaleGenderValue(); sal_Bool bHideEmptyParagraphs = rConfigItem.IsHideEmptyParagraphs(); const SwDBData& rData = rConfigItem.GetCurrentDBData(); - String sConditionBase(rData.sDataSource); - sConditionBase += '.'; - sConditionBase += String(rData.sCommand); - sConditionBase += '.'; + OUString sConditionBase(rData.sDataSource); + sConditionBase += "."; + sConditionBase += rData.sCommand; + sConditionBase += "."; //split the name column from here - String sNameColumnBase(sConditionBase); + OUString sNameColumnBase(sConditionBase); - sConditionBase += String(sGenderColumn); - sConditionBase += ']'; - sConditionBase.Insert('[', 0); + sConditionBase += sGenderColumn; + sConditionBase += "]"; + sConditionBase = "[" + sConditionBase; - sNameColumnBase += String(sNameColumn); - sNameColumnBase += ']'; - sNameColumnBase.Insert('[', 0); + sNameColumnBase += sNameColumn; + sNameColumnBase += "]"; + sNameColumnBase = "[" + sNameColumnBase; - String sDBName(rData.sDataSource); - sDBName += DB_DELIM; - sDBName += String(rData.sCommand); - sDBName += DB_DELIM; + OUString sDBName(rData.sDataSource); + sDBName += OUString(DB_DELIM); + sDBName += rData.sCommand; + sDBName += OUString(DB_DELIM); sDBName += OUString::number(rData.nCommandType); - sDBName += DB_DELIM; + sDBName += OUString(DB_DELIM); // Female: [database.sGenderColumn] != "rFemaleGenderValue" && [database.NameColumn] // Male: [database.sGenderColumn] == "rFemaleGenderValue" && [database.rGenderColumn] // Neutral: [database.sNameColumn] - OSL_ENSURE(sGenderColumn.Len() && !rFemaleGenderValue.isEmpty(), + OSL_ENSURE(!sGenderColumn.isEmpty() && !rFemaleGenderValue.isEmpty(), "gender settings not available - how to form the condition?"); //column used as lastname for(sal_Int8 eGender = SwMailMergeConfigItem::FEMALE; @@ -555,7 +545,7 @@ void SwMailMergeLayoutPage::InsertGreeting(SwWrtShell& rShell, SwMailMergeConfig { sGreeting = aEntries[nCurrent]; OUString sCondition(sConditionBase); - String sHideParagraphsExpression; + OUString sHideParagraphsExpression; switch(eGender) { case SwMailMergeConfigItem::FEMALE: @@ -564,7 +554,7 @@ void SwMailMergeLayoutPage::InsertGreeting(SwWrtShell& rShell, SwMailMergeConfig sCondition += "\" OR NOT "; sCondition += sNameColumnBase; - sHideParagraphsExpression += '!'; + sHideParagraphsExpression += "!"; sHideParagraphsExpression += sNameColumnBase; break; case SwMailMergeConfigItem::MALE: @@ -578,12 +568,9 @@ void SwMailMergeLayoutPage::InsertGreeting(SwWrtShell& rShell, SwMailMergeConfig break; } - if(bHideEmptyParagraphs && sHideParagraphsExpression.Len()) + if(bHideEmptyParagraphs && !sHideParagraphsExpression.isEmpty()) { - OUString sComplete( "(" + sCondition ); - sComplete += ") OR ("; - sComplete += sHideParagraphsExpression; - sComplete += ")"; + OUString sComplete = "(" + sCondition + ") OR (" + sHideParagraphsExpression + ")"; SwInsertFld_Data aData(TYP_HIDDENPARAFLD, 0, sComplete, aEmptyStr, 0, &rShell ); aFldMgr.InsertFld( aData ); } @@ -603,8 +590,8 @@ void SwMailMergeLayoutPage::InsertGreeting(SwWrtShell& rShell, SwMailMergeConfig SwMergeAddressItem aItem = aIter.Next(); if(aItem.bIsColumn) { - String sDB(sDBName); - String sConvertedColumn = aItem.sText; + OUString sDB(sDBName); + OUString sConvertedColumn = aItem.sText; for(sal_uInt16 nColumn = 0; nColumn < rHeaders.Count() && nColumn < aAssignment.getLength(); ++nColumn) diff --git a/sw/source/ui/dbui/mmmergepage.cxx b/sw/source/ui/dbui/mmmergepage.cxx index 8864d327015d..aa3e15cbc459 100644 --- a/sw/source/ui/dbui/mmmergepage.cxx +++ b/sw/source/ui/dbui/mmmergepage.cxx @@ -50,8 +50,8 @@ SwMailMergeMergePage::SwMailMergeMergePage( SwMailMergeWizard* _pParent) : m_pWizard(_pParent) { FreeResource(); - String sTemp(m_aEditFI.GetText()); - sTemp.SearchAndReplace(OUString("%1"), m_aEditPB.GetText()); + OUString sTemp(m_aEditFI.GetText()); + sTemp = sTemp.replaceFirst("%1", m_aEditPB.GetText()); m_aEditFI.SetText(sTemp); m_aEditPB.SetClickHdl( LINK( this, SwMailMergeMergePage, EditDocumentHdl_Impl)); m_aFindPB.SetClickHdl( LINK( this, SwMailMergeMergePage, FindHdl_Impl )); diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx index 232607183515..6514e5ad4145 100644 --- a/sw/source/ui/dbui/mmoutputpage.cxx +++ b/sw/source/ui/dbui/mmoutputpage.cxx @@ -74,16 +74,16 @@ using namespace svt; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; -static String lcl_GetExtensionForDocType(sal_uLong nDocType) +static OUString lcl_GetExtensionForDocType(sal_uLong nDocType) { OUString sExtension; switch( nDocType ) { - case MM_DOCTYPE_OOO : sExtension = OUString( "odt" ); break; - case MM_DOCTYPE_PDF : sExtension = OUString( "pdf" ); break; - case MM_DOCTYPE_WORD: sExtension = OUString( "doc" ); break; - case MM_DOCTYPE_HTML: sExtension = OUString( "html" ); break; - case MM_DOCTYPE_TEXT: sExtension = OUString( "txt" ); break; + case MM_DOCTYPE_OOO : sExtension = "odt"; break; + case MM_DOCTYPE_PDF : sExtension = "pdf"; break; + case MM_DOCTYPE_WORD: sExtension = "doc"; break; + case MM_DOCTYPE_HTML: sExtension = "html"; break; + case MM_DOCTYPE_TEXT: sExtension = "txt"; break; } return sExtension; } @@ -469,8 +469,8 @@ IMPL_LINK(SwMailMergeOutputPage, OutputTypeHdl_Impl, RadioButton*, pButton) m_aSendAllRB.Check(); if(m_aAttachmentED.GetText().isEmpty()) { - String sAttach( m_sDefaultAttachmentST ); - sAttach += '.'; + OUString sAttach( m_sDefaultAttachmentST ); + sAttach += "."; sAttach += lcl_GetExtensionForDocType( (sal_uLong)m_aSendAsLB.GetEntryData(m_aSendAsLB.GetSelectEntryPos())); m_aAttachmentED.SetText( sAttach ); @@ -495,7 +495,7 @@ IMPL_LINK(SwMailMergeOutputPage, OutputTypeHdl_Impl, RadioButton*, pButton) m_aMailToLB.SelectEntryPos(0); // then select the right one - may not be available const ResStringArray& rHeaders = rConfigItem.GetDefaultAddressHeaders(); - String sEMailColumn = rHeaders.GetString( MM_PART_E_MAIL ); + OUString sEMailColumn = rHeaders.GetString( MM_PART_E_MAIL ); Sequence< OUString> aAssignment = rConfigItem.GetColumnAssignment( rConfigItem.GetCurrentDBData() ); if(aAssignment.getLength() > MM_PART_E_MAIL && !aAssignment[MM_PART_E_MAIL].isEmpty()) @@ -650,7 +650,7 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton) OUString sPath = SwMailMergeHelper::CallSaveAsDialog(sFilter); if (sPath.isEmpty()) return 0; - String sTargetTempURL = URIHelper::SmartRel2Abs( + OUString sTargetTempURL = URIHelper::SmartRel2Abs( INetURLObject(), utl::TempFile::CreateTempName(), URIHelper::GetMaybeFileHdl()); const SfxFilter *pSfxFlt = SwIoSystem::GetFilterOfFormat( @@ -701,9 +701,7 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton) sExtension = comphelper::string::getToken(pSfxFlt->GetWildcard().getGlob(), 1, '.'); sPath += "." + sExtension; } - String sStat(SW_RES(STR_STATSTR_LETTER)); - sStat += ' '; - sStat += OUString::number( nDoc ); + OUString sStat = OUString(SW_RES(STR_STATSTR_LETTER)) + " " + OUString::number( nDoc ); aSaveMonitor.m_pPrintInfo->SetText(sStat); //now extract a document from the target document @@ -726,10 +724,9 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton) (sal_uInt16)rInfo.nStartPageInTarget, (sal_uInt16)rInfo.nEndPageInTarget ); pTargetView->GetWrtShell().EndAction(); //then save it - String sOutPath = aURL.GetMainURL(INetURLObject::DECODE_TO_IURI); - String sCounter = OUString('_'); - sCounter += OUString::number(nDoc); - sOutPath.Insert(sCounter, sOutPath.Len() - sExtension.getLength() - 1); + OUString sOutPath = aURL.GetMainURL(INetURLObject::DECODE_TO_IURI); + OUString sCounter = "_" + OUString::number(nDoc); + sOutPath = sOutPath.replaceAt( sOutPath.getLength() - sExtension.getLength() - 1, 0, sCounter); while(true) { @@ -974,7 +971,7 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton) SfxFilterContainer* pFilterContainer = SwDocShell::Factory().GetFilterContainer(); const SfxFilter *pSfxFlt = 0; sal_uLong nDocType = (sal_uLong)m_aSendAsLB.GetEntryData(m_aSendAsLB.GetSelectEntryPos()); - String sExtension = lcl_GetExtensionForDocType(nDocType); + OUString sExtension = lcl_GetExtensionForDocType(nDocType); switch( nDocType ) { case MM_DOCTYPE_OOO: @@ -1070,11 +1067,11 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton) return 0; } SfxStringItem aFilterName( SID_FILTER_NAME, pSfxFlt->GetFilterName() ); - String sEMailColumn = m_aMailToLB.GetSelectEntry(); - OSL_ENSURE( sEMailColumn.Len(), "No email column selected"); + OUString sEMailColumn = m_aMailToLB.GetSelectEntry(); + OSL_ENSURE( !sEMailColumn.isEmpty(), "No email column selected"); Reference< sdbcx::XColumnsSupplier > xColsSupp( rConfigItem.GetResultSet(), UNO_QUERY); Reference < container::XNameAccess> xColAccess = xColsSupp.is() ? xColsSupp->getColumns() : 0; - if(!sEMailColumn.Len() || !xColAccess.is() || !xColAccess->hasByName(sEMailColumn)) + if(sEMailColumn.isEmpty() || !xColAccess.is() || !xColAccess->hasByName(sEMailColumn)) return 0; OUString sFilterOptions; @@ -1088,7 +1085,7 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton) aOpt.SetParaFlags( LINEEND_CR ); aOpt.WriteUserData( sFilterOptions ); } - String sTargetTempURL = URIHelper::SmartRel2Abs( + OUString sTargetTempURL = URIHelper::SmartRel2Abs( INetURLObject(), utl::TempFile::CreateTempName(), URIHelper::GetMaybeFileHdl()); const SfxFilter *pTargetSfxFlt = SwIoSystem::GetFilterOfFormat( @@ -1161,7 +1158,7 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton) sal_Int32 nTarget = rConfigItem.MoveResultSet(rInfo.nDBRow); OSL_ENSURE( nTarget == rInfo.nDBRow, "row of current document could not be selected"); (void)nTarget; - OSL_ENSURE( sEMailColumn.Len(), "No email column selected"); + OSL_ENSURE( !sEMailColumn.isEmpty(), "No email column selected"); OUString sEMail = lcl_GetColumnValueOf(sEMailColumn, xColAccess); SwMailDescriptor aDesc; aDesc.sEMail = sEMail; @@ -1211,7 +1208,7 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton) { OUString sNameColumn = rConfigItem.GetAssignedColumn(MM_PART_LASTNAME); OUString sName = lcl_GetColumnValueOf(sNameColumn, xColAccess); - String sGreeting; + OUString sGreeting; if(!sName.isEmpty() && rConfigItem.IsIndividualGreeting(sal_True)) { OUString sGenderColumn = rConfigItem.GetAssignedColumn(MM_PART_GENDER); @@ -1233,10 +1230,8 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton) [rConfigItem.GetCurrentGreeting(SwMailMergeConfigItem::NEUTRAL)]; } - sGreeting += '\n'; - OUString sTemp( sGreeting ); - sTemp += sBody; - sBody = sTemp; + sGreeting += "\n"; + sBody = sGreeting + sBody; } } aDesc.sBodyContent = sBody; diff --git a/sw/source/ui/dbui/selectdbtabledialog.cxx b/sw/source/ui/dbui/selectdbtabledialog.cxx index f8fb54d303f0..d5b6e385ed5b 100644 --- a/sw/source/ui/dbui/selectdbtabledialog.cxx +++ b/sw/source/ui/dbui/selectdbtabledialog.cxx @@ -107,8 +107,8 @@ SwSelectDBTableDialog::SwSelectDBTableDialog(Window* pParent, const OUString* pTbls = aTbls.getConstArray(); for(long i = 0; i < aTbls.getLength(); i++) { - String sEntry = pTbls[i]; - sEntry += '\t'; + OUString sEntry = pTbls[i]; + sEntry += "\t"; sEntry += m_sTable; SvTreeListEntry* pEntry = m_aTableLB.InsertEntry(sEntry); pEntry->SetUserData((void*)0); @@ -122,8 +122,8 @@ SwSelectDBTableDialog::SwSelectDBTableDialog(Window* pParent, const OUString* pQueries = aQueries.getConstArray(); for(long i = 0; i < aQueries.getLength(); i++) { - String sEntry = pQueries[i]; - sEntry += '\t'; + OUString sEntry = pQueries[i]; + sEntry += "\t"; sEntry += m_sQuery; SvTreeListEntry* pEntry = m_aTableLB.InsertEntry(sEntry); pEntry->SetUserData((void*)1); |