From 52d1caa43786adb5e6066f5f3f670212ff84e422 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sat, 14 Apr 2012 20:52:41 +0100 Subject: String::CreateFromInt32->rtl::OUString::valueOf --- sw/source/filter/ww8/ww8glsy.cxx | 4 ++-- sw/source/filter/ww8/ww8graf.cxx | 14 +++++++------- sw/source/filter/ww8/ww8par.cxx | 5 ++--- sw/source/filter/ww8/ww8par.hxx | 18 ++++++++---------- sw/source/filter/ww8/ww8scan.cxx | 32 ++++++++++++++++---------------- sw/source/filter/ww8/ww8scan.hxx | 4 ++-- 6 files changed, 37 insertions(+), 40 deletions(-) (limited to 'sw') diff --git a/sw/source/filter/ww8/ww8glsy.cxx b/sw/source/filter/ww8/ww8glsy.cxx index fa328e4d8c05..15eed4fe8ec6 100644 --- a/sw/source/filter/ww8/ww8glsy.cxx +++ b/sw/source/filter/ww8/ww8glsy.cxx @@ -161,13 +161,13 @@ bool WW8Glossary::MakeEntries(SwDoc *pD, SwTextBlocks &rBlocks, String sShortcut = rLNm; // Need to check make sure the shortcut is not already being used - xub_StrLen nStart = 0; + sal_Int32 nStart = 0; sal_uInt16 nCurPos = rBlocks.GetIndex( sShortcut ); xub_StrLen nLen = sShortcut.Len(); while( (sal_uInt16)-1 != nCurPos ) { sShortcut.Erase( nLen ) += - String::CreateFromInt32( ++nStart ); // add an Number to it + rtl::OUString::valueOf(++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 06714382984f..b044636fd89b 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -159,15 +159,15 @@ Color WW8TransCol(SVBT32 nWC) return Color(nWC[0], nWC[1], nWC[2]); } -void wwFrameNamer::SetUniqueGraphName(SwFrmFmt *pFrmFmt, const String &rFixed) +void wwFrameNamer::SetUniqueGraphName(SwFrmFmt *pFrmFmt, const rtl::OUString &rFixed) { - if (mbIsDisabled || !rFixed.Len()) + if (mbIsDisabled || rFixed.isEmpty()) return; - String aName(msSeed); - aName += String::CreateFromInt32(++mnImportedGraphicsCount); - aName.APPEND_CONST_ASC( ": " ); - aName += rFixed; - pFrmFmt->SetName( aName ); + rtl::OUStringBuffer aName(msSeed); + aName.append(++mnImportedGraphicsCount); + aName.append(": "); + aName.append(rFixed); + pFrmFmt->SetName(aName.makeStringAndClear()); } // ReadGrafStart liest die ObjektDaten ein und erzeugt falls noetig einen Anker diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 6fe97846b70f..d038f19f7e24 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -3537,8 +3537,7 @@ bool SwWW8ImplReader::ReadText(long nStartCp, long nTextLen, ManTypes nType) if(pAktItemSet && !pFmt) { - String sPrefix(CREATE_CONST_ASC( "WW8Dropcap")); - sPrefix += String::CreateFromInt32( nDropCap++ ); + rtl::OUString sPrefix(rtl::OUStringBuffer("WW8Dropcap").append(nDropCap++).makeStringAndClear()); pNewSwCharFmt = rDoc.MakeCharFmt(sPrefix, (SwCharFmt*)rDoc.GetDfltCharFmt()); pAktItemSet->ClearItem(RES_CHRATR_ESCAPEMENT); pNewSwCharFmt->SetFmtAttr( *pAktItemSet ); @@ -5659,7 +5658,7 @@ sal_Bool SwMSDffManager::GetOLEStorageName(long nOLEId, String& rStorageName, if( bRet ) { rStorageName = '_'; - rStorageName += String::CreateFromInt32(nPictureId); + rStorageName += rtl::OUString::valueOf(nPictureId); rSrcStorage = rReader.pStg->OpenSotStorage(CREATE_CONST_ASC( SL::aObjectPool)); if (!rReader.mpDocShell) diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index 7b4ec8efd762..de9219d78efc 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -840,20 +840,18 @@ public: void delete_all_from_doc(); }; -class wwFrameNamer +class wwFrameNamer : private ::boost::noncopyable { private: - String msSeed; - int mnImportedGraphicsCount; + rtl::OUString msSeed; + sal_Int32 mnImportedGraphicsCount; bool mbIsDisabled; - //No copying - wwFrameNamer(const wwFrameNamer&); - wwFrameNamer& operator=(const wwFrameNamer&); public: - void SetUniqueGraphName(SwFrmFmt *pFrmFmt,const String &rFixedPart); - wwFrameNamer(bool bIsDisabled, const String &rSeed) + void SetUniqueGraphName(SwFrmFmt *pFrmFmt, const rtl::OUString &rFixedPart); + wwFrameNamer(bool bIsDisabled, const rtl::OUString &rSeed) : msSeed(rSeed), mnImportedGraphicsCount(0), mbIsDisabled(bIsDisabled) - { } + { + } }; class wwSectionNamer @@ -1212,7 +1210,7 @@ private: bool bParaAutoAfter; bool bDropCap; - int nDropCap; + sal_Int32 nDropCap; int nIdctHint; bool bBidi; diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index ac801fbd4f37..94a751bb9f2b 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -4155,23 +4155,23 @@ String WW8PLCFx_Book::GetBookmark(long nStart,long nEnd, sal_uInt16 &nIndex) return bFound ? aBookNames[i] : aEmptyStr; } -String WW8PLCFx_Book::GetUniqueBookmarkName(const rtl::OUString &rSuggestedName) -{ - String aRet=(rSuggestedName.isEmpty() ? rtl::OUString("Unnamed") : rSuggestedName); - unsigned int i=0; - while(i0 && aRet.GetChar(static_cast(p))>='0' && aRet.GetChar(static_cast(p))<='9') - p--; - aRet=String(aRet, 0, static_cast(p+1)); - aRet += String::CreateFromInt32( nBookmarkId++ ); - i=0; // start search from beginning - } else { - i++; +rtl::OUString WW8PLCFx_Book::GetUniqueBookmarkName(const rtl::OUString &rSuggestedName) +{ + rtl::OUString aRet(rSuggestedName.isEmpty() ? rtl::OUString("Unnamed") : rSuggestedName); + size_t i = 0; + while (i < aBookNames.size()) + { + if (aRet.equals(aBookNames[i])) + { + sal_Int32 len = aRet.getLength(); + sal_Int32 p = len - 1; + while (p > 0 && aRet[p] >= '0' && aRet[p] <= '9') + --p; + aRet = aRet.copy(0, p+1) + rtl::OUString::valueOf(nBookmarkId++); + i = 0; // start search from beginning } + else + ++i; } return aRet; } diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx index c9e88896ff27..2adec6661023 100644 --- a/sw/source/filter/ww8/ww8scan.hxx +++ b/sw/source/filter/ww8/ww8scan.hxx @@ -713,7 +713,7 @@ private: eBookStatus* pStatus; long nIMax; // Number of Booknotes sal_uInt16 nIsEnd; - int nBookmarkId; // counter incremented by GetUniqueBookmarkName. + sal_Int32 nBookmarkId; // counter incremented by GetUniqueBookmarkName. //No copying WW8PLCFx_Book(const WW8PLCFx_Book&); @@ -740,7 +740,7 @@ public: bool MapName(String& rName); String GetBookmark(long nStart,long nEnd, sal_uInt16 &nIndex); eBookStatus GetStatus() const; - String GetUniqueBookmarkName(const rtl::OUString &rSuggestedName); + rtl::OUString GetUniqueBookmarkName(const rtl::OUString &rSuggestedName); }; /* -- cgit