[Libreoffice-commits] core.git: 7 commits - basic/source include/svtools include/tools reportdesign/source sc/source svtools/source sw/inc sw/source tools/source

Caolán McNamara caolanm at redhat.com
Mon Oct 7 03:47:21 PDT 2013


 basic/source/comp/exprnode.cxx                        |    7 +++-
 basic/source/comp/exprtree.cxx                        |    8 +++-
 basic/source/comp/scanner.cxx                         |    1 
 basic/source/comp/symtbl.cxx                          |    6 +--
 include/svtools/ctrlbox.hxx                           |    3 +
 include/tools/string.hxx                              |    2 -
 reportdesign/source/ui/inspection/GeometryHandler.cxx |   30 +++++++-----------
 sc/source/ui/Accessibility/AccessibleCellBase.cxx     |    5 +--
 sc/source/ui/Accessibility/AccessibleDocument.cxx     |    6 +--
 sc/source/ui/Accessibility/AccessiblePageHeader.cxx   |   10 ++----
 sc/source/ui/Accessibility/AccessiblePreviewTable.cxx |    6 +--
 sc/source/ui/Accessibility/AccessibleTableBase.cxx    |    6 +--
 sc/source/ui/dbgui/scuiimoptdlg.cxx                   |    6 +--
 sc/source/ui/dbgui/sortdlg.cxx                        |    6 +--
 sc/source/ui/docshell/docsh.cxx                       |    4 +-
 sc/source/ui/docshell/docsh4.cxx                      |    4 +-
 svtools/source/control/ctrlbox.cxx                    |   24 +++++++++++++-
 sw/inc/shellres.hxx                                   |    2 -
 sw/source/core/doc/docedt.cxx                         |    2 -
 sw/source/ui/config/optpage.cxx                       |    7 +---
 sw/source/ui/dbui/dbtablepreviewdialog.cxx            |    5 +--
 sw/source/ui/dbui/mailmergechildwindow.cxx            |   23 ++++++-------
 sw/source/ui/dbui/mmaddressblockpage.cxx              |   12 +------
 sw/source/ui/dbui/mmaddressblockpage.hxx              |    6 +--
 sw/source/ui/dbui/mmgreetingspage.cxx                 |    8 +---
 sw/source/ui/dbui/mmgreetingspage.hxx                 |    2 -
 sw/source/ui/dbui/mmoutputpage.hxx                    |    2 -
 sw/source/ui/frmdlg/column.cxx                        |   25 ++++++---------
 sw/source/ui/index/cnttab.cxx                         |    6 +--
 sw/source/ui/uiview/view2.cxx                         |    5 +--
 sw/source/ui/utlui/initui.cxx                         |    7 +---
 tools/source/string/strascii.cxx                      |   14 --------
 32 files changed, 124 insertions(+), 136 deletions(-)

New commits:
commit e5dd19526fcdb2f9eb0e87017e33e9fd8402b028
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Oct 7 11:46:15 2013 +0100

    make font style size stable on switching fonts
    
    Change-Id: I891fa5b9b8bd3be7dd4d73f2911ec56d16a3b09f

diff --git a/include/svtools/ctrlbox.hxx b/include/svtools/ctrlbox.hxx
index b3a88df..061bb24 100644
--- a/include/svtools/ctrlbox.hxx
+++ b/include/svtools/ctrlbox.hxx
@@ -450,6 +450,8 @@ class SVT_DLLPUBLIC FontStyleBox : public ComboBox
 {
     OUString        aLastStyle;
 
+    Size            aOptimalSize;
+
 private:
     using ComboBox::SetText;
 public:
@@ -460,6 +462,7 @@ public:
     virtual void    Select();
     virtual void    LoseFocus();
     virtual void    Modify();
+    virtual Size    GetOptimalSize() const;
 
     void            SetText( const OUString& rText );
     void            Fill( const OUString& rName, const FontList* pList );
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx
index 32513d4..87ed82d 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -1431,10 +1431,30 @@ FontStyleBox::FontStyleBox( Window* pParent, const ResId& rResId ) :
     aLastStyle = GetText();
 }
 
-FontStyleBox::FontStyleBox( Window* pParent, WinBits nBits ) :
-    ComboBox( pParent, nBits )
+FontStyleBox::FontStyleBox(Window* pParent, WinBits nBits)
+    : ComboBox(pParent, nBits)
 {
     aLastStyle = GetText();
+
+    //Use the standard texts to get an optimal size and stick to that size.
+    //That should stop the character dialog dancing around.
+    InsertEntry(SVT_RESSTR(STR_SVT_STYLE_LIGHT));
+    InsertEntry(SVT_RESSTR(STR_SVT_STYLE_LIGHT_ITALIC));
+    InsertEntry(SVT_RESSTR(STR_SVT_STYLE_NORMAL));
+    InsertEntry(SVT_RESSTR(STR_SVT_STYLE_NORMAL_ITALIC));
+    InsertEntry(SVT_RESSTR(STR_SVT_STYLE_BOLD));
+    InsertEntry(SVT_RESSTR(STR_SVT_STYLE_BOLD_ITALIC));
+    InsertEntry(SVT_RESSTR(STR_SVT_STYLE_BLACK));
+    InsertEntry(SVT_RESSTR(STR_SVT_STYLE_BLACK_ITALIC));
+    aOptimalSize = GetOptimalSize();
+    Clear();
+}
+
+Size FontStyleBox::GetOptimalSize() const
+{
+    if (aOptimalSize.Width() || aOptimalSize.Height())
+        return aOptimalSize;
+    return ComboBox::GetOptimalSize();
 }
 
 extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeFontStyleBox(Window *pParent, VclBuilder::stringmap &rMap)
commit 9cff818949f0a3d07c225c916c03097c6602e63b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Oct 7 11:18:59 2013 +0100

    CID#708773 unused pointer value
    
    Change-Id: Ib394a444882f5ffa1e0c5e833d59f4e4985479df

