diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2013-09-16 23:44:26 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-09-19 13:09:40 +0000 |
commit | 4da39c170ff2d5bca16e991d244a73ff6b5945b0 (patch) | |
tree | 8fde0475a5fd7244736b66e7586fc86e827c2ff8 | |
parent | 1bda6fd3c46cb6d82490839830b34327af3b6fdd (diff) |
String to OUString
Change-Id: I463a42e7fa755aa534cddbd150ee0c82d2827b0f
Reviewed-on: https://gerrit.libreoffice.org/5968
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sw/source/filter/ww8/ww8par.hxx | 10 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par5.cxx | 45 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8scan.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8scan.hxx | 2 |
4 files changed, 29 insertions, 32 deletions
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index 53f754eb5d23..946a3d7c923c 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -417,15 +417,15 @@ public: struct ltstr { - bool operator()(const String &r1, const String &r2) const + bool operator()(const OUString &r1, const OUString &r2) const { - return r1.CompareIgnoreCaseToAscii(r2) == COMPARE_LESS; + return r1.compareToIgnoreAsciiCase(r2)<0; } }; //Keep track of variable names created with fields, and the bookmark //mapped to their position, hopefully the same, but very possibly //an additional pseudo bookmark - std::map<String, String, ltstr> aFieldVarNames; + std::map<OUString, OUString, ltstr> aFieldVarNames; protected: SwFltStackEntry *RefToVar(const SwField* pFld,SwFltStackEntry& rEntry); virtual void SetAttrInDoc(const SwPosition& rTmpPos, @@ -1730,8 +1730,8 @@ public: // eigentlich private, geht aber leider nur public static sal_uInt32 ExtractColour(const sal_uInt8* &rpData, bool bVer67); void Read_UnderlineColor(sal_uInt16, const sal_uInt8* pData, short nLen); - long MapBookmarkVariables(const WW8FieldDesc* pF,String &rOrigName, - const String &rData); + long MapBookmarkVariables(const WW8FieldDesc* pF, OUString &rOrigName, + const OUString &rData); String GetMappedBookmark(const String &rOrigName); // Felder diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index 556b5d73a078..c4dd5bd0675a 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -1359,7 +1359,7 @@ returns an identifier of the bookmark attribute to close after inserting the appropriate set/ask field. */ long SwWW8ImplReader::MapBookmarkVariables(const WW8FieldDesc* pF, - String &rOrigName, const String &rData) + OUString &rOrigName, const OUString &rData) { OSL_ENSURE(pPlcxMan,"No pPlcxMan"); long nNo; @@ -1369,18 +1369,17 @@ long SwWW8ImplReader::MapBookmarkVariables(const WW8FieldDesc* pF, */ sal_uInt16 nIndex; pPlcxMan->GetBook()->MapName(rOrigName); - String sName = pPlcxMan->GetBook()->GetBookmark( + OUString sName = pPlcxMan->GetBook()->GetBookmark( pF->nSCode, pF->nSCode + pF->nLen, nIndex); - if (sName.Len()) + if (!sName.isEmpty()) { pPlcxMan->GetBook()->SetStatus(nIndex, BOOK_IGNORE); nNo = nIndex; } else { - sName = OUString("WWSetBkmk"); nNo = pReffingStck->aFieldVarNames.size()+1; - sName += OUString::number(nNo); + sName = "WWSetBkmk" + OUString::number(nNo); nNo += pPlcxMan->GetBook()->GetIMax(); } pReffedStck->NewAttr(*pPaM->GetPoint(), @@ -1406,14 +1405,14 @@ SwFltStackEntry *SwWW8FltRefStack::RefToVar(const SwField* pFld, if (pFld && RES_GETREFFLD == pFld->Which()) { //Get the name of the ref field, and see if actually a variable - const String &rName = pFld->GetPar1(); - ::std::map<String,String,SwWW8FltRefStack::ltstr>::const_iterator - aResult = aFieldVarNames.find(rName); + const OUString sName = pFld->GetPar1(); + ::std::map<OUString, OUString, SwWW8FltRefStack::ltstr>::const_iterator + aResult = aFieldVarNames.find(sName); if (aResult != aFieldVarNames.end()) { SwGetExpField aFld( (SwGetExpFieldType*) - pDoc->GetSysFldType(RES_GETEXPFLD), rName, nsSwGetSetExpType::GSE_STRING, 0); + pDoc->GetSysFldType(RES_GETEXPFLD), sName, nsSwGetSetExpType::GSE_STRING, 0); delete rEntry.pAttr; SwFmtFld aTmp(aFld); rEntry.pAttr = aTmp.Clone(); @@ -1425,25 +1424,23 @@ SwFltStackEntry *SwWW8FltRefStack::RefToVar(const SwField* pFld, String SwWW8ImplReader::GetMappedBookmark(const String &rOrigName) { - String sName(BookmarkToWriter(rOrigName)); + OUString sName(BookmarkToWriter(rOrigName)); OSL_ENSURE(pPlcxMan,"no pPlcxMan"); pPlcxMan->GetBook()->MapName(sName); //See if there has been a variable set with this name, if so get //the pseudo bookmark name that was set with it. - ::std::map<String,String,SwWW8FltRefStack::ltstr>::const_iterator aResult = + ::std::map<OUString, OUString, SwWW8FltRefStack::ltstr>::const_iterator aResult = pReffingStck->aFieldVarNames.find(sName); - const String &rBkmName = (aResult == pReffingStck->aFieldVarNames.end()) + return (aResult == pReffingStck->aFieldVarNames.end()) ? sName : (*aResult).second; - - return rBkmName; } // "ASK" eF_ResT SwWW8ImplReader::Read_F_InputVar( WW8FieldDesc* pF, OUString& rStr ) { - String sOrigName; + OUString sOrigName; String aQ; String aDef; WW8ReadFieldParams aReadParam( rStr ); @@ -1455,7 +1452,7 @@ eF_ResT SwWW8ImplReader::Read_F_InputVar( WW8FieldDesc* pF, OUString& rStr ) switch( nRet ) { case -2: - if (!sOrigName.Len()) + if (sOrigName.isEmpty()) sOrigName = aReadParam.GetResult(); else if( !aQ.Len() ) aQ = aReadParam.GetResult(); @@ -1468,10 +1465,10 @@ eF_ResT SwWW8ImplReader::Read_F_InputVar( WW8FieldDesc* pF, OUString& rStr ) } } - if( !sOrigName.Len() ) + if (sOrigName.isEmpty()) return FLD_TAGIGN; // macht ohne Textmarke keinen Sinn - String aResult(GetFieldResult(pF)); + const OUString aResult(GetFieldResult(pF)); //#i24377#, munge Default Text into title as we have only one slot //available for aResult and aDef otherwise @@ -1482,7 +1479,7 @@ eF_ResT SwWW8ImplReader::Read_F_InputVar( WW8FieldDesc* pF, OUString& rStr ) aQ.Append(aDef); } - long nNo = MapBookmarkVariables(pF, sOrigName, aResult); + const long nNo = MapBookmarkVariables(pF, sOrigName, aResult); SwSetExpFieldType* pFT = (SwSetExpFieldType*)rDoc.InsertFldType( SwSetExpFieldType(&rDoc, sOrigName, nsSwGetSetExpType::GSE_STRING)); @@ -2058,8 +2055,8 @@ eF_ResT SwWW8ImplReader::Read_F_Embedd( WW8FieldDesc*, OUString& rStr ) // "SET" eF_ResT SwWW8ImplReader::Read_F_Set( WW8FieldDesc* pF, OUString& rStr ) { - String sOrigName; - String sVal; + OUString sOrigName; + OUString sVal; WW8ReadFieldParams aReadParam( rStr ); for (;;) { @@ -2069,15 +2066,15 @@ eF_ResT SwWW8ImplReader::Read_F_Set( WW8FieldDesc* pF, OUString& rStr ) switch( nRet ) { case -2: - if( !sOrigName.Len() ) + if (sOrigName.isEmpty()) sOrigName = aReadParam.GetResult(); - else if( !sVal.Len() ) + else if (sVal.isEmpty()) sVal = aReadParam.GetResult(); break; } } - long nNo = MapBookmarkVariables(pF,sOrigName,sVal); + const long nNo = MapBookmarkVariables(pF, sOrigName, sVal); SwFieldType* pFT = rDoc.InsertFldType( SwSetExpFieldType( &rDoc, sOrigName, nsSwGetSetExpType::GSE_STRING ) ); diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 7f7fec15a2da..279608586bc0 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -4136,7 +4136,7 @@ OUString WW8PLCFx_Book::GetUniqueBookmarkName(const OUString &rSuggestedName) return aRet; } -bool WW8PLCFx_Book::MapName(String& rName) +bool WW8PLCFx_Book::MapName(OUString& rName) { if( !pBook[0] || !pBook[1] ) return false; @@ -4145,7 +4145,7 @@ bool WW8PLCFx_Book::MapName(String& rName) sal_uInt16 i = 0; do { - if (COMPARE_EQUAL == rName.CompareIgnoreCaseToAscii(aBookNames[i])) + if (rName.equalsIgnoreAsciiCase(aBookNames[i])) { rName = aBookNames[i]; bFound = true; diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx index e14db4543d85..c643e4434d32 100644 --- a/sw/source/filter/ww8/ww8scan.hxx +++ b/sw/source/filter/ww8/ww8scan.hxx @@ -742,7 +742,7 @@ public: bool GetIsEnd() const { return nIsEnd ? true : false; } long GetHandle() const; void SetStatus( sal_uInt16 nIndex, eBookStatus eStat ); - bool MapName(String& rName); + bool MapName(OUString& rName); String GetBookmark(long nStart,long nEnd, sal_uInt16 &nIndex); eBookStatus GetStatus() const; OUString GetUniqueBookmarkName(const OUString &rSuggestedName); |