[Libreoffice-commits] core.git: 5 commits - include/tools reportdesign/source sc/source sw/source tools/source
Caolán McNamara
caolanm at redhat.com
Tue Oct 8 06:06:25 PDT 2013
include/tools/string.hxx | 2 -
reportdesign/source/ui/inspection/GeometryHandler.cxx | 12 +++++-----
sc/source/core/tool/rangeutl.cxx | 10 ++++-----
sc/source/ui/app/inputwin.cxx | 6 -----
sc/source/ui/drawfunc/drtxtob.cxx | 3 +-
sw/source/core/doc/docfld.cxx | 4 +--
sw/source/core/doc/doctxm.cxx | 20 +++++++++---------
sw/source/filter/ascii/ascatr.cxx | 6 ++---
sw/source/filter/html/wrthtml.cxx | 13 ++++-------
sw/source/filter/ww8/docxattributeoutput.cxx | 17 +++++++--------
sw/source/filter/ww8/docxattributeoutput.hxx | 2 -
sw/source/filter/ww8/wrtw8nds.cxx | 12 +++++-----
sw/source/filter/ww8/wrtw8sty.cxx | 5 +---
sw/source/filter/ww8/ww8atr.cxx | 10 +++------
sw/source/ui/dbui/dbui.cxx | 6 ++---
sw/source/ui/dbui/mmlayoutpage.cxx | 4 +--
sw/source/ui/misc/redlndlg.cxx | 15 +++++--------
sw/source/ui/uiview/viewport.cxx | 10 +++++----
tools/source/string/strimp.cxx | 19 -----------------
tools/source/string/tustring.cxx | 15 -------------
20 files changed, 72 insertions(+), 119 deletions(-)
New commits:
commit 9914e44400524a2ffafd1efbd7f717281af27a74
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 8 14:03:03 2013 +0100
can drop casts now
Change-Id: If54ee50dd3d3d856257882c40e4424bbbe3eac45
diff --git a/sc/source/core/tool/rangeutl.cxx b/sc/source/core/tool/rangeutl.cxx
index 1d32cb2..e5a8acb 100644
--- a/sc/source/core/tool/rangeutl.cxx
+++ b/sc/source/core/tool/rangeutl.cxx
@@ -503,17 +503,17 @@ sal_Bool ScRangeStringConverter::GetRangeFromString(
// This isn't parsed by ScRange, so try to parse the two Addresses then.
if (!bResult)
{
- bResult = ((rRange.aStart.Parse( aUIString.copy(0, (xub_StrLen)nIndex), const_cast<ScDocument*>(pDocument),
+ bResult = ((rRange.aStart.Parse( aUIString.copy(0, nIndex), const_cast<ScDocument*>(pDocument),
eConv) & SCA_VALID) == SCA_VALID) &&
- ((rRange.aEnd.Parse( aUIString.copy((xub_StrLen)nIndex+1), const_cast<ScDocument*>(pDocument),
+ ((rRange.aEnd.Parse( aUIString.copy(nIndex+1), const_cast<ScDocument*>(pDocument),
eConv) & SCA_VALID) == SCA_VALID);
::formula::FormulaGrammar::AddressConvention eConvUI = pDocument->GetAddressConvention();
if (!bResult && eConv != eConvUI)
{
- bResult = ((rRange.aStart.Parse( aUIString.copy(0, (xub_StrLen)nIndex), const_cast<ScDocument*>(pDocument),
+ bResult = ((rRange.aStart.Parse( aUIString.copy(0, nIndex), const_cast<ScDocument*>(pDocument),
eConvUI) & SCA_VALID) == SCA_VALID) &&
- ((rRange.aEnd.Parse( aUIString.copy((xub_StrLen)nIndex+1), const_cast<ScDocument*>(pDocument),
+ ((rRange.aEnd.Parse( aUIString.copy(nIndex+1), const_cast<ScDocument*>(pDocument),
eConvUI) & SCA_VALID) == SCA_VALID);
}
}
commit 97527649bc03e9db1f74f788884c3f5211427a4e
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 8 14:01:11 2013 +0100
just copy everything remaining
Change-Id: I32a7b82eae664a60bf4bc73cb2645d3132ddaa81
diff --git a/sc/source/core/tool/rangeutl.cxx b/sc/source/core/tool/rangeutl.cxx
index 1395a63..1d32cb2 100644
--- a/sc/source/core/tool/rangeutl.cxx
+++ b/sc/source/core/tool/rangeutl.cxx
@@ -126,7 +126,7 @@ sal_Bool ScRangeUtil::IsAbsTabArea( const OUString& rAreaStr,
ScRefAddress aEndPos;
aStartPosStr = aTempAreaStr.copy( 0, nColonPos );
- aEndPosStr = aTempAreaStr.copy( nColonPos+1, STRING_LEN );
+ aEndPosStr = aTempAreaStr.copy( nColonPos+1 );
if ( ConvertSingleRef( pDoc, aStartPosStr, 0, aStartPos, rDetails ) )
{
commit 387c88a1e6d743ae7c0cc131fc74281e2be42092
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 8 13:31:42 2013 +0100
drop intermediate strings
Change-Id: I603031739aef12393084b14a51aa2a61311e5709
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index fc0bd81..ca2f9ae 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -618,11 +618,7 @@ void ScInputWindow::SetTextString( const OUString& rString )
if (rString.getLength() <= 32767)
aTextWindow.SetTextString(rString);
else
- {
- OUString aNew = rString;
- aNew = aNew.copy(0, 32767);
- aTextWindow.SetTextString(aNew);
- }
+ aTextWindow.SetTextString(rString.copy(0, 32767));
}
void ScInputWindow::SetOkCancelMode()
commit 832e5aadbff006ec24959162c29756fe2b1982be
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 8 10:06:59 2013 +0100
Related: fdo#38838 remove UniString::SearchAndReplaceAll
Change-Id: I093c95b8700b628375d69293022f7d4b8da2af9c
diff --git a/include/tools/string.hxx b/include/tools/string.hxx
index c6217dc..75aa0b8 100644
--- a/include/tools/string.hxx
+++ b/include/tools/string.hxx
@@ -245,8 +245,6 @@ public:
xub_StrLen nIndex = 0 );
xub_StrLen SearchAndReplace( const UniString& rStr, const UniString& rRepStr,
xub_StrLen nIndex = 0 );
- void SearchAndReplaceAll( sal_Unicode c, sal_Unicode cRep );
- void SearchAndReplaceAll( const UniString& rStr, const UniString& rRepStr );
void SetToken( xub_StrLen nToken, sal_Unicode cTok, const UniString& rStr,
xub_StrLen nIndex = 0 );
diff --git a/reportdesign/source/ui/inspection/GeometryHandler.cxx b/reportdesign/source/ui/inspection/GeometryHandler.cxx
index 3f40709..892e217 100644
--- a/reportdesign/source/ui/inspection/GeometryHandler.cxx
+++ b/reportdesign/source/ui/inspection/GeometryHandler.cxx
@@ -2114,9 +2114,9 @@ void GeometryHandler::impl_createFunction(const OUString& _sFunctionName,const O
const String sPlaceHolder1(RTL_CONSTASCII_USTRINGPARAM("%Column"));
const String sPlaceHolder2(RTL_CONSTASCII_USTRINGPARAM("%FunctionName"));
- String sFormula(_aFunction.m_sFormula);
- sFormula.SearchAndReplaceAll(sPlaceHolder1,_sDataField);
- sFormula.SearchAndReplaceAll(sPlaceHolder2,_sFunctionName);
+ OUString sFormula(_aFunction.m_sFormula);
+ sFormula = sFormula.replaceAll(sPlaceHolder1,_sDataField);
+ sFormula = sFormula.replaceAll(sPlaceHolder2,_sFunctionName);
m_xFunction->setFormula(sFormula);
m_xFunction->setPreEvaluated(_aFunction.m_bPreEvaluated);
@@ -2124,9 +2124,9 @@ void GeometryHandler::impl_createFunction(const OUString& _sFunctionName,const O
if ( _aFunction.m_sInitialFormula.IsPresent )
{
beans::Optional< OUString> aInitialFormula = _aFunction.m_sInitialFormula;
- String sInitialFormula = aInitialFormula.Value;
- sInitialFormula.SearchAndReplaceAll(sPlaceHolder1,_sDataField);
- sInitialFormula.SearchAndReplaceAll(sPlaceHolder2,_sFunctionName);
+ OUString sInitialFormula = aInitialFormula.Value;
+ sInitialFormula = sInitialFormula.replaceAll(sPlaceHolder1,_sDataField);
+ sInitialFormula = sInitialFormula.replaceAll(sPlaceHolder2,_sFunctionName);
aInitialFormula.Value = sInitialFormula;
m_xFunction->setInitialFormula( aInitialFormula );
}
diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx
index 6b83111..ab25cf6 100644
--- a/sw/source/core/doc/docfld.cxx
+++ b/sw/source/core/doc/docfld.cxx
@@ -284,9 +284,9 @@ SwFieldType* SwDoc::GetFldType( sal_uInt16 nResId, const String& rName,
{
SwFieldType* pFldType = (*mpFldTypes)[i];
- String aFldName( pFldType->GetName() );
+ OUString aFldName( pFldType->GetName() );
if (bDbFieldMatching && nResId == RES_DBFLD) // #i51815#
- aFldName.SearchAndReplaceAll(DB_DELIM, '.');
+ aFldName = aFldName.replace(DB_DELIM, '.');
if( nResId == pFldType->Which() &&
rSCmp.isEqual( rName, aFldName ))
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index 0dbe245..2ac32a6 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -1539,28 +1539,28 @@ static String lcl_GetNumString( const SwTOXSortTabBase& rBase, bool bUsePrefix,
/// Generate String with newlines changed to spaces, consecutive spaces changed
/// to a single space, and trailing space removed.
-String lcl_RemoveLineBreaks( String sRet )
+OUString lcl_RemoveLineBreaks(const OUString &rRet)
{
- if (!sRet.Len())
- return sRet;
- xub_StrLen nOffset = 0;
- sRet.SearchAndReplaceAll('\n', ' ');
- for (xub_StrLen i = 1; i < sRet.Len(); i++)
+ if (rRet.isEmpty())
+ return rRet;
+ sal_Int32 nOffset = 0;
+ OUStringBuffer sRet(rRet.replace('\n', ' '));
+ for (sal_Int32 i = 1; i < sRet.getLength(); ++i)
{
- if ( sRet.GetChar(i - 1) == ' ' && sRet.GetChar(i) == ' ' )
+ if ( sRet[i - 1] == ' ' && sRet[i] == ' ' )
{
nOffset += 1;
}
else
{
- sRet.SetChar(i - nOffset, sRet.GetChar(i));
+ sRet[i - nOffset] = sRet[i];
}
}
- if (sRet.GetChar(sRet.Len() - 1) == ' ')
+ if (sRet[sRet.getLength() - 1] == ' ')
{
nOffset += 1;
}
- return sRet.Copy(0, sRet.Len() - nOffset);
+ return sRet.copy(0, sRet.getLength() - nOffset).toString();
}
// Add parameter <_TOXSectNdIdx> and <_pDefaultPageDesc> in order to control,
diff --git a/sw/source/filter/ascii/ascatr.cxx b/sw/source/filter/ascii/ascatr.cxx
index 87a4000..17f7983 100644
--- a/sw/source/filter/ascii/ascatr.cxx
+++ b/sw/source/filter/ascii/ascatr.cxx
@@ -165,9 +165,9 @@ static Writer& OutASC_SwTxtNode( Writer& rWrt, SwCntntNode& rNode )
}
}
- String aStr( rNd.GetTxt() );
+ OUString aStr( rNd.GetTxt() );
if( rWrt.bASCII_ParaAsBlanc )
- aStr.SearchAndReplaceAll( 0x0A, ' ' );
+ aStr = aStr.replace(0x0A, ' ');
const bool bExportSoftHyphens = RTL_TEXTENCODING_UCS2 == rWrt.GetAsciiOptions().GetCharSet() ||
RTL_TEXTENCODING_UTF8 == rWrt.GetAsciiOptions().GetCharSet();
@@ -180,7 +180,7 @@ static Writer& OutASC_SwTxtNode( Writer& rWrt, SwCntntNode& rNode )
if( !aAttrIter.OutAttr( nStrPos ))
{
- String aOutStr( aStr.Copy( nStrPos, nNextAttr - nStrPos ) );
+ String aOutStr( aStr.copy( nStrPos, nNextAttr - nStrPos ) );
if ( !bExportSoftHyphens )
aOutStr = comphelper::string::remove(aOutStr, CHAR_SOFTHYPHEN);
diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx
index cf13747..a2f8a68 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -1059,9 +1059,8 @@ void SwHTMLWriter::OutBookmarks()
while( nPos < aOutlineMarkPoss.size() && aOutlineMarkPoss[nPos] == nNode )
{
- String sMark( aOutlineMarks[nPos] );
- sMark.SearchAndReplaceAll( '?', '_' ); // '?' causes problems in IE/Netscape 5
- OutAnchor( sMark );
+ OUString sMark( aOutlineMarks[nPos] );
+ OutAnchor( sMark.replace('?', '_') ); // '?' causes problems in IE/Netscape 5
aOutlineMarkPoss.erase( aOutlineMarkPoss.begin()+nPos );
aOutlineMarks.erase( aOutlineMarks.begin() + nPos );
}
@@ -1072,13 +1071,11 @@ void SwHTMLWriter::OutImplicitMark( const String& rMark,
{
if( rMark.Len() && !aImplicitMarks.empty() )
{
- String sMark( rMark );
- sMark.Append( cMarkSeparator );
- sMark.AppendAscii( pMarkType );
+ OUString sMark( rMark );
+ sMark + OUString(cMarkSeparator) + OUString::createFromAscii(pMarkType);
if( 0 != aImplicitMarks.erase( sMark ) )
{
- sMark.SearchAndReplaceAll( '?', '_' ); // '?' causes problems in IE/Netscape 5
- OutAnchor( sMark );
+ OutAnchor(sMark.replace('?', '_')); // '?' causes problems in IE/Netscape 5
}
}
}
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 1940fa2..1bcedd3 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -890,9 +890,9 @@ void DocxAttributeOutput::StartField_Impl( FieldInfos& rInfos, bool bWriteRun )
}
}
-void DocxAttributeOutput::DoWriteCmd( String& rCmd )
+void DocxAttributeOutput::DoWriteCmd( const OUString& rCmd )
{
- OUString sCmd = OUString(rCmd).trim();
+ OUString sCmd = rCmd.trim();
if (sCmd.startsWith("SEQ"))
{
OUString sSeqName = msfilter::util::findQuotedText(sCmd, "SEQ ", '\\').trim();
@@ -900,7 +900,7 @@ void DocxAttributeOutput::DoWriteCmd( String& rCmd )
}
// Write the Field command
m_pSerializer->startElementNS( XML_w, XML_instrText, FSEND );
- m_pSerializer->writeEscaped( OUString( rCmd ) );
+ m_pSerializer->writeEscaped( rCmd );
m_pSerializer->endElementNS( XML_w, XML_instrText );
}
@@ -912,15 +912,15 @@ void DocxAttributeOutput::CmdField_Impl( FieldInfos& rInfos )
for ( xub_StrLen i = 0; i < nNbToken; i++ )
{
- String sToken = rInfos.sCmd.GetToken( i, '\t' );
+ OUString sToken = rInfos.sCmd.GetToken( i, '\t' );
if ( rInfos.eType == ww::eCREATEDATE
|| rInfos.eType == ww::eSAVEDATE
|| rInfos.eType == ww::ePRINTDATE
|| rInfos.eType == ww::eDATE
|| rInfos.eType == ww::eTIME )
{
- sToken.SearchAndReplaceAll( String( "NNNN" ), String( "dddd" ) );
- sToken.SearchAndReplaceAll( String( "NN" ), String( "ddd" ) );
+ sToken = sToken.replaceAll("NNNN", "dddd");
+ sToken = sToken.replaceAll("NN", "ddd");
}
// Write the Field command
DoWriteCmd( sToken );
@@ -963,10 +963,9 @@ void DocxAttributeOutput::EndField_Impl( FieldInfos& rInfos )
// Write the Field latest value
m_pSerializer->startElementNS( XML_w, XML_r, FSEND );
- String sExpand( rInfos.pField->ExpandField( true ) );
+ OUString sExpand( rInfos.pField->ExpandField( true ) );
// newlines embedded in fields are 0x0B in MSO and 0x0A for us
- sExpand.SearchAndReplaceAll( 0x0A, 0x0B );
- RunText( sExpand );
+ RunText(sExpand.replace(0x0A, 0x0B));
m_pSerializer->endElementNS( XML_w, XML_r );
}
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index 54d3c79..16f17b7 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -631,7 +631,7 @@ private:
void WriteCommentRanges();
void StartField_Impl( FieldInfos& rInfos, bool bWriteRun = sal_False );
- void DoWriteCmd( String& rCmd );
+ void DoWriteCmd( const OUString& rCmd );
void CmdField_Impl( FieldInfos& rInfos );
void EndField_Impl( FieldInfos& rInfos );
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 5fce527..a7d97a1 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -1397,16 +1397,16 @@ because word doesn't have the feature
String SwWW8AttrIter::GetSnippet(const String &rStr, xub_StrLen nAktPos,
xub_StrLen nLen) const
{
- String aSnippet(rStr, nAktPos, nLen);
if (!nLen)
- return aSnippet;
+ return OUString();
+ OUString aSnippet(rStr.Copy(nAktPos, nLen));
// 0x0a ( Hard Line Break ) -> 0x0b
// 0xad ( soft hyphen ) -> 0x1f
// 0x2011 ( hard hyphen ) -> 0x1e
- aSnippet.SearchAndReplaceAll(0x0A, 0x0B);
- aSnippet.SearchAndReplaceAll(CHAR_HARDHYPHEN, 0x1e);
- aSnippet.SearchAndReplaceAll(CHAR_SOFTHYPHEN, 0x1f);
+ aSnippet = aSnippet.replace(0x0A, 0x0B);
+ aSnippet = aSnippet.replace(CHAR_HARDHYPHEN, 0x1e);
+ aSnippet = aSnippet.replace(CHAR_SOFTHYPHEN, 0x1f);
m_rExport.m_aCurrentCharPropStarts.push( nAktPos );
const SfxPoolItem &rItem = GetItem(RES_CHRATR_CASEMAP);
@@ -1444,7 +1444,7 @@ String SwWW8AttrIter::GetSnippet(const String &rStr, xub_StrLen nAktPos,
rStr, nAktPos, g_pBreakIt->GetLocale(nLanguage),
i18n::WordType::ANYWORD_IGNOREWHITESPACES ) )
{
- aSnippet.SetChar(0, rStr.GetChar(nAktPos));
+ aSnippet = OUString(rStr.GetChar(nAktPos)) + aSnippet.copy(1);
}
}
m_rExport.m_aCurrentCharPropStarts.pop();
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index 969b2b3..cf954bf 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -2087,9 +2087,8 @@ bool WW8_WrPlcSubDoc::WriteGenericTxt( WW8Export& rWrt, sal_uInt8 nTTyp,
rWrt.WriteOutliner(*rAtn.mpRichText, nTTyp);
else
{
- String sTxt(rAtn.msSimpleText);
- sTxt.SearchAndReplaceAll(0x0A, 0x0B);
- rWrt.WriteStringAsPara( sTxt );
+ OUString sTxt(rAtn.msSimpleText);
+ rWrt.WriteStringAsPara(sTxt.replace(0x0A, 0x0B));
}
}
break;
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index dc3117a..2d2c48a 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -1734,12 +1734,10 @@ static void InsertSpecialChar( WW8Export& rWrt, sal_uInt8 c,
static String lcl_GetExpandedField(const SwField &rFld)
{
- String sRet(rFld.ExpandField(true));
+ OUString sRet(rFld.ExpandField(true));
//replace LF 0x0A with VT 0x0B
- sRet.SearchAndReplaceAll(0x0A, 0x0B);
-
- return sRet;
+ return sRet.replace(0x0A, 0x0B);
}
WW8_WrPlcFld* WW8Export::CurrentFieldPlc() const
@@ -2405,10 +2403,10 @@ OUString FieldString(ww::eField eIndex)
void WW8AttributeOutput::HiddenField( const SwField& rFld )
{
- String sExpand(rFld.GetPar2());
+ OUString sExpand(rFld.GetPar2());
//replace LF 0x0A with VT 0x0B
- sExpand.SearchAndReplaceAll(0x0A, 0x0B);
+ sExpand = sExpand.replace(0x0A, 0x0B);
m_rWW8Export.pChpPlc->AppendFkpEntry(m_rWW8Export.Strm().Tell());
if (m_rWW8Export.IsUnicode())
{
diff --git a/sw/source/ui/dbui/dbui.cxx b/sw/source/ui/dbui/dbui.cxx
index 09b2357..f1b58e2 100644
--- a/sw/source/ui/dbui/dbui.cxx
+++ b/sw/source/ui/dbui/dbui.cxx
@@ -66,9 +66,9 @@ CreateMonitor::CreateMonitor( Window *pParent )
void CreateMonitor::UpdateCountingText()
{
- String sText(m_sCountingPattern);
- sText.SearchAndReplaceAll( m_sVariable_Total, OUString::number( m_nTotalCount ) );
- sText.SearchAndReplaceAll( m_sVariable_Position, OUString::number( m_nCurrentPosition ) );
+ OUString sText(m_sCountingPattern);
+ sText = sText.replaceAll( m_sVariable_Total, OUString::number( m_nTotalCount ) );
+ sText = sText.replaceAll( m_sVariable_Position, OUString::number( m_nCurrentPosition ) );
m_aCounting.SetText(sText);
}
diff --git a/sw/source/ui/dbui/mmlayoutpage.cxx b/sw/source/ui/dbui/mmlayoutpage.cxx
index 34fafc2..e213d70 100644
--- a/sw/source/ui/dbui/mmlayoutpage.cxx
+++ b/sw/source/ui/dbui/mmlayoutpage.cxx
@@ -319,8 +319,8 @@ SwFrmFmt* SwMailMergeLayoutPage::InsertAddressFrame(
sDBName += DB_DELIM;
sDBName += String(rData.sCommand);
sDBName += DB_DELIM;
- String sDatabaseConditionPrefix(sDBName);
- sDatabaseConditionPrefix.SearchAndReplaceAll(DB_DELIM, '.');
+ OUString sDatabaseConditionPrefix(sDBName);
+ sDatabaseConditionPrefix = sDatabaseConditionPrefix.replace(DB_DELIM, '.');
sDBName += OUString::number(rData.nCommandType);
sDBName += DB_DELIM;
diff --git a/sw/source/ui/misc/redlndlg.cxx b/sw/source/ui/misc/redlndlg.cxx
index 870ca9ac..d4edaf0 100644
--- a/sw/source/ui/misc/redlndlg.cxx
+++ b/sw/source/ui/misc/redlndlg.cxx
@@ -438,9 +438,8 @@ void SwRedlineAcceptDlg::Activate()
if (pParent->pTLBParent)
{
// update only comment
- String sComment(rRedln.GetComment());
- sComment.SearchAndReplaceAll((sal_Unicode)'\n',(sal_Unicode)' ');
- pTable->SetEntryText(sComment, pParent->pTLBParent, 3);
+ OUString sComment(rRedln.GetComment());
+ pTable->SetEntryText(sComment.replace('\n', ' '), pParent->pTLBParent, 3);
}
pParent->sComment = rRedln.GetComment();
}
@@ -725,9 +724,8 @@ void SwRedlineAcceptDlg::InsertParents(sal_uInt16 nStart, sal_uInt16 nEnd)
pRedlineParent = new SwRedlineDataParent;
pRedlineParent->pData = pRedlineData;
pRedlineParent->pNext = 0;
- String sComment(rRedln.GetComment());
- sComment.SearchAndReplaceAll((sal_Unicode)'\n',(sal_Unicode)' ');
- pRedlineParent->sComment = sComment;
+ OUString sComment(rRedln.GetComment());
+ pRedlineParent->sComment = sComment.replace('\n', ' ');
aRedlineParents.insert(aRedlineParents.begin() + i, pRedlineParent);
pData = new RedlinData;
@@ -1113,12 +1111,11 @@ IMPL_LINK_NOARG(SwRedlineAcceptDlg, CommandHdl)
if ( pDlg->Execute() == RET_OK )
{
const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
- String sMsg(((const SvxPostItTextItem&)pOutSet->Get(SID_ATTR_POSTIT_TEXT)).GetValue());
+ OUString sMsg(((const SvxPostItTextItem&)pOutSet->Get(SID_ATTR_POSTIT_TEXT)).GetValue());
// insert / change comment
pSh->SetRedlineComment(sMsg);
- sMsg.SearchAndReplaceAll((sal_Unicode)'\n',(sal_Unicode)' ');
- pTable->SetEntryText(sMsg, pEntry, 3);
+ pTable->SetEntryText(sMsg.replace('\n', ' '), pEntry, 3);
}
delete pDlg;
diff --git a/sw/source/ui/uiview/viewport.cxx b/sw/source/ui/uiview/viewport.cxx
index 77ccf02..c137db6 100644
--- a/sw/source/ui/uiview/viewport.cxx
+++ b/sw/source/ui/uiview/viewport.cxx
@@ -695,15 +695,17 @@ IMPL_LINK( SwView, ScrollHdl, SwScrollbar *, pScrollbar )
aRect.Right() = aRect.Left();
aRect.Bottom() = aRect.Top();
- String sPageStr( GetPageStr( nPhNum, nVirtNum, sDisplay ));
+ OUString sPageStr( GetPageStr( nPhNum, nVirtNum, sDisplay ));
SwContentAtPos aCnt( SwContentAtPos::SW_OUTLINE );
m_pWrtShell->GetContentAtPos( aPos, aCnt );
if( aCnt.sStr.Len() )
{
sPageStr += OUString(" - ");
- sPageStr.Insert( aCnt.sStr, 0, 80 );
- sPageStr.SearchAndReplaceAll( '\t', ' ' );
- sPageStr.SearchAndReplaceAll( 0x0a, ' ' );
+ sal_Int32 nChunkLen = std::min<sal_Int32>(aCnt.sStr.Len(), 80);
+ OUString sChunk = aCnt.sStr.Copy(0, nChunkLen);
+ sPageStr = sChunk + sPageStr;
+ sPageStr = sPageStr.replace('\t', ' ');
+ sPageStr = sPageStr.replace(0x0a, ' ');
}
nPgNum = nPhNum;
}
diff --git a/tools/source/string/strimp.cxx b/tools/source/string/strimp.cxx
index 3357c22..b86564a 100644
--- a/tools/source/string/strimp.cxx
+++ b/tools/source/string/strimp.cxx
@@ -428,23 +428,4 @@ xub_StrLen STRING::Search( const STRING& rStr, xub_StrLen nIndex ) const
return STRING_NOTFOUND;
}
-void STRING::SearchAndReplaceAll( STRCODE c, STRCODE cRep )
-{
- DBG_CHKTHIS( STRING, DBGCHECKSTRING );
-
- sal_Int32 nLen = mpData->mnLen;
- const STRCODE* pStr = mpData->maStr;
- sal_Int32 nIndex = 0;
- while ( nIndex < nLen )
- {
- if ( *pStr == c )
- {
- ImplCopyData();
- mpData->maStr[nIndex] = cRep;
- }
- ++pStr,
- ++nIndex;
- }
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/tools/source/string/tustring.cxx b/tools/source/string/tustring.cxx
index 5d1d7e4..9b10bde 100644
--- a/tools/source/string/tustring.cxx
+++ b/tools/source/string/tustring.cxx
@@ -235,21 +235,6 @@ xub_StrLen STRING::Match( const STRING& rStr ) const
return STRING_MATCH;
}
-void STRING::SearchAndReplaceAll( const STRING& rStr, const STRING& rRepStr )
-{
- DBG_CHKTHIS( STRING, DBGCHECKSTRING );
- DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
- DBG_CHKOBJ( &rRepStr, STRING, DBGCHECKSTRING );
-
- xub_StrLen nSPos = Search( rStr, 0 );
- while ( nSPos != STRING_NOTFOUND )
- {
- Replace( nSPos, rStr.Len(), rRepStr );
- nSPos = nSPos + rRepStr.Len();
- nSPos = Search( rStr, nSPos );
- }
-}
-
void STRING::SetToken( xub_StrLen nToken, STRCODE cTok, const STRING& rStr,
xub_StrLen nIndex )
{
commit c811c0706f0ecf3400e8fcc510ca283dd593237f
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 8 13:18:42 2013 +0100
make sure length is within bounds
Change-Id: I86819211de809a57c240778a747ddad175137a9b
diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx
index 581aafc..96513bc 100644
--- a/sc/source/ui/drawfunc/drtxtob.cxx
+++ b/sc/source/ui/drawfunc/drtxtob.cxx
@@ -404,7 +404,8 @@ void ScDrawTextObjectBar::GetState( SfxItemSet& rSet )
{
// use selected text as name for urls
OUString sReturn = pOutView->GetSelected();
- sReturn = sReturn.copy(0, 255);
+ sal_Int32 nLen = std::min<sal_Int32>(sReturn.getLength(), 255);
+ sReturn = sReturn.copy(0, nLen);
aHLinkItem.SetName(comphelper::string::stripEnd(sReturn, ' '));
}
}
More information about the Libreoffice-commits
mailing list