diff --git a/basic/source/comp/symtbl.cxx b/basic/source/comp/symtbl.cxx
index 2b8190c..b47583e 100644
--- a/basic/source/comp/symtbl.cxx
+++ b/basic/source/comp/symtbl.cxx
@@ -454,12 +454,12 @@ void SbiProcDef::SetType( SbxDataType t )
 
 void SbiProcDef::Match( SbiProcDef* pOld )
 {
-    SbiSymDef* po, *pn=NULL;
+    SbiSymDef *pn=NULL;
     // parameter 0 is the function name
     sal_uInt16 i;
     for( i = 1; i < aParams.GetSize(); i++ )
     {
-        po = pOld->aParams.Get( i );
+        SbiSymDef* po = pOld->aParams.Get( i );
         pn = aParams.Get( i );
         // no type matching - that is done during running
         // but is it maybe called with too little parameters?
@@ -467,7 +467,7 @@ void SbiProcDef::Match( SbiProcDef* pOld )
         {
             break;
         }
-        po = pOld->aParams.Next();
+        pOld->aParams.Next();
     }
 
     if( pn && i < aParams.GetSize() && pOld->pIn )
commit 470af978eb397e2078e5ee1a0b146b00de01e280
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Oct 7 11:09:15 2013 +0100

    CID#707648 uninitialized member
    
    Change-Id: Ib8371710dd6c856b143782ca9c18f4ee76798f0e

diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx
index b59e22a..d966406 100644
--- a/basic/source/comp/scanner.cxx
+++ b/basic/source/comp/scanner.cxx
@@ -47,6 +47,7 @@ SbiScanner::SbiScanner( const OUString& rBuf, StarBASIC* p ) : aBuf( rBuf )
     bInStatement =
     bPrevLineExtentsComment = false;
     bHash    = true;
+    pSaveLine = NULL;
 }
 
 SbiScanner::~SbiScanner()
commit 3c2983ded9f0f646a5b543e16e0d9a9bbf476e4e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Oct 7 11:05:50 2013 +0100

    CID#707646 uninitialized member variables
    
    also CID#707647
    
    Change-Id: I9962bd2417119944a243d8a92711866548248e36

diff --git a/basic/source/comp/exprtree.cxx b/basic/source/comp/exprtree.cxx
index e77bf77..e56d706 100644
--- a/basic/source/comp/exprtree.cxx
+++ b/basic/source/comp/exprtree.cxx
@@ -55,9 +55,11 @@ SbiExpression::SbiExpression( SbiParser* p, SbiExprType t,
 SbiExpression::SbiExpression( SbiParser* p, double n, SbxDataType t )
 {
     pParser = p;
+    bBased = bError = bByVal = bBracket = false;
+    nParenLevel = 0;
     eCurExpr = SbOPERAND;
+    m_eMode = EXPRMODE_STANDARD;
     pNext = NULL;
-    bBased = bError = bByVal = bBracket = false;
     pExpr = new SbiExprNode( pParser, n, t );
     pExpr->Optimize();
 }
@@ -65,9 +67,11 @@ SbiExpression::SbiExpression( SbiParser* p, double n, SbxDataType t )
 SbiExpression::SbiExpression( SbiParser* p, const SbiSymDef& r, SbiExprList* pPar )
 {
     pParser = p;
-    pNext = NULL;
     bBased = bError = bByVal = bBracket = false;
+    nParenLevel = 0;
     eCurExpr = SbOPERAND;
+    m_eMode = EXPRMODE_STANDARD;
+    pNext = NULL;
     pExpr = new SbiExprNode( pParser, r, SbxVARIANT, pPar );
 }
 
commit ef53bd8ab2499b0b2bf0b79c0ab090f3de56525f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Oct 7 10:18:48 2013 +0100

    CID#707643 uninitialized members
    
    Change-Id: I23386c780bf484652a518d907d7dc0cc3c910040

diff --git a/basic/source/comp/exprnode.cxx b/basic/source/comp/exprnode.cxx
index 53ef38d..e245fef 100644
--- a/basic/source/comp/exprnode.cxx
+++ b/basic/source/comp/exprnode.cxx
@@ -25,11 +25,16 @@
 #include "expr.hxx"
 
 
-SbiExprNode::SbiExprNode( void )
+SbiExprNode::SbiExprNode()
 {
     pLeft = NULL;
     pRight = NULL;
+    pWithParent = NULL;
+    pGen = NULL;
     eNodeType = SbxDUMMY;
+    eType = SbxVARIANT;
+    eTok = NIL;
+    bError = false;
 }
 
 SbiExprNode::SbiExprNode( SbiParser* p, SbiExprNode* l, SbiToken t, SbiExprNode* r )
commit b8cf30e93f18ddc16fd648976a41a6bbb6c6d8b2
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Oct 7 10:12:16 2013 +0100

    Related: fdo#38838 remove UniString::SearchAndReplaceAscii
    
    Change-Id: I86019d7ab248679cd8518a621fe8e3721b44aeb0

diff --git a/include/tools/string.hxx b/include/tools/string.hxx
index 5ca0047..c6217dc 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 );
-    xub_StrLen          SearchAndReplaceAscii( const sal_Char* pAsciiStr, const UniString& rRepStr,
-                                               xub_StrLen nIndex = 0 );
     void                SearchAndReplaceAll( sal_Unicode c, sal_Unicode cRep );
     void                SearchAndReplaceAll( const UniString& rStr, const UniString& rRepStr );
 
