diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-10-02 13:34:02 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-10-02 16:03:54 +0100 |
commit | c1198cf209aa343575d0ebccde1053ac2909e67a (patch) | |
tree | ffaf4dc56790c3d4344a2c69fb4bcaf35587b8d1 | |
parent | c6a8abf3687caf66259792fbfe5b0b9b69d0e345 (diff) |
remove yet another StringHash impl
Change-Id: I1f7894a4a08b193b48dceb40bf0a451d4a3b3d6d
-rw-r--r-- | sw/inc/SwStyleNameMapper.hxx | 1 | ||||
-rw-r--r-- | sw/inc/calc.hxx | 4 | ||||
-rw-r--r-- | sw/inc/doc.hxx | 3 | ||||
-rw-r--r-- | sw/inc/numrule.hxx | 1 | ||||
-rw-r--r-- | sw/inc/stringhash.hxx | 98 | ||||
-rw-r--r-- | sw/source/core/bastyp/calc.cxx | 14 | ||||
-rw-r--r-- | sw/source/core/crsr/crsrsh.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/doc/docnew.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/doc/docnum.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/edit/autofmt.cxx | 21 | ||||
-rw-r--r-- | sw/source/core/edit/edlingu.cxx | 12 | ||||
-rw-r--r-- | sw/source/core/fields/fldbas.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/fields/scrptfld.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/inc/scriptinfo.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/text/porlay.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/unocore/unochart.cxx | 12 | ||||
-rw-r--r-- | sw/source/core/unocore/unotbl.cxx | 10 | ||||
-rw-r--r-- | sw/source/filter/ww8/writerwordglue.cxx | 28 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlimp.cxx | 65 | ||||
-rw-r--r-- | sw/source/ui/inc/view.hxx | 2 | ||||
-rw-r--r-- | sw/source/ui/uiview/viewling.cxx | 6 |
21 files changed, 99 insertions, 204 deletions
diff --git a/sw/inc/SwStyleNameMapper.hxx b/sw/inc/SwStyleNameMapper.hxx index 08251c1c3822..e2fdedec8302 100644 --- a/sw/inc/SwStyleNameMapper.hxx +++ b/sw/inc/SwStyleNameMapper.hxx @@ -25,7 +25,6 @@ #include "swdllapi.h" #include <boost/unordered_map.hpp> -#include <stringhash.hxx> #include <vector> diff --git a/sw/inc/calc.hxx b/sw/inc/calc.hxx index 4051e657b899..4227f8fdbade 100644 --- a/sw/inc/calc.hxx +++ b/sw/inc/calc.hxx @@ -221,10 +221,10 @@ public: void SetCalcError( SwCalcError eErr ) { eError = eErr; } sal_Bool IsCalcError() const { return 0 != eError; } - static bool Str2Double( const String& rStr, xub_StrLen& rPos, + static bool Str2Double( const OUString& rStr, sal_Int32& rPos, double& rVal, LocaleDataWrapper const*const pData = 0 ); - static bool Str2Double( const String& rStr, xub_StrLen& rPos, + static bool Str2Double( const OUString& rStr, sal_Int32& rPos, double& rVal, SwDoc *const pDoc ); SW_DLLPUBLIC static sal_Bool IsValidVarName( const OUString& rStr, diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 8d6ea4db9c0e..80caaa8276a7 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -70,7 +70,6 @@ class SwList; #include <com/sun/star/script/vba/XVBAEventProcessor.hpp> #include <boost/unordered_map.hpp> -#include <stringhash.hxx> #include <svtools/embedhlp.hxx> #include <vector> @@ -352,7 +351,7 @@ class SW_DLLPUBLIC SwDoc : /// Hash map to find numrules by name mutable boost::unordered_map<OUString, SwNumRule *, OUStringHash> maNumRuleMap; - typedef boost::unordered_map< String, SwList*, StringHash > tHashMapForLists; + typedef boost::unordered_map<OUString, SwList*, OUStringHash> tHashMapForLists; /// container to hold the lists of the text document tHashMapForLists maLists; /// relation between list style and its default list diff --git a/sw/inc/numrule.hxx b/sw/inc/numrule.hxx index 850d4128cd9c..39edc8bc924e 100644 --- a/sw/inc/numrule.hxx +++ b/sw/inc/numrule.hxx @@ -28,7 +28,6 @@ #include <calbck.hxx> #include <hints.hxx> #include <boost/unordered_map.hpp> -#include <stringhash.hxx> #include <SwNumberTreeTypes.hxx> #include <vector> diff --git a/sw/inc/stringhash.hxx b/sw/inc/stringhash.hxx deleted file mode 100644 index 51efab426b8a..000000000000 --- a/sw/inc/stringhash.hxx +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef _STRINGHASH_HXX -#define _STRINGHASH_HXX - -#include <tools/string.hxx> - -struct StringEq -{ - sal_Bool operator() ( const String *r1, - const String *r2) const - { - return r1->Equals(*r2); - } -}; - -struct StringEqRef -{ - sal_Bool operator() (const String &r1, const String &r2) const - { - return r1.Equals(r2); - } -}; - -struct StringHash -{ - size_t operator() ( const String *rString) const - { - sal_Int32 h, nLen; - h = nLen = rString->Len(); - const sal_Unicode *pStr = rString->GetBuffer(); - - if ( nLen < 16 ) - while ( nLen-- > 0 ) - h = (h*37) + *(pStr++); - else - { - sal_Int32 nSkip; - const sal_Unicode* pEndStr = pStr+nLen-5; - - /* only sample some characters */ - /* the first 3, some characters between, and the last 5 */ - h = (h*39) + *(pStr++); - h = (h*39) + *(pStr++); - h = (h*39) + *(pStr++); - - nSkip = nLen / nLen < 32 ? 4 : 8; - nLen -= 8; - while ( nLen > 0 ) - { - h = (h*39) + ( *pStr ); - pStr += nSkip; - nLen -= nSkip; - } - - h = (h*39) + *(pEndStr++); - h = (h*39) + *(pEndStr++); - h = (h*39) + *(pEndStr++); - h = (h*39) + *(pEndStr++); - h = (h*39) + *(pEndStr++); - } - return h; - } - - size_t operator() (const String & rStr) const - { - return (*this)(&rStr); - } -}; - -struct StringHashRef -{ - size_t operator () (const String &rStr) const - { - StringHash aStrHash; - - return aStrHash(&rStr); - } -}; -#endif // _STRINGHASH_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx index 99a72298209c..b45ea58c4d9d 100644 --- a/sw/source/core/bastyp/calc.cxx +++ b/sw/source/core/bastyp/calc.cxx @@ -1487,7 +1487,7 @@ String SwCalc::GetDBName(const String& rName) namespace { - static bool lcl_Str2Double( const String& rCommand, xub_StrLen& rCommandPos, + static bool lcl_Str2Double( const OUString& rCommand, sal_Int32& rCommandPos, double& rVal, const LocaleDataWrapper* const pLclData ) { @@ -1495,20 +1495,20 @@ namespace const sal_Unicode nCurrCmdPos = rCommandPos; rtl_math_ConversionStatus eStatus; const sal_Unicode* pEnd; - rVal = rtl_math_uStringToDouble( rCommand.GetBuffer() + rCommandPos, - rCommand.GetBuffer() + rCommand.Len(), + rVal = rtl_math_uStringToDouble( rCommand.getStr() + rCommandPos, + rCommand.getStr() + rCommand.getLength(), pLclData->getNumDecimalSep()[0], pLclData->getNumThousandSep()[0], &eStatus, &pEnd ); - rCommandPos = static_cast<xub_StrLen>(pEnd - rCommand.GetBuffer()); + rCommandPos = static_cast<sal_Int32>(pEnd - rCommand.getStr()); return rtl_math_ConversionStatus_Ok == eStatus && nCurrCmdPos != rCommandPos; } } -bool SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos, +bool SwCalc::Str2Double( const OUString& rCommand, sal_Int32& rCommandPos, double& rVal, const LocaleDataWrapper* const pLclData ) { const SvtSysLocale aSysLocale; @@ -1516,7 +1516,7 @@ bool SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos, pLclData ? pLclData : aSysLocale.GetLocaleDataPtr() ); } -bool SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos, +bool SwCalc::Str2Double( const OUString& rCommand, sal_Int32& rCommandPos, double& rVal, SwDoc* const pDoc ) { const SvtSysLocale aSysLocale; @@ -1602,7 +1602,7 @@ double SwSbxValue::GetDouble() const double nRet; if( SbxSTRING == GetType() ) { - xub_StrLen nStt = 0; + sal_Int32 nStt = 0; SwCalc::Str2Double( GetOUString(), nStt, nRet ); } else if (IsBool()) diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 128684eafd2e..12f79afb2889 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -3306,7 +3306,7 @@ void SwCrsrShell::GetSmartTagTerm( const Point& rPt, SwRect& rSelectRect, lcl_FillTextRange( rRange, *pNode, nBegin, nLen ); // get smarttag word - String aText( pNode->GetTxt().copy(nBegin, nLen) ); + OUString aText( pNode->GetTxt().copy(nBegin, nLen) ); //save the start and end positons of the line and the starting point Push(); @@ -3320,11 +3320,11 @@ void SwCrsrShell::GetSmartTagTerm( const Point& rPt, SwRect& rSelectRect, // include "in word" character to the left and right in order to // preserve those. Therefore count those "in words" in order to // modify the selection accordingly. - const sal_Unicode* pChar = aText.GetBuffer(); + const sal_Unicode* pChar = aText.getStr(); xub_StrLen nLeft = 0; while (pChar && *pChar++ == CH_TXTATR_INWORD) ++nLeft; - pChar = aText.Len() ? aText.GetBuffer() + aText.Len() - 1 : 0; + pChar = aText.getLength() ? aText.getStr() + aText.getLength() - 1 : 0; xub_StrLen nRight = 0; while (pChar && *pChar-- == CH_TXTATR_INWORD) ++nRight; diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 58e03ccbf30b..605b9b861b52 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -668,7 +668,7 @@ SwDoc::~SwDoc() delete mpNumRuleTbl; { - for ( boost::unordered_map< String, SwList*, StringHash >::iterator + for ( boost::unordered_map< OUString, SwList*, OUStringHash >::iterator aListIter = maLists.begin(); aListIter != maLists.end(); ++aListIter ) @@ -842,7 +842,7 @@ void SwDoc::ClearDoc() mpNumRuleTbl->clear(); // #i114725#,#i115828# { - for ( boost::unordered_map< String, SwList*, StringHash >::iterator + for ( boost::unordered_map< OUString, SwList*, OUStringHash >::iterator aListIter = maLists.begin(); aListIter != maLists.end(); ++aListIter ) diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index 235db1dd92b9..4d89ea364c4f 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -2495,7 +2495,7 @@ SwList* SwDoc::getListByName( const String sListId ) const { SwList* pList = 0; - boost::unordered_map< String, SwList*, StringHash >::const_iterator + boost::unordered_map< OUString, SwList*, OUStringHash >::const_iterator aListIter = maLists.find( sListId ); if ( aListIter != maLists.end() ) { @@ -2542,7 +2542,7 @@ SwList* SwDoc::getListForListStyle( const String sListStyleName ) const { SwList* pList = 0; - boost::unordered_map< String, SwList*, StringHash >::const_iterator + boost::unordered_map< OUString, SwList*, OUStringHash >::const_iterator aListIter = maListStyleLists.find( sListStyleName ); if ( aListIter != maListStyleLists.end() ) { diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx index c5022c9b6642..3753f0164461 100644 --- a/sw/source/core/edit/autofmt.cxx +++ b/sw/source/core/edit/autofmt.cxx @@ -167,7 +167,7 @@ class SwAutoFormat sal_uInt16 CalcLevel( const SwTxtNode&, sal_uInt16 *pDigitLvl = 0 ) const; xub_StrLen GetBigIndent( xub_StrLen& rAktSpacePos ) const; - String& DelLeadingBlanks( String& rStr ) const; + OUString DelLeadingBlanks(const OUString& rStr) const; String& DelTrailingBlanks( String& rStr ) const; xub_StrLen GetLeadingBlanks( const String& rStr ) const; xub_StrLen GetTrailingBlanks( const String& rStr ) const; @@ -417,9 +417,8 @@ sal_Bool SwAutoFormat::IsEnumericChar( const SwTxtNode& rNd ) const sal_Bool SwAutoFormat::IsBlanksInString( const SwTxtNode& rNd ) const { // Search more that 5 blanks/tabs in the string. - String sTmp( rNd.GetTxt() ); - DelTrailingBlanks( DelLeadingBlanks( sTmp )); - const sal_Unicode* pTmp = sTmp.GetBuffer(); + OUString sTmp( DelLeadingBlanks(rNd.GetTxt()) ); + const sal_Unicode* pTmp = sTmp.getStr(); while( *pTmp ) { if( IsSpace( *pTmp ) ) @@ -676,15 +675,13 @@ bool SwAutoFormat::DoTable() return 1 < aPosArr.size(); } -String& SwAutoFormat::DelLeadingBlanks( String& rStr ) const +OUString SwAutoFormat::DelLeadingBlanks( const OUString& rStr ) const { - xub_StrLen nL; - xub_StrLen n; - - for( nL = rStr.Len(), n = 0; n < nL && IsSpace( rStr.GetChar(n) ); ++n ) + sal_Int32 nL, n; + for( nL = rStr.getLength(), n = 0; n < nL && IsSpace( rStr[n] ); ++n ) ; if( n ) // no Spaces - rStr.Erase( 0, n ); + return rStr.copy(n); return rStr; } @@ -2324,9 +2321,9 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags, if( !bReplaceStyles ) break; - String sClrStr( pAktTxtNd->GetTxt() ); + OUString sClrStr( DelLeadingBlanks(pAktTxtNd->GetTxt()) ); - if( !DelLeadingBlanks( sClrStr ).Len() ) + if( sClrStr.isEmpty() ) { bEmptyLine = true; eStat = READ_NEXT_PARA; diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx index c72cf0201db5..cbb93925ed07 100644 --- a/sw/source/core/edit/edlingu.cxx +++ b/sw/source/core/edit/edlingu.cxx @@ -839,7 +839,7 @@ uno::Reference< XSpellAlternatives > xub_StrLen nLen = 1; if( pWrong->InWrongWord(nBegin,nLen) && !pNode->IsSymbol(nBegin) ) { - String const aText(pNode->GetTxt().copy(nBegin, nLen)); + const OUString aText(pNode->GetTxt().copy(nBegin, nLen)); String aWord( aText ); aWord = comphelper::string::remove(aWord, CH_TXTATR_BREAKWORD); aWord = comphelper::string::remove(aWord, CH_TXTATR_INWORD); @@ -883,11 +883,11 @@ uno::Reference< XSpellAlternatives > // not "in word" character to the left and right in order to // preserve those. Therefore count those "in words" in order to // modify the selection accordingly. - const sal_Unicode* pChar = aText.GetBuffer(); + const sal_Unicode* pChar = aText.getStr(); xub_StrLen nLeft = 0; while (pChar && *pChar++ == CH_TXTATR_INWORD) ++nLeft; - pChar = aText.Len() ? aText.GetBuffer() + aText.Len() - 1 : 0; + pChar = aText.getLength() ? aText.getStr() + aText.getLength() - 1 : 0; xub_StrLen nRight = 0; while (pChar && *pChar-- == CH_TXTATR_INWORD) ++nRight; @@ -951,7 +951,7 @@ bool SwEditShell::GetGrammarCorrection( xub_StrLen nLen = 1; if (pWrong->InWrongWord(nBegin, nLen)) { - String const aText(pNode->GetTxt().copy(nBegin, nLen)); + const OUString aText(pNode->GetTxt().copy(nBegin, nLen)); uno::Reference< linguistic2::XProofreadingIterator > xGCIterator( mpDoc->GetGCIterator() ); if (xGCIterator.is()) @@ -1009,11 +1009,11 @@ bool SwEditShell::GetGrammarCorrection( // not include "in word" character to the left and right in // order to preserve those. Therefore count those "in words" in // order to modify the selection accordingly. - const sal_Unicode* pChar = aText.GetBuffer(); + const sal_Unicode* pChar = aText.getStr(); xub_StrLen nLeft = 0; while (pChar && *pChar++ == CH_TXTATR_INWORD) ++nLeft; - pChar = aText.Len() ? aText.GetBuffer() + aText.Len() - 1 : 0; + pChar = aText.getLength() ? aText.getStr() + aText.getLength() - 1 : 0; xub_StrLen nRight = 0; while (pChar && *pChar-- == CH_TXTATR_INWORD) ++nRight; diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx index e80657c9c051..5416bd243131 100644 --- a/sw/source/core/fields/fldbas.cxx +++ b/sw/source/core/fields/fldbas.cxx @@ -650,7 +650,7 @@ void SwFormulaField::SetFormula(const OUString& rStr) if( nFmt && SAL_MAX_UINT32 != nFmt ) { - xub_StrLen nPos = 0; + sal_Int32 nPos = 0; double fTmpValue; if( SwCalc::Str2Double( rStr, nPos, fTmpValue, GetDoc() ) ) SwValueField::SetValue( fTmpValue ); diff --git a/sw/source/core/fields/scrptfld.cxx b/sw/source/core/fields/scrptfld.cxx index 22ea9db9400f..fa014b87d12b 100644 --- a/sw/source/core/fields/scrptfld.cxx +++ b/sw/source/core/fields/scrptfld.cxx @@ -47,7 +47,7 @@ OUString SwScriptField::GetDescription() const OUString SwScriptField::Expand() const { - return aEmptyStr; + return OUString(); } SwField* SwScriptField::Copy() const diff --git a/sw/source/core/inc/scriptinfo.hxx b/sw/source/core/inc/scriptinfo.hxx index c0d5682fd43a..719fbf7ff5eb 100644 --- a/sw/source/core/inc/scriptinfo.hxx +++ b/sw/source/core/inc/scriptinfo.hxx @@ -77,7 +77,7 @@ private: xub_StrLen nInvalidityPos; sal_uInt8 nDefaultDir; - void UpdateBidiInfo( const String& rTxt ); + void UpdateBidiInfo( const OUString& rTxt ); sal_Bool IsKashidaValid ( xub_StrLen nKashPos ) const; void MarkKashidaInvalid ( xub_StrLen nKashPos ); diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx index 2d042341672c..07ada0bb7199 100644 --- a/sw/source/core/text/porlay.cxx +++ b/sw/source/core/text/porlay.cxx @@ -1265,7 +1265,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL ) } } -void SwScriptInfo::UpdateBidiInfo( const String& rTxt ) +void SwScriptInfo::UpdateBidiInfo( const OUString& rTxt ) { // remove invalid entries from direction information arrays aDirectionChanges.clear(); @@ -1273,10 +1273,10 @@ void SwScriptInfo::UpdateBidiInfo( const String& rTxt ) // Bidi functions from icu 2.0 // UErrorCode nError = U_ZERO_ERROR; - UBiDi* pBidi = ubidi_openSized( rTxt.Len(), 0, &nError ); + UBiDi* pBidi = ubidi_openSized( rTxt.getLength(), 0, &nError ); nError = U_ZERO_ERROR; - ubidi_setPara( pBidi, reinterpret_cast<const UChar *>(rTxt.GetBuffer()), rTxt.Len(), // UChar != sal_Unicode in MinGW + ubidi_setPara( pBidi, reinterpret_cast<const UChar *>(rTxt.getStr()), rTxt.getLength(), // UChar != sal_Unicode in MinGW nDefaultDir, NULL, &nError ); nError = U_ZERO_ERROR; long nCount = ubidi_countRuns( pBidi, &nError ); diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx index 7f2bf91091bd..47131eb83de4 100644 --- a/sw/source/core/unocore/unochart.cxx +++ b/sw/source/core/unocore/unochart.cxx @@ -54,7 +54,7 @@ using namespace ::com::sun::star; // from unotbl.cxx -extern void sw_GetCellPosition( const String &rCellName, sal_Int32 &rColumn, sal_Int32 &rRow); +extern void sw_GetCellPosition( const OUString &rCellName, sal_Int32 &rColumn, sal_Int32 &rRow); extern String sw_GetCellName( sal_Int32 nColumn, sal_Int32 nRow ); extern int sw_CompareCellsByColFirst( const String &rCellName1, const String &rCellName2 ); extern int sw_CompareCellsByRowFirst( const String &rCellName1, const String &rCellName2 ); @@ -2159,12 +2159,12 @@ uno::Sequence< OUString > SAL_CALL SwChartDataSequence::generateLabel( nCol = nCol + i; else nRow = nRow + i; - String aCellName( sw_GetCellName( nCol, nRow ) ); + OUString aCellName( sw_GetCellName( nCol, nRow ) ); - xub_StrLen nLen = aCellName.Len(); + sal_Int32 nLen = aCellName.getLength(); if (nLen) { - const sal_Unicode *pBuf = aCellName.GetBuffer(); + const sal_Unicode *pBuf = aCellName.getStr(); const sal_Unicode *pEnd = pBuf + nLen; while (pBuf < pEnd && !('0' <= *pBuf && *pBuf <= '9')) ++pBuf; @@ -2176,12 +2176,12 @@ uno::Sequence< OUString > SAL_CALL SwChartDataSequence::generateLabel( if (bUseCol) { aRplc = OUString("%COLUMNLETTER"); - aNew = OUString(aCellName.GetBuffer(), pBuf - aCellName.GetBuffer()); + aNew = OUString(aCellName.getStr(), pBuf - aCellName.getStr()); } else { aRplc = OUString("%ROWNUMBER"); - aNew = OUString(pBuf, (aCellName.GetBuffer() + nLen) - pBuf); + aNew = OUString(pBuf, (aCellName.getStr() + nLen) - pBuf); } xub_StrLen nPos = aTxt.Search( aRplc ); if (nPos != STRING_NOTFOUND) diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index d487448d4696..3b66f15f4dd9 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -347,22 +347,22 @@ static uno::Any lcl_GetSpecialProperty(SwFrmFmt* pFmt, const SfxItemPropertySimp * @param [IN,OUT] rRow (0-based) */ //TODO: potential for throwing proper exceptions instead of having every caller to check for errors -void sw_GetCellPosition(const String &rCellName, +void sw_GetCellPosition(const OUString &rCellName, sal_Int32 &rColumn, sal_Int32 &rRow) { rColumn = rRow = -1; // default return values indicating failure - xub_StrLen nLen = rCellName.Len(); + sal_Int32 nLen = rCellName.getLength(); if (nLen) { - const sal_Unicode *pBuf = rCellName.GetBuffer(); + const sal_Unicode *pBuf = rCellName.getStr(); const sal_Unicode *pEnd = pBuf + nLen; while (pBuf < pEnd && !('0' <= *pBuf && *pBuf <= '9')) ++pBuf; // start of number found? if (pBuf < pEnd && ('0' <= *pBuf && *pBuf <= '9')) { - OUString aColTxt(rCellName.GetBuffer(), pBuf - rCellName.GetBuffer()); - OUString aRowTxt(pBuf, (rCellName.GetBuffer() + nLen - pBuf)); + OUString aColTxt(rCellName.getStr(), pBuf - rCellName.getStr()); + OUString aRowTxt(pBuf, (rCellName.getStr() + nLen - pBuf)); if (!aColTxt.isEmpty() && !aRowTxt.isEmpty()) { sal_Int32 nColIdx = 0; diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx index 8f879f3cfd5b..a65175d04490 100644 --- a/sw/source/filter/ww8/writerwordglue.cxx +++ b/sw/source/filter/ww8/writerwordglue.cxx @@ -500,7 +500,7 @@ namespace sw CharRuns GetPseudoCharRuns(const SwTxtNode& rTxtNd, xub_StrLen nTxtStart, bool bSplitOnCharSet) { - const String &rTxt = rTxtNd.GetTxt(); + const OUString &rTxt = rTxtNd.GetTxt(); bool bParaIsRTL = false; OSL_ENSURE(rTxtNd.GetDoc(), "No document for node?, suspicious"); @@ -516,7 +516,7 @@ namespace sw using namespace ::com::sun::star::i18n; sal_uInt16 nScript = i18n::ScriptType::LATIN; - if (rTxt.Len() && g_pBreakIt && g_pBreakIt->GetBreakIter().is()) + if (!rTxt.isEmpty() && g_pBreakIt && g_pBreakIt->GetBreakIter().is()) nScript = g_pBreakIt->GetBreakIter()->getScriptType(rTxt, 0); rtl_TextEncoding eChrSet = ItemGet<SvxFontItem>(rTxtNd, @@ -525,7 +525,7 @@ namespace sw CharRuns aRunChanges; - if (!rTxt.Len()) + if (rTxt.isEmpty()) { aRunChanges.push_back(CharRunEntry(0, nScript, eChrSet, bParaIsRTL)); @@ -550,8 +550,8 @@ namespace sw UBiDiDirection eDefaultDir = bParaIsRTL ? UBIDI_RTL : UBIDI_LTR; UErrorCode nError = U_ZERO_ERROR; - UBiDi* pBidi = ubidi_openSized(rTxt.Len(), 0, &nError); - ubidi_setPara(pBidi, reinterpret_cast<const UChar *>(rTxt.GetBuffer()), rTxt.Len(), + UBiDi* pBidi = ubidi_openSized(rTxt.getLength(), 0, &nError); + ubidi_setPara(pBidi, reinterpret_cast<const UChar *>(rTxt.getStr()), rTxt.getLength(), static_cast< UBiDiLevel >(eDefaultDir), 0, &nError); sal_Int32 nCount = ubidi_countRuns(pBidi, &nError); @@ -583,15 +583,15 @@ namespace sw { //Split unicode text into plausable 8bit ranges for export to //older non unicode aware format - xub_StrLen nLen = rTxt.Len(); - xub_StrLen nPos = 0; + sal_Int32 nLen = rTxt.getLength(); + sal_Int32 nPos = 0; while (nPos != nLen) { rtl_TextEncoding ScriptType = - getBestMSEncodingByChar(rTxt.GetChar(nPos++)); + getBestMSEncodingByChar(rTxt[nPos++]); while ( (nPos != nLen) && - (ScriptType == getBestMSEncodingByChar(rTxt.GetChar(nPos))) + (ScriptType == getBestMSEncodingByChar(rTxt[nPos])) ) { ++nPos; @@ -605,15 +605,15 @@ namespace sw if (g_pBreakIt && g_pBreakIt->GetBreakIter().is()) { - xub_StrLen nLen = rTxt.Len(); - xub_StrLen nPos = 0; + sal_Int32 nLen = rTxt.getLength(); + sal_Int32 nPos = 0; while (nPos < nLen) { sal_Int32 nEnd2 = g_pBreakIt->GetBreakIter()->endOfScript(rTxt, nPos, nScript); if (nEnd2 < 0) break; - nPos = static_cast< xub_StrLen >(nEnd2); + nPos = nEnd2; aScripts.push_back(ScriptEntry(nPos, nScript)); nScript = g_pBreakIt->GetBreakIter()->getScriptType(rTxt, nPos); } @@ -635,12 +635,12 @@ namespace sw aScriptIter != aScriptEnd ) { - xub_StrLen nMinPos = rTxt.Len(); + sal_Int32 nMinPos = rTxt.getLength(); if (aBiDiIter != aBiDiEnd) { if (aBiDiIter->first < nMinPos) - nMinPos = static_cast< xub_StrLen >(aBiDiIter->first); + nMinPos = aBiDiIter->first; bCharIsRTL = aBiDiIter->second; } diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index c5f20d05c0b1..7c31973466aa 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -55,7 +55,6 @@ #include <unotools/saveopt.hxx> #include <tools/diagnose_ex.h> #include <boost/unordered_set.hpp> -#include <stringhash.hxx> // for locking SolarMutex: svapp + mutex #include <vcl/svapp.hxx> @@ -1096,38 +1095,38 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC if( !xInfo.is() ) return; - boost::unordered_set< String, StringHashRef, StringEqRef > aSet; - aSet.insert(String("ForbiddenCharacters", RTL_TEXTENCODING_ASCII_US)); - aSet.insert(String("IsKernAsianPunctuation", RTL_TEXTENCODING_ASCII_US)); - aSet.insert(String("CharacterCompressionType", RTL_TEXTENCODING_ASCII_US)); - aSet.insert(String("LinkUpdateMode", RTL_TEXTENCODING_ASCII_US)); - aSet.insert(String("FieldAutoUpdate", RTL_TEXTENCODING_ASCII_US)); - aSet.insert(String("ChartAutoUpdate", RTL_TEXTENCODING_ASCII_US)); - aSet.insert(String("AddParaTableSpacing", RTL_TEXTENCODING_ASCII_US)); - aSet.insert(String("AddParaTableSpacingAtStart", RTL_TEXTENCODING_ASCII_US)); - aSet.insert(String("PrintAnnotationMode", RTL_TEXTENCODING_ASCII_US)); - aSet.insert(String("PrintBlackFonts", RTL_TEXTENCODING_ASCII_US)); - aSet.insert(String("PrintControls", RTL_TEXTENCODING_ASCII_US)); - aSet.insert(String("PrintDrawings", RTL_TEXTENCODING_ASCII_US)); - aSet.insert(String("PrintGraphics", RTL_TEXTENCODING_ASCII_US)); - aSet.insert(String("PrintLeftPages", RTL_TEXTENCODING_ASCII_US)); - aSet.insert(String("PrintPageBackground", RTL_TEXTENCODING_ASCII_US)); - aSet.insert(String("PrintProspect", RTL_TEXTENCODING_ASCII_US)); - aSet.insert(String("PrintReversed", RTL_TEXTENCODING_ASCII_US)); - aSet.insert(String("PrintRightPages", RTL_TEXTENCODING_ASCII_US)); - aSet.insert(String("PrintFaxName", RTL_TEXTENCODING_ASCII_US)); - aSet.insert(String("PrintPaperFromSetup", RTL_TEXTENCODING_ASCII_US)); - aSet.insert(String("PrintTables", RTL_TEXTENCODING_ASCII_US)); - aSet.insert(String("PrintSingleJobs", RTL_TEXTENCODING_ASCII_US)); - aSet.insert(String("UpdateFromTemplate", RTL_TEXTENCODING_ASCII_US)); - aSet.insert(String("PrinterIndependentLayout", RTL_TEXTENCODING_ASCII_US)); - aSet.insert(String("PrintEmptyPages", RTL_TEXTENCODING_ASCII_US)); - aSet.insert(String("SmallCapsPercentage66", RTL_TEXTENCODING_ASCII_US)); - aSet.insert(String("TabOverflow", RTL_TEXTENCODING_ASCII_US)); - aSet.insert(String("UnbreakableNumberings", RTL_TEXTENCODING_ASCII_US)); - aSet.insert(String("ClippedPictures", RTL_TEXTENCODING_ASCII_US)); - aSet.insert(String("BackgroundParaOverDrawings", RTL_TEXTENCODING_ASCII_US)); - aSet.insert(String("TabOverMargin", RTL_TEXTENCODING_ASCII_US)); + boost::unordered_set< OUString, OUStringHash > aSet; + aSet.insert(OUString("ForbiddenCharacters")); + aSet.insert(OUString("IsKernAsianPunctuation")); + aSet.insert(OUString("CharacterCompressionType")); + aSet.insert(OUString("LinkUpdateMode")); + aSet.insert(OUString("FieldAutoUpdate")); + aSet.insert(OUString("ChartAutoUpdate")); + aSet.insert(OUString("AddParaTableSpacing")); + aSet.insert(OUString("AddParaTableSpacingAtStart")); + aSet.insert(OUString("PrintAnnotationMode")); + aSet.insert(OUString("PrintBlackFonts")); + aSet.insert(OUString("PrintControls")); + aSet.insert(OUString("PrintDrawings")); + aSet.insert(OUString("PrintGraphics")); + aSet.insert(OUString("PrintLeftPages")); + aSet.insert(OUString("PrintPageBackground")); + aSet.insert(OUString("PrintProspect")); + aSet.insert(OUString("PrintReversed")); + aSet.insert(OUString("PrintRightPages")); + aSet.insert(OUString("PrintFaxName")); + aSet.insert(OUString("PrintPaperFromSetup")); + aSet.insert(OUString("PrintTables")); + aSet.insert(OUString("PrintSingleJobs")); + aSet.insert(OUString("UpdateFromTemplate")); + aSet.insert(OUString("PrinterIndependentLayout")); + aSet.insert(OUString("PrintEmptyPages")); + aSet.insert(OUString("SmallCapsPercentage66")); + aSet.insert(OUString("TabOverflow")); + aSet.insert(OUString("UnbreakableNumberings")); + aSet.insert(OUString("ClippedPictures")); + aSet.insert(OUString("BackgroundParaOverDrawings")); + aSet.insert(OUString("TabOverMargin")); sal_Int32 nCount = aConfigProps.getLength(); const PropertyValue* pValues = aConfigProps.getConstArray(); diff --git a/sw/source/ui/inc/view.hxx b/sw/source/ui/inc/view.hxx index cd7a323d0fb7..93885d741b2c 100644 --- a/sw/source/ui/inc/view.hxx +++ b/sw/source/ui/inc/view.hxx @@ -422,7 +422,7 @@ public: // replace word/selection with text from the thesaurus // (this code has special handling for "in word" character) - void InsertThesaurusSynonym( const String &rSynonmText, const String &rLookUpText, bool bValidSelection ); + void InsertThesaurusSynonym( const OUString &rSynonmText, const OUString &rLookUpText, bool bValidSelection ); bool IsValidSelectionForThesaurus() const; String GetThesaurusLookUpText( bool bSelection ) const; diff --git a/sw/source/ui/uiview/viewling.cxx b/sw/source/ui/uiview/viewling.cxx index fc1bf1ca5bfc..1620eb96e114 100644 --- a/sw/source/ui/uiview/viewling.cxx +++ b/sw/source/ui/uiview/viewling.cxx @@ -497,7 +497,7 @@ String SwView::GetThesaurusLookUpText( bool bSelection ) const return bSelection ? m_pWrtShell->GetSelTxt() : m_pWrtShell->GetCurWord(); } -void SwView::InsertThesaurusSynonym( const String &rSynonmText, const String &rLookUpText, bool bSelection ) +void SwView::InsertThesaurusSynonym( const OUString &rSynonmText, const OUString &rLookUpText, bool bSelection ) { sal_Bool bOldIns = m_pWrtShell->IsInsMode(); m_pWrtShell->SetInsMode( sal_True ); @@ -516,11 +516,11 @@ void SwView::InsertThesaurusSynonym( const String &rSynonmText, const String &rL // include "in word" character to the left and right in order to // preserve those. Therefore count those "in words" in order to modify // the selection accordingly. - const sal_Unicode* pChar = rLookUpText.GetBuffer(); + const sal_Unicode* pChar = rLookUpText.getStr(); xub_StrLen nLeft = 0; while (pChar && *pChar++ == CH_TXTATR_INWORD) ++nLeft; - pChar = rLookUpText.Len() ? rLookUpText.GetBuffer() + rLookUpText.Len() - 1 : 0; + pChar = rLookUpText.getLength() ? rLookUpText.getStr() + rLookUpText.getLength() - 1 : 0; xub_StrLen nRight = 0; while (pChar && *pChar-- == CH_TXTATR_INWORD) ++nRight; |