diff options
author | Noel Grandin <noel@peralex.com> | 2013-10-14 14:02:31 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-10-15 12:25:49 +0200 |
commit | 02bfed8a53556badfea637930b05d923cf9465f2 (patch) | |
tree | 1c81ba594a46eb475e6a17cbf4f9d3c6f0e30a8c | |
parent | 1331b4736f434147cf96b7704cf19e191899f81b (diff) |
convert sw/source/filter/ww8/*.cxx from String to OUString
Change-Id: Ibdd454008244b9a6db5037f511ac2da723648d89
24 files changed, 360 insertions, 366 deletions
diff --git a/sw/source/filter/basflt/fltini.cxx b/sw/source/filter/basflt/fltini.cxx index 0729e3b5d96d..7848fc133592 100644 --- a/sw/source/filter/basflt/fltini.cxx +++ b/sw/source/filter/basflt/fltini.cxx @@ -673,8 +673,8 @@ extern "C" { Reader *ImportRTF(); void ExportRTF( const String&, const String& rBaseURL, WriterRef& ); Reader *ImportDOC(); - void ExportDOC( const String&, const String& rBaseURL, WriterRef& ); - sal_uLong SaveOrDelMSVBAStorage_ww8( SfxObjectShell&, SotStorage&, sal_Bool, const String& ); + void ExportDOC( const OUString&, const OUString& rBaseURL, WriterRef& ); + sal_uLong SaveOrDelMSVBAStorage_ww8( SfxObjectShell&, SotStorage&, sal_Bool, const OUString& ); sal_uLong GetSaveWarningOfMSVBAStorage_ww8( SfxObjectShell& ); } diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index d4fbec0bc504..7c4b19e8211f 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -1014,7 +1014,7 @@ void DocxAttributeOutput::EndField_Impl( FieldInfos& rInfos ) rInfos.sCmd += "\" "; // Clean the field bookmark data to avoid infinite loop - m_sFieldBkm = String( ); + m_sFieldBkm = OUString( ); // Write the end of the field EndField_Impl( rInfos ); @@ -1449,7 +1449,7 @@ void DocxAttributeOutput::Redline( const SwRedlineData* pRedline) return; OString aId( OString::number( pRedline->GetSeqNo() ) ); - const String &rAuthor( SW_MOD()->GetRedlineAuthor( pRedline->GetAuthor() ) ); + const OUString &rAuthor( SW_MOD()->GetRedlineAuthor( pRedline->GetAuthor() ) ); OString aAuthor( OUStringToOString( rAuthor, RTL_TEXTENCODING_UTF8 ) ); OString aDate( msfilter::util::DateTimeToOString( pRedline->GetTimeStamp() ) ); @@ -1509,7 +1509,7 @@ void DocxAttributeOutput::StartRedline() OString aId( OString::number( m_nRedlineId++ ) ); - const String &rAuthor( SW_MOD()->GetRedlineAuthor( pRedlineData->GetAuthor() ) ); + const OUString &rAuthor( SW_MOD()->GetRedlineAuthor( pRedlineData->GetAuthor() ) ); OString aAuthor( OUStringToOString( rAuthor, RTL_TEXTENCODING_UTF8 ) ); OString aDate( msfilter::util::DateTimeToOString( pRedlineData->GetTimeStamp() ) ); @@ -3549,9 +3549,9 @@ void DocxAttributeOutput::WriteOutliner(const OutlinerParaObject& rParaObj) if( n ) aAttrIter.NextPara( n ); - String aStr( rEditObj.GetText( n )); + OUString aStr( rEditObj.GetText( n )); xub_StrLen nAktPos = 0; - xub_StrLen nEnd = aStr.Len(); + xub_StrLen nEnd = aStr.getLength(); m_pSerializer->startElementNS( XML_w, XML_p, FSEND ); @@ -3575,7 +3575,7 @@ void DocxAttributeOutput::WriteOutliner(const OutlinerParaObject& rParaObj) bool bTxtAtr = aAttrIter.IsTxtAttr( nAktPos ); if( !bTxtAtr ) { - String aOut( aStr.Copy( nAktPos, nNextAttr - nAktPos ) ); + OUString aOut( aStr.copy( nAktPos, nNextAttr - nAktPos ) ); RunText(aOut); } @@ -4815,7 +4815,7 @@ bool DocxAttributeOutput::DropdownField( const SwField* pFld ) bool bExpand = false; ww::eField eType = ww::eFORMDROPDOWN; - String sCmd = FieldString( eType ); + OUString sCmd = FieldString( eType ); GetExport( ).OutputField( pFld, eType, sCmd ); return bExpand; @@ -4860,7 +4860,7 @@ void DocxAttributeOutput::SetField( const SwField& rFld, ww::eField eType, const void DocxAttributeOutput::WriteExpand( const SwField* pFld ) { // Will be written in the next End Run - String sCmd; + OUString sCmd; m_rExport.OutputField( pFld, ww::eUNKNOWN, sCmd ); } diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index 7403e3b9b9a3..bf45dacd37ac 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -868,9 +868,9 @@ void DocxExport::WriteOutliner(const OutlinerParaObject& rParaObj, sal_uInt8 nTy AttrOutput().StartParagraph( ww8::WW8TableNodeInfo::Pointer_t()); rtl_TextEncoding eChrSet = aAttrIter.GetNodeCharSet(); - String aStr( rEditObj.GetText( n )); + OUString aStr( rEditObj.GetText( n )); xub_StrLen nAktPos = 0; - xub_StrLen nEnd = aStr.Len(); + xub_StrLen nEnd = aStr.getLength(); do { AttrOutput().StartRun( NULL ); xub_StrLen nNextAttr = aAttrIter.WhereNext(); @@ -882,11 +882,11 @@ void DocxExport::WriteOutliner(const OutlinerParaObject& rParaObj, sal_uInt8 nTy bool bTxtAtr = aAttrIter.IsTxtAttr( nAktPos ); if( !bTxtAtr ) { - if( nAktPos == 0 && nNextAttr - nAktPos == aStr.Len()) + if( nAktPos == 0 && nNextAttr - nAktPos == aStr.getLength()) AttrOutput().RunText( aStr, eChrSet ); else { - String tmp( aStr.Copy( nAktPos, nNextAttr - nAktPos )); + OUString tmp( aStr.copy( nAktPos, nNextAttr - nAktPos )); AttrOutput().RunText( tmp, eChrSet ); } } diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 072d0a576c8a..47b66e7f6ec3 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -466,8 +466,8 @@ bool RtfAttributeOutput::StartURL( const OUString& rUrl, const OUString& rTarget m_aStyles.append(OOO_STRING_SVTOOLS_RTF_FLDINST); m_aStyles.append(" HYPERLINK "); - String sURL( rUrl ); - if( sURL.Len() ) + OUString sURL( rUrl ); + if( !sURL.isEmpty() ) { m_aStyles.append("\""); m_aStyles.append(msfilter::rtfutil::OutString( sURL, m_rExport.eCurrentEncoding)); @@ -2606,13 +2606,13 @@ void RtfAttributeOutput::ParaNumRule_Impl( const SwTxtNode* pTxtNd, sal_Int32 nL m_aStyles.append(*pString); { - String sTxt; + OUString sTxt; if( SVX_NUM_CHAR_SPECIAL == pFmt->GetNumberingType() || SVX_NUM_BITMAP == pFmt->GetNumberingType() ) - sTxt = pFmt->GetBulletChar(); + sTxt = OUString(pFmt->GetBulletChar()); else sTxt = pTxtNd->GetNumString(); - if (sTxt.Len()) + if (!sTxt.isEmpty()) { m_aStyles.append(' '); m_aStyles.append(msfilter::rtfutil::OutString(sTxt, m_rExport.eDefaultEncoding)); @@ -2620,7 +2620,7 @@ void RtfAttributeOutput::ParaNumRule_Impl( const SwTxtNode* pTxtNd, sal_Int32 nL if( OUTLINE_RULE != pRule->GetRuleType() ) { - if (sTxt.Len()) + if (!sTxt.isEmpty()) m_aStyles.append(OOO_STRING_SVTOOLS_RTF_TAB); m_aStyles.append('}'); m_aStyles.append(OOO_STRING_SVTOOLS_RTF_ILVL); @@ -3129,7 +3129,7 @@ void RtfAttributeOutput::ParaOutlineLevel(const SfxUInt16Item& /*rItem*/) void RtfAttributeOutput::WriteExpand( const SwField* pFld ) { SAL_INFO("sw.rtf", OSL_THIS_FUNC); - String sCmd; // for optional Parameters + OUString sCmd; // for optional Parameters switch (pFld->GetTyp()->Which()) { //#i119803# Export user field and DB field for RTF filter @@ -3430,12 +3430,12 @@ static OString ExportPICT( const SwFlyFrmFmt* pFlyFrmFmt, const Size &rOrig, con if( pFlyFrmFmt ) { - String sDescription = pFlyFrmFmt->GetObjDescription(); + OUString sDescription = pFlyFrmFmt->GetObjDescription(); //write picture properties - wzDescription at first //looks like: "{\*\picprop{\sp{\sn PropertyName}{\sv PropertyValue}}}" aRet.append( "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_PICPROP );//"{\*\picprop lcl_AppendSP( aRet, "wzDescription", sDescription, rExport ); - String sName = pFlyFrmFmt->GetObjTitle(); + OUString sName = pFlyFrmFmt->GetObjTitle(); lcl_AppendSP( aRet, "wzName", sName, rExport ); aRet.append( "}" ); //"}" } diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx index db3e1ff0f675..58e6bc79be0a 100644 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -1165,17 +1165,17 @@ class SwRTFWriter : public Writer bool m_bOutOutlineOnly; public: - SwRTFWriter( const String& rFilterName, const String& rBaseURL ); + SwRTFWriter( const OUString& rFilterName, const OUString& rBaseURL ); virtual ~SwRTFWriter(); virtual sal_uLong WriteStream(); }; -SwRTFWriter::SwRTFWriter( const String& rFltName, const String & rBaseURL ) +SwRTFWriter::SwRTFWriter( const OUString& rFltName, const OUString & rBaseURL ) { SAL_INFO("sw.rtf", OSL_THIS_FUNC); SetBaseURL( rBaseURL ); // export outline nodes, only (send outline to clipboard/presentation) - m_bOutOutlineOnly = 'O' == rFltName.GetChar( 0 ); + m_bOutOutlineOnly = 'O' == rFltName[0]; } SwRTFWriter::~SwRTFWriter() @@ -1190,7 +1190,7 @@ sal_uLong SwRTFWriter::WriteStream() return 0; } -extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL ExportRTF( const String& rFltName, const String& rBaseURL, WriterRef& xRet ) +extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL ExportRTF( const OUString& rFltName, const OUString& rBaseURL, WriterRef& xRet ) { SAL_INFO("sw.rtf", OSL_THIS_FUNC); xRet = new SwRTFWriter( rFltName, rBaseURL ); diff --git a/sw/source/filter/ww8/rtfsdrexport.cxx b/sw/source/filter/ww8/rtfsdrexport.cxx index fafb82986a6e..f5dae0f0cee9 100644 --- a/sw/source/filter/ww8/rtfsdrexport.cxx +++ b/sw/source/filter/ww8/rtfsdrexport.cxx @@ -539,9 +539,9 @@ void RtfSdrExport::WriteOutliner(const OutlinerParaObject& rParaObj) rtl_TextEncoding eChrSet = aAttrIter.GetNodeCharSet(); - String aStr( rEditObj.GetText( n )); + OUString aStr( rEditObj.GetText( n )); xub_StrLen nAktPos = 0; - xub_StrLen nEnd = aStr.Len(); + xub_StrLen nEnd = aStr.getLength(); aAttrIter.OutParaAttr(false); m_rAttrOutput.RunText().append(m_rAttrOutput.Styles().makeStringAndClear()); @@ -558,7 +558,7 @@ void RtfSdrExport::WriteOutliner(const OutlinerParaObject& rParaObj) bool bTxtAtr = aAttrIter.IsTxtAttr( nAktPos ); if( !bTxtAtr ) { - String aOut( aStr.Copy( nAktPos, nNextAttr - nAktPos ) ); + OUString aOut( aStr.copy( nAktPos, nNextAttr - nAktPos ) ); m_rAttrOutput.RunText().append( msfilter::rtfutil::OutString( aOut, eChrSet ) ); } diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index 6bd4112e2a39..da36ef3b8242 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -373,7 +373,7 @@ void WW8Export::DoFormText(const SwInputField * pFld) OutputField(0, ww::eFORMTEXT, aEmptyStr, WRITEFIELD_CMD_END); - String const fieldStr( pFld->ExpandField(true) ); + OUString const fieldStr( pFld->ExpandField(true) ); SwWW8Writer::WriteString16(Strm(), fieldStr, false); static sal_uInt8 aArr2[] = { @@ -943,7 +943,7 @@ void MSWord_SdrAttrIter::OutEEField(const SfxPoolItem& rHt) const SvxURLField *pURL = (const SvxURLField *)pFld; m_rExport.AttrOutput().StartURL( pURL->GetURL(), pURL->GetTargetFrame() ); - const String &rStr = pURL->GetRepresentation(); + const OUString &rStr = pURL->GetRepresentation(); m_rExport.AttrOutput().RawText( rStr, true, GetNodeCharSet() ); // FIXME kendy: is the 'true' actually correct here? It was here before, but... ;-) m_rExport.AttrOutput().EndURL(); @@ -1144,9 +1144,9 @@ void WW8Export::WriteOutliner(const OutlinerParaObject& rParaObj, sal_uInt8 nTyp OSL_ENSURE( pO->empty(), " pO ist am Zeilenanfang nicht leer" ); - String aStr( rEditObj.GetText( n )); + OUString aStr( rEditObj.GetText( n )); xub_StrLen nAktPos = 0; - xub_StrLen nEnd = aStr.Len(); + xub_StrLen nEnd = aStr.getLength(); do { xub_StrLen nNextAttr = aAttrIter.WhereNext(); rtl_TextEncoding eNextChrSet = aAttrIter.GetNextCharSet(); @@ -2994,8 +2994,7 @@ bool SwMSConvertControls::ExportControl(WW8Export &rWW8Wrt, const SdrObject *pOb sal_uInt8 *pData = aSpecOLE+2; Set_UInt32(pData,nObjId ); - OUString sFld(FieldString(ww::eCONTROL)); - sFld += "Forms." + sUName + ".1 \\s "; + OUString sFld = FieldString(ww::eCONTROL) + "Forms." + sUName + ".1 \\s "; rWW8Wrt.OutputField(0, ww::eCONTROL, sFld, WRITEFIELD_START|WRITEFIELD_CMD_START|WRITEFIELD_CMD_END); diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 156a9bd4a4a1..1eeda8665719 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -222,14 +222,14 @@ SwWW8AttrIter::SwWW8AttrIter(MSWordExportBase& rWr, const SwTxtNode& rTxtNd) : nAktSwPos = SearchNext(1); } -xub_StrLen lcl_getMinPos( xub_StrLen pos1, xub_StrLen pos2 ) +sal_Int32 lcl_getMinPos( sal_Int32 pos1, sal_Int32 pos2 ) { - xub_StrLen min = STRING_NOTFOUND; - if ( pos1 == STRING_NOTFOUND && pos2 != STRING_NOTFOUND ) + xub_StrLen min = -1; + if ( pos1 == -1 && pos2 != -1 ) min = pos2; - else if ( pos2 == STRING_NOTFOUND && pos1 != STRING_NOTFOUND ) + else if ( pos2 == -1 && pos1 != -1 ) min = pos1; - else if ( pos1 != STRING_NOTFOUND && pos2 != STRING_NOTFOUND ) + else if ( pos1 != -1 && pos2 != -1 ) { if ( pos1 < pos2 ) min = pos1; @@ -246,16 +246,16 @@ xub_StrLen SwWW8AttrIter::SearchNext( xub_StrLen nStartPos ) xub_StrLen nMinPos = STRING_MAXLEN; xub_StrLen i=0; - const String aTxt = rNd.GetTxt(); - xub_StrLen fieldEndPos = aTxt.Search(CH_TXT_ATR_FIELDEND, nStartPos); - xub_StrLen fieldStartPos = aTxt.Search(CH_TXT_ATR_FIELDSTART, nStartPos); - xub_StrLen formElementPos = aTxt.Search(CH_TXT_ATR_FORMELEMENT, nStartPos); + const OUString aTxt = rNd.GetTxt(); + sal_Int32 fieldEndPos = aTxt.indexOf(CH_TXT_ATR_FIELDEND, nStartPos); + sal_Int32 fieldStartPos = aTxt.indexOf(CH_TXT_ATR_FIELDSTART, nStartPos); + sal_Int32 formElementPos = aTxt.indexOf(CH_TXT_ATR_FORMELEMENT, nStartPos); - xub_StrLen pos = lcl_getMinPos( fieldEndPos, fieldStartPos ); + sal_Int32 pos = lcl_getMinPos( fieldEndPos, fieldStartPos ); pos = lcl_getMinPos( pos, formElementPos ); - if (pos!=STRING_NOTFOUND) - nMinPos=pos; + if (pos != -1) + nMinPos = pos; // first the redline, then the attributes if( pCurRedline ) @@ -686,7 +686,7 @@ void WW8AttributeOutput::StartRuby( const SwTxtNode& rNode, xub_StrLen /*nPos*/, const SwTxtRuby* pRubyTxt = rRuby.GetTxtRuby(); const SwCharFmt* pFmt = pRubyTxt ? pRubyTxt->GetCharFmt() : 0; - String sFamilyName; + OUString sFamilyName; long nHeight; if ( pFmt ) { @@ -760,11 +760,11 @@ void WW8AttributeOutput::EndRuby() } /*#i15387# Better ideas welcome*/ -String &TruncateBookmark( String &rRet ) +OUString &TruncateBookmark( OUString &rRet ) { - if ( rRet.Len() > 40 ) - rRet.Erase( 40 ); - OSL_ENSURE( rRet.Len() <= 40, "Word cannot have bookmarks longer than 40 chars" ); + if ( rRet.getLength() > 40 ) + rRet = rRet.copy( 0, 40 ); + OSL_ENSURE( rRet.getLength() <= 40, "Word cannot have bookmarks longer than 40 chars" ); return rRet; } @@ -880,10 +880,10 @@ bool WW8AttributeOutput::StartURL( const OUString &rUrl, const OUString &rTarget // Compare the URL written by AnalyzeURL with the original one to see if // the output URL is absolute or relative. - String sRelativeURL; + OUString sRelativeURL; if ( !rUrl.isEmpty() ) sRelativeURL = URIHelper::simpleNormalizedMakeRelative( m_rWW8Export.GetWriter().GetBaseURL(), rUrl ); - bool bAbsolute = sRelativeURL.Equals( rUrl ); + bool bAbsolute = sRelativeURL == rUrl; static sal_uInt8 aURLData1[] = { 0,0,0,0, // len of struct @@ -1009,7 +1009,7 @@ bool WW8AttributeOutput::EndURL() OUString BookmarkToWord(const OUString &rBookmark) { - String sRet(INetURLObject::encode(rBookmark, + OUString sRet(INetURLObject::encode(rBookmark, INetURLObject::PART_REL_SEGMENT_EXTRA, '%', INetURLObject::ENCODE_ALL, RTL_TEXTENCODING_ASCII_US)); return TruncateBookmark(sRet); @@ -1789,8 +1789,7 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) if ( aAttrIter.RequiresImplicitBookmark() ) { - String sBkmkName = String( "_toc" ); - sBkmkName += OUString::number( rNode.GetIndex() ); + OUString sBkmkName = "_toc" + OUString::number( rNode.GetIndex() ); AppendWordBookmark( sBkmkName ); } @@ -1870,7 +1869,7 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) else if ( pFieldmark && pFieldmark->GetFieldname( ) == ODF_HYPERLINK ) WriteHyperlinkData( *pFieldmark ); if (!bCommentRange) - OutputField( NULL, lcl_getFieldId( pFieldmark ), String(), WRITEFIELD_CMD_END ); + OutputField( NULL, lcl_getFieldId( pFieldmark ), OUString(), WRITEFIELD_CMD_END ); if ( pFieldmark && pFieldmark->GetFieldname() == ODF_UNHANDLED ) { @@ -1908,7 +1907,7 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) if (pFieldmark && pFieldmark->GetFieldname() == ODF_COMMENTRANGE) AttrOutput().WritePostitFieldEnd(); else - OutputField( NULL, eFieldId, String(), WRITEFIELD_CLOSE ); + OutputField( NULL, eFieldId, OUString(), WRITEFIELD_CLOSE ); if ( pFieldmark && pFieldmark->GetFieldname() == ODF_FORMTEXT ) AppendBookmark( pFieldmark->GetName(), false ); @@ -1929,18 +1928,18 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) WRITEFIELD_START | WRITEFIELD_CMD_START ); if ( isDropdownOrCheckbox ) WriteFormData( *pFieldmark ); - OutputField( NULL, lcl_getFieldId( pFieldmark ), String(), WRITEFIELD_CLOSE ); + OutputField( NULL, lcl_getFieldId( pFieldmark ), OUString(), WRITEFIELD_CLOSE ); if ( isDropdownOrCheckbox ) AppendBookmark( pFieldmark->GetName(), false ); } nLen -= static_cast< sal_Int32 >( ofs ); - String aSnippet( aAttrIter.GetSnippet( aStr, nAktPos + static_cast< sal_Int32 >( ofs ), nLen ) ); + OUString aSnippet( aAttrIter.GetSnippet( aStr, nAktPos + static_cast< sal_Int32 >( ofs ), nLen ) ); if ( ( nTxtTyp == TXT_EDN || nTxtTyp == TXT_FTN ) && nAktPos == 0 && nLen > 0 ) { // Insert tab for aesthetic puposes #i24762# - if ( aSnippet.GetChar( 0 ) != 0x09 ) - aSnippet.Insert( 0x09, 0 ); + if ( aSnippet[0] != 0x09 ) + aSnippet = OUString( 0x09 ) + aSnippet; } AttrOutput().RunText( aSnippet, eChrSet ); } diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx index f095cf1dd6f8..bea022e3791b 100644 --- a/sw/source/filter/ww8/wrtw8num.cxx +++ b/sw/source/filter/ww8/wrtw8num.cxx @@ -411,7 +411,7 @@ void MSWordExportBase::AbstractNumberingDefinitions() // now search the nums in the string for( sal_uInt8 i = 0; i <= nLvl; ++i ) { - String sSrch( OUString::number( i )); + OUString sSrch( OUString::number( i )); sal_Int32 nFnd = sNumStr.indexOf( sSrch ); if( -1 != nFnd ) { @@ -539,12 +539,12 @@ void WW8Export::OutListNamesTab() for( ; nNms < nCount; ++nNms ) { const SwNumRule& rRule = *(*pUsedNumTbl)[ nNms ]; - String sNm; + OUString sNm; if( !rRule.IsAutoRule() ) sNm = rRule.GetName(); - SwWW8Writer::WriteShort( *pTableStrm, sNm.Len() ); - if (sNm.Len()) + SwWW8Writer::WriteShort( *pTableStrm, sNm.getLength() ); + if (!sNm.isEmpty()) SwWW8Writer::WriteString16(*pTableStrm, sNm, false); } @@ -709,7 +709,7 @@ void MSWordExportBase::SubstituteBullet( OUString& rNumStr, rFontName = sFontName; } -static void SwWw8_InsertAnlText( const String& rStr, sal_uInt8*& rpCh, +static void SwWw8_InsertAnlText( const OUString& rStr, sal_uInt8*& rpCh, sal_uInt16& rCharLen, SVBT8& r8Len ) { sal_uInt8 nb = 0; diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index cd918581170e..4acb308c92c6 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -2366,11 +2366,11 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( WW8Export& rWrt, sal_uInt8 nTTyp, OSL_ENSURE(aIter != aStrArr.end() && *aIter == rAtn.msOwner, "Impossible"); sal_uInt16 nFndPos = static_cast< sal_uInt16 >(aIter - aStrArr.begin()); - String sAuthor(*aIter); - sal_uInt8 nNameLen = (sal_uInt8)sAuthor.Len(); + OUString sAuthor(*aIter); + sal_uInt8 nNameLen = (sal_uInt8)sAuthor.getLength(); if ( nNameLen > 9 ) { - sAuthor.Erase( 9 ); + sAuthor = sAuthor.copy( 0, 9 ); nNameLen = 9; } diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 27bb820c4fba..b26b77effbae 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -184,9 +184,9 @@ private: struct BookmarkInfo { sal_uLong startPos; //!< Starting character position. sal_uLong endPos; //!< Ending character position. - bool isField; //!< True if the bookmark is in a field result. - String name; //!< Name of this bookmark. - inline BookmarkInfo(sal_uLong start, sal_uLong end, bool isFld, const String& bkName) : startPos(start), endPos(end), isField(isFld), name(bkName) {}; + bool isField; //!< True if the bookmark is in a field result. + OUString name; //!< Name of this bookmark. + inline BookmarkInfo(sal_uLong start, sal_uLong end, bool isFld, const OUString& bkName) : startPos(start), endPos(end), isField(isFld), name(bkName) {}; //! Operator < is defined purely for sorting. inline bool operator<(const BookmarkInfo &other) const { return startPos < other.startPos; } }; @@ -194,7 +194,7 @@ private: typedef std::vector<BookmarkInfo>::iterator BkmIter; //! Return the position in aBookmarks where the string rNm can be found. - BkmIter GetPos( const String& rNm ); + BkmIter GetPos( const OUString& rNm ); //No copying WW8_WrtBookmarks(const WW8_WrtBookmarks&); @@ -204,7 +204,7 @@ public: ~WW8_WrtBookmarks(); //! Add a new bookmark to the list OR add an end position to an existing bookmark. - void Append( WW8_CP nStartCp, const String& rNm, const ::sw::mark::IMark* pBkmk=NULL ); + void Append( WW8_CP nStartCp, const OUString& rNm, const ::sw::mark::IMark* pBkmk=NULL ); //! Write out bookmarks to file. void Write( WW8Export& rWrt ); //! Move existing field marks from one position to another. @@ -1247,7 +1247,7 @@ WW8_WrtBookmarks::~WW8_WrtBookmarks() { } -void WW8_WrtBookmarks::Append( WW8_CP nStartCp, const String& rNm, const ::sw::mark::IMark* ) +void WW8_WrtBookmarks::Append( WW8_CP nStartCp, const OUString& rNm, const ::sw::mark::IMark* ) { BkmIter bkIter = GetPos( rNm ); if( bkIter == aBookmarks.end() ) @@ -1328,7 +1328,7 @@ void WW8_WrtBookmarks::Write( WW8Export& rWrt ) } } -WW8_WrtBookmarks::BkmIter WW8_WrtBookmarks::GetPos( const String& rNm ) +WW8_WrtBookmarks::BkmIter WW8_WrtBookmarks::GetPos( const OUString& rNm ) { for (BkmIter bIt = aBookmarks.begin(); bIt < aBookmarks.end(); ++bIt) { if (rNm == bIt->name) @@ -1586,8 +1586,8 @@ void WW8Export::WriteAsStringTable(const std::vector<OUString>& rStrings, SwWW8Writer::WriteLong( rStrm, nCount ); for( n = 0; n < nCount; ++n ) { - const String& rNm = rStrings[n]; - SwWW8Writer::WriteShort( rStrm, rNm.Len() ); + const OUString& rNm = rStrings[n]; + SwWW8Writer::WriteShort( rStrm, rNm.getLength() ); SwWW8Writer::WriteString16(rStrm, rNm, false); if( nExtraLen ) SwWW8Writer::FillCount(rStrm, nExtraLen); @@ -1599,8 +1599,8 @@ void WW8Export::WriteAsStringTable(const std::vector<OUString>& rStrings, for( n = 0; n < nCount; ++n ) { const OUString &rString = rStrings[n]; - const String aNm(rString.copy(0, std::min<sal_Int32>(rString.getLength(), 255))); - rStrm << (sal_uInt8)aNm.Len(); + const OUString aNm(rString.copy(0, std::min<sal_Int32>(rString.getLength(), 255))); + rStrm << (sal_uInt8)aNm.getLength(); SwWW8Writer::WriteString8(rStrm, aNm, false, RTL_TEXTENCODING_MS_1252); if (nExtraLen) @@ -1770,7 +1770,7 @@ void WW8Export::OutSwString(const OUString& rStr, xub_StrLen nStt, if( nStt || nLen != rStr.getLength() ) { - String sOut( rStr.copy( nStt, nLen ) ); + OUString sOut( rStr.copy( nStt, nLen ) ); SAL_INFO( "sw.ww8.level2", sOut ); @@ -2869,7 +2869,7 @@ void MSWordExportBase::AddLinkTarget(const OUString& rURL) if( sCmp == "outline" ) { SwPosition aPos( *pCurPam->GetPoint() ); - String aOutline( BookmarkToWriter(aURL.copy( 0, nPos )) ); + OUString aOutline( BookmarkToWriter(aURL.copy( 0, nPos )) ); // If we can find the outline this bookmark refers to // save the name of the bookmark and the // node index number of where it points to @@ -3465,13 +3465,13 @@ SwWW8Writer::~SwWW8Writer() { } -extern "C" SAL_DLLPUBLIC_EXPORT sal_uLong SAL_CALL SaveOrDelMSVBAStorage_ww8( SfxObjectShell& rDoc, SotStorage& rStor, sal_Bool bSaveInto, const String& rStorageName ) +extern "C" SAL_DLLPUBLIC_EXPORT sal_uLong SAL_CALL SaveOrDelMSVBAStorage_ww8( SfxObjectShell& rDoc, SotStorage& rStor, sal_Bool bSaveInto, const OUString& rStorageName ) { SvxImportMSVBasic aTmp( rDoc, rStor ); return aTmp.SaveOrDelMSVBAStorage( bSaveInto, rStorageName ); } -extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL ExportDOC( const String& rFltName, const String& rBaseURL, WriterRef& xRet ) +extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL ExportDOC( const OUString& rFltName, const OUString& rBaseURL, WriterRef& xRet ) { xRet = new SwWW8Writer( rFltName, rBaseURL ); } @@ -3734,11 +3734,11 @@ void WW8Export::WriteFormData( const ::sw::mark::IFieldmark& rFieldmark ) *pDataStrm << sal_uInt16(0); - SwWW8Writer::WriteString_xstz( *pDataStrm, String( ffformat ), true ); - SwWW8Writer::WriteString_xstz( *pDataStrm, String( ffhelptext ), true ); - SwWW8Writer::WriteString_xstz( *pDataStrm, String( ffstattext ), true ); - SwWW8Writer::WriteString_xstz( *pDataStrm, String( ffentrymcr ), true ); - SwWW8Writer::WriteString_xstz( *pDataStrm, String( ffexitmcr ), true ); + SwWW8Writer::WriteString_xstz( *pDataStrm, OUString( ffformat ), true ); + SwWW8Writer::WriteString_xstz( *pDataStrm, OUString( ffhelptext ), true ); + SwWW8Writer::WriteString_xstz( *pDataStrm, OUString( ffstattext ), true ); + SwWW8Writer::WriteString_xstz( *pDataStrm, OUString( ffentrymcr ), true ); + SwWW8Writer::WriteString_xstz( *pDataStrm, OUString( ffexitmcr ), true ); if (type==2) { *pDataStrm<<(sal_uInt16)0xFFFF; const int items=aListItems.size(); diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx index f618cb6054a6..fbca287233f0 100644 --- a/sw/source/filter/ww8/wrtww8gr.cxx +++ b/sw/source/filter/ww8/wrtww8gr.cxx @@ -281,9 +281,7 @@ void WW8Export::OutputOLENode( const SwOLENode& rOLENode ) // write as embedded field - the other things will be done // in the escher export - String sServer(FieldString(ww::eEMBED)); - sServer += xOleStg->GetUserName(); - sServer += ' '; + OUString sServer = FieldString(ww::eEMBED) + xOleStg->GetUserName() + " "; OutputField(0, ww::eEMBED, sServer, WRITEFIELD_START | WRITEFIELD_CMD_START | WRITEFIELD_CMD_END); @@ -509,7 +507,7 @@ void WW8Export::OutGrf(const sw::Frame &rFrame) // linked, as-character anchored graphics have to be exported as fields. else if ( pGrfNd && pGrfNd->IsLinkedFile() ) { - OutputField( 0, ww::eINCLUDEPICTURE, String(), WRITEFIELD_CLOSE ); + OutputField( 0, ww::eINCLUDEPICTURE, OUString(), WRITEFIELD_CLOSE ); } //Added for i120568,the hyperlink info within a graphic whose anchor type is //"As character" will be exported to ensure the fidelity diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 39a198184f74..528615ebedc3 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -955,9 +955,9 @@ void WW8AttributeOutput::StartRun( const SwRedlineData* pRedlineData, bool /*bSi { if (pRedlineData) { - const String &rComment = pRedlineData->GetComment(); + const OUString &rComment = pRedlineData->GetComment(); //Only possible to export to main text - if (rComment.Len() && (m_rWW8Export.nTxtTyp == TXT_MAINTEXT)) + if (!rComment.isEmpty() && (m_rWW8Export.nTxtTyp == TXT_MAINTEXT)) { if (m_rWW8Export.pAtn->IsNewRedlineComment(pRedlineData)) { @@ -1647,7 +1647,7 @@ void WW8AttributeOutput::TextINetFormat( const SwFmtINetFmt& rINet ) // add optional parameter <bIncludeEmptyPicLocation> // It is needed to write an empty picture location for page number field separators static void InsertSpecialChar( WW8Export& rWrt, sal_uInt8 c, - String* pLinkStr = 0L, + OUString* pLinkStr = 0L, bool bIncludeEmptyPicLocation = false ) { ww::bytes aItems; @@ -1691,7 +1691,7 @@ static void InsertSpecialChar( WW8Export& rWrt, sal_uInt8 c, }; rStrm.Write( aFixHeader, nFixHdrLen ); // write reference string including length+1 - sal_uInt32 nStrLen( pLinkStr->Len() + 1 ); + sal_uInt32 nStrLen( pLinkStr->getLength() + 1 ); SwWW8Writer::WriteLong( rStrm, nStrLen ); SwWW8Writer::WriteString16( rStrm, *(pLinkStr), false ); // write additional two NULL Bytes @@ -1732,7 +1732,7 @@ static void InsertSpecialChar( WW8Export& rWrt, sal_uInt8 c, rWrt.pChpPlc->AppendFkpEntry(rWrt.Strm().Tell(), aItems.size(), aItems.data()); } -static String lcl_GetExpandedField(const SwField &rFld) +static OUString lcl_GetExpandedField(const SwField &rFld) { OUString sRet(rFld.ExpandField(true)); @@ -1814,7 +1814,7 @@ void WW8Export::OutputField( const SwField* pFld, ww::eField eFldType, if ( bHandleBookmark ) { // retrieve reference destination - the name of the bookmark - String aLinkStr; + OUString aLinkStr; const sal_uInt16 nSubType = pFld->GetSubType(); const SwGetRefField& rRFld = *(static_cast<const SwGetRefField*>(pFld)); if ( nSubType == REF_SETREFATTR || @@ -1845,12 +1845,12 @@ void WW8Export::OutputField( const SwField* pFld, ww::eField eFldType, } if (WRITEFIELD_END & nMode) { - String sOut; + OUString sOut; if( pFld ) sOut = lcl_GetExpandedField(*pFld); else sOut = rFldCmd; - if( sOut.Len() ) + if( !sOut.isEmpty() ) { if( bUnicode ) SwWW8Writer::WriteString16(Strm(), sOut, false); @@ -1944,10 +1944,10 @@ sal_uInt16 MSWordExportBase::GetId( const SwTOXType& rTOXType ) // 2 - TabStop before PageNum, // 3 - Text before PageNum - rTxt hold the text // 4 - no Text and no TabStop before PageNum -static int lcl_CheckForm( const SwForm& rForm, sal_uInt8 nLvl, String& rText ) +static int lcl_CheckForm( const SwForm& rForm, sal_uInt8 nLvl, OUString& rText ) { int nRet = 4; - rText.Erase(); + rText = ""; // #i21237# SwFormTokens aPattern = rForm.GetPattern(nLvl); @@ -2048,18 +2048,18 @@ void AttributeOutputBase::StartTOX( const SwSection& rSect ) sStr += "\\h \"A\" "; { - String aFillTxt; + OUString aFillTxt; for (sal_uInt8 n = 1; n <= 3; ++n) { - String aTxt; + OUString aTxt; int nRet = ::lcl_CheckForm(pTOX->GetTOXForm(), n, aTxt); if( 3 == nRet ) aFillTxt = aTxt; else if ((4 == nRet) || (2 == nRet)) - aFillTxt = '\t'; + aFillTxt = "\t"; else - aFillTxt.Erase(); + aFillTxt = ""; } sStr += "\\e \""; sStr += aFillTxt; @@ -2078,7 +2078,7 @@ void AttributeOutputBase::StartTOX( const SwSection& rSect ) sStr += pTOX->GetSequenceName(); sStr += sEntryEnd; - String aTxt; + OUString aTxt; int nRet = ::lcl_CheckForm( pTOX->GetTOXForm(), 1, aTxt ); if (1 == nRet) sStr += "\\n "; @@ -2095,7 +2095,7 @@ void AttributeOutputBase::StartTOX( const SwSection& rSect ) { sStr = FieldString(eCode); - String sTOption; + OUString sTOption; sal_uInt16 n, nTOXLvl = pTOX->GetLevel(); if( !nTOXLvl ) ++nTOXLvl; @@ -2195,9 +2195,9 @@ void AttributeOutputBase::StartTOX( const SwSection& rSect ) sal_uInt8 nTestLvl = ::sal::static_int_cast<sal_uInt8>(pColl->GetAssignedOutlineStyleLevel()); if (nTestLvl < nTOXLvl && nTestLvl >= nMaxMSAutoEvaluate) { - if( sTOption.Len() ) - sTOption += ','; - (( sTOption += pColl->GetName() ) += ',' ) += OUString::number( nTestLvl + 1 ); + if( !sTOption.isEmpty() ) + sTOption += ","; + sTOption += pColl->GetName() + "," + OUString::number( nTestLvl + 1 ); } } } @@ -2207,21 +2207,21 @@ void AttributeOutputBase::StartTOX( const SwSection& rSect ) // #i99641# - Consider additional styles regardless of TOX-outlinelevel for( n = 0; n < MAXLEVEL; ++n ) { - const String& rStyles = pTOX->GetStyleNames( n ); - if( rStyles.Len() ) + const OUString& rStyles = pTOX->GetStyleNames( n ); + if( !rStyles.isEmpty() ) { sal_Int32 nPos = 0; - String sLvl = OUString(','); + OUString sLvl = OUString(','); sLvl += OUString::number( n + 1 ); do { - String sStyle( rStyles.GetToken( 0, TOX_STYLE_DELIMITER, nPos )); - if( sStyle.Len() ) + OUString sStyle( rStyles.getToken( 0, TOX_STYLE_DELIMITER, nPos )); + if( !sStyle.isEmpty() ) { SwTxtFmtColl* pColl = GetExport().pDoc->FindTxtFmtCollByName(sStyle); if (!pColl || !pColl->IsAssignedToListLevelOfOutlineStyle() || pColl->GetAssignedOutlineStyleLevel() < nTOXLvl) { - if( sTOption.Len() ) - sTOption += ','; + if( !sTOption.isEmpty() ) + sTOption += ","; ( sTOption += sStyle ) += sLvl; } } @@ -2229,12 +2229,12 @@ void AttributeOutputBase::StartTOX( const SwSection& rSect ) } } - String aFillTxt; + OUString aFillTxt; sal_uInt8 nNoPgStt = MAXLEVEL, nNoPgEnd = MAXLEVEL; bool bFirstFillTxt = true, bOnlyText = true; for( n = 0; n < nTOXLvl; ++n ) { - String aTxt; + OUString aTxt; int nRet = ::lcl_CheckForm( pTOX->GetTOXForm(), static_cast< sal_uInt8 >(n+1), aTxt ); if( 1 == nRet ) @@ -2255,7 +2255,7 @@ void AttributeOutputBase::StartTOX( const SwSection& rSect ) if( bFirstFillTxt ) aFillTxt = aTxt; else if( aFillTxt != aTxt ) - aFillTxt.Erase(); + aFillTxt = ""; bFirstFillTxt = false; } } @@ -2277,7 +2277,7 @@ void AttributeOutputBase::StartTOX( const SwSection& rSect ) sStr += sEntryEnd; } - if( sTOption.Len() ) + if( !sTOption.isEmpty() ) { sStr += "\\t \""; sStr += sTOption; @@ -2429,7 +2429,7 @@ void WW8AttributeOutput::HiddenField( const SwField& rFld ) void WW8AttributeOutput::SetField( const SwField& rFld, ww::eField eType, const OUString& rCmd ) { const SwSetExpField* pSet=(const SwSetExpField*)(&rFld); - const String &rVar = pSet->GetPar2(); + const OUString &rVar = pSet->GetPar2(); sal_uLong nFrom = m_rWW8Export.Fc2Cp(m_rWW8Export.Strm().Tell()); @@ -2446,7 +2446,7 @@ void WW8AttributeOutput::SetField( const SwField& rFld, ww::eField eType, const */ m_rWW8Export.MoveFieldMarks(nFrom,m_rWW8Export.Fc2Cp(m_rWW8Export.Strm().Tell())); - if (rVar.Len()) + if (!rVar.isEmpty()) { if (m_rWW8Export.IsUnicode()) SwWW8Writer::WriteString16(m_rWW8Export.Strm(), rVar, false); @@ -2494,8 +2494,8 @@ void WW8AttributeOutput::RefField( const SwField &rFld, const OUString &rRef) sStr += "\"" + rRef + "\" "; m_rWW8Export.OutputField( &rFld, ww::eREF, sStr, WRITEFIELD_START | WRITEFIELD_CMD_START | WRITEFIELD_CMD_END ); - String sVar = lcl_GetExpandedField( rFld ); - if ( sVar.Len() ) + OUString sVar = lcl_GetExpandedField( rFld ); + if ( !sVar.isEmpty() ) { if ( m_rWW8Export.IsUnicode() ) SwWW8Writer::WriteString16( m_rWW8Export.Strm(), sVar, false ); @@ -2510,7 +2510,7 @@ void WW8AttributeOutput::RefField( const SwField &rFld, const OUString &rRef) void WW8AttributeOutput::WriteExpand( const SwField* pFld ) { - String sExpand( lcl_GetExpandedField( *pFld ) ); + OUString sExpand( lcl_GetExpandedField( *pFld ) ); if ( m_rWW8Export.IsUnicode() ) SwWW8Writer::WriteString16( m_rWW8Export.Strm(), sExpand, false ); else @@ -2668,11 +2668,11 @@ void AttributeOutputBase::TextField( const SwFmtFld& rField ) if (pDocInfoField != NULL) { - String sFieldname = pDocInfoField->GetFieldName(); - xub_StrLen nIndex = sFieldname.Search(':'); + OUString sFieldname = pDocInfoField->GetFieldName(); + sal_Int32 nIndex = sFieldname.indexOf(':'); - if (nIndex != sFieldname.Len()) - sFieldname = sFieldname.Copy(nIndex + 1); + if (nIndex != sFieldname.getLength()) + sFieldname = sFieldname.copy(nIndex + 1); sStr = sQuotes + sFieldname + sQuotes; } @@ -2928,8 +2928,8 @@ void AttributeOutputBase::TextField( const SwFmtFld& rField ) break; case RES_HIDDENTXTFLD: { - String sExpand(pFld->GetPar2()); - if (sExpand.Len()) + OUString sExpand(pFld->GetPar2()); + if (!sExpand.isEmpty()) { HiddenField( *pFld ); } @@ -3196,7 +3196,7 @@ void AttributeOutputBase::TextFootnote( const SwFmtFtn& rFtn ) // if any reference to this footnote/endnote then insert an internal // Bookmark. - String sBkmkNm; + OUString sBkmkNm; if ( GetExport().HasRefToObject( nTyp, 0, rFtn.GetTxtFtn()->GetSeqRefNo() )) { sBkmkNm = GetExport().GetBookmarkName( nTyp, 0, @@ -3206,7 +3206,7 @@ void AttributeOutputBase::TextFootnote( const SwFmtFtn& rFtn ) TextFootnote_Impl( rFtn ); - if ( sBkmkNm.Len() ) + if ( !sBkmkNm.isEmpty() ) GetExport().AppendBookmark( sBkmkNm ); // FIXME: Why is it added twice? Shouldn't this one go to WW8AttributeOuput::TextFootnote_Impl()? } diff --git a/sw/source/filter/ww8/ww8glsy.cxx b/sw/source/filter/ww8/ww8glsy.cxx index d07b4dd065a6..831566ad9866 100644 --- a/sw/source/filter/ww8/ww8glsy.cxx +++ b/sw/source/filter/ww8/ww8glsy.cxx @@ -84,7 +84,7 @@ bool WW8Glossary::MakeEntries(SwDoc *pD, SwTextBlocks &rBlocks, { // this code will be called after reading all text into the // empty sections - const String aOldURL( rBlocks.GetBaseURL() ); + const OUString aOldURL( rBlocks.GetBaseURL() ); bool bRet=false; if( bSaveRelFile ) { @@ -149,16 +149,16 @@ bool WW8Glossary::MakeEntries(SwDoc *pD, SwTextBlocks &rBlocks, rBlocks.ClearDoc(); const OUString &rLNm = rStrings[nGlosEntry]; - String sShortcut = rLNm; + OUString sShortcut = rLNm; // Need to check make sure the shortcut is not already being used sal_Int32 nStart = 0; sal_uInt16 nCurPos = rBlocks.GetIndex( sShortcut ); - xub_StrLen nLen = sShortcut.Len(); + xub_StrLen nLen = sShortcut.getLength(); while( (sal_uInt16)-1 != nCurPos ) { - sShortcut.Erase( nLen ) += - OUString::number(++nStart); // add an Number to it + sShortcut = sShortcut.copy( 0, nLen ); + sShortcut += OUString::number(++nStart); // add an Number to it nCurPos = rBlocks.GetIndex( sShortcut ); } diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index 294dd95c8409..1e310b7d98b9 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -561,11 +561,11 @@ static void lcl_StripFields(OUString &rString, long &rNewStartCp) class Chunk { private: - String msURL; + OUString msURL; long mnStartPos; //0x13 long mnEndPos; //0x15 public: - explicit Chunk(long nStart, const String &rURL) + explicit Chunk(long nStart, const OUString &rURL) : msURL(rURL), mnStartPos(nStart), mnEndPos(0) {} Chunk(const Chunk &rChunk) : msURL(rChunk.msURL), mnStartPos(rChunk.mnStartPos), @@ -580,7 +580,7 @@ public: void SetEndPos(long nEnd) { mnEndPos = nEnd; } long GetStartPos() const {return mnStartPos;} long GetEndPos() const {return mnEndPos;} - const String &GetURL() const {return msURL;} + const OUString &GetURL() const {return msURL;} void Adjust(sal_Int32 nAdjust) { mnStartPos-=nAdjust; @@ -677,7 +677,7 @@ void SwWW8ImplReader::InsertAttrsAsDrawingAttrs(long nStartCp, long nEndCp, size_t nCount = pCtrlStck->size(); if (maFieldStack.empty() && Read_Field(&aRes)) { - String sURL; + OUString sURL; for (size_t nI = pCtrlStck->size(); nI > nCount; --nI) { const SfxPoolItem *pItem = ((*pCtrlStck)[nI-1]).pAttr; @@ -768,7 +768,7 @@ void SwWW8ImplReader::InsertAttrsAsDrawingAttrs(long nStartCp, long nEndCp, lcl_StripFields(aString, nDummy); sal_Int32 nChanged; - if (aIter->GetURL().Len()) + if (!aIter->GetURL().isEmpty()) { SvxURLField aURL(aIter->GetURL(), aString, SVXURLFORMAT_APPDEFAULT); @@ -2583,7 +2583,7 @@ SwFrmFmt* SwWW8ImplReader::Read_GrafLayer( long nGrafAnchorCp ) if ( bMoveToBackgrd ) aFlySet.Put(SvxOpaqueItem(RES_OPAQUE,false)); - String aObjName = pObject->GetName(); + OUString aObjName = pObject->GetName(); SwFrmFmt* pRetFrmFmt = 0; if (bReplaceable) @@ -2666,7 +2666,7 @@ SwFrmFmt* SwWW8ImplReader::Read_GrafLayer( long nGrafAnchorCp ) MapWrapIntoFlyFmt(pRecord, pRetFrmFmt); // Set frame name with object name - if( pRetFrmFmt /*#i52825# */ && aObjName.Len() ) + if( pRetFrmFmt /*#i52825# */ && !aObjName.isEmpty() ) pRetFrmFmt->SetName( aObjName ); return AddAutoAnchor(pRetFrmFmt); } @@ -2935,7 +2935,7 @@ SwFlyFrmFmt* SwWW8ImplReader::ImportReplaceableDrawables( SdrObject* &rpObject, MatchEscherMirrorIntoFlySet(*pRecord, aGrSet); } - String aObjectName(rpObject->GetName()); + OUString aObjectName(rpObject->GetName()); if (OBJ_OLE2 == SdrObjKind(rpObject->GetObjIdentifier())) pRetFrmFmt = InsertOle(*((SdrOle2Obj*)rpObject), rFlySet, aGrSet); else @@ -2945,7 +2945,7 @@ SwFlyFrmFmt* SwWW8ImplReader::ImportReplaceableDrawables( SdrObject* &rpObject, if (pGrf->IsLinkedGraphic() && !pGrf->GetFileName().isEmpty()) { GraphicType eType = pGrf->GetGraphicType(); - String aGrfName( + OUString aGrfName( URIHelper::SmartRel2Abs( INetURLObject(sBaseURL), pGrf->GetFileName(), URIHelper::GetMaybeFileHdl())); diff --git a/sw/source/filter/ww8/ww8graf2.cxx b/sw/source/filter/ww8/ww8graf2.cxx index 529f744cb138..d95637342aa1 100644 --- a/sw/source/filter/ww8/ww8graf2.cxx +++ b/sw/source/filter/ww8/ww8graf2.cxx @@ -246,7 +246,7 @@ bool SwWW8ImplReader::GetPictGrafFromStream(Graphic& rGraphic, SvStream& rSrc) GRFILTER_FORMAT_DONTKNOW); } -bool SwWW8ImplReader::ReadGrafFile(String& rFileName, Graphic*& rpGraphic, +bool SwWW8ImplReader::ReadGrafFile(OUString& rFileName, Graphic*& rpGraphic, const WW8_PIC& rPic, SvStream* pSt, sal_uLong nFilePos, bool* pbInDoc) { // Grafik in File schreiben *pbInDoc = true; // default @@ -260,12 +260,12 @@ bool SwWW8ImplReader::ReadGrafFile(String& rFileName, Graphic*& rpGraphic, pSt->Seek(nPosFc); // Name als P-String einlesen rFileName = read_uInt8_PascalString(*pSt, eStructCharSet); - if (rFileName.Len()) + if (!rFileName.isEmpty()) rFileName = URIHelper::SmartRel2Abs( INetURLObject(sBaseURL), rFileName, URIHelper::GetMaybeFileHdl()); *pbInDoc = false; // Datei anschliessend nicht loeschen - return rFileName.Len() != 0; // Einlesen OK + return !rFileName.isEmpty(); // Einlesen OK } GDIMetaFile aWMF; @@ -415,7 +415,7 @@ SwFrmFmt* SwWW8ImplReader::ImportGraf1(WW8_PIC& rPic, SvStream* pSt, if( pSt->IsEof() || rPic.fError || rPic.MFP.mm == 99 ) return 0; - String aFileName; + OUString aFileName; bool bInDoc; Graphic* pGraph = 0; bool bOk = ReadGrafFile(aFileName, pGraph, rPic, pSt, nFilePos, &bInDoc); diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 046e1b44f658..686fdb10a786 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -763,7 +763,7 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt, SfxItemState eState = aSet.GetItemState( XATTR_FILLCOLOR, sal_False, &pPoolItem ); if( SFX_ITEM_DEFAULT == eState ) - aSet.Put( XFillColorItem( String(), + aSet.Put( XFillColorItem( OUString(), Color( mnDefaultColor ) ) ); pObj->SetMergedItemSet(aSet); } @@ -1019,7 +1019,7 @@ const SwNumFmt* SwWW8FltControlStack::GetNumFmtFromStack(const SwPosition &rPos, const SfxPoolItem *pItem = GetStackAttr(rPos, RES_FLTR_NUMRULE); if (pItem && rTxtNode.GetNumRule()) { - String sName(((SfxStringItem*)pItem)->GetValue()); + OUString sName(((SfxStringItem*)pItem)->GetValue()); if (rTxtNode.IsCountedInList()) { const SwNumRule *pRule = pDoc->FindNumRulePtr(sName); @@ -1804,7 +1804,7 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes) if (pA) sAuthor = *pA; else - sAuthor = String(pDescri->xstUsrInitl + 1, pDescri->xstUsrInitl[0], + sAuthor = OUString(pDescri->xstUsrInitl + 1, pDescri->xstUsrInitl[0], RTL_TEXTENCODING_MS_1252); } else @@ -2716,9 +2716,9 @@ bool SwWW8ImplReader::ReadPlainChars(WW8_CP& rPos, long nEnd, long nCpOfs) sal_Char aTest[2]; aTest[0] = static_cast< sal_Char >((nUCode & 0xFF00) >> 8); aTest[1] = static_cast< sal_Char >(nUCode & 0x00FF); - String aTemp(aTest, 2, eSrcCJKCharSet); - OSL_ENSURE(aTemp.Len() == 1, "so much for that theory"); - *pWork = aTemp.GetChar(0); + OUString aTemp(aTest, 2, eSrcCJKCharSet); + OSL_ENSURE(aTemp.getLength() == 1, "so much for that theory"); + *pWork = aTemp[0]; } else { @@ -3007,11 +3007,11 @@ void SwWW8ImplReader::simpleAddTextToParagraph(const OUString& rAddString) if (pNd->GetTxt().getLength() < STRING_MAXLEN -1) { - String sTempStr (rAddString,0, + OUString sTempStr = rAddString.copy( 0, STRING_MAXLEN - pNd->GetTxt().getLength() -1); rDoc.InsertString(*pPaM, sTempStr); - sTempStr = rAddString.copy(sTempStr.Len(), - rAddString.getLength() - sTempStr.Len()); + sTempStr = rAddString.copy(sTempStr.getLength(), + rAddString.getLength() - sTempStr.getLength()); AppendTxtNode(*pPaM->GetPoint()); rDoc.InsertString(*pPaM, sTempStr); } @@ -4288,10 +4288,10 @@ void SwWW8ImplReader::ReadDocInfo() #if OSL_DEBUG_LEVEL > 1 aSttb.Print( stderr ); #endif - String sPath = aSttb.getStringAtIndex( 0x1 ); + OUString sPath = aSttb.getStringAtIndex( 0x1 ); OUString aURL; // attempt to convert to url (won't work for obvious reasons on linux) - if ( sPath.Len() ) + if ( !sPath.isEmpty() ) ::utl::LocalFileHelper::ConvertPhysicalNameToURL( sPath, aURL ); if (aURL.isEmpty()) xDocProps->setTemplateURL( aURL ); @@ -4380,7 +4380,7 @@ bool WW8Customizations::Import( SwDocShell* pShell ) bool SwWW8ImplReader::ReadGlobalTemplateSettings( const OUString& sCreatedFrom, const uno::Reference< container::XNameContainer >& xPrjNameCache ) { SvtPathOptions aPathOpt; - String aAddinPath = aPathOpt.GetAddinPath(); + OUString aAddinPath = aPathOpt.GetAddinPath(); uno::Sequence< OUString > sGlobalTemplates; // first get the autoload addins in the directory STARTUP @@ -4998,9 +4998,9 @@ namespace } // moan, copy and paste :-( - String QueryPasswordForMedium(SfxMedium& rMedium) + OUString QueryPasswordForMedium(SfxMedium& rMedium) { - String aPassw; + OUString aPassw; using namespace com::sun::star; @@ -5044,7 +5044,7 @@ namespace if ( !aEncryptionData.getLength() ) { - String sUniPassword = QueryPasswordForMedium( rMedium ); + OUString sUniPassword = QueryPasswordForMedium( rMedium ); OString sPassword(OUStringToOString(sUniPassword, WW8Fib::GetFIBCharset(pWwFib->chseTables))); @@ -5080,7 +5080,7 @@ namespace sal_uInt16 pStd97Pass[16]; memset( pStd97Pass, 0, sizeof( pStd97Pass ) ); for (xub_StrLen nChar = 0; nChar < nLen; ++nChar ) - pStd97Pass[nChar] = sUniPassword.GetChar(nChar); + pStd97Pass[nChar] = sUniPassword[nChar]; aCodec97.InitKey( pStd97Pass, pDocId ); @@ -5103,15 +5103,15 @@ namespace if ( !aEncryptionData.getLength() ) { - String sUniPassword = QueryPasswordForMedium( rMedium ); + OUString sUniPassword = QueryPasswordForMedium( rMedium ); - xub_StrLen nLen = sUniPassword.Len(); + xub_StrLen nLen = sUniPassword.getLength(); if ( nLen <= 15 ) { sal_Unicode pPassword[16]; memset( pPassword, 0, sizeof( pPassword ) ); for (xub_StrLen nChar = 0; nChar < nLen; ++nChar ) - pPassword[nChar] = sUniPassword.GetChar(nChar); + pPassword[nChar] = sUniPassword[nChar]; rCodec.InitKey( pPassword, pDocId ); aEncryptionData = rCodec.GetEncryptionData(); diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index 8deec2968f32..bb20928b91ef 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -1405,7 +1405,7 @@ private: bool ProcessSpecial(bool &rbReSync, WW8_CP nStartCp); sal_uInt16 TabRowSprm(int nLevel) const; - bool ReadGrafFile(String& rFileName, Graphic*& rpGraphic, + bool ReadGrafFile(OUString& rFileName, Graphic*& rpGraphic, const WW8_PIC& rPic, SvStream* pSt, sal_uLong nFilePos, bool* pDelIt); void ReplaceObj(const SdrObject &rReplaceTextObj, diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index ca9cb5050854..66c2b9941740 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -103,7 +103,7 @@ WW8TabBandDesc::~WW8TabBandDesc() class WW8TabDesc { - std::vector<String> aNumRuleNames; + std::vector<OUString> aNumRuleNames; sw::util::RedlineStack *mpOldRedlineStack; SwWW8ImplReader* pIo; @@ -193,8 +193,8 @@ public: const WW8_TCell* GetAktWWCell() const { return pAktWWCell; } short GetAktCol() const { return nAktCol; } // find name of numrule valid for current WW-COL - const String& GetNumRuleName() const; - void SetNumRuleName( const String& rName ); + const OUString& GetNumRuleName() const; + void SetNumRuleName( const OUString& rName ); sw::util::RedlineStack* getOldRedlineStack(){ return mpOldRedlineStack; } }; @@ -291,12 +291,12 @@ sal_uInt16 SwWW8ImplReader::End_Ftn() SwTxtNode* pTxt = pPaM->GetNode()->GetTxtNode(); xub_StrLen nPos = pPaM->GetPoint()->nContent.GetIndex(); - String sChar; + OUString sChar; SwTxtAttr* pFN = 0; //There should have been a footnote char, we will replace this. if (pTxt && nPos) { - sChar.Append(pTxt->GetTxt()[--nPos]); + sChar += OUString(pTxt->GetTxt()[--nPos]); pPaM->SetMark(); pPaM->GetMark()->nContent--; rDoc.DeleteRange( *pPaM ); @@ -326,7 +326,7 @@ sal_uInt16 SwWW8ImplReader::End_Ftn() bFtEdOk = true; bFtnEdn = bOld; - OSL_ENSURE(sChar.Len()==1 && ((rDesc.mbAutoNum == (sChar.GetChar(0) == 2))), + OSL_ENSURE(sChar.getLength()==1 && ((rDesc.mbAutoNum == (sChar[0] == 2))), "footnote autonumbering must be 0x02, and everthing else must not be"); // If no automatic numbering use the following char from the main text @@ -342,9 +342,9 @@ sal_uInt16 SwWW8ImplReader::End_Ftn() SwNodeIndex& rNIdx = pPaM->GetPoint()->nNode; rNIdx = pSttIdx->GetIndex() + 1; SwTxtNode* pTNd = rNIdx.GetNode().GetTxtNode(); - if (pTNd && !pTNd->GetTxt().isEmpty() && sChar.Len()) + if (pTNd && !pTNd->GetTxt().isEmpty() && !sChar.isEmpty()) { - if (pTNd->GetTxt()[0] == sChar.GetChar(0)) + if (pTNd->GetTxt()[0] == sChar[0]) { pPaM->GetPoint()->nContent.Assign( pTNd, 0 ); pPaM->SetMark(); @@ -589,8 +589,7 @@ static void SetBaseAnlv(SwNumFmt &rNum, WW8_ANLV &rAV, sal_uInt8 nSwLevel ) if( SVBT8ToByte( rAV.nfc ) == 5 || SVBT8ToByte( rAV.nfc ) == 7 ) { - String sP( rNum.GetSuffix() ); - sP.Insert( '.', 0 ); + OUString sP = "." + rNum.GetSuffix(); rNum.SetSuffix( sP ); // ordinal number } } @@ -604,10 +603,10 @@ void SwWW8ImplReader::SetAnlvStrings(SwNumFmt &rNum, WW8_ANLV &rAV, const WW8_FFN* pF = pFonts->GetFont(SVBT16ToShort(rAV.ftc)); // FontInfo bool bListSymbol = pF && ( pF->chs == 2 ); // Symbol/WingDings/... - String sTxt; + OUString sTxt; if (bVer67) { - sTxt = String( (sal_Char*)pTxt, SVBT8ToByte( rAV.cbTextBefore ) + sTxt = OUString( (sal_Char*)pTxt, SVBT8ToByte( rAV.cbTextBefore ) + SVBT8ToByte( rAV.cbTextAfter ), eCharSet ); } else @@ -615,7 +614,7 @@ void SwWW8ImplReader::SetAnlvStrings(SwNumFmt &rNum, WW8_ANLV &rAV, for(xub_StrLen i = SVBT8ToByte(rAV.cbTextBefore); i < SVBT8ToByte(rAV.cbTextAfter); ++i, pTxt += 2) { - sTxt.Append(SVBT16ToShort(*(SVBT16*)pTxt)); + sTxt += OUString(SVBT16ToShort(*(SVBT16*)pTxt)); } } @@ -661,7 +660,7 @@ void SwWW8ImplReader::SetAnlvStrings(SwNumFmt &rNum, WW8_ANLV &rAV, // take only the very first character if( rAV.cbTextBefore || rAV.cbTextAfter) - rNum.SetBulletChar( sTxt.GetChar( 0 ) ); + rNum.SetBulletChar( sTxt[ 0 ] ); else rNum.SetBulletChar( 0x2190 ); } @@ -671,14 +670,14 @@ void SwWW8ImplReader::SetAnlvStrings(SwNumFmt &rNum, WW8_ANLV &rAV, { if( rAV.cbTextBefore ) { - String sP( sTxt.Copy( 0, SVBT8ToByte( rAV.cbTextBefore ) ) ); + OUString sP( sTxt.copy( 0, SVBT8ToByte( rAV.cbTextBefore ) ) ); rNum.SetPrefix( sP ); } if( SVBT8ToByte( rAV.cbTextAfter ) ) { - String sP( rNum.GetSuffix() ); - sP.Insert( sTxt.Copy( SVBT8ToByte( rAV.cbTextBefore ), - SVBT8ToByte( rAV.cbTextAfter ) ) ); + OUString sP( rNum.GetSuffix() ); + sP += sTxt.copy( SVBT8ToByte( rAV.cbTextBefore ), + SVBT8ToByte( rAV.cbTextAfter ) ); rNum.SetSuffix( sP ); } // The characters before and after multipe digits do not apply because @@ -899,36 +898,36 @@ void SwWW8ImplReader::StartAnl(const sal_uInt8* pSprm13) // check for COL numbering: const sal_uInt8* pS12 = 0;// sprmAnld - String sNumRule; + OUString sNumRule; if (pTableDesc) { sNumRule = pTableDesc->GetNumRuleName(); - if (sNumRule.Len()) + if (!sNumRule.isEmpty()) { pNumRule = rDoc.FindNumRulePtr(sNumRule); if (!pNumRule) - sNumRule.Erase(); + sNumRule = ""; else { // this is ROW numbering ? pS12 = pPlcxMan->HasParaSprm(bVer67 ? 12 : 0xC63E); // sprmAnld if (pS12 && 0 != SVBT8ToByte(((WW8_ANLD*)pS12)->fNumberAcross)) - sNumRule.Erase(); + sNumRule = ""; } } } SwWW8StyInf * pStyInf = GetStyle(nAktColl); - if (!sNumRule.Len() && pStyInf != NULL && pStyInf->bHasStyNumRule) + if (sNumRule.isEmpty() && pStyInf != NULL && pStyInf->bHasStyNumRule) { sNumRule = pStyInf->pFmt->GetNumRule().GetValue(); pNumRule = rDoc.FindNumRulePtr(sNumRule); if (!pNumRule) - sNumRule.Erase(); + sNumRule = ""; } - if (!sNumRule.Len()) + if (sNumRule.isEmpty()) { if (!pNumRule) { @@ -3304,16 +3303,16 @@ sal_uInt16 WW8TabDesc::GetLogicalWWCol() const // returns number of col as INDIC } // find name of numrule valid for current WW-COL -const String& WW8TabDesc::GetNumRuleName() const +const OUString& WW8TabDesc::GetNumRuleName() const { sal_uInt16 nCol = GetLogicalWWCol(); if (nCol < aNumRuleNames.size()) return aNumRuleNames[nCol]; else - return aEmptyStr; + return aEmptyOUStr; } -void WW8TabDesc::SetNumRuleName( const String& rName ) +void WW8TabDesc::SetNumRuleName( const OUString& rName ) { sal_uInt16 nCol = GetLogicalWWCol(); for (sal_uInt16 nSize = static_cast< sal_uInt16 >(aNumRuleNames.size()); nSize <= nCol; ++nSize) @@ -4225,12 +4224,12 @@ void WW8RStyle::ImportOldFormatStyles() SwWW8StyInf &rSI = pIo->vColl[stc]; if (nCount != 0xFF) // undefined style { - String sName; + OUString sName; if (nCount == 0) // inbuilt style { ww::sti eSti = ww::GetCanonicalStiFromStc(stc); if (const sal_Char *pStr = GetEnglishNameFromSti(eSti)) - sName = String(pStr, RTL_TEXTENCODING_ASCII_US); + sName = OUString(pStr, strlen(pStr), RTL_TEXTENCODING_ASCII_US); else sName = OUString("Unknown"); } @@ -4248,7 +4247,7 @@ void WW8RStyle::ImportOldFormatStyles() ww::sti eSti = ww::GetCanonicalStiFromStc(stc); if (const sal_Char *pStr = GetEnglishNameFromSti(eSti)) { - String sName = String(pStr, RTL_TEXTENCODING_ASCII_US); + OUString sName = OUString(pStr, strlen(pStr), RTL_TEXTENCODING_ASCII_US); rSI.SetOrgWWIdent(sName, stc); } } diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index cdd8ce3aba8e..e7b0b40702ef 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -136,28 +136,28 @@ eF_ResT SwWW8ImplReader::Read_F_FormTextBox( WW8FieldDesc* pF, OUString& rStr ) return FLD_OK; } else { WW8PLCFx_Book* pB = pPlcxMan->GetBook(); - String aBookmarkName; + OUString aBookmarkName; if (pB!=NULL) { WW8_CP currentCP=pF->nSCode; WW8_CP currentLen=pF->nLen; sal_uInt16 bkmFindIdx; - String aBookmarkFind=pB->GetBookmark(currentCP-1, currentCP+currentLen-1, bkmFindIdx); + OUString aBookmarkFind=pB->GetBookmark(currentCP-1, currentCP+currentLen-1, bkmFindIdx); - if (aBookmarkFind.Len()>0) { + if (!aBookmarkFind.isEmpty()) { pB->SetStatus(bkmFindIdx, BOOK_FIELD); // mark bookmark as consumed, such that tl'll not get inserted as a "normal" bookmark again - if (aBookmarkFind.Len()>0) { + if (!aBookmarkFind.isEmpty()) { aBookmarkName=aBookmarkFind; } } } - if (pB!=NULL && aBookmarkName.Len()==0) { + if (pB!=NULL && aBookmarkName.isEmpty()) { aBookmarkName=pB->GetUniqueBookmarkName(aFormula.sTitle); } - if (aBookmarkName.Len()>0) { + if (!aBookmarkName.isEmpty()) { maFieldStack.back().SetBookmarkName(aBookmarkName); maFieldStack.back().SetBookmarkType(ODF_FORMTEXT); maFieldStack.back().getParameters()["Description"] = uno::makeAny(OUString(aFormula.sToolTip)); @@ -185,28 +185,28 @@ eF_ResT SwWW8ImplReader::Read_F_FormCheckBox( WW8FieldDesc* pF, OUString& rStr ) return FLD_OK; } - String aBookmarkName; + OUString aBookmarkName; WW8PLCFx_Book* pB = pPlcxMan->GetBook(); if (pB!=NULL) { WW8_CP currentCP=pF->nSCode; WW8_CP currentLen=pF->nLen; sal_uInt16 bkmFindIdx; - String aBookmarkFind=pB->GetBookmark(currentCP-1, currentCP+currentLen-1, bkmFindIdx); + OUString aBookmarkFind=pB->GetBookmark(currentCP-1, currentCP+currentLen-1, bkmFindIdx); - if (aBookmarkFind.Len()>0) { + if (!aBookmarkFind.isEmpty()) { pB->SetStatus(bkmFindIdx, BOOK_FIELD); // mark as consumed by field - if (aBookmarkFind.Len()>0) { + if (!aBookmarkFind.isEmpty()) { aBookmarkName=aBookmarkFind; } } } - if (pB!=NULL && aBookmarkName.Len()==0) { + if (pB!=NULL && aBookmarkName.isEmpty()) { aBookmarkName=pB->GetUniqueBookmarkName(aFormula.sTitle); } - if (aBookmarkName.Len()>0) + if (!aBookmarkName.isEmpty()) { IDocumentMarkAccess* pMarksAccess = rDoc.getIDocumentMarkAccess( ); IFieldmark* pFieldmark = dynamic_cast<IFieldmark*>( pMarksAccess->makeNoTextFieldBookmark( @@ -257,7 +257,7 @@ eF_ResT SwWW8ImplReader::Read_F_FormListBox( WW8FieldDesc* pF, OUString& rStr) else { // TODO: review me - String aBookmarkName; + OUString aBookmarkName; WW8PLCFx_Book* pB = pPlcxMan->GetBook(); if (pB!=NULL) { @@ -265,20 +265,20 @@ eF_ResT SwWW8ImplReader::Read_F_FormListBox( WW8FieldDesc* pF, OUString& rStr) WW8_CP currentLen=pF->nLen; sal_uInt16 bkmFindIdx; - String aBookmarkFind=pB->GetBookmark(currentCP-1, currentCP+currentLen-1, bkmFindIdx); + OUString aBookmarkFind=pB->GetBookmark(currentCP-1, currentCP+currentLen-1, bkmFindIdx); - if (aBookmarkFind.Len()>0) + if (!aBookmarkFind.isEmpty()) { pB->SetStatus(bkmFindIdx, BOOK_FIELD); // mark as consumed by field - if (aBookmarkFind.Len()>0) + if (!aBookmarkFind.isEmpty()) aBookmarkName=aBookmarkFind; } } - if (pB!=NULL && aBookmarkName.Len()==0) + if (pB!=NULL && aBookmarkName.isEmpty()) aBookmarkName=pB->GetUniqueBookmarkName(aFormula.sTitle); - if (aBookmarkName.Len()>0) + if (!aBookmarkName.isEmpty()) { IDocumentMarkAccess* pMarksAccess = rDoc.getIDocumentMarkAccess( ); IFieldmark *pFieldmark = dynamic_cast<IFieldmark*>( @@ -485,16 +485,16 @@ WW8LSTInfo* WW8ListManager::GetLSTByListId( sal_uInt32 nIdLst ) const return *aResult; } -static void lcl_CopyGreaterEight(String &rDest, String &rSrc, +static void lcl_CopyGreaterEight(OUString &rDest, OUString &rSrc, xub_StrLen nStart, xub_StrLen nLen = STRING_LEN) { - if (nLen > rSrc.Len() || nLen == STRING_LEN) - nLen = rSrc.Len(); + if (nLen > rSrc.getLength() || nLen == STRING_LEN) + nLen = rSrc.getLength(); for (xub_StrLen nI = nStart; nI < nLen; ++nI) { - sal_Unicode nChar = rSrc.GetChar(nI); + sal_Unicode nChar = rSrc[nI]; if (nChar > WW8ListManager::nMaxLevel) - rDest.Append(nChar); + rDest += OUString(nChar); } } @@ -511,8 +511,8 @@ bool WW8ListManager::ReadLVL(SwNumFmt& rNumFmt, SfxItemSet*& rpItemSet, sal_Unicode cGrfBulletCP(USHRT_MAX); - String sPrefix; - String sPostfix; + OUString sPrefix; + OUString sPostfix; WW8LVL aLVL; // // 1. LVLF einlesen @@ -709,7 +709,7 @@ bool WW8ListManager::ReadLVL(SwNumFmt& rNumFmt, SfxItemSet*& rpItemSet, // // 4. den Nummerierungsstring einlesen: ergibt Prefix und Postfix // - String sNumString(read_uInt16_PascalString(rSt)); + OUString sNumString(read_uInt16_PascalString(rSt)); // // 5. gelesene Werte in Writer Syntax umwandeln @@ -777,7 +777,7 @@ bool WW8ListManager::ReadLVL(SwNumFmt& rNumFmt, SfxItemSet*& rpItemSet, for(nLevelB = 0; nLevelB <= nLevel; ++nLevelB) { sal_uInt8 nPos = aOfsNumsXCH[nLevelB]; - if (nPos && nPos < sNumString.Len() && sNumString.GetChar(nPos-1) < nMaxLevel) + if (nPos && nPos < sNumString.getLength() && sNumString[nPos-1] < nMaxLevel) { if (rNotReallyThere[nLevelB]) aOfsNumsXCH[nLevelB] = 0; @@ -815,7 +815,7 @@ bool WW8ListManager::ReadLVL(SwNumFmt& rNumFmt, SfxItemSet*& rpItemSet, if (SVX_NUM_CHAR_SPECIAL == eType) { - cBullet = sNumString.Len() ? sNumString.GetChar(0) : 0x2190; + cBullet = !sNumString.isEmpty() ? sNumString[0] : 0x2190; if (!cBullet) // unsave control code? cBullet = 0x2190; @@ -847,7 +847,7 @@ bool WW8ListManager::ReadLVL(SwNumFmt& rNumFmt, SfxItemSet*& rpItemSet, nOneBasedNextNoIndex > 0 ? nOneBasedNextNoIndex -1 : STRING_LEN; if (nNextNoIndex != STRING_LEN) ++nNextNoIndex; - if (sNumString.Len() > nNextNoIndex) + if (sNumString.getLength() > nNextNoIndex) lcl_CopyGreaterEight(sPostfix, sNumString, nNextNoIndex); } @@ -902,7 +902,7 @@ bool WW8ListManager::ReadLVL(SwNumFmt& rNumFmt, SfxItemSet*& rpItemSet, else { // reminder: Garnix ist default Prefix - if( sPrefix.Len() ) + if( !sPrefix.isEmpty() ) rNumFmt.SetPrefix( sPrefix ); // reminder: Point is default Postfix rNumFmt.SetSuffix( sPostfix ); @@ -2261,7 +2261,7 @@ void WW8FormulaControl::FormulaRead(SwWw8ControlType nWhich, maListEntries.reserve(nNoStrings); for (sal_uInt32 nI = 0; nI < nNoStrings; ++nI) { - String sEntry = read_uInt16_PascalString(*pDataStream); + OUString sEntry = read_uInt16_PascalString(*pDataStream); maListEntries.push_back(sEntry); } } @@ -2321,7 +2321,7 @@ awt::Size SwWW8ImplReader::MiserableDropDownFormHack(const OUString &rString, { case RES_CHRATR_COLOR: { - String pNm; + OUString pNm; if (xPropSetInfo->hasPropertyByName(pNm = "TextColor")) { aTmp <<= (sal_Int32)((SvxColorItem*)pItem)->GetValue().GetColor(); @@ -2333,7 +2333,7 @@ awt::Size SwWW8ImplReader::MiserableDropDownFormHack(const OUString &rString, case RES_CHRATR_FONT: { const SvxFontItem *pFontItem = (SvxFontItem *)pItem; - String pNm; + OUString pNm; if (xPropSetInfo->hasPropertyByName(pNm = "FontStyleName")) { aTmp <<= OUString( pFontItem->GetStyleName()); diff --git a/sw/source/filter/ww8/ww8par4.cxx b/sw/source/filter/ww8/ww8par4.cxx index f92e3e6ca308..c863024c532a 100644 --- a/sw/source/filter/ww8/ww8par4.cxx +++ b/sw/source/filter/ww8/ww8par4.cxx @@ -344,7 +344,7 @@ SdrObject* SwWW8ImplReader::ImportOleBase( Graphic& rGraph, long nX=0, nY=0; // nX, nY is graphic size bool bOleOk = true; - String aSrcStgName = OUString('_'); + OUString aSrcStgName('_'); // ergibt Name "_4711" aSrcStgName += OUString::number( nObjLocFc ); diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index e52b6490afeb..85acc2a5abcb 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -234,42 +234,42 @@ namespace { /// translate FieldParameter names into the /// system character set and makes them uppercase - void ConvertUFName( String& rName ) + void ConvertUFName( OUString& rName ) { rName = GetAppCharClass().uppercase( rName ); } } -static void lcl_ConvertSequenceName(String& rSequenceName) +static void lcl_ConvertSequenceName(OUString& rSequenceName) { ConvertUFName(rSequenceName); - if ('0' <= rSequenceName.GetChar(0) && '9' >= rSequenceName.GetChar(0)) - rSequenceName.Insert('_', 0); + if ('0' <= rSequenceName[0] && '9' >= rSequenceName[0]) + rSequenceName = "_" + rSequenceName; } // FindParaStart() finds 1st Parameter that follows '\' and cToken // and returns start of this parameter or STRING_NOT_FOUND. -xub_StrLen FindParaStart( const String& rStr, sal_Unicode cToken, sal_Unicode cToken2 ) +xub_StrLen FindParaStart( const OUString& rStr, sal_Unicode cToken, sal_Unicode cToken2 ) { bool bStr = false; // ignore inside a string - for( xub_StrLen nBuf=0; nBuf+1 < rStr.Len(); nBuf++ ) + for( xub_StrLen nBuf=0; nBuf+1 < rStr.getLength(); nBuf++ ) { - if( rStr.GetChar( nBuf ) == '"' ) + if( rStr[ nBuf ] == '"' ) bStr = !bStr; if( !bStr - && rStr.GetChar( nBuf ) == '\\' - && ( rStr.GetChar( nBuf + 1 ) == cToken - || rStr.GetChar( nBuf + 1 ) == cToken2 ) ) + && rStr[ nBuf ] == '\\' + && ( rStr[ nBuf + 1 ] == cToken + || rStr[ nBuf + 1 ] == cToken2 ) ) { nBuf += 2; // skip spaces between cToken and it's parameters - while( nBuf < rStr.Len() - && rStr.GetChar( nBuf ) == ' ' ) + while( nBuf < rStr.getLength() + && rStr[ nBuf ] == ' ' ) nBuf++; // return start of parameters - return nBuf < rStr.Len() ? nBuf : STRING_NOTFOUND; + return nBuf < rStr.getLength() ? nBuf : STRING_NOTFOUND; } } return STRING_NOTFOUND; @@ -278,31 +278,31 @@ xub_StrLen FindParaStart( const String& rStr, sal_Unicode cToken, sal_Unicode cT // FindPara() findet den ersten Parameter mit '\' und cToken. Es wird // ein neuer String allokiert ( der vom Aufrufer deallokiert werden muss ) // und alles, was zum Parameter gehoert, wird in ihm zurueckgeliefert. -String FindPara( const String& rStr, sal_Unicode cToken, sal_Unicode cToken2 ) +OUString FindPara( const OUString& rStr, sal_Unicode cToken, sal_Unicode cToken2 ) { xub_StrLen n2; // end xub_StrLen n = FindParaStart( rStr, cToken, cToken2 ); // start if( STRING_NOTFOUND == n ) return aEmptyStr; - if( rStr.GetChar( n ) == '"' - || rStr.GetChar( n ) == 132 ) + if( rStr[ n ] == '"' + || rStr[ n ] == 132 ) { // Anfuehrungszeichen vor Para n++; // Anfuehrungszeichen ueberlesen n2 = n; // ab hier nach Ende suchen - while( n2 < rStr.Len() - && rStr.GetChar( n2 ) != 147 - && rStr.GetChar( n2 ) != '"' ) + while( n2 < rStr.getLength() + && rStr[ n2 ] != 147 + && rStr[ n2 ] != '"' ) n2++; // Ende d. Paras suchen } else { // keine Anfuehrungszeichen n2 = n; // ab hier nach Ende suchen - while( n2 < rStr.Len() - && rStr.GetChar( n2 ) != ' ' ) + while( n2 < rStr.getLength() + && rStr[ n2 ] != ' ' ) n2++; // Ende d. Paras suchen } - return rStr.Copy( n, n2-n ); + return rStr.copy( n, n2-n ); } @@ -364,14 +364,14 @@ String GetWordDefaultDateStringAsUS(SvNumberFormatter* pFormatter, sal_uInt16 nL (*(pFormatter->GetEntry(nIndex))); aFormat.ConvertLanguage(*pFormatter, nLang, LANGUAGE_ENGLISH_US); - String sParams(aFormat.GetFormatstring()); + OUString sParams(aFormat.GetFormatstring()); // #i36594# // Fix provided by mloiseleur@openoffice.org. // A default date can have already 4 year digits, in some case - const xub_StrLen pos = sParams.Search(OUString("YYYY")); - if ( pos == STRING_NOTFOUND ) + const sal_Int32 pos = sParams.indexOf("YYYY"); + if ( pos == -1 ) { - sParams.SearchAndReplace(OUString("YY"), OUString("YYYY")); + sParams = sParams.replaceFirst("YY", "YYYY"); } return sParams; } @@ -546,7 +546,7 @@ sal_uInt16 SwWW8ImplReader::End_Field() if ( maFieldStack.back().mnObjLocFc > 0 ) { // Store the OLE object as an internal link - String sOleId = OUString('_'); + OUString sOleId('_'); sOleId += OUString::number( maFieldStack.back().mnObjLocFc ); SvStorageRef xSrc0 = pStg->OpenSotStorage(OUString(SL::aObjectPool)); @@ -992,12 +992,12 @@ void SwWW8ImplReader::MakeTagString( OUString& rStr, const OUString& rOrg ) if( bSetAsHex ) { //all Hex-Numbers with \x before - String sTmp( sHex ); + OUString sTmp( sHex ); if( cChar < 0x10 ) - sTmp += '0'; + sTmp += "0"; sTmp += OUString::number( cChar, 16 ); rStr = rStr.replaceAt( nI, 1 , sTmp ); - nI += sTmp.Len() - 1; + nI += sTmp.getLength() - 1; } } @@ -1007,7 +1007,7 @@ void SwWW8ImplReader::MakeTagString( OUString& rStr, const OUString& rOrg ) void SwWW8ImplReader::InsertTagField( const sal_uInt16 nId, const OUString& rTagText ) { - String aName(OUString("WwFieldTag")); + OUString aName("WwFieldTag"); if( SwFltGetFlag( nFieldFlags, SwFltControlStack::TAGS_DO_ID ) ) // Nummer? aName += OUString::number( nId ); // ausgeben ? @@ -1058,8 +1058,8 @@ long SwWW8ImplReader::Read_F_Tag( WW8FieldDesc* pF ) eF_ResT SwWW8ImplReader::Read_F_Input( WW8FieldDesc* pF, OUString& rStr ) { - String aDef; - String aQ; + OUString aDef; + OUString aQ; WW8ReadFieldParams aReadParam( rStr ); for (;;) { @@ -1069,7 +1069,7 @@ eF_ResT SwWW8ImplReader::Read_F_Input( WW8FieldDesc* pF, OUString& rStr ) switch( nRet ) { case -2: - if( !aQ.Len() ) + if( aQ.isEmpty() ) aQ = aReadParam.GetResult(); break; case 'd': @@ -1079,7 +1079,7 @@ eF_ResT SwWW8ImplReader::Read_F_Input( WW8FieldDesc* pF, OUString& rStr ) break; } } - if( !aDef.Len() ) + if( aDef.isEmpty() ) aDef = GetFieldResult( pF ); if ( pF->nId != 0x01 ) // 0x01 fields have no result @@ -1238,7 +1238,7 @@ OUString SwWW8ImplReader::GetMappedBookmark(const OUString &rOrigName) eF_ResT SwWW8ImplReader::Read_F_InputVar( WW8FieldDesc* pF, OUString& rStr ) { OUString sOrigName, aQ; - String aDef; + OUString aDef; WW8ReadFieldParams aReadParam( rStr ); for (;;) { @@ -1268,7 +1268,7 @@ eF_ResT SwWW8ImplReader::Read_F_InputVar( WW8FieldDesc* pF, OUString& rStr ) //#i24377#, munge Default Text into title as we have only one slot //available for aResult and aDef otherwise - if (aDef.Len()) + if (!aDef.isEmpty()) { if (!aQ.isEmpty()) aQ += " - "; @@ -1307,12 +1307,12 @@ eF_ResT SwWW8ImplReader::Read_F_ANumber( WW8FieldDesc*, OUString& rStr ) // "SEQ" eF_ResT SwWW8ImplReader::Read_F_Seq( WW8FieldDesc*, OUString& rStr ) { - String aSequenceName; - String aBook; + OUString aSequenceName; + OUString aBook; bool bHidden = false; bool bFormat = false; bool bCountOn = true; - String sStart; + OUString sStart; SvxExtNumType eNumFormat = SVX_NUM_ARABIC; WW8ReadFieldParams aReadParam( rStr ); for (;;) @@ -1323,9 +1323,9 @@ eF_ResT SwWW8ImplReader::Read_F_Seq( WW8FieldDesc*, OUString& rStr ) switch( nRet ) { case -2: - if( !aSequenceName.Len() ) + if( aSequenceName.isEmpty() ) aSequenceName = aReadParam.GetResult(); - else if( !aBook.Len() ) + else if( aBook.isEmpty() ) aBook = aReadParam.GetResult(); break; @@ -1361,7 +1361,7 @@ eF_ResT SwWW8ImplReader::Read_F_Seq( WW8FieldDesc*, OUString& rStr ) break; } } - if (!aSequenceName.Len() && !aBook.Len()) + if (aSequenceName.isEmpty() && aBook.isEmpty()) return FLD_TAGIGN; SwSetExpFieldType* pFT = (SwSetExpFieldType*)rDoc.InsertFldType( @@ -1372,8 +1372,8 @@ eF_ResT SwWW8ImplReader::Read_F_Seq( WW8FieldDesc*, OUString& rStr ) if (bHidden) aFld.SetSubType(aFld.GetSubType() | nsSwExtendedSubType::SUB_INVISIBLE); - if (sStart.Len()) - aFld.SetFormula( ( aSequenceName += '=' ) += sStart ); + if (!sStart.isEmpty()) + aFld.SetFormula( ( aSequenceName += "=" ) += sStart ); else if (!bCountOn) aFld.SetFormula(aSequenceName); @@ -1390,7 +1390,7 @@ eF_ResT SwWW8ImplReader::Read_F_DocInfo( WW8FieldDesc* pF, OUString& rStr ) if( 85 == pF->nId ) { - String aDocProperty; + OUString aDocProperty; WW8ReadFieldParams aReadParam( rStr ); for (;;) { @@ -1400,7 +1400,7 @@ eF_ResT SwWW8ImplReader::Read_F_DocInfo( WW8FieldDesc* pF, OUString& rStr ) switch( nRet ) { case -2: - if( !aDocProperty.Len() ) + if( aDocProperty.isEmpty() ) aDocProperty = aReadParam.GetResult(); break; case '*': @@ -1485,8 +1485,8 @@ eF_ResT SwWW8ImplReader::Read_F_DocInfo( WW8FieldDesc* pF, OUString& rStr ) { for(nFIdx = 0; !bFldFound && (nFldCnt > nFIdx); ++nFIdx) { - if( aDocProperty.Equals( String( aNameSet_26[nFIdx][nLIdx], - RTL_TEXTENCODING_MS_1252 ) ) ) + if( aDocProperty == OUString( aNameSet_26[nFIdx][nLIdx], strlen(aNameSet_26[nFIdx][nLIdx]), + RTL_TEXTENCODING_MS_1252 ) ) { bFldFound = true; pF->nId = aNameSet_26[nFIdx][0][0]; @@ -1577,7 +1577,7 @@ eF_ResT SwWW8ImplReader::Read_F_DocInfo( WW8FieldDesc* pF, OUString& rStr ) } } - String aData; + OUString aData; // Extract DOCVARIABLE varname if ( 64 == pF->nId ) { @@ -1590,7 +1590,7 @@ eF_ResT SwWW8ImplReader::Read_F_DocInfo( WW8FieldDesc* pF, OUString& rStr ) switch( nRet ) { case -2: - if( !aData.Len() ) + if( aData.isEmpty() ) aData = aReadParam.GetResult(); break; case '*': @@ -1618,7 +1618,7 @@ eF_ResT SwWW8ImplReader::Read_F_Author( WW8FieldDesc*, OUString& ) // Autor, sondern den aktuellen Benutzer, also besser ueber DocInfo SwDocInfoField aFld( (SwDocInfoFieldType*) rDoc.GetSysFldType( RES_DOCINFOFLD ), - DI_CREATE|DI_SUB_AUTHOR, String() ); + DI_CREATE|DI_SUB_AUTHOR, OUString() ); rDoc.InsertPoolItem( *pPaM, SwFmtFld( aFld ), 0 ); return FLD_OK; } @@ -1754,8 +1754,8 @@ eF_ResT SwWW8ImplReader::Read_F_CurPage( WW8FieldDesc*, OUString& rStr ) eF_ResT SwWW8ImplReader::Read_F_Symbol( WW8FieldDesc*, OUString& rStr ) { //e.g. #i20118# - String aQ; - String aName; + OUString aQ; + OUString aName; sal_Int32 nSize = 0; WW8ReadFieldParams aReadParam( rStr ); for (;;) @@ -1766,7 +1766,7 @@ eF_ResT SwWW8ImplReader::Read_F_Symbol( WW8FieldDesc*, OUString& rStr ) switch( nRet ) { case -2: - if( !aQ.Len() ) + if( aQ.isEmpty() ) aQ = aReadParam.GetResult(); break; case 'f': @@ -1785,12 +1785,12 @@ eF_ResT SwWW8ImplReader::Read_F_Symbol( WW8FieldDesc*, OUString& rStr ) break; } } - if( !aQ.Len() ) + if( aQ.isEmpty() ) return FLD_TAGIGN; // -> no 0-char in text - if (sal_Unicode cChar = static_cast<sal_Unicode>(aQ.ToInt32())) + if (sal_Unicode cChar = static_cast<sal_Unicode>(aQ.toInt32())) { - if (aName.Len()) // Font Name set ? + if (!aName.isEmpty()) // Font Name set ? { SvxFontItem aFont(FAMILY_DONTKNOW, aName, aEmptyStr, PITCH_DONTKNOW, RTL_TEXTENCODING_SYMBOL, RES_CHRATR_FONT); @@ -1807,7 +1807,7 @@ eF_ResT SwWW8ImplReader::Read_F_Symbol( WW8FieldDesc*, OUString& rStr ) if (nSize > 0) pCtrlStck->SetAttr(*pPaM->GetPoint(), RES_CHRATR_FONTSIZE); - if (aName.Len()) + if (!aName.isEmpty()) pCtrlStck->SetAttr(*pPaM->GetPoint(), RES_CHRATR_FONT); } else @@ -1821,7 +1821,7 @@ eF_ResT SwWW8ImplReader::Read_F_Symbol( WW8FieldDesc*, OUString& rStr ) // "EINBETTEN" eF_ResT SwWW8ImplReader::Read_F_Embedd( WW8FieldDesc*, OUString& rStr ) { - String sHost; + OUString sHost; WW8ReadFieldParams aReadParam( rStr ); for (;;) @@ -1886,7 +1886,7 @@ eF_ResT SwWW8ImplReader::Read_F_Set( WW8FieldDesc* pF, OUString& rStr ) // "REF" eF_ResT SwWW8ImplReader::Read_F_Ref( WW8FieldDesc*, OUString& rStr ) { // Reference - Field - String sOrigBkmName; + OUString sOrigBkmName; REFERENCEMARK eFormat = REF_CONTENT; WW8ReadFieldParams aReadParam( rStr ); @@ -1898,7 +1898,7 @@ eF_ResT SwWW8ImplReader::Read_F_Ref( WW8FieldDesc*, OUString& rStr ) switch( nRet ) { case -2: - if( !sOrigBkmName.Len() ) // get name of bookmark + if( sOrigBkmName.isEmpty() ) // get name of bookmark sOrigBkmName = aReadParam.GetResult(); break; @@ -1933,7 +1933,7 @@ eF_ResT SwWW8ImplReader::Read_F_Ref( WW8FieldDesc*, OUString& rStr ) } } - String sBkmName(GetMappedBookmark(sOrigBkmName)); + OUString sBkmName(GetMappedBookmark(sOrigBkmName)); SwGetRefField aFld( (SwGetRefFieldType*)rDoc.GetSysFldType( RES_GETREFFLD ), @@ -1960,7 +1960,7 @@ eF_ResT SwWW8ImplReader::Read_F_Ref( WW8FieldDesc*, OUString& rStr ) // Note Reference - Field eF_ResT SwWW8ImplReader::Read_F_NoteReference( WW8FieldDesc*, OUString& rStr ) { - String aBkmName; + OUString aBkmName; bool bAboveBelow = false; WW8ReadFieldParams aReadParam( rStr ); @@ -1972,7 +1972,7 @@ eF_ResT SwWW8ImplReader::Read_F_NoteReference( WW8FieldDesc*, OUString& rStr ) switch( nRet ) { case -2: - if( !aBkmName.Len() ) // get name of foot/endnote + if( aBkmName.isEmpty() ) // get name of foot/endnote aBkmName = aReadParam.GetResult(); break; case 'r': @@ -2010,7 +2010,7 @@ eF_ResT SwWW8ImplReader::Read_F_NoteReference( WW8FieldDesc*, OUString& rStr ) // "SEITENREF" eF_ResT SwWW8ImplReader::Read_F_PgRef( WW8FieldDesc*, OUString& rStr ) { - String sOrigName; + OUString sOrigName; WW8ReadFieldParams aReadParam( rStr ); for (;;) { @@ -2020,13 +2020,13 @@ eF_ResT SwWW8ImplReader::Read_F_PgRef( WW8FieldDesc*, OUString& rStr ) switch( nRet ) { case -2: - if( !sOrigName.Len() ) + if( sOrigName.isEmpty() ) sOrigName = aReadParam.GetResult(); break; } } - String sName(GetMappedBookmark(sOrigName)); + OUString sName(GetMappedBookmark(sOrigName)); #if defined(WW_NATIVE_TOC) if (1) { @@ -2201,7 +2201,7 @@ bool CanUseRemoteLink(const OUString &rGrfName) // "EINF"UGENGRAFIK" eF_ResT SwWW8ImplReader::Read_F_IncludePicture( WW8FieldDesc*, OUString& rStr ) { - String aGrfName; + OUString aGrfName; bool bEmbedded = true; WW8ReadFieldParams aReadParam( rStr ); @@ -2213,7 +2213,7 @@ eF_ResT SwWW8ImplReader::Read_F_IncludePicture( WW8FieldDesc*, OUString& rStr ) switch( nRet ) { case -2: - if (!aGrfName.Len()) + if (aGrfName.isEmpty()) aGrfName = ConvertFFileName(aReadParam.GetResult()); break; @@ -2268,8 +2268,8 @@ OUString wwSectionNamer::UniqueName() // "EINFUEGENTEXT" eF_ResT SwWW8ImplReader::Read_F_IncludeText( WW8FieldDesc* /*pF*/, OUString& rStr ) { - String aPara; - String aBook; + OUString aPara; + OUString aBook; WW8ReadFieldParams aReadParam( rStr ); for (;;) { @@ -2279,9 +2279,9 @@ eF_ResT SwWW8ImplReader::Read_F_IncludeText( WW8FieldDesc* /*pF*/, OUString& rSt switch( nRet ) { case -2: - if( !aPara.Len() ) + if( aPara.isEmpty() ) aPara = aReadParam.GetResult(); - else if( !aBook.Len() ) + else if( aBook.isEmpty() ) aBook = aReadParam.GetResult(); break; case '*': @@ -2292,12 +2292,12 @@ eF_ResT SwWW8ImplReader::Read_F_IncludeText( WW8FieldDesc* /*pF*/, OUString& rSt } aPara = ConvertFFileName(aPara); - if (aBook.Len() && aBook.GetChar( 0 ) != '\\') + if (!aBook.isEmpty() && aBook[ 0 ] != '\\') { // Bereich aus Quelle ( kein Switch ) ? ConvertUFName(aBook); - aPara += sfx2::cTokenSeparator; - aPara += sfx2::cTokenSeparator; + aPara += OUString(sfx2::cTokenSeparator); + aPara += OUString(sfx2::cTokenSeparator); aPara += aBook; } @@ -2337,7 +2337,7 @@ eF_ResT SwWW8ImplReader::Read_F_IncludeText( WW8FieldDesc* /*pF*/, OUString& rSt // "SERIENDRUCKFELD" eF_ResT SwWW8ImplReader::Read_F_DBField( WW8FieldDesc* pF, OUString& rStr ) { - String aName; + OUString aName; WW8ReadFieldParams aReadParam( rStr ); for (;;) { @@ -2347,7 +2347,7 @@ eF_ResT SwWW8ImplReader::Read_F_DBField( WW8FieldDesc* pF, OUString& rStr ) switch( nRet ) { case -2: - if( !aName.Len() ) + if( aName.isEmpty() ) aName = aReadParam.GetResult(); break; } @@ -2430,10 +2430,10 @@ eF_ResT SwWW8ImplReader::Read_F_Equation( WW8FieldDesc*, OUString& rStr ) void SwWW8ImplReader::Read_SubF_Ruby( WW8ReadFieldParams& rReadParam) { sal_uInt16 nJustificationCode=0; - String sFontName; + OUString sFontName; sal_uInt32 nFontSize=0; - String sRuby; - String sText; + OUString sRuby; + OUString sText; for (;;) { const sal_Int32 nRet = rReadParam.SkipToNextToken(); @@ -2507,7 +2507,7 @@ void SwWW8ImplReader::Read_SubF_Ruby( WW8ReadFieldParams& rReadParam) } //Translate and apply - if (sRuby.Len() && sText.Len() && sFontName.Len() && nFontSize) + if (!sRuby.isEmpty() && !sText.isEmpty() && !sFontName.isEmpty() && nFontSize) { switch (nJustificationCode) { @@ -2606,7 +2606,7 @@ static void lcl_toxMatchACSwitch( SwWW8ImplReader& /*rReader*/, rBase.RegisterToTOXType( *pType ); rBase.SetCaptionDisplay( eCaptionType ); // Read Sequence Name and store in TOXBase - String sSeqName( rParam.GetResult() ); + OUString sSeqName( rParam.GetResult() ); lcl_ConvertSequenceName( sSeqName ); rBase.SetSequenceName( sSeqName ); } @@ -2670,18 +2670,18 @@ static void lcl_toxMatchTSwitch(SwWW8ImplReader& rReader, SwTOXBase& rBase, { if ( rParam.GoToTokenParam() ) { - String sParams( rParam.GetResult() ); - if( sParams.Len() ) + OUString sParams( rParam.GetResult() ); + if( !sParams.isEmpty() ) { sal_Int32 nIndex = 0; // Delimiters between styles and style levels appears to allow both ; and , - OUString sTemplate( sParams.GetToken(0, ';', nIndex) ); + OUString sTemplate( sParams.getToken(0, ';', nIndex) ); if( -1 == nIndex ) { nIndex=0; - sTemplate = sParams.GetToken(0, ',', nIndex); + sTemplate = sParams.getToken(0, ',', nIndex); } if( -1 == nIndex ) { @@ -2695,12 +2695,12 @@ static void lcl_toxMatchTSwitch(SwWW8ImplReader& rReader, SwTOXBase& rBase, { sal_Int32 nOldIndex=nIndex; sal_uInt16 nLevel = static_cast<sal_uInt16>( - sParams.GetToken(0, ';', nIndex).ToInt32()); + sParams.getToken(0, ';', nIndex).toInt32()); if( -1 == nIndex ) { nIndex = nOldIndex; nLevel = static_cast<sal_uInt16>( - sParams.GetToken(0, ',', nIndex).ToInt32()); + sParams.getToken(0, ',', nIndex).toInt32()); } if( (0 < nLevel) && (MAXLEVEL >= nLevel) ) @@ -2713,19 +2713,19 @@ static void lcl_toxMatchTSwitch(SwWW8ImplReader& rReader, SwTOXBase& rBase, if( pStyle ) sTemplate = pStyle->GetName(); - String sStyles( rBase.GetStyleNames( nLevel ) ); - if( sStyles.Len() ) - sStyles += TOX_STYLE_DELIMITER; + OUString sStyles( rBase.GetStyleNames( nLevel ) ); + if( !sStyles.isEmpty() ) + sStyles += OUString(TOX_STYLE_DELIMITER); sStyles += sTemplate; rBase.SetStyleNames( sStyles, nLevel ); } // read next style name... nOldIndex = nIndex; - sTemplate = sParams.GetToken(0, ';', nIndex); + sTemplate = sParams.getToken(0, ';', nIndex); if( -1 == nIndex ) { nIndex=nOldIndex; - sTemplate = sParams.GetToken(0, ',', nIndex); + sTemplate = sParams.getToken(0, ',', nIndex); } } } @@ -2826,7 +2826,7 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, OUString& rStr ) if ( aReadParam.GoToTokenParam() ) { const OUString sParams( aReadParam.GetResult() ); - // if NO String just ignore the \c + // if NO OUString just ignore the \c if( !sParams.isEmpty() ) { nIndexCols = static_cast<sal_uInt16>(sParams.toInt32()); @@ -2837,7 +2837,7 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, OUString& rStr ) { if ( aReadParam.GoToTokenParam() ) // if NO String just ignore the \e { - String sDelimiter( aReadParam.GetResult() ); + OUString sDelimiter( aReadParam.GetResult() ); SwForm aForm( pBase->GetTOXForm() ); // Attention: if TOX_CONTENT brave @@ -2869,7 +2869,7 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, OUString& rStr ) { --aIt; - if(0x09 == sDelimiter.GetChar(0)) + if(0x09 == sDelimiter[0]) aIt->eTabAlign = SVX_TAB_ADJUST_END; else { @@ -2963,7 +2963,7 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, OUString& rStr ) { if ( aReadParam.GoToTokenParam() ) // if NO String just ignore the \p { - String sDelimiter( aReadParam.GetResult() ); + OUString sDelimiter( aReadParam.GetResult() ); SwForm aForm( pBase->GetTOXForm() ); // Attention: if TOX_CONTENT brave @@ -3302,7 +3302,7 @@ eF_ResT SwWW8ImplReader::Read_F_Hyperlink( WW8FieldDesc* /*pF*/, OUString& rStr } #endif - String sURL, sMark; + OUString sURL, sMark; OUString sTarget; bool bDataImport = false; //HYPERLINK "filename" [switches] @@ -3321,7 +3321,7 @@ eF_ResT SwWW8ImplReader::Read_F_Hyperlink( WW8FieldDesc* /*pF*/, OUString& rStr switch( nRet ) { case -2: - if (!sURL.Len() && !bOptions) + if (sURL.isEmpty() && !bOptions) sURL = ConvertFFileName(aReadParam.GetResult()); break; @@ -3335,8 +3335,8 @@ eF_ResT SwWW8ImplReader::Read_F_Hyperlink( WW8FieldDesc* /*pF*/, OUString& rStr if ( aReadParam.SkipToNextToken()==-2 ) { sMark = aReadParam.GetResult(); - if( sMark.Len() && '"' == sMark.GetChar( sMark.Len()-1 )) - sMark.Erase( sMark.Len() - 1 ); + if( !sMark.isEmpty() && '"' == sMark[ sMark.getLength()-1 ]) + sMark = sMark.copy( 0, sMark.getLength() - 1 ); } break; @@ -3356,10 +3356,10 @@ eF_ResT SwWW8ImplReader::Read_F_Hyperlink( WW8FieldDesc* /*pF*/, OUString& rStr } // das Resultat uebernehmen - OSL_ENSURE((sURL.Len() || sMark.Len()), "WW8: Empty URL"); + OSL_ENSURE(!sURL.isEmpty() || !sMark.isEmpty(), "WW8: Empty URL"); - if( sMark.Len() ) - ( sURL += INET_MARK_TOKEN ) += sMark; + if( !sMark.isEmpty() ) + ( sURL += OUString(INET_MARK_TOKEN) ) += sMark; SwFmtINetFmt aURL( sURL, sTarget ); @@ -3371,13 +3371,13 @@ eF_ResT SwWW8ImplReader::Read_F_Hyperlink( WW8FieldDesc* /*pF*/, OUString& rStr return FLD_TEXT; } -static void lcl_ImportTox(SwDoc &rDoc, SwPaM &rPaM, const String &rStr, bool bIdx) +static void lcl_ImportTox(SwDoc &rDoc, SwPaM &rPaM, const OUString &rStr, bool bIdx) { TOXTypes eTox = ( !bIdx ) ? TOX_CONTENT : TOX_INDEX; // Default sal_uInt16 nLevel = 1; - String sFldTxt; + OUString sFldTxt; WW8ReadFieldParams aReadParam(rStr); for (;;) { @@ -3387,7 +3387,7 @@ static void lcl_ImportTox(SwDoc &rDoc, SwPaM &rPaM, const String &rStr, bool bId switch( nRet ) { case -2: - if( !sFldTxt.Len() ) + if( sFldTxt.isEmpty() ) { // PrimaryKey ohne ":", 2nd dahinter sFldTxt = aReadParam.GetResult(); @@ -3426,22 +3426,21 @@ static void lcl_ImportTox(SwDoc &rDoc, SwPaM &rPaM, const String &rStr, bool bId aM.SetLevel( nLevel ); else { - xub_StrLen nFnd = sFldTxt.Search( WW8_TOX_LEVEL_DELIM ); - if( STRING_NOTFOUND != nFnd ) // it exist levels + sal_Int32 nFnd = sFldTxt.indexOf( WW8_TOX_LEVEL_DELIM ); + if( -1 != nFnd ) // it exist levels { - aM.SetPrimaryKey( sFldTxt.Copy( 0, nFnd ) ); - xub_StrLen nScndFnd = - sFldTxt.Search( WW8_TOX_LEVEL_DELIM, nFnd+1 ); - if( STRING_NOTFOUND != nScndFnd ) + aM.SetPrimaryKey( sFldTxt.copy( 0, nFnd ) ); + sal_Int32 nScndFnd = sFldTxt.indexOf( WW8_TOX_LEVEL_DELIM, nFnd+1 ); + if( -1 != nScndFnd ) { - aM.SetSecondaryKey( sFldTxt.Copy( nFnd+1, nScndFnd - nFnd - 1 )); + aM.SetSecondaryKey( sFldTxt.copy( nFnd+1, nScndFnd - nFnd - 1 )); nFnd = nScndFnd; } - sFldTxt.Erase( 0, nFnd+1 ); + sFldTxt = sFldTxt.copy( nFnd+1 ); } } - if (sFldTxt.Len()) + if (!sFldTxt.isEmpty()) { aM.SetAlternativeText( sFldTxt ); rDoc.InsertPoolItem( rPaM, aM, 0 ); diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index b28ed8e22be9..0aa251963e83 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -1888,16 +1888,16 @@ Err: return false; } -String read_uInt8_BeltAndBracesString(SvStream& rStrm, rtl_TextEncoding eEnc) +OUString read_uInt8_BeltAndBracesString(SvStream& rStrm, rtl_TextEncoding eEnc) { OUString aRet = read_lenPrefixed_uInt8s_ToOUString<sal_uInt8>(rStrm, eEnc); rStrm.SeekRel(sizeof(sal_uInt8)); // skip null-byte at end return aRet; } -String read_uInt16_BeltAndBracesString(SvStream& rStrm) +OUString read_uInt16_BeltAndBracesString(SvStream& rStrm) { - String aRet = read_uInt16_PascalString(rStrm); + OUString aRet = read_uInt16_PascalString(rStrm); rStrm.SeekRel(sizeof(sal_Unicode)); // skip null-byte at end return aRet; } @@ -6270,7 +6270,7 @@ WW8Fonts::WW8Fonts( SvStream& rSt, WW8Fib& rFib ) if ((eEnc == RTL_TEXTENCODING_SYMBOL) || (eEnc == RTL_TEXTENCODING_DONTKNOW)) eEnc = RTL_TEXTENCODING_MS_1252; - p->sFontname = String ( (((const sal_Char*)pVer2) + 1 + 2), eEnc); + p->sFontname = OUString ( (((const sal_Char*)pVer2) + 1 + 2), strlen((((const sal_Char*)pVer2) + 1 + 2)), eEnc); pVer2 = (WW8_FFN_BASE*)( ((sal_uInt8*)pVer2) + pVer2->cbFfnM1 + 1 ); } } diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx index 007e6a5aeb88..5b4c1156fe82 100644 --- a/sw/source/filter/ww8/ww8scan.hxx +++ b/sw/source/filter/ww8/ww8scan.hxx @@ -134,8 +134,8 @@ inline OUString read_uInt16_PascalString(SvStream& rStrm) //Belt and Braces strings, i.e. Pascal-style strings followed by //null termination, Spolsky calls them "fucked strings" FWIW //http://www.joelonsoftware.com/articles/fog0000000319.html -String read_uInt8_BeltAndBracesString(SvStream& rStrm, rtl_TextEncoding eEnc); -String read_uInt16_BeltAndBracesString(SvStream& rStrm); +OUString read_uInt8_BeltAndBracesString(SvStream& rStrm, rtl_TextEncoding eEnc); +OUString read_uInt16_BeltAndBracesString(SvStream& rStrm); //--Line abovewhich the code has meaningful comments |