diff --git a/reportdesign/source/ui/inspection/GeometryHandler.cxx b/reportdesign/source/ui/inspection/GeometryHandler.cxx
index 1b4e5a0..3f40709 100644
--- a/reportdesign/source/ui/inspection/GeometryHandler.cxx
+++ b/reportdesign/source/ui/inspection/GeometryHandler.cxx
@@ -1719,12 +1719,11 @@ void GeometryHandler::impl_fillScopeList_nothrow(::std::vector< OUString >& _out
         else if ( xSection == xReportDefinition->getDetail() )
             nPos = xGroups->getCount()-1;
 
-        const String sGroup = String(ModuleRes(RID_STR_SCOPE_GROUP));
+        const OUString sGroup = ModuleRes(RID_STR_SCOPE_GROUP).toString();
         for (sal_Int32 i = 0 ; i <= nPos ; ++i)
         {
             xGroup.set(xGroups->getByIndex(i),uno::UNO_QUERY_THROW);
-            String sGroupName = sGroup;
-            sGroupName.SearchAndReplaceAscii("%1",xGroup->getExpression());
+            OUString sGroupName = sGroup.replaceFirst("%1",xGroup->getExpression());
             _out_rList.push_back(sGroupName);
         }
         _out_rList.push_back(xReportDefinition->getName());
@@ -1747,10 +1746,9 @@ uno::Reference< report::XFunctionsSupplier> GeometryHandler::fillScope_throw(OUS
         const uno::Reference< report::XGroup> xGroup(xSection->getGroup(),uno::UNO_QUERY);
         if ( xGroup.is() )
         {
-            String sGroupName = String(ModuleRes(RID_STR_SCOPE_GROUP));
+            OUString sGroupName = ModuleRes(RID_STR_SCOPE_GROUP).toString();
             _rsNamePostFix = xGroup->getExpression();
-            sGroupName.SearchAndReplaceAscii("%1",_rsNamePostFix);
-            m_sScope = sGroupName;
+            m_sScope = sGroupName.replaceFirst("%1",_rsNamePostFix);
             xReturn = xGroup.get();
         }
         else if ( xSection == xReportDefinition->getDetail() )
@@ -1760,10 +1758,9 @@ uno::Reference< report::XFunctionsSupplier> GeometryHandler::fillScope_throw(OUS
             if ( nCount )
             {
                 const uno::Reference< report::XGroup> xGroup2(xGroups->getByIndex(nCount - 1),uno::UNO_QUERY_THROW);
-                String sGroupName = String(ModuleRes(RID_STR_SCOPE_GROUP));
+                OUString sGroupName = String(ModuleRes(RID_STR_SCOPE_GROUP));
                 _rsNamePostFix = xGroup2->getExpression();
-                sGroupName.SearchAndReplaceAscii("%1",_rsNamePostFix);
-                m_sScope = sGroupName;
+                m_sScope = sGroupName.replaceFirst("%1",_rsNamePostFix);
                 xReturn = xGroup2.get();
             }
         }
@@ -1786,9 +1783,8 @@ uno::Reference< report::XFunctionsSupplier> GeometryHandler::fillScope_throw(OUS
         for (sal_Int32 i = 0 ; i < nCount; ++i)
         {
             const uno::Reference< report::XGroup> xGroup(xGroups->getByIndex(i),uno::UNO_QUERY_THROW);
-            String sGroupName = String(ModuleRes(RID_STR_SCOPE_GROUP));
-            sGroupName.SearchAndReplaceAscii("%1",xGroup->getExpression());
-            if ( m_sScope == OUString(sGroupName) )
+            OUString sGroupName = String(ModuleRes(RID_STR_SCOPE_GROUP));
+            if ( m_sScope == sGroupName.replaceFirst("%1",xGroup->getExpression()) )
             {
                 _rsNamePostFix = xGroup->getExpression();
                 xReturn = xGroup.get();
@@ -1833,9 +1829,8 @@ sal_Bool GeometryHandler::isDefaultFunction( const OUString& _sQuotedFunction
                             uno::Reference< report::XGroup> xGroup(aFind.first->second.second,uno::UNO_QUERY);
                             if ( xGroup.is() )
                             {
-                                String sGroupName = String(ModuleRes(RID_STR_SCOPE_GROUP));
-                                sGroupName.SearchAndReplaceAscii("%1",xGroup->getExpression());
-                                m_sScope = sGroupName;
+                                OUString sGroupName = String(ModuleRes(RID_STR_SCOPE_GROUP));
+                                m_sScope = sGroupName.replaceFirst("%1",xGroup->getExpression());
                             }
                             else
                                 m_sScope = xReportDefinition->getName();
@@ -2095,9 +2090,8 @@ bool GeometryHandler::impl_isCounterFunction_throw(const OUString& _sQuotedFunct
                 const uno::Reference< report::XGroup > xGroup(aFind.first->second.second,uno::UNO_QUERY);
                 if ( xGroup.is() )
                 {
-                    String sGroupName = String(ModuleRes(RID_STR_SCOPE_GROUP));
-                    sGroupName.SearchAndReplaceAscii("%1",xGroup->getExpression());
-                    _Out_sScope = sGroupName;
+                    OUString sGroupName = String(ModuleRes(RID_STR_SCOPE_GROUP));
+                    _Out_sScope = sGroupName.replaceFirst("%1",xGroup->getExpression());
                 }
                 else
                     _Out_sScope = uno::Reference< report::XReportDefinition >(aFind.first->second.second,uno::UNO_QUERY_THROW)->getName();
diff --git a/sc/source/ui/Accessibility/AccessibleCellBase.cxx b/sc/source/ui/Accessibility/AccessibleCellBase.cxx
index 0d6f431..a1a9011 100644
--- a/sc/source/ui/Accessibility/AccessibleCellBase.cxx
+++ b/sc/source/ui/Accessibility/AccessibleCellBase.cxx
@@ -212,15 +212,14 @@ OUString SAL_CALL
     ScAccessibleCellBase::createAccessibleName(void)
     throw (uno::RuntimeException)
 {
-    String sName( ScResId(STR_ACC_CELL_NAME) );
+    OUString sName( SC_RESSTR(STR_ACC_CELL_NAME) );
     // Document not needed, because only the cell address, but not the tablename is needed
     // always us OOO notation
     OUString sAddress(maCellAddress.Format(SCA_VALID, NULL));
-    sName.SearchAndReplaceAscii("%1", sAddress);
     /*  #i65103# ZoomText merges cell address and contents, e.g. if value 2 is
         contained in cell A1, ZT reads "cell A twelve" instead of "cell A1 - 2".
         Simple solution: Append a space character to the cell address. */
-    sName.Append( ' ' );
+    sName = sName.replaceFirst("%1", sAddress) + " ";
     return OUString(sName);
 }
 
diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index 3e85822..44d6b46 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -2084,14 +2084,14 @@ void ScAccessibleDocument::RemoveChild(const uno::Reference<XAccessible>& xAcc,
 
 OUString ScAccessibleDocument::GetCurrentCellName() const
 {
-    String sName( ScResId(STR_ACC_CELL_NAME) );
+    OUString sName(SC_RESSTR(STR_ACC_CELL_NAME));
     if (mpViewShell)
     {
         // Document not needed, because only the cell address, but not the tablename is needed
         OUString sAddress(mpViewShell->GetViewData()->GetCurPos().Format(SCA_VALID, NULL));
-        sName.SearchAndReplaceAscii("%1", sAddress);
+        sName = sName.replaceFirst("%1", sAddress);
     }
-    return OUString(sName);
+    return sName;
 }
 
 OUString ScAccessibleDocument::GetCurrentCellDescription() const
diff --git a/sc/source/ui/Accessibility/AccessiblePageHeader.cxx b/sc/source/ui/Accessibility/AccessiblePageHeader.cxx
index 8240498..3d7b46f 100644
--- a/sc/source/ui/Accessibility/AccessiblePageHeader.cxx
+++ b/sc/source/ui/Accessibility/AccessiblePageHeader.cxx
@@ -339,17 +339,15 @@ uno::Sequence<OUString> SAL_CALL ScAccessiblePageHeader::getSupportedServiceName
 OUString SAL_CALL ScAccessiblePageHeader::createAccessibleDescription(void)
                     throw (uno::RuntimeException)
 {
-    String sDesc(ScResId(mbHeader ? STR_ACC_HEADER_DESCR : STR_ACC_FOOTER_DESCR));
-    sDesc.SearchAndReplaceAscii("%1", String(ScResId(SCSTR_UNKNOWN)));
-    return OUString( sDesc );
+    OUString sDesc(SC_RESSTR(mbHeader ? STR_ACC_HEADER_DESCR : STR_ACC_FOOTER_DESCR));
+    return sDesc.replaceFirst("%1", SC_RESSTR(SCSTR_UNKNOWN));
 }
 
 OUString SAL_CALL ScAccessiblePageHeader::createAccessibleName(void)
                     throw (uno::RuntimeException)
 {
-    String sName(ScResId(mbHeader ? STR_ACC_HEADER_NAME : STR_ACC_FOOTER_NAME));
-    sName.SearchAndReplaceAscii("%1", String(ScResId(SCSTR_UNKNOWN)));
-    return OUString( sName );
+    OUString sName(SC_RESSTR(mbHeader ? STR_ACC_HEADER_NAME : STR_ACC_FOOTER_NAME));
+    return sName.replaceFirst("%1", SC_RESSTR(SCSTR_UNKNOWN));
 }
 
 Rectangle ScAccessiblePageHeader::GetBoundingBoxOnScreen() const throw (uno::RuntimeException)
diff --git a/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx b/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx
index 2ed5c55..f0b17d6 100644
--- a/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx
+++ b/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx
@@ -615,7 +615,7 @@ OUString SAL_CALL ScAccessiblePreviewTable::createAccessibleDescription(void)
 OUString SAL_CALL ScAccessiblePreviewTable::createAccessibleName(void)
                     throw (uno::RuntimeException)
 {
-    String sName(ScResId(STR_ACC_TABLE_NAME));
+    OUString sName(SC_RESSTR(STR_ACC_TABLE_NAME));
 
     if (mpViewShell && mpViewShell->GetDocument())
     {
@@ -625,11 +625,11 @@ OUString SAL_CALL ScAccessiblePreviewTable::createAccessibleName(void)
         {
             OUString sCoreName;
             if (mpViewShell->GetDocument()->GetName( mpTableInfo->GetTab(), sCoreName ))
-                sName.SearchAndReplaceAscii("%1", sCoreName);
+                sName = sName.replaceFirst("%1", sCoreName);
         }
     }
 
-    return OUString(sName);
+    return sName;
 }
 
 Rectangle ScAccessiblePreviewTable::GetBoundingBoxOnScreen() const throw (uno::RuntimeException)
diff --git a/sc/source/ui/Accessibility/AccessibleTableBase.cxx b/sc/source/ui/Accessibility/AccessibleTableBase.cxx
index 95d8e1b..6272f06 100644
--- a/sc/source/ui/Accessibility/AccessibleTableBase.cxx
+++ b/sc/source/ui/Accessibility/AccessibleTableBase.cxx
@@ -358,11 +358,11 @@ OUString SAL_CALL
     ScAccessibleTableBase::createAccessibleName(void)
     throw (uno::RuntimeException)
 {
-    String sName(ScResId(STR_ACC_TABLE_NAME));
+    OUString sName(SC_RESSTR(STR_ACC_TABLE_NAME));
     OUString sCoreName;
     if (mpDoc && mpDoc->GetName( maRange.aStart.Tab(), sCoreName ))
-        sName.SearchAndReplaceAscii("%1", sCoreName);
-    return OUString(sName);
+        sName = sName.replaceFirst("%1", sCoreName);
+    return sName;
 }
 
 uno::Reference<XAccessibleRelationSet> SAL_CALL
diff --git a/sc/source/ui/dbgui/scuiimoptdlg.cxx b/sc/source/ui/dbgui/scuiimoptdlg.cxx
index d5f4788..1670ca2 100644
--- a/sc/source/ui/dbgui/scuiimoptdlg.cxx
+++ b/sc/source/ui/dbgui/scuiimoptdlg.cxx
@@ -133,9 +133,9 @@ ScImportOptionsDlg::ScImportOptionsDlg(
         aBtnCancel  ( this, ScResId( BTN_CANCEL ) ),
         aBtnHelp    ( this, ScResId( BTN_HELP ) )
 {
-    String sFieldSep( ScResId( SCSTR_FIELDSEP ) );
-    sFieldSep.SearchAndReplaceAscii( "%TAB",   String(ScResId(SCSTR_FIELDSEP_TAB)) );
-    sFieldSep.SearchAndReplaceAscii( "%SPACE", String(ScResId(SCSTR_FIELDSEP_SPACE)) );
+    OUString sFieldSep(SC_RESSTR(SCSTR_FIELDSEP));
+    sFieldSep = sFieldSep.replaceFirst( "%TAB",   SC_RESSTR(SCSTR_FIELDSEP_TAB) );
+    sFieldSep = sFieldSep.replaceFirst( "%SPACE", SC_RESSTR(SCSTR_FIELDSEP_SPACE) );
 
     // im Ctor-Initializer nicht moeglich (MSC kann das nicht):
     pFieldSepTab = new ScDelimiterTable( sFieldSep );
diff --git a/sc/source/ui/dbgui/sortdlg.cxx b/sc/source/ui/dbgui/sortdlg.cxx
index 3c539b2..683c267 100644
--- a/sc/source/ui/dbgui/sortdlg.cxx
+++ b/sc/source/ui/dbgui/sortdlg.cxx
@@ -54,9 +54,9 @@ ScSortWarningDlg::ScSortWarningDlg( Window* pParent,
     get( aBtnExtSort, "extend" );
     get( aBtnCurSort, "current" );
 
-    String sTextName = aFtText->GetText();
-    sTextName.SearchAndReplaceAscii("%1", rExtendText);
-    sTextName.SearchAndReplaceAscii("%2", rCurrentText);
+    OUString sTextName = aFtText->GetText();
+    sTextName = sTextName.replaceFirst("%1", rExtendText);
+    sTextName = sTextName.replaceFirst("%2", rCurrentText);
     aFtText->SetText( sTextName );
 
     aBtnExtSort->SetClickHdl( LINK( this, ScSortWarningDlg, BtnHdl ) );
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 12596466..c39499a 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -792,8 +792,8 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
                                         }
                                         else
                                         {
-                                            String aMessage( ScGlobal::GetRscString( STR_FILE_LOCKED_SAVE_LATER ) );
-                                            aMessage.SearchAndReplaceAscii( "%1", aUserName );
+                                            OUString aMessage( ScGlobal::GetRscString( STR_FILE_LOCKED_SAVE_LATER ) );
+                                            aMessage = aMessage.replaceFirst( "%1", aUserName );
 
                                             WarningBox aBox( GetActiveDialogParent(), WinBits( WB_RETRY_CANCEL | WB_DEF_RETRY ), aMessage );
                                             if ( aBox.Execute() == RET_RETRY )
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 6d3d4ef..1d7e1d1 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -1010,8 +1010,8 @@ void ScDocShell::Execute( SfxRequest& rReq )
                                         catch ( uno::Exception& )
                                         {
                                         }
-                                        String aMessage( ScGlobal::GetRscString( STR_FILE_LOCKED_TRY_LATER ) );
-                                        aMessage.SearchAndReplaceAscii( "%1", aUserName );
+                                        OUString aMessage( ScGlobal::GetRscString( STR_FILE_LOCKED_TRY_LATER ) );
+                                        aMessage = aMessage.replaceFirst( "%1", aUserName );
 
                                         WarningBox aBox( GetActiveDialogParent(), WinBits( WB_OK ), aMessage );
                                         aBox.Execute();
diff --git a/sw/inc/shellres.hxx b/sw/inc/shellres.hxx
index 1122334..793cad6 100644
--- a/sw/inc/shellres.hxx
+++ b/sw/inc/shellres.hxx
@@ -80,7 +80,7 @@ struct SW_DLLPUBLIC ShellResource : public Resource
     // Returns for the specific filter the new names of pagedescs
     // This method is for the old code of the specific filters with
     // now localized names.
-    String GetPageDescName( sal_uInt16 nNo, PageNameMode eMode );
+    OUString GetPageDescName(sal_uInt16 nNo, PageNameMode eMode);
 
     ShellResource();
     ~ShellResource();
diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index a92ea29..1e368ef 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -752,14 +752,13 @@ void SwStdFontTabPage::Reset( const SfxItemSet& rSet)
     if( SFX_ITEM_SET == rSet.GetItemState(nLangSlot, sal_False, &pLang))
         eLanguage = ((const SvxLanguageItem*)pLang)->GetValue();
 
-    String sTmp = pLabelFT->GetText();
-    String sToReplace = sScriptWestern;
+    OUString sTmp = pLabelFT->GetText();
+    OUString sToReplace = sScriptWestern;
     if(FONT_GROUP_CJK == nFontGroup )
         sToReplace = sScriptAsian;
     else if(FONT_GROUP_CTL == nFontGroup )
         sToReplace = sScriptComplex;
-    sTmp.SearchAndReplaceAscii("%1", sToReplace);
-    pLabelFT->SetText(sTmp);
+    pLabelFT->SetText(sTmp.replaceFirst("%1", sToReplace));
 
     const SfxPoolItem* pItem;
 
diff --git a/sw/source/ui/dbui/dbtablepreviewdialog.cxx b/sw/source/ui/dbui/dbtablepreviewdialog.cxx
index e1faea9..593de92 100644
--- a/sw/source/ui/dbui/dbtablepreviewdialog.cxx
+++ b/sw/source/ui/dbui/dbtablepreviewdialog.cxx
@@ -53,11 +53,10 @@ SwDBTablePreviewDialog::SwDBTablePreviewDialog(Window* pParent, uno::Sequence< b
     {
         if ( pValues[nValue].Name == "Command" )
         {
-            String sDescription = m_aDescriptionFI.GetText();
+            OUString sDescription = m_aDescriptionFI.GetText();
             OUString sTemp;
             pValues[nValue].Value >>= sTemp;
-            sDescription.SearchAndReplaceAscii("%1", sTemp);
-            m_aDescriptionFI.SetText(sDescription);
+            m_aDescriptionFI.SetText(sDescription.replaceFirst("%1", sTemp));
             break;
         }
     }
diff --git a/sw/source/ui/dbui/mailmergechildwindow.cxx b/sw/source/ui/dbui/mailmergechildwindow.cxx
index f03fc87..2b9e2eb 100644
--- a/sw/source/ui/dbui/mailmergechildwindow.cxx
+++ b/sw/source/ui/dbui/mailmergechildwindow.cxx
@@ -547,12 +547,11 @@ void  SwSendMailDialog::IterateMails()
         {
             Image aInsertImg = m_aImageList.GetImage( FN_FORMULA_CANCEL );
 
-            String sMessage = m_sSendingTo;
+            OUString sMessage = m_sSendingTo;
             String sTmp(pCurrentMailDescriptor->sEMail);
             sTmp += '\t';
             sTmp += m_sFailed;
-            sMessage.SearchAndReplaceAscii("%1", sTmp);
-            m_aStatusLB.InsertEntry( sMessage, aInsertImg, aInsertImg);
+            m_aStatusLB.InsertEntry( sMessage.replaceFirst("%1", sTmp), aInsertImg, aInsertImg);
             ++m_nSendCount;
             ++m_nErrorCount;
             UpdateTransferStatus( );
@@ -646,12 +645,11 @@ void SwSendMailDialog::DocumentSent( uno::Reference< mail::XMailMessage> xMessag
     }
     Image aInsertImg = m_aImageList.GetImage( bResult ? FN_FORMULA_APPLY : FN_FORMULA_CANCEL );
 
-    String sMessage = m_sSendingTo;
-    String sTmp(xMessage->getRecipients()[0]);
-    sTmp += '\t';
+    OUString sMessage = m_sSendingTo;
+    OUString sTmp(xMessage->getRecipients()[0]);
+    sTmp += "\t";
     sTmp += bResult ? m_sCompleted : m_sFailed;
-    sMessage.SearchAndReplaceAscii("%1", sTmp);
-    m_aStatusLB.InsertEntry( sMessage, aInsertImg, aInsertImg);
+    m_aStatusLB.InsertEntry( sMessage.replaceFirst("%1", sTmp), aInsertImg, aInsertImg);
     ++m_nSendCount;
     if(!bResult)
         ++m_nErrorCount;
@@ -667,13 +665,12 @@ void SwSendMailDialog::DocumentSent( uno::Reference< mail::XMailMessage> xMessag
 
 void SwSendMailDialog::UpdateTransferStatus()
 {
-    String sStatus( m_sTransferStatus );
-    sStatus.SearchAndReplaceAscii("%1", OUString::number(m_nSendCount) );
-    sStatus.SearchAndReplaceAscii("%2", OUString::number(m_pImpl->nDocumentCount));
+    OUString sStatus( m_sTransferStatus );
+    sStatus = sStatus.replaceFirst("%1", OUString::number(m_nSendCount) );
+    sStatus = sStatus.replaceFirst("%2", OUString::number(m_pImpl->nDocumentCount));
     m_aTransferStatusFT.SetText(sStatus);
 
-    sStatus = m_sErrorStatus;
-    sStatus.SearchAndReplaceAscii("%1", OUString::number(m_nErrorCount) );
+    sStatus = m_sErrorStatus.replaceFirst("%1", OUString::number(m_nErrorCount) );
     m_aErrorStatusFT.SetText(sStatus);
 
     if(m_pImpl->aDescriptors.size())
diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx
index 8cfec10..c1411f6 100644
--- a/sw/source/ui/dbui/mmaddressblockpage.cxx
+++ b/sw/source/ui/dbui/mmaddressblockpage.cxx
@@ -138,9 +138,7 @@ void SwMailMergeAddressBlockPage::ActivatePage()
     if(bIsLetter)
     {
         m_aHideEmptyParagraphsCB.Check( rConfigItem.IsHideEmptyParagraphs() );
-        String sTemp(m_sDocument);
-        sTemp.SearchAndReplaceAscii("%1", OUString::number(1));
-        m_aDocumentIndexFI.SetText(sTemp);
+        m_aDocumentIndexFI.SetText(m_sDocument.replaceFirst("%1", OUString::number(1)));
 
         m_aSettingsWIN.Clear();
         const uno::Sequence< OUString> aBlocks =
@@ -319,18 +317,14 @@ IMPL_LINK(SwMailMergeAddressBlockPage, InsertDataHdl_Impl, ImageButton*, pButton
         }
     }
     m_aPrevSetIB.Enable(bEnable);
-    String sTemp(m_sDocument);
-    sTemp.SearchAndReplaceAscii("%1", OUString::number(nPos));
-    m_aDocumentIndexFI.SetText(sTemp);
+    m_aDocumentIndexFI.SetText(m_sDocument.replaceFirst("%1", OUString::number(nPos)));
 
     GetWizard()->enableButtons(WZB_NEXT, GetWizard()->isStateEnabled(MM_GREETINGSPAGE));
     sal_Bool bHasResultSet = rConfig.GetResultSet().is();
     m_aCurrentAddressFI.Show(bHasResultSet);
     if(bHasResultSet)
     {
-        String sTmp = m_sCurrentAddress;
-        sTmp.SearchAndReplaceAscii("%1", rConfig.GetCurrentDBData().sDataSource );
-        m_aCurrentAddressFI.SetText(sTmp);
+        m_aCurrentAddressFI.SetText(m_sCurrentAddress.replaceFirst("%1", rConfig.GetCurrentDBData().sDataSource));
         m_aAddressListPB.SetText(m_sChangeAddress);
     }
     EnableAddressBlock(bHasResultSet, m_aAddressCB.IsChecked());
diff --git a/sw/source/ui/dbui/mmaddressblockpage.hxx b/sw/source/ui/dbui/mmaddressblockpage.hxx
index 03dabbc..992df36 100644
--- a/sw/source/ui/dbui/mmaddressblockpage.hxx
+++ b/sw/source/ui/dbui/mmaddressblockpage.hxx
@@ -69,9 +69,9 @@ class SwMailMergeAddressBlockPage : public svt::OWizardPage
     ImageButton         m_aPrevSetIB;
     ImageButton         m_aNextSetIB;
 
-    String              m_sDocument;
-    String              m_sCurrentAddress;
-    String              m_sChangeAddress;
+    OUString            m_sDocument;
+    OUString            m_sCurrentAddress;
+    OUString            m_sChangeAddress;
 
     SwMailMergeWizard*  m_pWizard;
 
diff --git a/sw/source/ui/dbui/mmgreetingspage.cxx b/sw/source/ui/dbui/mmgreetingspage.cxx
index c1126eb..d5d6f1a 100644
--- a/sw/source/ui/dbui/mmgreetingspage.cxx
+++ b/sw/source/ui/dbui/mmgreetingspage.cxx
@@ -319,9 +319,7 @@ SwMailMergeGreetingsPage::SwMailMergeGreetingsPage( SwMailMergeWizard* _pParent)
     lcl_FillGreetingsBox(m_aMaleLB, rConfig, SwMailMergeConfigItem::MALE);
     lcl_FillGreetingsBox(m_aNeutralCB, rConfig, SwMailMergeConfigItem::NEUTRAL);
 
-    String sTemp(m_sDocument);
-    sTemp.SearchAndReplaceAscii("%1", OUString::number(1));
-    m_aDocumentIndexFI.SetText(sTemp);
+    m_aDocumentIndexFI.SetText(m_sDocument.replaceFirst("%1", OUString::number(1)));
 }
 
 SwMailMergeGreetingsPage::~SwMailMergeGreetingsPage()
@@ -428,9 +426,7 @@ IMPL_LINK(SwMailMergeGreetingsPage, InsertDataHdl_Impl, ImageButton*, pButton)
     m_aPrevSetIB.Enable(bEnable);
     m_aNextSetIB.Enable(bEnable);
     m_aDocumentIndexFI.Enable(bEnable);
-    String sTemp(m_sDocument);
-    sTemp.SearchAndReplaceAscii("%1", OUString::number(nPos));
-    m_aDocumentIndexFI.SetText(sTemp);
+    m_aDocumentIndexFI.SetText(m_sDocument.replaceFirst("%1", OUString::number(nPos)));
     return 0;
 }
 
diff --git a/sw/source/ui/dbui/mmgreetingspage.hxx b/sw/source/ui/dbui/mmgreetingspage.hxx
index 7738463..479b5e4 100644
--- a/sw/source/ui/dbui/mmgreetingspage.hxx
+++ b/sw/source/ui/dbui/mmgreetingspage.hxx
@@ -100,7 +100,7 @@ class SwMailMergeGreetingsPage : public svt::OWizardPage,
     ImageButton         m_aPrevSetIB;
     ImageButton         m_aNextSetIB;
 
-    String              m_sDocument;
+    OUString            m_sDocument;
 
     DECL_LINK(ContainsHdl_Impl, CheckBox*);
     DECL_LINK(InsertDataHdl_Impl, ImageButton*);
diff --git a/sw/source/ui/dbui/mmoutputpage.hxx b/sw/source/ui/dbui/mmoutputpage.hxx
index eb0b0a3..874c5cf 100644
--- a/sw/source/ui/dbui/mmoutputpage.hxx
+++ b/sw/source/ui/dbui/mmoutputpage.hxx
@@ -174,7 +174,7 @@ class SW_DLLPUBLIC SwSendMailDialog : public ModelessDialog //SfxModalDialog
     String                  m_sStop;
     String                  m_sSend;
     String                  m_sTransferStatus;
-    String                  m_sErrorStatus;
+    OUString                m_sErrorStatus;
     String                  m_sSendingTo;
     String                  m_sCompleted;
     String                  m_sFailed;
diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx
index cae138a..ebbeae0 100644
--- a/sw/source/ui/frmdlg/column.cxx
+++ b/sw/source/ui/frmdlg/column.cxx
@@ -924,27 +924,24 @@ void SwColumnPage::SetLabels( sal_uInt16 nVis )
     String tmp3(sLbl2);
     sLbl2.Insert(sLbl, sLbl2.Len() - 1);
     m_pLbl3->SetText(sLbl2);
-    String sColumnWidth = SW_RESSTR( STR_ACCESS_COLUMN_WIDTH ) ;
-    sColumnWidth.SearchAndReplaceAscii("%1", tmp1);
-    aEd1.SetAccessibleName(sColumnWidth);
+    OUString sColumnWidth = SW_RESSTR( STR_ACCESS_COLUMN_WIDTH ) ;
+    aEd1.SetAccessibleName(sColumnWidth.replaceFirst("%1", tmp1));
 
     sColumnWidth = SW_RESSTR( STR_ACCESS_COLUMN_WIDTH ) ;
-    sColumnWidth.SearchAndReplaceAscii("%1", tmp2);
-    aEd2.SetAccessibleName(sColumnWidth);
+    aEd2.SetAccessibleName(sColumnWidth.replaceFirst("%1", tmp2));
 
     sColumnWidth = SW_RESSTR( STR_ACCESS_COLUMN_WIDTH ) ;
-    sColumnWidth.SearchAndReplaceAscii("%1", tmp3);
-    aEd3.SetAccessibleName(sColumnWidth);
+    aEd3.SetAccessibleName(sColumnWidth.replaceFirst("%1", tmp3));
 
-    String sDist = SW_RESSTR( STR_ACCESS_PAGESETUP_SPACING ) ;
-    String sDist1 = sDist;
-    sDist1.SearchAndReplaceAscii("%1", tmp1);
-    sDist1.SearchAndReplaceAscii("%2", tmp2);
+    OUString sDist = SW_RESSTR( STR_ACCESS_PAGESETUP_SPACING ) ;
+    OUString sDist1 = sDist;
+    sDist1 = sDist1.replaceFirst("%1", tmp1);
+    sDist1 = sDist1.replaceFirst("%2", tmp2);
     aDistEd1.SetAccessibleName(sDist1);
 
-    String sDist2 = sDist;
-    sDist2.SearchAndReplaceAscii("%1", tmp2);
-    sDist2.SearchAndReplaceAscii("%2", tmp3);
+    OUString sDist2 = sDist;
+    sDist2 = sDist2.replaceFirst("%1", tmp2);
+    sDist2 = sDist2.replaceFirst("%2", tmp3);
     aDistEd2.SetAccessibleName(sDist2);
 }
 
diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index 4bf24ff..3064a95 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -513,9 +513,9 @@ IMPL_LINK_NOARG( SwMultiTOXTabDialog, ShowPreviewHdl )
 
             if(!bExist)
             {
-                String sInfo(SW_RES(STR_FILE_NOT_FOUND));
-                sInfo.SearchAndReplaceAscii( "%1", sTemplate );
-                sInfo.SearchAndReplaceAscii( "%2", aOpt.GetTemplatePath() );
+                OUString sInfo(SW_RESSTR(STR_FILE_NOT_FOUND));
+                sInfo = sInfo.replaceFirst( "%1", sTemplate );
+                sInfo = sInfo.replaceFirst( "%2", aOpt.GetTemplatePath() );
                 InfoBox aInfo(GetParent(), sInfo);
                 aInfo.Execute();
             }
diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx
index 9b578c6..85188f4 100644
--- a/sw/source/ui/uiview/view2.cxx
+++ b/sw/source/ui/uiview/view2.cxx
@@ -2327,9 +2327,8 @@ void SwView::GenerateFormLetter(sal_Bool bUseCurrentDocument)
             if(!GetWrtShell().IsFieldDataSourceAvailable(sSource))
             {
                 SwMergeSourceWarningBox_Impl aWarning( &GetViewFrame()->GetWindow());
-                String sTmp(aWarning.GetMessText());
-                sTmp.SearchAndReplaceAscii("%1", sSource);
-                aWarning.SetMessText(sTmp);
+                OUString sTmp(aWarning.GetMessText());
+                aWarning.SetMessText(sTmp.replaceFirst("%1", sSource));
                 if(RET_OK == aWarning.Execute())
                 {
                     SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
diff --git a/sw/source/ui/utlui/initui.cxx b/sw/source/ui/utlui/initui.cxx
index 4ff0610..d506db5 100644
--- a/sw/source/ui/utlui/initui.cxx
+++ b/sw/source/ui/utlui/initui.cxx
@@ -230,9 +230,9 @@ ShellResource::~ShellResource()
     delete pAutoFmtNameLst;
 }
 
-String ShellResource::GetPageDescName( sal_uInt16 nNo, PageNameMode eMode )
+OUString ShellResource::GetPageDescName(sal_uInt16 nNo, PageNameMode eMode)
 {
-    String sRet;
+    OUString sRet;
 
     switch (eMode)
     {
@@ -247,8 +247,7 @@ String ShellResource::GetPageDescName( sal_uInt16 nNo, PageNameMode eMode )
             break;
     }
 
-    sRet.SearchAndReplaceAscii( "$(ARG1)", OUString::number( nNo ));
-    return sRet;
+    return sRet.replaceFirst( "$(ARG1)", OUString::number( nNo ));
 }
 
 
diff --git a/tools/source/string/strascii.cxx b/tools/source/string/strascii.cxx
index 53a2bab..56e7122 100644
--- a/tools/source/string/strascii.cxx
+++ b/tools/source/string/strascii.cxx
@@ -247,18 +247,4 @@ xub_StrLen UniString::SearchAscii( const sal_Char* pAsciiStr, xub_StrLen nIndex
     return STRING_NOTFOUND;
 }
 
-xub_StrLen UniString::SearchAndReplaceAscii( const sal_Char* pAsciiStr, const UniString& rRepStr,
-                                             xub_StrLen nIndex )
-{
-    DBG_CHKTHIS( UniString, DbgCheckUniString );
-    DBG_ASSERT( ImplDbgCheckAsciiStr( pAsciiStr, STRING_LEN ),
-                "UniString::SearchAndReplaceAscii() - pAsciiStr include characters > 127" );
-
-    xub_StrLen nSPos = SearchAscii( pAsciiStr, nIndex );
-    if ( nSPos != STRING_NOTFOUND )
-        Replace( nSPos, ImplStringLen( pAsciiStr ), rRepStr );
-
-    return nSPos;
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 511b3ce85ebb2261f5ea866efdb333eaf94c64f8
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Oct 7 09:53:30 2013 +0100

    restore original nPos increment
    
    b0caeafc1add0b52b3d7a9dc80f50080ba439f59 changed the logic of
    lcl_GetTokenToParaBreak slightly, from nPos+=1 to nPos+=2, which
    worries me a bit
    
    Change-Id: Ifb621a0bf8ea0705f39f35461449632c592e65e9

diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index 9175145..2734e7f 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -2138,7 +2138,7 @@ static bool lcl_GetTokenToParaBreak( OUString& rStr, OUString& rRet, bool bRegEx
             // Has this been escaped?
             if( nPos && '\\' == rStr[nPos-1])
             {
-                nPos += sPara.getLength();
+                ++nPos;
                 if( nPos >= rStr.getLength() )
                 {
                     break;


More information about the Libreoffice-commits mailing list