[Libreoffice-commits] core.git: 20 commits - sw/source

Matteo Casalin matteo.casalin at yahoo.com
Sun Jun 1 11:21:13 PDT 2014


 sw/source/core/undo/untblk.cxx           |    8 -
 sw/source/core/unocore/swunohelper.cxx   |   14 +--
 sw/source/core/unocore/unochart.cxx      |   77 +++++++----------
 sw/source/core/unocore/unocoll.cxx       |   65 +++++++-------
 sw/source/core/unocore/unocrsrhelper.cxx |   30 ++----
 sw/source/core/unocore/unodraw.cxx       |   33 +++----
 sw/source/core/unocore/unoevent.cxx      |    8 -
 sw/source/core/unocore/unofield.cxx      |  101 +++++++++++-----------
 sw/source/core/unocore/unoflatpara.cxx   |    4 
 sw/source/core/unocore/unoidx.cxx        |  139 ++++++++++++-------------------
 sw/source/core/unocore/unoobj.cxx        |   43 ++++-----
 sw/source/core/unocore/unoobj2.cxx       |   17 +--
 sw/source/core/unocore/unoparagraph.cxx  |   33 ++-----
 sw/source/core/unocore/unoportenum.cxx   |    4 
 sw/source/core/unocore/unoredline.cxx    |   30 ++----
 sw/source/core/unocore/unorefmk.cxx      |   36 ++++----
 16 files changed, 288 insertions(+), 354 deletions(-)

New commits:
commit dded2e25491212026a341ed636d4d984067c988c
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Jun 1 19:12:54 2014 +0200

    sal_uInt16 to size_t
    
    Change-Id: Ia8795223224a6d2772f12ad41d7691517db80714

diff --git a/sw/source/core/undo/untblk.cxx b/sw/source/core/undo/untblk.cxx
index df62334..6a35fe2 100644
--- a/sw/source/core/undo/untblk.cxx
+++ b/sw/source/core/undo/untblk.cxx
@@ -50,8 +50,8 @@ SwUndoInserts::SwUndoInserts( SwUndoId nUndoId, const SwPaM& rPam )
 
         if( !nSttCntnt )    // than take the Flys along
         {
-            sal_uInt16 nArrLen = pDoc->GetSpzFrmFmts()->size();
-            for( sal_uInt16 n = 0; n < nArrLen; ++n )
+            const size_t nArrLen = pDoc->GetSpzFrmFmts()->size();
+            for( size_t n = 0; n < nArrLen; ++n )
             {
                 SwFrmFmt* pFmt = (*pDoc->GetSpzFrmFmts())[n];
                 SwFmtAnchor const*const  pAnchor = &pFmt->GetAnchor();
@@ -103,8 +103,8 @@ void SwUndoInserts::SetInsertRange( const SwPaM& rPam, bool bScanFlys,
     {
         // than collect all new Flys
         SwDoc* pDoc = (SwDoc*)rPam.GetDoc();
-        sal_uInt16 nArrLen = pDoc->GetSpzFrmFmts()->size();
-        for( sal_uInt16 n = 0; n < nArrLen; ++n )
+        const size_t nArrLen = pDoc->GetSpzFrmFmts()->size();
+        for( size_t n = 0; n < nArrLen; ++n )
         {
             SwFrmFmt* pFmt = (*pDoc->GetSpzFrmFmts())[n];
             SwFmtAnchor const*const pAnchor = &pFmt->GetAnchor();
commit 63b902175b58b65fb6f385cd084d55d6ac02da17
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Jun 1 19:12:30 2014 +0200

    Avoid temporary OUStrings
    
    Change-Id: I02f26228f0f9068ce7f497913fb36ac8945e785b

diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx
index 8e992db..cccb2c3 100644
--- a/sw/source/core/unocore/unocoll.cxx
+++ b/sw/source/core/unocore/unocoll.cxx
@@ -608,7 +608,7 @@ uno::Reference< uno::XInterface >   SwXServiceProvider::MakeInstance(sal_uInt16
                 {
                     uno::Sequence< uno::Any > aArgs(1);
                     aArgs[ 0 ] <<= pDoc->GetDocShell()->GetModel();
-                    aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( OUString("ooo.vba.word.Globals"), aArgs );
+                    aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( "ooo.vba.word.Globals", aArgs );
                     pDoc->GetDocShell()->GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
                 }
                 aGlobs >>= xRet;
@@ -1465,21 +1465,20 @@ uno::Any SwXTextSections::getByIndex(sal_Int32 nIndex)
     return makeAny(xRet);
 }
 
-uno::Any SwXTextSections::getByName(const OUString& Name)
+uno::Any SwXTextSections::getByName(const OUString& rName)
     throw( NoSuchElementException, WrappedTargetException, uno::RuntimeException, std::exception )
 {
     SolarMutexGuard aGuard;
     uno::Any aRet;
     if(IsValid())
     {
-        OUString aName(Name);
         SwSectionFmts& rFmts = GetDoc()->GetSections();
         uno::Reference< XTextSection >  xSect;
         for(size_t i = 0; i < rFmts.size(); ++i)
         {
             SwSectionFmt* pFmt = rFmts[i];
             if (pFmt->IsInNodesArr()
-                && (aName == pFmt->GetSection()->GetSectionName()))
+                && (rName == pFmt->GetSection()->GetSectionName()))
             {
                 xSect = GetObject(*pFmt);
                 aRet.setValue(&xSect, cppu::UnoType<XTextSection>::get());
commit 2932e45b68a5b0d083532942f997aff94856b995
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Jun 1 14:48:43 2014 +0200

    sal_uInt16 to size_t, constify
    
    Change-Id: Ie864814c71a31aaf2b139641bac9bb720143abfe

diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx
index a6e2831..8e992db 100644
--- a/sw/source/core/unocore/unocoll.cxx
+++ b/sw/source/core/unocore/unocoll.cxx
@@ -478,7 +478,7 @@ OUString    SwXServiceProvider::GetProviderName(sal_uInt16 nObjectType)
 {
     SolarMutexGuard aGuard;
     OUString sRet;
-    sal_uInt16 nEntries = sizeof(aProvNamesId) / sizeof(aProvNamesId[0]);
+    const sal_uInt16 nEntries = sizeof(aProvNamesId) / sizeof(aProvNamesId[0]);
     if(nObjectType < nEntries)
         sRet = OUString::createFromAscii(aProvNamesId[nObjectType].pName);
     return sRet;
@@ -486,7 +486,7 @@ OUString    SwXServiceProvider::GetProviderName(sal_uInt16 nObjectType)
 
 uno::Sequence<OUString>     SwXServiceProvider::GetAllServiceNames()
 {
-    sal_uInt16 nEntries = sizeof(aProvNamesId) / sizeof(aProvNamesId[0]);
+    const sal_uInt16 nEntries = sizeof(aProvNamesId) / sizeof(aProvNamesId[0]);
     uno::Sequence<OUString> aRet(nEntries);
     OUString* pArray = aRet.getArray();
     sal_uInt16 n = 0;
@@ -506,7 +506,7 @@ uno::Sequence<OUString>     SwXServiceProvider::GetAllServiceNames()
 
 sal_uInt16  SwXServiceProvider::GetProviderType(const OUString& rServiceName)
 {
-    sal_uInt16 nEntries = sizeof(aProvNamesId) / sizeof(aProvNamesId[0]);
+    const sal_uInt16 nEntries = sizeof(aProvNamesId) / sizeof(aProvNamesId[0]);
     for(sal_uInt16 i = 0; i < nEntries; i++ )
     {
         if (rServiceName.equalsAscii(aProvNamesId[i].pName))
@@ -889,7 +889,7 @@ uno::Any SwXTextTables::getByName(const OUString& rItemName)
     uno::Any aRet;
     if(IsValid())
     {
-        sal_uInt16 nCount = GetDoc()->GetTblFrmFmtCount(true);
+        const sal_uInt16 nCount = GetDoc()->GetTblFrmFmtCount(true);
         uno::Reference< XTextTable >  xTbl;
         for( sal_uInt16 i = 0; i < nCount; i++)
         {
@@ -916,7 +916,7 @@ uno::Sequence< OUString > SwXTextTables::getElementNames(void)
     SolarMutexGuard aGuard;
     if(!IsValid())
         throw uno::RuntimeException();
-    sal_uInt16 nCount = GetDoc()->GetTblFrmFmtCount(true);
+    const sal_uInt16 nCount = GetDoc()->GetTblFrmFmtCount(true);
     uno::Sequence<OUString> aSeq(nCount);
     if(nCount)
     {
@@ -938,7 +938,7 @@ sal_Bool SwXTextTables::hasByName(const OUString& rName)
     bool bRet= false;
     if(IsValid())
     {
-        sal_uInt16 nCount = GetDoc()->GetTblFrmFmtCount(true);
+        const sal_uInt16 nCount = GetDoc()->GetTblFrmFmtCount(true);
         for( sal_uInt16 i = 0; i < nCount; i++)
         {
             SwFrmFmt& rFmt = GetDoc()->GetTblFrmFmt(i, true);
@@ -1084,14 +1084,14 @@ SwXFrameEnumeration<T>::SwXFrameEnumeration(const SwDoc* const pDoc)
         return;
     // #i104937#
 //    const SwFrmFmt* const pFmtsEnd = (*pFmts)[pFmts->Count()];
-    const sal_uInt16 nSize = pFmts->size();
+    const size_t nSize = pFmts->size();
     ::std::insert_iterator<frmcontainer_t> pInserter = ::std::insert_iterator<frmcontainer_t>(m_aFrames, m_aFrames.begin());
     // #i104937#
     SwFrmFmt* pFmt( 0 );
 
     std::list<SwFrmFmt*> aTextBoxes = SwTextBoxHelper::findTextBoxes(pDoc);
 
-    for( sal_uInt16 i = 0; i < nSize; ++i )
+    for( size_t i = 0; i < nSize; ++i )
 //    for(SwFrmFmt* pFmt = (*pFmts)[0]; pFmt < pFmtsEnd; ++pFmt)
     {
         // #i104937#
@@ -1423,8 +1423,8 @@ sal_Int32 SwXTextSections::getCount(void) throw( uno::RuntimeException, std::exc
     if(!IsValid())
         throw uno::RuntimeException();
     const SwSectionFmts& rSectFmts = GetDoc()->GetSections();
-    sal_uInt16 nCount = rSectFmts.size();
-    for(sal_uInt16 i = nCount; i; i--)
+    size_t nCount = rSectFmts.size();
+    for(size_t i = nCount; i; --i)
     {
         if( !rSectFmts[i - 1]->IsInNodesArr())
             nCount--;
@@ -1442,17 +1442,17 @@ uno::Any SwXTextSections::getByIndex(sal_Int32 nIndex)
         SwSectionFmts& rFmts = GetDoc()->GetSections();
 
         const SwSectionFmts& rSectFmts = GetDoc()->GetSections();
-        sal_uInt16 nCount = rSectFmts.size();
-        for(sal_uInt16 i = 0; i < nCount; i++)
+        const size_t nCount = rSectFmts.size();
+        for(size_t i = 0; i < nCount; ++i)
         {
             if( !rSectFmts[i]->IsInNodesArr())
                 nIndex ++;
-            else if(nIndex == i)
+            else if(static_cast<size_t>(nIndex) == i)
                 break;
-            if(nIndex == i)
+            if(static_cast<size_t>(nIndex) == i)
                 break;
         }
-        if(nIndex >= 0 && nIndex < (sal_Int32)rFmts.size())
+        if(nIndex >= 0 && static_cast<size_t>(nIndex) < rFmts.size())
         {
             SwSectionFmt* pFmt = rFmts[(sal_uInt16)nIndex];
             xRet = GetObject(*pFmt);
@@ -1475,7 +1475,7 @@ uno::Any SwXTextSections::getByName(const OUString& Name)
         OUString aName(Name);
         SwSectionFmts& rFmts = GetDoc()->GetSections();
         uno::Reference< XTextSection >  xSect;
-        for(sal_uInt16 i = 0; i < rFmts.size(); i++)
+        for(size_t i = 0; i < rFmts.size(); ++i)
         {
             SwSectionFmt* pFmt = rFmts[i];
             if (pFmt->IsInNodesArr()
@@ -1500,9 +1500,9 @@ uno::Sequence< OUString > SwXTextSections::getElementNames(void)
     SolarMutexGuard aGuard;
     if(!IsValid())
         throw uno::RuntimeException();
-    sal_uInt16 nCount = GetDoc()->GetSections().size();
+    size_t nCount = GetDoc()->GetSections().size();
     SwSectionFmts& rSectFmts = GetDoc()->GetSections();
-    for(sal_uInt16 i = nCount; i; i--)
+    for(size_t i = nCount; i; --i)
     {
         if( !rSectFmts[i - 1]->IsInNodesArr())
             nCount--;
@@ -1513,8 +1513,8 @@ uno::Sequence< OUString > SwXTextSections::getElementNames(void)
     {
         SwSectionFmts& rFmts = GetDoc()->GetSections();
         OUString* pArray = aSeq.getArray();
-        sal_uInt16 nIndex = 0;
-        for( sal_uInt16 i = 0; i < nCount; i++, nIndex++)
+        size_t nIndex = 0;
+        for( size_t i = 0; i < nCount; ++i, ++nIndex)
         {
             const SwSectionFmt* pFmt = rFmts[nIndex];
             while(!pFmt->IsInNodesArr())
@@ -1535,7 +1535,7 @@ sal_Bool SwXTextSections::hasByName(const OUString& rName)
     if(IsValid())
     {
         SwSectionFmts& rFmts = GetDoc()->GetSections();
-        for(sal_uInt16 i = 0; i < rFmts.size(); i++)
+        for(size_t i = 0; i < rFmts.size(); ++i)
         {
             const SwSectionFmt* pFmt = rFmts[i];
             if (rName == pFmt->GetSection()->GetSectionName())
@@ -1562,7 +1562,7 @@ uno::Type SAL_CALL SwXTextSections::getElementType() throw(uno::RuntimeException
 sal_Bool SwXTextSections::hasElements(void) throw( uno::RuntimeException, std::exception )
 {
     SolarMutexGuard aGuard;
-    sal_uInt16 nCount = 0;
+    size_t nCount = 0;
     if(IsValid())
     {
         SwSectionFmts& rFmts = GetDoc()->GetSections();
@@ -1760,9 +1760,9 @@ uno::Any SwXNumberingRulesCollection::getByIndex(sal_Int32 nIndex)
     if(IsValid())
     {
         uno::Reference< XIndexReplace >  xRef;
-        if ( nIndex < (sal_Int32)GetDoc()->GetNumRuleTbl().size() )
+        if ( static_cast<size_t>(nIndex) < GetDoc()->GetNumRuleTbl().size() )
         {
-            xRef = new SwXNumberingRules( *GetDoc()->GetNumRuleTbl()[ static_cast< sal_uInt16 >(nIndex) ], GetDoc());
+            xRef = new SwXNumberingRules( *GetDoc()->GetNumRuleTbl()[ nIndex ], GetDoc());
             aRet.setValue(&xRef, cppu::UnoType<XIndexReplace>::get());
         }
 
@@ -1821,9 +1821,9 @@ sal_Int32 SwXFootnotes::getCount(void) throw( uno::RuntimeException, std::except
     if(!IsValid())
         throw uno::RuntimeException();
     sal_Int32 nCount = 0;
-    sal_uInt16 n, nFtnCnt = GetDoc()->GetFtnIdxs().size();
+    const size_t nFtnCnt = GetDoc()->GetFtnIdxs().size();
     SwTxtFtn* pTxtFtn;
-    for( n = 0; n < nFtnCnt; ++n )
+    for( size_t n = 0; n < nFtnCnt; ++n )
     {
         pTxtFtn = GetDoc()->GetFtnIdxs()[ n ];
         const SwFmtFtn& rFtn = pTxtFtn->GetFtn();
@@ -1842,10 +1842,10 @@ uno::Any SwXFootnotes::getByIndex(sal_Int32 nIndex)
     sal_Int32 nCount = 0;
     if(IsValid())
     {
-        sal_uInt16 n, nFtnCnt = GetDoc()->GetFtnIdxs().size();
+        const size_t nFtnCnt = GetDoc()->GetFtnIdxs().size();
         SwTxtFtn* pTxtFtn;
         uno::Reference< XFootnote >  xRef;
-        for( n = 0; n < nFtnCnt; ++n )
+        for( size_t n = 0; n < nFtnCnt; ++n )
         {
             pTxtFtn = GetDoc()->GetFtnIdxs()[ n ];
             const SwFmtFtn& rFtn = pTxtFtn->GetFtn();
@@ -1971,7 +1971,7 @@ uno::Sequence< OUString > SwXReferenceMarks::getElementNames(void) throw( uno::R
     if(IsValid())
     {
         std::vector<OUString> aStrings;
-        sal_uInt16 nCount = GetDoc()->GetRefMarks( &aStrings );
+        const sal_uInt16 nCount = GetDoc()->GetRefMarks( &aStrings );
         aRet.realloc(nCount);
         OUString* pNames = aRet.getArray();
         for(sal_uInt16 i = 0; i < nCount; i++)
commit 672ef15cd4e32bb4254e41c24a594d522e3c31fe
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Jun 1 14:19:47 2014 +0200

    OUString: avoid temporaries and simplify
    
    Change-Id: I1e131913991f0b28e55e54e8cc64ce37135be946

diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
index 53b40e8..18b0bf6 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -343,7 +343,7 @@ bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry
                     sRet = pTmpNode->GetNumString();
                 }
 
-                *pAny <<= OUString(sRet);
+                *pAny <<= sRet;
             }
         break;
         case RES_PARATR_OUTLINELEVEL:
@@ -425,8 +425,7 @@ bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry
                     // #i91601#
                     else if ( rEntry.nWID == FN_UNO_LIST_ID )
                     {
-                        const OUString sListId = pTxtNd->GetListId();
-                        *pAny <<= OUString(sListId);
+                        *pAny <<= pTxtNd->GetListId();
                     }
                     else /*if(rEntry.nWID == UNO_NAME_PARA_IS_NUMBERING_RESTART)*/
                     {
@@ -901,10 +900,8 @@ void GetCurPageStyle(SwPaM& rPaM, OUString &rString)
     const SwPageFrm* pPage = rPaM.GetCntntNode()->getLayoutFrm(rPaM.GetDoc()->GetCurrentLayout())->FindPageFrm();
     if(pPage)
     {
-        OUString tmp;
         SwStyleNameMapper::FillProgName(pPage->GetPageDesc()->GetName(),
-            tmp, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC, true);
-        rString = tmp;
+            rString, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC, true);
     }
 }
 
@@ -1116,8 +1113,6 @@ bool DocInsertStringSplitCR(
 
     // grouping done in InsertString is intended for typing, not API calls
     ::sw::GroupUndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo());
-    OUString aTxt;
-    sal_Int32 nStartIdx = 0;
     SwTxtNode* const pTxtNd =
         rNewCursor.GetPoint()->nNode.GetNode().GetTxtNode();
     if (!pTxtNd)
@@ -1125,6 +1120,8 @@ bool DocInsertStringSplitCR(
         SAL_INFO("sw.uno", "DocInsertStringSplitCR: need a text node");
         return false;
     }
+    OUString aTxt;
+    sal_Int32 nStartIdx = 0;
     const sal_Int32 nMaxLength = COMPLETE_STRING - pTxtNd->GetTxt().getLength();
 
     sal_Int32 nIdx = rText.indexOf( '\r', nStartIdx );
commit 2b81f3c28e76c231e257d643c47bca47b66916ce
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Jun 1 13:50:07 2014 +0200

    sal_uInt16 to more proper types + minor optimizations
    
    Change-Id: I8873a1ec910024b6fc25490891dc2e2c8d20d5d1

diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
index b3c3840..53b40e8 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -20,6 +20,7 @@
 #include <unocrsrhelper.hxx>
 
 #include <map>
+#include <algorithm>
 
 #include <com/sun/star/beans/PropertyState.hpp>
 #include <com/sun/star/embed/ElementModes.hpp>
@@ -667,13 +668,11 @@ bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry
             if (rPam.GetNode(true) == rPam.GetNode(false)
                 && pTxtNode && pTxtNode->GetpSwpHints())
             {
-                sal_uInt16 nPaMStart = rPam.GetPoint()->nContent.GetIndex();
-                sal_uInt16 nPaMEnd = rPam.GetMark() ? rPam.GetMark()->nContent.GetIndex() : nPaMStart;
+                sal_Int32 nPaMStart = rPam.GetPoint()->nContent.GetIndex();
+                sal_Int32 nPaMEnd = rPam.GetMark() ? rPam.GetMark()->nContent.GetIndex() : nPaMStart;
                 if(nPaMStart > nPaMEnd)
                 {
-                    sal_uInt16 nTmp = nPaMStart;
-                    nPaMStart = nPaMEnd;
-                    nPaMEnd = nTmp;
+                    std::swap(nPaMStart, nPaMEnd);
                 }
                 Sequence< OUString> aCharStyles;
                 SwpHints* pHints = pTxtNode->GetpSwpHints();
@@ -682,8 +681,8 @@ bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry
                     SwTxtAttr* pAttr = pHints->GetStart( nAttr );
                     if(pAttr->Which() != RES_TXTATR_CHARFMT)
                         continue;
-                    sal_uInt16 nAttrStart = *pAttr->GetStart();
-                    sal_uInt16 nAttrEnd = *pAttr->GetEnd();
+                    const sal_Int32 nAttrStart = *pAttr->GetStart();
+                    const sal_Int32 nAttrEnd = *pAttr->GetEnd();
                     //check if the attribute touches the selection
                     if( ( nAttrEnd > nPaMStart && nAttrStart < nPaMEnd ) ||
                         ( !nAttrStart && !nAttrEnd && !nPaMStart && !nPaMEnd ) )
@@ -787,9 +786,9 @@ void setNumberingProperty(const Any& rValue, SwPaM& rPam)
                         {
 
                             // get CharStyle and set the rule
-                            sal_uInt16 nChCount = pDoc->GetCharFmts()->size();
+                            const size_t nChCount = pDoc->GetCharFmts()->size();
                             SwCharFmt* pCharFmt = 0;
-                            for(sal_uInt16 nCharFmt = 0; nCharFmt < nChCount; nCharFmt++)
+                            for(size_t nCharFmt = 0; nCharFmt < nChCount; ++nCharFmt)
                             {
                                 SwCharFmt& rChFmt = *((*(pDoc->GetCharFmts()))[nCharFmt]);
                                 if(rChFmt.GetName() == pNewCharStyles[i])
commit b101ebff8ecd63da917ae033298a1445d75d691e
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Jun 1 13:36:28 2014 +0200

    Group common code
    
    Change-Id: I857366ca2fb6e0e0cb43ff12b161310eab5015f6

diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index 007dc3e..68820e9 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -291,6 +291,23 @@ static sal_uInt16 lcl_GetPropMapIdForFieldType( sal_uInt16 nWhich )
     return nId;
 }
 
+static sal_Int32 lcl_PropName2TokenPos(const OUString& rPropertyName)
+{
+    if (rPropertyName == UNO_NAME_DDE_COMMAND_TYPE)
+        return 0;
+
+    if (rPropertyName == UNO_NAME_DDE_COMMAND_FILE)
+        return 1;
+
+    if (rPropertyName == UNO_NAME_DDE_COMMAND_ELEMENT)
+        return 2;
+
+    if (rPropertyName == UNO_NAME_IS_AUTOMATIC_UPDATE)
+        return 3;
+
+    return SAL_MAX_INT32;
+}
+
 sal_uInt16 GetFieldTypeMId( const OUString& rProperty, const SwFieldType& rTyp )
 {
     sal_uInt16 nId = lcl_GetPropMapIdForFieldType( rTyp.Which() );
@@ -711,10 +728,7 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
             break;
         case RES_DDEFLD:
             {
-                sal_uInt16 nPart = rPropertyName == UNO_NAME_DDE_COMMAND_TYPE ? 0 :
-                        rPropertyName == UNO_NAME_DDE_COMMAND_FILE ? 1 :
-                        rPropertyName == UNO_NAME_DDE_COMMAND_ELEMENT ? 2 :
-                        rPropertyName == UNO_NAME_IS_AUTOMATIC_UPDATE ? 3 : USHRT_MAX;
+                sal_Int32 nPart = lcl_PropName2TokenPos(rPropertyName);
                 if(nPart  < 3 )
                 {
                     if (m_pImpl->m_sParam1.isEmpty())
@@ -915,10 +929,7 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
                 break;
             case RES_DDEFLD:
                 {
-                    sal_uInt16 nPart = rPropertyName == UNO_NAME_DDE_COMMAND_TYPE  ? 0 :
-                        rPropertyName == UNO_NAME_DDE_COMMAND_FILE ? 1 :
-                            rPropertyName == UNO_NAME_DDE_COMMAND_ELEMENT  ? 2 :
-                            rPropertyName == UNO_NAME_IS_AUTOMATIC_UPDATE ? 3 : USHRT_MAX;
+                    const sal_Int32 nPart = lcl_PropName2TokenPos(rPropertyName);
                     if(nPart  < 3 )
                         aRet <<= m_pImpl->m_sParam1.getToken(nPart, sfx2::cTokenSeparator);
                     else if(3 == nPart)
commit 9af0c596cc6337d81d1788f75a77680d0dfbffc3
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Jun 1 13:06:45 2014 +0200

    OUString: simplify, constify, remove temporaries
    
    Change-Id: I7dbba6bfe9f44b28cdf62b1eb4da05eda696d0dd

diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index 17a49ed..007dc3e 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -558,7 +558,7 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
         {
             const ::std::vector<OUString>& rExtraArr(
                     SwStyleNameMapper::GetExtraUINameArray());
-            OUString sTypeName = pType->GetName();
+            const OUString sTypeName = pType->GetName();
             static sal_uInt16 nIds[] =
             {
                 RES_POOLCOLL_LABEL_DRAWING - RES_POOLCOLL_EXTRA_BEGIN,
@@ -603,21 +603,17 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
     }
     else if (!pType && m_pImpl->m_pDoc && rPropertyName == UNO_NAME_NAME)
     {
-        OUString uTmp;
-        rValue >>= uTmp;
-        OUString sTypeName(uTmp);
+        OUString sTypeName;
+        rValue >>= sTypeName;
         SwFieldType * pType2 = m_pImpl->m_pDoc->GetFldType(
                 m_pImpl->m_nResTypeId, sTypeName, false);
 
-        OUString sTable(SW_RES(STR_POOLCOLL_LABEL_TABLE));
-        OUString sDrawing(SW_RES(STR_POOLCOLL_LABEL_DRAWING));
-        OUString sFrame(SW_RES(STR_POOLCOLL_LABEL_FRAME));
-        OUString sIllustration(SW_RES(STR_POOLCOLL_LABEL_ABB));
-
         if(pType2 ||
             (RES_SETEXPFLD == m_pImpl->m_nResTypeId &&
-            ( sTypeName == sTable || sTypeName == sDrawing ||
-              sTypeName == sFrame || sTypeName == sIllustration )))
+            ( sTypeName == SW_RESSTR(STR_POOLCOLL_LABEL_TABLE) ||
+              sTypeName == SW_RESSTR(STR_POOLCOLL_LABEL_DRAWING) ||
+              sTypeName == SW_RESSTR(STR_POOLCOLL_LABEL_FRAME) ||
+              sTypeName == SW_RESSTR(STR_POOLCOLL_LABEL_ABB) )))
         {
             throw lang::IllegalArgumentException();
         }
@@ -1023,7 +1019,7 @@ void SwXFieldMaster::Impl::Modify(
 
 OUString SwXFieldMaster::GetProgrammaticName(const SwFieldType& rType, SwDoc& rDoc)
 {
-    OUString sRet(rType.GetName());
+    const OUString sName(rType.GetName());
     if(RES_SETEXPFLD == rType.Which())
     {
         const SwFldTypes* pTypes = rDoc.GetFldTypes();
@@ -1031,12 +1027,11 @@ OUString SwXFieldMaster::GetProgrammaticName(const SwFieldType& rType, SwDoc& rD
         {
             if((*pTypes)[i] == &rType)
             {
-                sRet = SwStyleNameMapper::GetProgName ( sRet, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
-                break;
+                return SwStyleNameMapper::GetProgName( sName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
             }
         }
     }
-    return sRet;
+    return sName;
 }
 
 OUString SwXFieldMaster::LocalizeFormula(
@@ -1045,16 +1040,15 @@ OUString SwXFieldMaster::LocalizeFormula(
     bool bQuery)
 {
     const OUString sTypeName(rFld.GetTyp()->GetName());
-    OUString sProgName = SwStyleNameMapper::GetProgName(sTypeName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+    const OUString sProgName(
+        SwStyleNameMapper::GetProgName(sTypeName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL ));
     if(sProgName != sTypeName)
     {
-        OUString sSource = bQuery ? sTypeName : sProgName;
-        OUString sDest = bQuery ? sProgName : sTypeName;
+        const OUString sSource = bQuery ? sTypeName : sProgName;
+        const OUString sDest = bQuery ? sProgName : sTypeName;
         if(rFormula.startsWith(sSource))
         {
-            OUString sTmpFormula = sDest;
-            sTmpFormula += rFormula.copy(sSource.getLength());
-            return sTmpFormula;
+            return sDest + rFormula.copy(sSource.getLength());
         }
     }
     return rFormula;
@@ -1289,10 +1283,7 @@ throw (uno::RuntimeException, std::exception)
     {
         throw uno::RuntimeException();
     }
-    OUString const ret( (bShowCommand)
-            ? pField->GetFieldName()
-            : pField->ExpandField(true) );
-    return ret;
+    return bShowCommand ? pField->GetFieldName() : pField->ExpandField(true);
 }
 
 void SAL_CALL SwXTextField::attach(
@@ -2557,12 +2548,12 @@ throw (uno::RuntimeException, std::exception)
 uno::Sequence< OUString > SAL_CALL SwXTextField::getSupportedServiceNames()
 throw (uno::RuntimeException, std::exception)
 {
-    OUString sServiceName =
+    const OUString sServiceName =
         SwXServiceProvider::GetProviderName(m_pImpl->m_nServiceId);
 
     // case-corected version of service-name (see #i67811)
     // (need to supply both because of compatibility to older versions)
-    OUString sServiceNameCC(  OldNameToNewName_Impl( sServiceName ) );
+    const OUString sServiceNameCC(  OldNameToNewName_Impl( sServiceName ) );
     sal_Int32 nLen = sServiceName == sServiceNameCC ? 2 : 3;
 
     uno::Sequence< OUString > aRet( nLen );
@@ -2675,8 +2666,8 @@ static sal_uInt16 lcl_GetIdByName( OUString& rName, OUString& rTypeName )
     {
         nResId = RES_SETEXPFLD;
 
-        OUString sFldTypName( rName.getToken( 1, '.' ));
-        OUString sUIName( SwStyleNameMapper::GetSpecialExtraUIName( sFldTypName ) );
+        const OUString sFldTypName( rName.getToken( 1, '.' ));
+        const OUString sUIName( SwStyleNameMapper::GetSpecialExtraUIName( sFldTypName ) );
 
         if( sUIName != sFldTypName )
             rName = comphelper::string::setToken(rName, 1, '.', sUIName);
commit 12324ca824192c41ab76d797e648e88751ac6439
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sat May 31 11:30:09 2014 +0200

    sal_uInt16 to more proper types, constify
    
    Change-Id: Ic7d9f18e04429c5ccb7b0fad28f3e83aa199897c

diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index 4899005..17a49ed 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -197,7 +197,8 @@ static sal_uInt16 lcl_ServiceIdToResId(sal_uInt16 nServiceId)
 
 static sal_uInt16 lcl_GetServiceForField( const SwField& rFld )
 {
-    sal_uInt16 nWhich = rFld.Which(), nSrvId = USHRT_MAX;
+    const sal_uInt16 nWhich = rFld.Which();
+    sal_uInt16 nSrvId = USHRT_MAX;
     //special handling for some fields
     switch( nWhich )
     {
@@ -208,7 +209,7 @@ static sal_uInt16 lcl_GetServiceForField( const SwField& rFld )
 
     case RES_DOCINFOFLD:
         {
-            sal_uInt16 nSubType = rFld.GetSubType();
+            const sal_uInt16 nSubType = rFld.GetSubType();
             switch( (nSubType & 0xff))
             {
             case DI_CHANGE:
@@ -826,7 +827,7 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
 
             uno::Sequence<uno::Reference <text::XDependentTextField> > aRetSeq(aFldArr.size());
             uno::Reference<text::XDependentTextField>* pRetSeq = aRetSeq.getArray();
-            for(sal_uInt16 i = 0; i < aFldArr.size(); i++)
+            for(size_t i = 0; i < aFldArr.size(); ++i)
             {
                 pFld = aFldArr[i];
                 uno::Reference<text::XTextField> const xField =
@@ -840,7 +841,7 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
         else
         {
             //TODO: Properties fuer die uebrigen Feldtypen einbauen
-            sal_uInt16 nMId = GetFieldTypeMId( rPropertyName, *pType );
+            const sal_uInt16 nMId = GetFieldTypeMId( rPropertyName, *pType );
             if (USHRT_MAX == nMId)
             {
                 throw beans::UnknownPropertyException(
@@ -965,7 +966,7 @@ throw (uno::RuntimeException, std::exception)
         throw uno::RuntimeException();
     sal_uInt16 nTypeIdx = USHRT_MAX;
     const SwFldTypes* pTypes = m_pImpl->m_pDoc->GetFldTypes();
-    for( sal_uInt16 i = 0; i < pTypes->size(); i++ )
+    for( size_t i = 0; i < pTypes->size(); i++ )
     {
         if((*pTypes)[i] == pFldType)
             nTypeIdx = i;
@@ -1026,7 +1027,7 @@ OUString SwXFieldMaster::GetProgrammaticName(const SwFieldType& rType, SwDoc& rD
     if(RES_SETEXPFLD == rType.Which())
     {
         const SwFldTypes* pTypes = rDoc.GetFldTypes();
-        for( sal_uInt16 i = 0; i <= INIT_FLDTYPES; i++ )
+        for( size_t i = 0; i <= size_t(INIT_FLDTYPES); i++ )
         {
             if((*pTypes)[i] == &rType)
             {
@@ -2126,7 +2127,7 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
     if(pField)
     {
         // special treatment for mail merge fields
-        sal_uInt16 nWhich = pField->Which();
+        const sal_uInt16 nWhich = pField->Which();
         if( RES_DBFLD == nWhich &&
             (rPropertyName == UNO_NAME_DATA_BASE_NAME ||
             rPropertyName == UNO_NAME_DATA_BASE_URL||
@@ -2683,7 +2684,7 @@ static sal_uInt16 lcl_GetIdByName( OUString& rName, OUString& rTypeName )
     else if (rTypeName == "DataBase")
     {
         rName = rName.copy(RTL_CONSTASCII_LENGTH("DataBase."));
-        sal_uInt16 nDotCount = comphelper::string::getTokenCount(rName, '.');
+        const sal_Int32 nDotCount = comphelper::string::getTokenCount(rName, '.');
         if( 2 <= nDotCount )
         {
             // #i51815#
@@ -2704,7 +2705,7 @@ uno::Any SwXTextFieldMasters::getByName(const OUString& rName)
         throw uno::RuntimeException();
 
     OUString sName(rName), sTypeName;
-    sal_uInt16 nResId = lcl_GetIdByName( sName, sTypeName );
+    const sal_uInt16 nResId = lcl_GetIdByName( sName, sTypeName );
     if( USHRT_MAX == nResId )
         throw container::NoSuchElementException(
             "SwXTextFieldMasters::getByName(" + rName + ")",
@@ -2795,7 +2796,7 @@ sal_Bool SwXTextFieldMasters::hasByName(const OUString& rName) throw( uno::Runti
         throw uno::RuntimeException();
 
     OUString sName(rName), sTypeName;
-    sal_uInt16 nResId = lcl_GetIdByName( sName, sTypeName );
+    const sal_uInt16 nResId = lcl_GetIdByName( sName, sTypeName );
     bool bRet = false;
     if( USHRT_MAX != nResId )
     {
@@ -2971,8 +2972,8 @@ SwXFieldEnumeration::SwXFieldEnumeration(SwDoc & rDoc)
     sal_Int32 nFillPos = 0;
 
     const SwFldTypes* pFldTypes = m_pImpl->m_pDoc->GetFldTypes();
-    sal_uInt16 nCount = pFldTypes->size();
-    for(sal_uInt16 nType = 0;  nType < nCount;  ++nType)
+    const size_t nCount = pFldTypes->size();
+    for(size_t nType = 0;  nType < nCount;  ++nType)
     {
         const SwFieldType *pCurType = (*pFldTypes)[nType];
         SwIterator<SwFmtFld,SwFieldType> aIter( *pCurType );
commit 6e3b2014ee40c6cc010f2b2f43d0ab867f961070
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Wed May 28 22:56:17 2014 +0200

    Don't re-iterate over string to get consecutive tokens
    
    Change-Id: I502cc43c7419301ba0937e495172bc21b609f71a

diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx
index a2ad9ad..7440a9d 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -2689,10 +2689,11 @@ throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException,
     uno::Sequence<OUString> aStyles(nStyles);
     OUString* pStyles = aStyles.getArray();
     OUString aString;
+    sal_Int32 nPos = 0;
     for(sal_Int32 i = 0; i < nStyles; ++i)
     {
         SwStyleNameMapper::FillProgName(
-            rStyles.getToken(i, TOX_STYLE_DELIMITER),
+            rStyles.getToken(0, TOX_STYLE_DELIMITER, nPos),
             aString,
             nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL,
             true);
commit 56ee353b89668bd0f1ef57c6c837ebac27bd9c94
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Wed May 28 22:50:41 2014 +0200

    OUString: avoid temporaries, plus minor optimizations
    
    Change-Id: I5f55430ecca381aea87d6d12fc99d05cc97334da

diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx
index f95a9d3..a2ad9ad 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -146,7 +146,7 @@ static void lcl_ConvertTOUNameToProgrammaticName(OUString& rTmp)
 {
     ShellResource* pShellRes = SwViewShell::GetShellRes();
 
-    if(rTmp.equals(pShellRes->aTOXUserName))
+    if(rTmp==pShellRes->aTOXUserName)
     {
         rTmp = cUserDefined;
     }
@@ -363,8 +363,8 @@ public:
                 : 0));
         if (!pTOXSection)
         {
-            throw uno::RuntimeException(OUString(
-                    "SwXDocumentIndex: disposed or invalid"), 0);
+            throw uno::RuntimeException(
+                    "SwXDocumentIndex: disposed or invalid", 0);
         }
         return *pTOXSection;
     }
@@ -548,15 +548,13 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
     if (!pEntry)
     {
         throw beans::UnknownPropertyException(
-            OUString("Unknown property: ")
-                + rPropertyName,
+            "Unknown property: " + rPropertyName,
             static_cast<cppu::OWeakObject *>(this));
     }
     if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
     {
         throw beans::PropertyVetoException(
-            OUString("Property is read-only: " )
-                + rPropertyName,
+            "Property is read-only: " + rPropertyName,
             static_cast<cppu::OWeakObject *>(this));
     }
 
@@ -604,8 +602,7 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
                     "tox type name can only be changed for user indexes");
             if (pSectionFmt)
             {
-                OUString sTmp = rTOXBase.GetTOXType()->GetTypeName();
-                if (sTmp != sNewName)
+                if (rTOXBase.GetTOXType()->GetTypeName() != sNewName)
                 {
                     lcl_ReAssignTOXType(pSectionFmt->GetDoc(),
                             rTOXBase, sNewName);
@@ -726,9 +723,8 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
         {
             // convert file-format/API/external programmatic english name
             // to internal UI name before usage
-            OUString aName( SwStyleNameMapper::GetSpecialExtraUIName(
+            rTOXBase.SetSequenceName( SwStyleNameMapper::GetSpecialExtraUIName(
                                 lcl_AnyToString(rValue) ) );
-            rTOXBase.SetSequenceName( aName );
         }
         break;
         case WID_LABEL_DISPLAY_TYPE:
@@ -887,8 +883,7 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
     if (!pEntry)
     {
         throw beans::UnknownPropertyException(
-            OUString("Unknown property: ")
-                + rPropertyName,
+            "Unknown property: " + rPropertyName,
             static_cast< cppu::OWeakObject * >(this));
     }
 
@@ -942,24 +937,17 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
             break;
             case WID_IDX_TITLE  :
             {
-                OUString uRet(pTOXBase->GetTitle());
-                aRet <<= uRet;
+                aRet <<= pTOXBase->GetTitle();
                 break;
             }
             case WID_IDX_NAME:
-                aRet <<= OUString(pTOXBase->GetTOXName());
+                aRet <<= pTOXBase->GetTOXName();
             break;
             case WID_USER_IDX_NAME:
             {
-                OUString sTmp;
-                if (!m_pImpl->m_bIsDescriptor)
-                {
-                    sTmp = pTOXBase->GetTOXType()->GetTypeName();
-                }
-                else
-                {
-                    sTmp = m_pImpl->m_pProps->GetTypeName();
-                }
+                OUString sTmp((!m_pImpl->m_bIsDescriptor)
+                    ? pTOXBase->GetTOXType()->GetTypeName()
+                    : m_pImpl->m_pProps->GetTypeName());
                 //I18N
                 lcl_ConvertTOUNameToProgrammaticName(sTmp);
                 aRet <<= sTmp;
@@ -969,16 +957,16 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
                 aRet <<= LanguageTag(pTOXBase->GetLanguage()).getLocale();
             break;
             case WID_IDX_SORT_ALGORITHM:
-                aRet <<= OUString(pTOXBase->GetSortAlgorithm());
+                aRet <<= pTOXBase->GetSortAlgorithm();
             break;
             case WID_LEVEL      :
                 aRet <<= static_cast<sal_Int16>(pTOXBase->GetLevel());
             break;
             case WID_TOC_BOOKMARK  :
-               aRet <<= OUString(pTOXBase->GetBookmarkName());
+               aRet <<= pTOXBase->GetBookmarkName();
             break;
             case WID_INDEX_ENTRY_TYPE  :
-               aRet <<= OUString(pTOXBase->GetEntryTypeName());
+               aRet <<= pTOXBase->GetEntryTypeName();
             break;
             case WID_CREATE_FROM_MARKS:
                 lcl_BitMaskToAny(aRet, nCreate, nsSwTOXElement::TOX_MARK);
@@ -1042,9 +1030,8 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
                 // convert internal UI name to
                 // file-format/API/external programmatic english name
                 // before usage
-                OUString aName( SwStyleNameMapper::GetSpecialExtraProgName(
-                                    pTOXBase->GetSequenceName() ) );
-                aRet <<= OUString( aName );
+                aRet <<= SwStyleNameMapper::GetSpecialExtraProgName(
+                                    pTOXBase->GetSequenceName() );
             }
             break;
             case WID_LABEL_DISPLAY_TYPE:
@@ -1844,8 +1831,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception)
                 {
                     SwTOXType const*const pTemp =
                         pDoc->GetTOXType( m_pImpl->m_eTOXType, i );
-                    if (m_pImpl->m_sUserIndexName ==
-                            OUString(pTemp->GetTypeName()))
+                    if (m_pImpl->m_sUserIndexName == pTemp->GetTypeName())
                     {
                         pTOXType = pTemp;
                         break;
@@ -2003,8 +1989,8 @@ void SwXDocumentIndexMark::Impl::InsertTOXMark(
 
     if (!pTxtAttr)
     {
-        throw uno::RuntimeException(OUString(
-            "SwXDocumentIndexMark::InsertTOXMark(): cannot insert attribute"),
+        throw uno::RuntimeException(
+            "SwXDocumentIndexMark::InsertTOXMark(): cannot insert attribute",
             0);
     }
 
@@ -2121,15 +2107,13 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
     if (!pEntry)
     {
         throw beans::UnknownPropertyException(
-            OUString("Unknown property: ")
-                + rPropertyName,
+            "Unknown property: " + rPropertyName,
             static_cast<cppu::OWeakObject *>(this));
     }
     if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
     {
         throw beans::PropertyVetoException(
-            OUString("Property is read-only: ")
-                + rPropertyName,
+            "Property is read-only: " + rPropertyName,
             static_cast<cppu::OWeakObject *>(this));
     }
 
@@ -2271,8 +2255,7 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
     if (!pEntry)
     {
         throw beans::UnknownPropertyException(
-            OUString("Unknown property: ")
-                + rPropertyName,
+            "Unknown property: " + rPropertyName,
             static_cast<cppu::OWeakObject *>(this));
     }
     if (::sw::GetDefaultTextContentValue(aRet, rPropertyName, pEntry->nWID))
@@ -2286,33 +2269,32 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
         switch(pEntry->nWID)
         {
             case WID_ALT_TEXT:
-                aRet <<= OUString(m_pImpl->m_pTOXMark->GetAlternativeText());
+                aRet <<= m_pImpl->m_pTOXMark->GetAlternativeText();
             break;
             case WID_LEVEL:
                 aRet <<= static_cast<sal_Int16>(
                             m_pImpl->m_pTOXMark->GetLevel() - 1);
             break;
             case WID_TOC_BOOKMARK :
-                aRet <<= OUString(m_pImpl->m_pTOXMark->GetBookmarkName());
+                aRet <<= m_pImpl->m_pTOXMark->GetBookmarkName();
             break;
             case WID_INDEX_ENTRY_TYPE :
-                aRet <<= OUString(m_pImpl->m_pTOXMark->GetEntryTypeName());
+                aRet <<= m_pImpl->m_pTOXMark->GetEntryTypeName();
             break;
             case WID_PRIMARY_KEY  :
-                aRet <<= OUString(m_pImpl->m_pTOXMark->GetPrimaryKey());
+                aRet <<= m_pImpl->m_pTOXMark->GetPrimaryKey();
             break;
             case WID_SECONDARY_KEY:
-                aRet <<= OUString(m_pImpl->m_pTOXMark->GetSecondaryKey());
+                aRet <<= m_pImpl->m_pTOXMark->GetSecondaryKey();
             break;
             case WID_TEXT_READING:
-                aRet <<= OUString(m_pImpl->m_pTOXMark->GetTextReading());
+                aRet <<= m_pImpl->m_pTOXMark->GetTextReading();
             break;
             case WID_PRIMARY_KEY_READING:
-                aRet <<= OUString(m_pImpl->m_pTOXMark->GetPrimaryKeyReading());
+                aRet <<= m_pImpl->m_pTOXMark->GetPrimaryKeyReading();
             break;
             case WID_SECONDARY_KEY_READING:
-                aRet <<= OUString(
-                        m_pImpl->m_pTOXMark->GetSecondaryKeyReading());
+                aRet <<= m_pImpl->m_pTOXMark->GetSecondaryKeyReading();
             break;
             case WID_USER_IDX_NAME :
             {
@@ -2512,7 +2494,6 @@ throw (container::NoSuchElementException, lang::WrappedTargetException,
     if(!IsValid())
         throw uno::RuntimeException();
 
-    OUString sToFind(rName);
     const SwSectionFmts& rFmts = GetDoc()->GetSections();
     for( size_t n = 0; n < rFmts.size(); ++n )
     {
@@ -2520,7 +2501,7 @@ throw (container::NoSuchElementException, lang::WrappedTargetException,
         if( TOX_CONTENT_SECTION == pSect->GetType() &&
             pSect->GetFmt()->GetSectionNode() &&
             (static_cast<SwTOXBaseSection const*>(pSect)->GetTOXName()
-                == sToFind))
+                == rName))
         {
            const uno::Reference< text::XDocumentIndex > xTmp =
                SwXDocumentIndex::CreateXDocumentIndex(
@@ -2577,7 +2558,6 @@ throw (uno::RuntimeException, std::exception)
     if(!IsValid())
         throw uno::RuntimeException();
 
-    OUString sToFind(rName);
     const SwSectionFmts& rFmts = GetDoc()->GetSections();
     for( size_t n = 0; n < rFmts.size(); ++n )
     {
@@ -2586,7 +2566,7 @@ throw (uno::RuntimeException, std::exception)
             pSect->GetFmt()->GetSectionNode())
         {
             if (static_cast<SwTOXBaseSection const*>(pSect)->GetTOXName()
-                    == sToFind)
+                    == rName)
             {
                 return sal_True;
             }
@@ -2882,9 +2862,8 @@ throw (lang::IllegalArgumentException, lang::IndexOutOfBoundsException,
                     sFillChar.isEmpty() ? ' ' : sFillChar[0];
             }
             else if ( pProperties[j].Name == "Text" )
-               {
-                const OUString sText = lcl_AnyToString(pProperties[j].Value);
-                aToken.sText = sText;
+            {
+                aToken.sText = lcl_AnyToString(pProperties[j].Value);
             }
             else if ( pProperties[j].Name == "ChapterFormat" )
             {
@@ -3005,7 +2984,7 @@ throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException,
 
     sal_Int32 nTokenCount = 0;
     uno::Sequence< beans::PropertyValues > aRetSeq;
-    OUString aString;
+    OUString aProgCharStyle;
     while(aIt != aPattern.end()) // #i21237#
     {
         nTokenCount++;
@@ -3017,10 +2996,9 @@ throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException,
             pTokenProps[nTokenCount-1];
         SwStyleNameMapper::FillProgName(
                         aToken.sCharStyleName,
-                        aString,
+                        aProgCharStyle,
                         nsSwGetPoolIdFromName::GET_POOLID_CHRFMT,
                         true );
-        const OUString aProgCharStyle( aString );
         switch(aToken.eTokenType)
         {
             case TOKEN_ENTRY_NO:
@@ -3134,7 +3112,7 @@ throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException,
                 pArr[1].Value <<= aProgCharStyle;
 
                 pArr[2].Name = "Text";
-                pArr[2].Value <<= OUString(aToken.sText);
+                pArr[2].Value <<= aToken.sText;
             }
             break;
             case TOKEN_PAGE_NUMS:
commit 51a65d821d256c2e2c3e4c90142025053a550da8
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Wed May 28 21:47:51 2014 +0200

    sal_uInt16 to more proper types, constify, minor optimizations
    
    Change-Id: I37ccea7d87e6e2e818717ecd06c8738dea7bcf30

diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx
index 6bda222..f95a9d3 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -564,13 +564,10 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
     SwTOXBase & rTOXBase( m_pImpl->GetTOXSectionOrThrow() );
 
     sal_uInt16 nCreate = rTOXBase.GetCreateType();
-    sal_uInt16 nTOIOptions = 0;
     sal_uInt16 nOLEOptions = rTOXBase.GetOLEOptions();
     const TOXTypes eTxBaseType = rTOXBase.GetTOXType()->GetType();
-    if (eTxBaseType == TOX_INDEX)
-    {
-        nTOIOptions = rTOXBase.GetOptions();
-    }
+    sal_uInt16 nTOIOptions = (eTxBaseType == TOX_INDEX)
+        ? rTOXBase.GetOptions() : 0;
     SwForm  aForm(rTOXBase.GetTOXForm());
     bool bForm = false;
     switch (pEntry->nWID)
@@ -852,7 +849,7 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
                         rPropertyName, rValue, aAttrSet);
 
                 const SwSectionFmts& rSects = m_pImpl->m_pDoc->GetSections();
-                for (sal_uInt16 i = 0; i < rSects.size(); i++)
+                for (size_t i = 0; i < rSects.size(); ++i)
                 {
                     const SwSectionFmt* pTmpFmt = rSects[ i ];
                     if (pTmpFmt == pSectionFmt)
@@ -929,7 +926,7 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
                     SwSections aSectArr;
                     pSectionFmt->GetChildSections(aSectArr,
                             SORTSECT_NOT, false);
-                    for(sal_uInt16 i = 0; i < aSectArr.size(); i++)
+                    for(size_t i = 0; i < aSectArr.size(); ++i)
                     {
                         SwSection* pSect = aSectArr[i];
                         if(pSect->GetType() == TOX_HEADER_SECTION)
@@ -1172,7 +1169,7 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
             case WID_PARA_LEV10:
             {
                 // in sdbcx::Index Label 1 begins at Pos 2 otherwise at Pos 1
-                sal_uInt16 nLPos = pTOXBase->GetType() == TOX_INDEX ? 2 : 1;
+                const sal_uInt16 nLPos = pTOXBase->GetType() == TOX_INDEX ? 2 : 1;
                 OUString aString;
                 SwStyleNameMapper::FillProgName(
                         rForm.GetTemplate(nLPos + pEntry->nWID - WID_PARA_LEV1),
@@ -1195,7 +1192,7 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
                 SwTOXMark::InsertTOXMarks( aMarks, *pType );
                 uno::Sequence< uno::Reference<text::XDocumentIndexMark> > aXMarks(aMarks.size());
                 uno::Reference<text::XDocumentIndexMark>* pxMarks = aXMarks.getArray();
-                for(sal_uInt16 i = 0; i < aMarks.size(); i++)
+                for(size_t i = 0; i < aMarks.size(); ++i)
                 {
                     SwTOXMark* pMark = aMarks[i];
                     pxMarks[i] = SwXDocumentIndexMark::CreateXDocumentIndexMark(
@@ -2461,7 +2458,7 @@ SwXDocumentIndexes::getCount() throw (uno::RuntimeException, std::exception)
 
     sal_uInt32 nRet = 0;
     const SwSectionFmts& rFmts = GetDoc()->GetSections();
-    for( sal_uInt16 n = 0; n < rFmts.size(); ++n )
+    for( size_t n = 0; n < rFmts.size(); ++n )
     {
         const SwSection* pSect = rFmts[ n ]->GetSection();
         if( TOX_CONTENT_SECTION == pSect->GetType() &&
@@ -2486,7 +2483,7 @@ throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException,
     sal_Int32 nIdx = 0;
 
     const SwSectionFmts& rFmts = GetDoc()->GetSections();
-    for( sal_uInt16 n = 0; n < rFmts.size(); ++n )
+    for( size_t n = 0; n < rFmts.size(); ++n )
     {
         const SwSection* pSect = rFmts[ n ]->GetSection();
         if( TOX_CONTENT_SECTION == pSect->GetType() &&
@@ -2517,7 +2514,7 @@ throw (container::NoSuchElementException, lang::WrappedTargetException,
 
     OUString sToFind(rName);
     const SwSectionFmts& rFmts = GetDoc()->GetSections();
-    for( sal_uInt16 n = 0; n < rFmts.size(); ++n )
+    for( size_t n = 0; n < rFmts.size(); ++n )
     {
         const SwSection* pSect = rFmts[ n ]->GetSection();
         if( TOX_CONTENT_SECTION == pSect->GetType() &&
@@ -2546,8 +2543,7 @@ SwXDocumentIndexes::getElementNames() throw (uno::RuntimeException, std::excepti
 
     const SwSectionFmts& rFmts = GetDoc()->GetSections();
     sal_Int32 nCount = 0;
-    sal_uInt16 n;
-    for( n = 0; n < rFmts.size(); ++n )
+    for( size_t n = 0; n < rFmts.size(); ++n )
     {
         SwSection const*const pSect = rFmts[ n ]->GetSection();
         if( TOX_CONTENT_SECTION == pSect->GetType() &&
@@ -2559,8 +2555,8 @@ SwXDocumentIndexes::getElementNames() throw (uno::RuntimeException, std::excepti
 
     uno::Sequence< OUString > aRet(nCount);
     OUString* pArray = aRet.getArray();
-    sal_uInt16 nCnt;
-    for( n = 0, nCnt = 0; n < rFmts.size(); ++n )
+    sal_Int32 nCnt = 0;
+    for( size_t n = 0; n < rFmts.size(); ++n )
     {
         SwSection const*const pSect = rFmts[ n ]->GetSection();
         if( TOX_CONTENT_SECTION == pSect->GetType() &&
@@ -2583,7 +2579,7 @@ throw (uno::RuntimeException, std::exception)
 
     OUString sToFind(rName);
     const SwSectionFmts& rFmts = GetDoc()->GetSections();
-    for( sal_uInt16 n = 0; n < rFmts.size(); ++n )
+    for( size_t n = 0; n < rFmts.size(); ++n )
     {
         SwSection const*const pSect = rFmts[ n ]->GetSection();
         if( TOX_CONTENT_SECTION == pSect->GetType() &&
@@ -2709,11 +2705,11 @@ throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException,
 
     const OUString& rStyles =
         rTOXBase.GetStyleNames(static_cast<sal_uInt16>(nIndex));
-    const sal_uInt16 nStyles = comphelper::string::getTokenCount(rStyles, TOX_STYLE_DELIMITER);
+    const sal_Int32 nStyles = comphelper::string::getTokenCount(rStyles, TOX_STYLE_DELIMITER);
     uno::Sequence<OUString> aStyles(nStyles);
     OUString* pStyles = aStyles.getArray();
     OUString aString;
-    for(sal_uInt16 i = 0; i < nStyles; i++)
+    for(sal_Int32 i = 0; i < nStyles; ++i)
     {
         SwStyleNameMapper::FillProgName(
             rStyles.getToken(i, TOX_STYLE_DELIMITER),
@@ -3007,7 +3003,7 @@ throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException,
         GetPattern(static_cast<sal_uInt16>(nIndex));
     SwFormTokens::iterator aIt = aPattern.begin();
 
-    sal_uInt16 nTokenCount = 0;
+    sal_Int32 nTokenCount = 0;
     uno::Sequence< beans::PropertyValues > aRetSeq;
     OUString aString;
     while(aIt != aPattern.end()) // #i21237#
commit 6f29205b9d5187f2a5c9c17a2750a5bf6b21332e
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun May 25 20:10:55 2014 +0200

    OUString: constify, avoid temporaries and concatenated appends
    
    Change-Id: Ib1f6415dee8c3ffabf345f3e265d6beda652e159

diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx
index c48de72..af47cb7 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -448,8 +448,7 @@ static bool GetSubranges( const OUString &rRangeRepresentation,
         uno::Sequence< OUString > &rSubRanges, bool bNormalize )
 {
     bool bRes = true;
-    OUString aRangesStr( rRangeRepresentation );
-    sal_Int32 nLen = comphelper::string::getTokenCount(aRangesStr, ';');
+    sal_Int32 nLen = comphelper::string::getTokenCount(rRangeRepresentation, ';');
     uno::Sequence< OUString > aRanges( nLen );
 
     sal_Int32 nCnt = 0;
@@ -457,9 +456,10 @@ static bool GetSubranges( const OUString &rRangeRepresentation,
     {
         OUString *pRanges = aRanges.getArray();
         OUString aFirstTable;
+        sal_Int32 nPos = 0;
         for( sal_Int32 i = 0; i < nLen && bRes; ++i )
         {
-            OUString aRange( aRangesStr.getToken( i, ';' ) );
+            const OUString aRange( rRangeRepresentation.getToken( 0, ';', nPos ) );
             if (!aRange.isEmpty())
             {
                 pRanges[nCnt] = aRange;
@@ -532,7 +532,7 @@ static void SortSubranges( uno::Sequence< OUString > &rSubRanges, bool bCmpByCol
         }
 
         // move smallest element to the start of the not sorted area
-        OUString aTmp( pSubRanges[ nIdxOfSmallest ] );
+        const OUString aTmp( pSubRanges[ nIdxOfSmallest ] );
         pSubRanges[ nIdxOfSmallest ] = pSubRanges[ i ];
         pSubRanges[ i ] = aTmp;
     }
@@ -875,24 +875,22 @@ uno::Reference< chart2::data::XDataSource > SwChartDataProvider::Impl_createData
                     aDataDesc.nBottom   = oi;
                     aDataDesc.nRight    = aDataDesc.nLeft + aDataLen[oi] - 1;
                 }
-                OUString aBaseName =  pTblFmt->GetName() + ".";
+                const OUString aBaseName =  pTblFmt->GetName() + ".";
 
                 OUString aLabelRange;
                 if (aLabelIdx[oi] != -1)
                 {
-                    aLabelRange += aBaseName;
-                    aLabelRange += sw_GetCellName( aLabelDesc.nLeft, aLabelDesc.nTop );
-                    aLabelRange += ":";
-                    aLabelRange += sw_GetCellName( aLabelDesc.nRight, aLabelDesc.nBottom );
+                    aLabelRange = aBaseName
+                        + sw_GetCellName( aLabelDesc.nLeft, aLabelDesc.nTop )
+                        + ":" + sw_GetCellName( aLabelDesc.nRight, aLabelDesc.nBottom );
                 }
 
                 OUString aDataRange;
                 if (aDataStartIdx[oi] != -1)
                 {
-                    aDataRange += aBaseName;
-                    aDataRange += sw_GetCellName( aDataDesc.nLeft, aDataDesc.nTop );
-                    aDataRange += ":";
-                    aDataRange += sw_GetCellName( aDataDesc.nRight, aDataDesc.nBottom );
+                    aDataRange = aBaseName
+                        + sw_GetCellName( aDataDesc.nLeft, aDataDesc.nTop )
+                        + ":" + sw_GetCellName( aDataDesc.nRight, aDataDesc.nBottom );
                 }
 
                 // get cursors spanning the cell ranges for label and data
@@ -1005,8 +1003,6 @@ uno::Reference< chart2::data::XDataSource > SAL_CALL SwChartDataProvider::create
 OUString SwChartDataProvider::GetBrokenCellRangeForExport(
     const OUString &rCellRangeRepresentation )
 {
-    OUString aRes;
-
     // check that we do not have multiple ranges
     if (-1 == rCellRangeRepresentation.indexOf( ';' ))
     {
@@ -1024,11 +1020,11 @@ OUString SwChartDataProvider::GetBrokenCellRangeForExport(
         aStartCell = sw_GetCellName( nStartCol, nStartRow );
         aEndCell   = sw_GetCellName( nEndCol, nEndRow );
 
-        aRes = GetRangeRepFromTableAndCells( aTblName,
+        return GetRangeRepFromTableAndCells( aTblName,
                 aStartCell, aEndCell, false );
     }
 
-    return aRes;
+    return OUString();
 }
 
 uno::Sequence< beans::PropertyValue > SAL_CALL SwChartDataProvider::detectArguments(
@@ -1129,7 +1125,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwChartDataProvider::detectArgume
         // first and last cell used in both sequences
 
         sal_Int32 nFirstCol = -1, nFirstRow = -1, nLastCol = -1, nLastRow = -1;
-        OUString aCell( !aLabelStartCell.isEmpty() ? aLabelStartCell : aValuesStartCell );
+        const OUString aCell( !aLabelStartCell.isEmpty() ? aLabelStartCell : aValuesStartCell );
         OSL_ENSURE( !aCell.isEmpty() , "start cell missing?" );
         sw_GetCellPosition( aCell, nFirstCol, nFirstRow);
         sw_GetCellPosition( aValuesEndCell, nLastCol, nLastRow);
@@ -1255,7 +1251,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwChartDataProvider::detectArgume
 
     // build value for 'CellRangeRepresentation'
 
-    OUString aCellRangeBase = aTableName + ".";
+    const OUString aCellRangeBase = aTableName + ".";
     OUString aCurRange;
     for (sal_Int32 i = 0;  i < nTableRows;  ++i)
     {
@@ -1280,10 +1276,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwChartDataProvider::detectArgume
                 }
                 OUString aStartCell( sw_GetCellName( k, i ) );
                 OUString aEndCell( sw_GetCellName( k + nColSubLen - 1, i + nRowSubLen - 1) );
-                aCurRange = aCellRangeBase;
-                aCurRange += aStartCell;
-                aCurRange += ":";
-                aCurRange += aEndCell;
+                aCurRange = aCellRangeBase + aStartCell + ":" + aEndCell;
                 if (!aCellRanges.isEmpty())
                     aCellRanges += ";";
                 aCellRanges += aCurRange;
@@ -1344,7 +1337,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwChartDataProvider::detectArgume
         bFirstCellIsLabel = true;
 
     OSL_ENSURE( !aSortedCellRanges.isEmpty(), "CellRangeRepresentation missing" );
-    OUString aBrokenCellRangeForExport( GetBrokenCellRangeForExport( aSortedCellRanges ) );
+    const OUString aBrokenCellRangeForExport( GetBrokenCellRangeForExport( aSortedCellRanges ) );
 
     aResult.realloc(5);
     sal_Int32 nProps = 0;
@@ -1747,15 +1740,15 @@ OUString SAL_CALL SwChartDataProvider::convertRangeToXML( const OUString& rRange
         throw lang::DisposedException();
 
     OUString aRes;
-    OUString aRangeRepresentation( rRangeRepresentation );
 
     // multiple ranges are delimited by a ';' like in
     // "Table1.A1:A4;Table1.C2:C5" the same table must be used in all ranges!
-    sal_Int32 nNumRanges = comphelper::string::getTokenCount(aRangeRepresentation, ';');
+    sal_Int32 nNumRanges = comphelper::string::getTokenCount(rRangeRepresentation, ';');
     SwTable* pFirstFoundTable = 0;  // to check that only one table will be used
+    sal_Int32 nPos = 0;
     for (sal_Int32 i = 0;  i < nNumRanges;  ++i)
     {
-        OUString aRange( aRangeRepresentation.getToken(i, ';') );
+        const OUString aRange( rRangeRepresentation.getToken(0, ';', nPos) );
         SwFrmFmt    *pTblFmt  = 0;      // pointer to table format
         GetFormatAndCreateCursorFromRangeRep( pDoc, aRange, &pTblFmt, NULL );
         if (!pTblFmt)
@@ -1815,15 +1808,15 @@ OUString SAL_CALL SwChartDataProvider::convertRangeFromXML( const OUString& rXML
         throw lang::DisposedException();
 
     OUString aRes;
-    OUString aXMLRange( rXMLRange );
 
     // multiple ranges are delimited by a ' ' like in
     // "Table1.$A$1:.$A$4 Table1.$C$2:.$C$5" the same table must be used in all ranges!
-    sal_Int32 nNumRanges = comphelper::string::getTokenCount(aXMLRange, ' ');
+    sal_Int32 nNumRanges = comphelper::string::getTokenCount(rXMLRange, ' ');
     OUString aFirstFoundTable; // to check that only one table will be used
+    sal_Int32 nPos = 0;
     for (sal_Int32 i = 0;  i < nNumRanges;  ++i)
     {
-        OUString aRange( aXMLRange.getToken(i, ' ') );
+        OUString aRange( rXMLRange.getToken(0, ' ', nPos) );
 
         //!! following objects and function are implemented in XMLRangeHelper.?xx
         //!! which is a copy of the respective file from chart2 !!
@@ -2060,11 +2053,9 @@ OUString SAL_CALL SwChartDataSequence::getSourceRangeRepresentation(  )
     SwFrmFmt* pTblFmt = GetFrmFmt();
     if (pTblFmt)
     {
-        aRes = pTblFmt->GetName();
-        OUString aCellRange( GetCellRangeName( *pTblFmt, *pTblCrsr ) );
+        const OUString aCellRange( GetCellRangeName( *pTblFmt, *pTblCrsr ) );
         OSL_ENSURE( !aCellRange.isEmpty(), "failed to get cell range" );
-        aRes += ".";
-        aRes += aCellRange;
+        aRes = pTblFmt->GetName() + "." + aCellRange;
     }
     return aRes;
 }
@@ -2088,7 +2079,7 @@ uno::Sequence< OUString > SAL_CALL SwChartDataSequence::generateLabel(
             throw uno::RuntimeException();
         else
         {
-            OUString aCellRange( GetCellRangeName( *pTblFmt, *pTblCrsr ) );
+            const OUString aCellRange( GetCellRangeName( *pTblFmt, *pTblCrsr ) );
             OSL_ENSURE( !aCellRange.isEmpty(), "failed to get cell range" );
             bOk = FillRangeDescriptor( aDesc, aCellRange );
             OSL_ENSURE( bOk, "falied to get SwRangeDescriptor" );
@@ -2560,7 +2551,7 @@ bool SwChartDataSequence::DeleteBox( const SwTableBox &rBox )
             nRow += bMoveUp ? -1 : +1;
         if (bMoveHorizontal)
             nCol += bMoveLeft ? -1 : +1;
-        OUString aNewCellName = sw_GetCellName( nCol, nRow );
+        const OUString aNewCellName = sw_GetCellName( nCol, nRow );
         SwTableBox* pNewBox = (SwTableBox*) pTable->GetTblBox( aNewCellName );
 
         if (pNewBox)    // set new position (cell range) to use
@@ -2658,11 +2649,9 @@ bool SwChartDataSequence::ExtendTo( bool bExtendCol,
     pStartBox = pTable->GetTblBox( pStartNd->GetIndex() );
     const OUString aStartBox( pStartBox->GetName() );
 
-    OUString aCellRange( aStartBox );     // note that cell range here takes the newly added rows/cols already into account
-    aCellRange += ":";
-    aCellRange += aEndBox;
     SwRangeDescriptor aDesc;
-    FillRangeDescriptor( aDesc, aCellRange );
+    // note that cell range here takes the newly added rows/cols already into account
+    FillRangeDescriptor( aDesc, aStartBox + ":" + aEndBox );
 
     bool bChanged = false;
     OUString aNewStartCell;
commit 04b3c70d60f8cdf395a0f295edddfbf15f2c5b2c
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun May 25 19:44:08 2014 +0200

    Use more proper integer types and constify
    
    Change-Id: I7e51c1bc713f43bcd89bb6e5a098b2ced670681f

diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx
index c96ba75b..c48de72 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -125,7 +125,7 @@ void SwChartLockController_Helper::LockUnlockAllCharts( bool bLock )
         return;
 
     const SwFrmFmts& rTblFmts = *pDoc->GetTblFrmFmts();
-    for( sal_uInt16 n = 0; n < rTblFmts.size(); ++n )
+    for( size_t n = 0; n < rTblFmts.size(); ++n )
     {
         SwTable* pTmpTbl;
         const SwTableNode* pTblNd;
@@ -352,7 +352,7 @@ static void GetTableByName( const SwDoc &rDoc, const OUString &rTableName,
 
     // find frame format of table
     //! see SwXTextTables::getByName
-    sal_uInt16 nCount = rDoc.GetTblFrmFmtCount(true);
+    const sal_uInt16 nCount = rDoc.GetTblFrmFmtCount(true);
     for (sal_uInt16 i = 0; i < nCount && !pTblFmt; ++i)
     {
         SwFrmFmt& rTblFmt = rDoc.GetTblFrmFmt(i, true);
@@ -1753,7 +1753,7 @@ OUString SAL_CALL SwChartDataProvider::convertRangeToXML( const OUString& rRange
     // "Table1.A1:A4;Table1.C2:C5" the same table must be used in all ranges!
     sal_Int32 nNumRanges = comphelper::string::getTokenCount(aRangeRepresentation, ';');
     SwTable* pFirstFoundTable = 0;  // to check that only one table will be used
-    for (sal_uInt16 i = 0;  i < nNumRanges;  ++i)
+    for (sal_Int32 i = 0;  i < nNumRanges;  ++i)
     {
         OUString aRange( aRangeRepresentation.getToken(i, ';') );
         SwFrmFmt    *pTblFmt  = 0;      // pointer to table format
@@ -1821,7 +1821,7 @@ OUString SAL_CALL SwChartDataProvider::convertRangeFromXML( const OUString& rXML
     // "Table1.$A$1:.$A$4 Table1.$C$2:.$C$5" the same table must be used in all ranges!
     sal_Int32 nNumRanges = comphelper::string::getTokenCount(aXMLRange, ' ');
     OUString aFirstFoundTable; // to check that only one table will be used
-    for (sal_uInt16 i = 0;  i < nNumRanges;  ++i)
+    for (sal_Int32 i = 0;  i < nNumRanges;  ++i)
     {
         OUString aRange( aXMLRange.getToken(i, ' ') );
 
diff --git a/sw/source/core/unocore/unoevent.cxx b/sw/source/core/unocore/unoevent.cxx
index edbd811..06bc097 100644
--- a/sw/source/core/unocore/unoevent.cxx
+++ b/sw/source/core/unocore/unoevent.cxx
@@ -120,9 +120,9 @@ OUString SwHyperlinkEventDescriptor::getImplementationName(void)
 void SwHyperlinkEventDescriptor::copyMacrosFromINetFmt(
     const SwFmtINetFmt& aFmt)
 {
-    for(sal_Int16 i = 0; mpSupportedMacroItems[i].mnEvent != 0; i++)
+    for(sal_uInt16 i = 0; mpSupportedMacroItems[i].mnEvent != 0; ++i)
     {
-        sal_uInt16 nEvent = mpSupportedMacroItems[i].mnEvent;
+        const sal_uInt16 nEvent = mpSupportedMacroItems[i].mnEvent;
         const SvxMacro* aMacro = aFmt.GetMacro(nEvent);
         if (NULL != aMacro)
             replaceByName(nEvent, *aMacro);
@@ -132,9 +132,9 @@ void SwHyperlinkEventDescriptor::copyMacrosFromINetFmt(
 void SwHyperlinkEventDescriptor::copyMacrosIntoINetFmt(
     SwFmtINetFmt& aFmt)
 {
-    for(sal_Int16 i = 0; mpSupportedMacroItems[i].mnEvent != 0; i++)
+    for(sal_uInt16 i = 0; mpSupportedMacroItems[i].mnEvent != 0; ++i)
     {
-        sal_uInt16 nEvent = mpSupportedMacroItems[i].mnEvent;
+        const sal_uInt16 nEvent = mpSupportedMacroItems[i].mnEvent;
         if (hasByName(nEvent))
         {
             SvxMacro aMacro(sEmpty, sEmpty);
diff --git a/sw/source/core/unocore/unoflatpara.cxx b/sw/source/core/unocore/unoflatpara.cxx
index cb2279e..4bffefa 100644
--- a/sw/source/core/unocore/unoflatpara.cxx
+++ b/sw/source/core/unocore/unoflatpara.cxx
@@ -276,7 +276,7 @@ void SAL_CALL SwXFlatParagraph::changeText(::sal_Int32 nPos, ::sal_Int32 nLen, c
     uno::Reference< beans::XPropertySet > xPropSet( xRange, uno::UNO_QUERY );
     if ( xPropSet.is() )
     {
-        for ( sal_uInt16 i = 0; i < aAttributes.getLength(); ++i )
+        for ( sal_Int32 i = 0; i < aAttributes.getLength(); ++i )
             xPropSet->setPropertyValue( aAttributes[i].Name, aAttributes[i].Value );
     }
 
@@ -306,7 +306,7 @@ void SAL_CALL SwXFlatParagraph::changeAttributes(::sal_Int32 nPos, ::sal_Int32 n
     uno::Reference< beans::XPropertySet > xPropSet( xRange, uno::UNO_QUERY );
     if ( xPropSet.is() )
     {
-        for ( sal_uInt16 i = 0; i < aAttributes.getLength(); ++i )
+        for ( sal_Int32 i = 0; i < aAttributes.getLength(); ++i )
             xPropSet->setPropertyValue( aAttributes[i].Name, aAttributes[i].Value );
     }
 
commit 44a18f6c9e111c3a1a29ae0ee262eb982516adae
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun May 25 19:36:30 2014 +0200

    OUstring: avoid temporaries and constify
    
    Change-Id: I553f6219a695cb6a41ccd9811d5ab8b5e7138ac5

diff --git a/sw/source/core/unocore/swunohelper.cxx b/sw/source/core/unocore/swunohelper.cxx
index 11eeeeb..d7157b5 100644
--- a/sw/source/core/unocore/swunohelper.cxx
+++ b/sw/source/core/unocore/swunohelper.cxx
@@ -62,7 +62,7 @@ bool UCB_DeleteFile( const OUString& rURL )
         ucbhelper::Content aTempContent( rURL,
                                 ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >(),
                                 comphelper::getProcessComponentContext() );
-        aTempContent.executeCommand(OUString("delete"),
+        aTempContent.executeCommand("delete",
                         ::com::sun::star::uno::makeAny( sal_True ) );
         bRemoved = true;
     }
@@ -80,9 +80,9 @@ bool UCB_CopyFile( const OUString& rURL, const OUString& rNewURL, bool bCopyIsMo
     try
     {
         INetURLObject aURL( rNewURL );
-        OUString sName( aURL.GetName() );
+        const OUString sName( aURL.GetName() );
         aURL.removeSegment();
-        OUString sMainURL( aURL.GetMainURL(INetURLObject::NO_DECODE) );
+        const OUString sMainURL( aURL.GetMainURL(INetURLObject::NO_DECODE) );
 
         ucbhelper::Content aTempContent( sMainURL,
                                 ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >(),
@@ -95,8 +95,7 @@ bool UCB_CopyFile( const OUString& rURL, const OUString& rNewURL, bool bCopyIsMo
         aInfo.SourceURL = rURL;
         aInfo.MoveData = bCopyIsMove;
         aAny <<= aInfo;
-        aTempContent.executeCommand( OUString("transfer"),
-                                     aAny );
+        aTempContent.executeCommand( "transfer", aAny );
     }
     catch( ::com::sun::star::uno::Exception& )
     {
@@ -140,8 +139,7 @@ bool UCB_IsReadOnlyFileName( const OUString& rURL )
     try
     {
         ucbhelper::Content aCnt( rURL, ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() );
-        ::com::sun::star::uno::Any aAny = aCnt.getPropertyValue(
-            OUString("IsReadOnly"));
+        ::com::sun::star::uno::Any aAny = aCnt.getPropertyValue("IsReadOnly");
         if(aAny.hasValue())
             bIsReadOnly = *(sal_Bool*)aAny.getValue();
     }
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index 775f0ef..5263826 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -1539,7 +1539,7 @@ uno::Any SwXShape::getPropertyValue(const OUString& rPropertyName)
                 {
                     // get property <::drawing::Shape::Transformation>
                     // without conversion to layout direction as below
-                    aRet = _getPropAtAggrObj( OUString("Transformation") );
+                    aRet = _getPropAtAggrObj( "Transformation" );
                 }
                 else if ( FN_SHAPE_POSITION_LAYOUT_DIR == pEntry->nWID )
                 {
@@ -1550,13 +1550,13 @@ uno::Any SwXShape::getPropertyValue(const OUString& rPropertyName)
                 {
                     // get property <::drawing::Shape::StartPosition>
                     // without conversion to layout direction as below
-                    aRet = _getPropAtAggrObj( OUString("StartPosition") );
+                    aRet = _getPropAtAggrObj( "StartPosition" );
                 }
                 else if ( FN_SHAPE_ENDPOSITION_IN_HORI_L2R == pEntry->nWID )
                 {
                     // get property <::drawing::Shape::EndPosition>
                     // without conversion to layout direction as below
-                    aRet = _getPropAtAggrObj( OUString("EndPosition") );
+                    aRet = _getPropAtAggrObj( "EndPosition" );
                 }
                 else if (pEntry->nWID == RES_FRM_SIZE &&
                          (pEntry->nMemberId == MID_FRMSIZE_REL_HEIGHT ||
@@ -1648,7 +1648,7 @@ uno::Any SwXShape::getPropertyValue(const OUString& rPropertyName)
                     {
                         // get property <::drawing::Shape::Transformation>
                         // without conversion to layout direction as below
-                        aRet = _getPropAtAggrObj( OUString("Transformation") );
+                        aRet = _getPropAtAggrObj( "Transformation" );
                     }
                     break;
                     case FN_SHAPE_POSITION_LAYOUT_DIR:
@@ -1661,14 +1661,14 @@ uno::Any SwXShape::getPropertyValue(const OUString& rPropertyName)
                     {
                         // get property <::drawing::Shape::StartPosition>
                         // without conversion to layout direction as below
-                        aRet = _getPropAtAggrObj( OUString("StartPosition") );
+                        aRet = _getPropAtAggrObj( "StartPosition" );
                     }
                     break;
                     case FN_SHAPE_ENDPOSITION_IN_HORI_L2R:
                     {
                         // get property <::drawing::Shape::StartPosition>
                         // without conversion to layout direction as below
-                        aRet = _getPropAtAggrObj( OUString("EndPosition") );
+                        aRet = _getPropAtAggrObj( "EndPosition" );
                     }
                     break;
                 }
@@ -2364,12 +2364,11 @@ void SAL_CALL SwXShape::setSize( const awt::Size& aSize )
 // implementation of virtual methods from drawing::XShapeDescriptor
 OUString SAL_CALL SwXShape::getShapeType() throw ( uno::RuntimeException, std::exception )
 {
-    OUString aType;
     if ( mxShape.is() )
     {
-        aType = mxShape->getShapeType();
+        return mxShape->getShapeType();
     }
-    return aType;
+    return OUString();
 }
 /** method to determine top group object
     #i31698#
@@ -2427,8 +2426,7 @@ awt::Point SwXShape::_GetAttrPosition()
     text::TextContentAnchorType eTextAnchorType =
                             text::TextContentAnchorType_AT_PARAGRAPH;
     {
-        OUString sAnchorType( "AnchorType" );
-        uno::Any aAny = getPropertyValue( sAnchorType );
+        uno::Any aAny = getPropertyValue( "AnchorType" );
         aAny >>= eTextAnchorType;
     }
     if ( eTextAnchorType == text::TextContentAnchorType_AS_CHARACTER )
@@ -2556,14 +2554,13 @@ void SwXShape::_AdjustPositionProperties( const awt::Point _aPosition )
     text::TextContentAnchorType eTextAnchorType =
                             text::TextContentAnchorType_AT_PARAGRAPH;
     {
-        OUString sAnchorType( "AnchorType" );
-        uno::Any aAny = getPropertyValue( sAnchorType );
+        uno::Any aAny = getPropertyValue( "AnchorType" );
         aAny >>= eTextAnchorType;
     }
     if ( eTextAnchorType != text::TextContentAnchorType_AS_CHARACTER )
     {
         // determine current x-position
-        OUString aHoriPosPropStr("HoriOrientPosition");
+        const OUString aHoriPosPropStr("HoriOrientPosition");
         uno::Any aHoriPos( getPropertyValue( aHoriPosPropStr ) );
         sal_Int32 dCurrX = 0;
         aHoriPos >>= dCurrX;
@@ -2572,7 +2569,7 @@ void SwXShape::_AdjustPositionProperties( const awt::Point _aPosition )
         {
             // adjust x-position orientation to text::HoriOrientation::NONE, if needed
             // Note: has to be done before setting x-position attribute
-            OUString aHoriOrientPropStr("HoriOrient");
+            const OUString aHoriOrientPropStr("HoriOrient");
             uno::Any aHoriOrient( getPropertyValue( aHoriOrientPropStr ) );
             sal_Int16 eHoriOrient;
             if (aHoriOrient >>= eHoriOrient) // may be void
@@ -2593,7 +2590,7 @@ void SwXShape::_AdjustPositionProperties( const awt::Point _aPosition )
     // handle y-position
     {
         // determine current y-position
-        OUString aVertPosPropStr("VertOrientPosition");
+        const OUString aVertPosPropStr("VertOrientPosition");
         uno::Any aVertPos( getPropertyValue( aVertPosPropStr ) );
         sal_Int32 dCurrY = 0;
         aVertPos >>= dCurrY;
@@ -2602,7 +2599,7 @@ void SwXShape::_AdjustPositionProperties( const awt::Point _aPosition )
         {
             // adjust y-position orientation to text::VertOrientation::NONE, if needed
             // Note: has to be done before setting y-position attribute
-            OUString aVertOrientPropStr("VertOrient");
+            const OUString aVertOrientPropStr("VertOrient");
             uno::Any aVertOrient( getPropertyValue( aVertOrientPropStr ) );
             sal_Int16 eVertOrient;
             if (aVertOrient >>= eVertOrient) // may be void
commit e1cee80e4cb18e506d4a5fe3d2f4d6403e8f2223
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun May 25 19:23:05 2014 +0200

    sal_uInt16 to more proper types
    
    Change-Id: I5b3ac7b5bd0b5efe437f04ee308bdd94f55672c9

diff --git a/sw/source/core/unocore/swunohelper.cxx b/sw/source/core/unocore/swunohelper.cxx
index c203d73..11eeeeb 100644
--- a/sw/source/core/unocore/swunohelper.cxx
+++ b/sw/source/core/unocore/swunohelper.cxx
@@ -196,7 +196,7 @@ bool UCB_GetFileListOfFolder( const OUString& rURL,
         ucbhelper::Content aCnt( rURL, ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() );
         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > xResultSet;
 
-        sal_uInt16 nSeqSize = pDateTimeList ? 2 : 1;
+        const sal_Int32 nSeqSize = pDateTimeList ? 2 : 1;
         ::com::sun::star::uno::Sequence < OUString > aProps( nSeqSize );
         OUString* pProps = aProps.getArray();
         pProps[ 0 ] = "Title";
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index abb97a1..775f0ef 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -758,7 +758,7 @@ uno::Reference< drawing::XShapeGroup >  SwXDrawPage::group(const uno::Reference<
             if ( rMarkList.GetMarkCount() > 1 )
             {
                 bool bFlyInCnt = false;
-                for ( sal_uInt16 i = 0; !bFlyInCnt && i < rMarkList.GetMarkCount(); ++i )
+                for ( sal_uLong i = 0; !bFlyInCnt && i < rMarkList.GetMarkCount(); ++i )
                 {
                     const SdrObject *pObj = rMarkList.GetMark( i )->GetMarkedSdrObj();
                     if (FLY_AS_CHAR == ::FindFrmFmt(const_cast<SdrObject*>(
commit 56e3df3946821f0e61356e25322fea61461a5d95
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun May 25 19:14:25 2014 +0200

    Avoid temporary OUStrings
    
    Change-Id: I3f4ad2d94b8438705719c235fd318440406aed8c

diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index 1bfa268..dacbf6a 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -172,7 +172,7 @@ void SwUnoCursorHelper::GetTextFromPam(SwPaM & rPam, OUString & rBuffer)
 #endif
     WriterRef xWrt;
     // TODO/MBA: looks like a BaseURL doesn't make sense here
-    SwReaderWriter::GetWriter( OUString(FILTER_TEXT_DLG), OUString(), xWrt );
+    SwReaderWriter::GetWriter( FILTER_TEXT_DLG, OUString(), xWrt );
     if( xWrt.Is() )
     {
         SwWriter aWriter( aStream, rPam );
@@ -701,8 +701,7 @@ public:
     SwUnoCrsr & GetCursorOrThrow() {
         SwUnoCrsr *const pUnoCursor( GetCursor() );
         if (!pUnoCursor) {
-            throw uno::RuntimeException(OUString(
-                        "SwXTextCursor: disposed or invalid"), 0);
+            throw uno::RuntimeException("SwXTextCursor: disposed or invalid", 0);
         }
         return *pUnoCursor;
     }
@@ -1216,8 +1215,8 @@ throw (uno::RuntimeException, std::exception)
         if (!bNotForced)
         {
             throw uno::RuntimeException(
-                OUString("gotoRange: parameter range not contained in nesting"
-                    " text content for which this cursor was created"),
+                "gotoRange: parameter range not contained in nesting"
+                    " text content for which this cursor was created",
                 static_cast<text::XWordCursor*>(this));
         }
     }
@@ -1800,8 +1799,8 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
     if (!pEntry)
     {
         throw beans::UnknownPropertyException(
-            OUString("Unknown property: ")
-                + rPropertyName, static_cast<cppu::OWeakObject *>(0));
+            "Unknown property: " + rPropertyName,
+            static_cast<cppu::OWeakObject *>(0));
     }
 
     beans::PropertyState eTemp;
@@ -1967,8 +1966,7 @@ throw (beans::UnknownPropertyException, uno::RuntimeException)
             else
             {
                 throw beans::UnknownPropertyException(
-                    OUString("Unknown property: ")
-                        + pNames[i],
+                    "Unknown property: " + pNames[i],
                     static_cast<cppu::OWeakObject *>(0));
             }
         }
@@ -2091,14 +2089,14 @@ throw (beans::UnknownPropertyException, uno::RuntimeException)
     if (!pEntry)
     {
         throw beans::UnknownPropertyException(
-            OUString("Unknown property: ")
-                + rPropertyName, static_cast<cppu::OWeakObject *>(0));
+            "Unknown property: " + rPropertyName,
+            static_cast<cppu::OWeakObject *>(0));
     }
 
     if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
     {
-        throw uno::RuntimeException(OUString(
-                "setPropertyToDefault: property is read-only: ")
+        throw uno::RuntimeException(
+                "setPropertyToDefault: property is read-only: "
                 + rPropertyName, 0);
     }
 
@@ -2132,8 +2130,7 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
     if (!pEntry)
     {
         throw beans::UnknownPropertyException(
-            OUString("Unknown property: ")
-                + rPropertyName, static_cast<cppu::OWeakObject *>(0));
+            "Unknown property: " + rPropertyName, static_cast<cppu::OWeakObject *>(0));
     }
 
     uno::Any aRet;
@@ -2472,16 +2469,13 @@ throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
                     continue;
                 }
                 throw beans::UnknownPropertyException(
-                    OUString("Unknown property: ")
-                        + pNames[i],
+                    "Unknown property: " + pNames[i],
                     static_cast<cppu::OWeakObject *>(this));
             }
             if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
             {
                 throw uno::RuntimeException(
-                    OUString(
-                            "setPropertiesToDefault: property is read-only: ")
-                        + pNames[i],
+                    "setPropertiesToDefault: property is read-only: " + pNames[i],
                     static_cast<cppu::OWeakObject *>(this));
             }
 
@@ -2542,8 +2536,7 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
                     continue;
                 }
                 throw beans::UnknownPropertyException(
-                    OUString("Unknown property: ")
-                        + pNames[i],
+                    "Unknown property: " + pNames[i],
                     static_cast<cppu::OWeakObject *>(0));
             }
             if (pEntry->nWID < RES_FRMATR_END)
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index f82a168..1328b22 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -1680,9 +1680,8 @@ void SwUnoCursorHelper::SetString(SwCursor & rCursor, const OUString& rString)
     }
     if (!rString.isEmpty())
     {
-        OUString aText(rString);
         const bool bSuccess( SwUnoCursorHelper::DocInsertStringSplitCR(
-                    *pDoc, rCursor, aText, false ) );
+                    *pDoc, rCursor, rString, false ) );
         OSL_ENSURE( bSuccess, "DocInsertStringSplitCR" );
         (void) bSuccess;
         SwUnoCursorHelper::SelectPam(rCursor, true);
commit 62ce3cfe8dfd739d888a9870025b643def28bcec
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun May 25 18:40:27 2014 +0200

    sal_uInt16 to more proper types + some const
    
    Change-Id: I8b24a8fc3e636684b280b1aef1b8f522bfb7296e

diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index c572ffd..1bfa268 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -618,7 +618,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException, uno::DeploymentExc
 SwFmtColl *
 SwUnoCursorHelper::GetCurTxtFmtColl(SwPaM & rPaM, const bool bConditional)
 {
-    static const sal_uInt16 nMaxLookup = 1000;
+    static const sal_uLong nMaxLookup = 1000;
     SwFmtColl *pFmt = 0;
 
 //  if ( GetCrsrCnt() > nMaxLookup )
@@ -2412,8 +2412,8 @@ lcl_EnumerateIds(sal_uInt16 const* pIdRange, std::set<sal_uInt16> &rWhichIds)
 {
     while (*pIdRange)
     {
-        const sal_uInt16 nStart = sal::static_int_cast<sal_uInt16>(*pIdRange++);
-        const sal_uInt16 nEnd   = sal::static_int_cast<sal_uInt16>(*pIdRange++);
+        const sal_uInt16 nStart = *pIdRange++;
+        const sal_uInt16 nEnd   = *pIdRange++;
         for (sal_uInt16 nId = nStart + 1;  nId <= nEnd;  ++nId)
         {
             rWhichIds.insert( rWhichIds.end(), nId );
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index 4660ce1..f82a168 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -172,7 +172,7 @@ void CollectFrameAtNode( SwClient& rClnt, const SwNodeIndex& rIdx,
     // search all borders, images, and OLEs that are connected to the paragraph
     SwDoc* pDoc = rIdx.GetNode().GetDoc();
 
-    sal_uInt16 nChkType = static_cast< sal_uInt16 >((_bAtCharAnchoredObjs)
+    const sal_uInt16 nChkType = static_cast< sal_uInt16 >((_bAtCharAnchoredObjs)
             ? FLY_AT_CHAR : FLY_AT_PARA);
     const SwCntntFrm* pCFrm;
     const SwCntntNode* pCNd;
@@ -184,7 +184,7 @@ void CollectFrameAtNode( SwClient& rClnt, const SwNodeIndex& rIdx,
         if( pObjs )
         {
             std::list<SwFrmFmt*> aTextBoxes = SwTextBoxHelper::findTextBoxes(pDoc);
-            for( sal_uInt16 i = 0; i < pObjs->Count(); ++i )
+            for( sal_uInt32 i = 0; i < pObjs->Count(); ++i )
             {
                 SwAnchoredObject* pAnchoredObj = (*pObjs)[i];
                 SwFrmFmt& rFmt = pAnchoredObj->GetFrmFmt();
@@ -212,8 +212,8 @@ void CollectFrameAtNode( SwClient& rClnt, const SwNodeIndex& rIdx,
     else
     {
         const SwFrmFmts& rFmts = *pDoc->GetSpzFrmFmts();
-        sal_uInt16 nSize = rFmts.size();
-        for ( sal_uInt16 i = 0; i < nSize; i++)
+        const size_t nSize = rFmts.size();
+        for ( size_t i = 0; i < nSize; i++)
         {
             const SwFrmFmt* pFmt = rFmts[ i ];
             const SwFmtAnchor& rAnchor = pFmt->GetAnchor();
@@ -346,7 +346,7 @@ void SwUnoCursorHelper::SetCrsrAttr(SwPaM & rPam,
 void SwUnoCursorHelper::GetCrsrAttr(SwPaM & rPam,
         SfxItemSet & rSet, const bool bOnlyTxtAttr, const bool bGetFromChrFmt)
 {
-    static const sal_uInt16 nMaxLookup = 1000;
+    static const sal_uLong nMaxLookup = 1000;
     SfxItemSet aSet( *rSet.GetPool(), rSet.GetRanges() );
     SfxItemSet *pSet = &rSet;
     SwPaM *pCurrent = & rPam;
@@ -1224,9 +1224,9 @@ CreateParentXText(SwDoc & rDoc, const SwPosition& rPos)
         break;
         case SwFootnoteStartNode:
         {
-            const sal_uInt16 nFtnCnt = rDoc.GetFtnIdxs().size();
+            const size_t nFtnCnt = rDoc.GetFtnIdxs().size();
             uno::Reference< text::XFootnote >  xRef;
-            for (sal_uInt16 n = 0; n < nFtnCnt; ++n )
+            for (size_t n = 0; n < nFtnCnt; ++n )
             {
                 const SwTxtFtn* pTxtFtn = rDoc.GetFtnIdxs()[ n ];
                 const SwFmtFtn& rFtn = pTxtFtn->GetFtn();
commit dee853844d0be44d7f26925aad7b71c7dd55dcb5
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun May 25 11:23:18 2014 +0200

    OUString: avoid unnecessary conversions and buffers
    
    Change-Id: I5537b089b15987564004cf46dfe53e34576ebca5

diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx
index da5eed0..aa13240 100644
--- a/sw/source/core/unocore/unoparagraph.cxx
+++ b/sw/source/core/unocore/unoparagraph.cxx
@@ -131,8 +131,7 @@ public:
     SwTxtNode & GetTxtNodeOrThrow() {
         SwTxtNode *const pTxtNode( GetTxtNode() );
         if (!pTxtNode) {
-            throw uno::RuntimeException(OUString(
-                    "SwXParagraph: disposed or invalid"), 0);
+            throw uno::RuntimeException("SwXParagraph: disposed or invalid", 0);
         }
         return *pTxtNode;
     }
@@ -387,15 +386,13 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
         if (!pEntry)
         {
             throw beans::UnknownPropertyException(
-                OUString("Unknown property: ")
-                    + pPropertyNames[nProp],
+                "Unknown property: " + pPropertyNames[nProp],
                 static_cast< cppu::OWeakObject * >(&m_rThis));
         }
         if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
         {
             throw beans::PropertyVetoException(
-                OUString("Property is read-only: ")
-                    + pPropertyNames[nProp],
+                "Property is read-only: " + pPropertyNames[nProp],
                 static_cast< cppu::OWeakObject * >(&m_rThis));
         }
         aValues[nProp].Name = pPropertyNames[nProp];
@@ -448,8 +445,7 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
         if (!pEntry)
         {
             throw beans::UnknownPropertyException(
-                OUString("Unknown property: ")
-                    + pPropertyNames[nProp],
+                "Unknown property: " + pPropertyNames[nProp],
                 static_cast< cppu::OWeakObject * >(&m_rThis));
         }
         if (! ::sw::GetDefaultTextContentValue(
@@ -482,14 +478,12 @@ throw (uno::RuntimeException, std::exception)
     }
     catch (beans::UnknownPropertyException &)
     {
-        throw uno::RuntimeException(OUString(
-                "Unknown property exception caught"),
+        throw uno::RuntimeException("Unknown property exception caught",
             static_cast<cppu::OWeakObject *>(this));
     }
     catch (lang::WrappedTargetException &)
     {
-        throw uno::RuntimeException(OUString(
-                "WrappedTargetException caught"),
+        throw uno::RuntimeException("WrappedTargetException caught",
             static_cast<cppu::OWeakObject *>(this));
     }
 
@@ -910,8 +904,7 @@ throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
     if (!pEntry)
     {
         throw beans::UnknownPropertyException(
-            OUString("Unknown property: ")
-                + rPropertyName,
+            "Unknown property: " + rPropertyName,
             static_cast<cppu::OWeakObject *>(this));
     }
     bool bDummy = false;
@@ -944,8 +937,7 @@ throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
         if (!pEntry)
         {
             throw beans::UnknownPropertyException(
-                OUString("Unknown property: ")
-                    + *pNames,
+                "Unknown property: " + *pNames,
                 static_cast<cppu::OWeakObject *>(this));
         }
 
@@ -987,16 +979,14 @@ throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
     if (!pEntry)
     {
         throw beans::UnknownPropertyException(
-            OUString("Unknown property: ")
-                + rPropertyName,
+            "Unknown property: " + rPropertyName,
             static_cast<cppu::OWeakObject *>(this));
     }
 
     if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
     {
         throw uno::RuntimeException(
-            OUString("Property is read-only: ")
-                + rPropertyName,
+            "Property is read-only: " + rPropertyName,
             static_cast<cppu::OWeakObject *>(this));
     }
 
@@ -1057,8 +1047,7 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
     if (!pEntry)
     {
         throw beans::UnknownPropertyException(
-            OUString("Unknown property: ")
-                + rPropertyName,
+            "Unknown property: " + rPropertyName,
             static_cast<cppu::OWeakObject *>(this));
     }
 
diff --git a/sw/source/core/unocore/unoredline.cxx b/sw/source/core/unocore/unoredline.cxx
index d66263a..b1ea530 100644
--- a/sw/source/core/unocore/unoredline.cxx
+++ b/sw/source/core/unocore/unoredline.cxx
@@ -20,7 +20,6 @@
 #include <com/sun/star/util/DateTime.hpp>
 #include <com/sun/star/text/XTextTable.hpp>
 
-#include <rtl/ustrbuf.hxx>
 #include <osl/mutex.hxx>
 #include <vcl/svapp.hxx>
 #include <comphelper/servicehelper.hxx>
@@ -132,9 +131,9 @@ uno::Reference<text::XTextCursor> SwXRedlineText::createTextCursor(void)
         // no content node outside of a table could be found, and therefore we
         // except.
         uno::RuntimeException aExcept;
-        aExcept.Message = OUString(
+        aExcept.Message =
             "No content node found that is inside this change section "
-            "but outside of a table" );
+            "but outside of a table";
         throw aExcept;
     }
 
@@ -226,11 +225,11 @@ static uno::Sequence<beans::PropertyValue> lcl_GetSuccessorProperties(const SwRa
         pValues[0].Name = UNO_NAME_REDLINE_AUTHOR;
         // GetAuthorString(n) walks the SwRedlineData* chain;
         // here we always need element 1
-        pValues[0].Value <<= OUString(rRedline.GetAuthorString(1));
+        pValues[0].Value <<= rRedline.GetAuthorString(1);
         pValues[1].Name = UNO_NAME_REDLINE_DATE_TIME;
         pValues[1].Value <<= lcl_DateTimeToUno(pNext->GetTimeStamp());
         pValues[2].Name = UNO_NAME_REDLINE_COMMENT;
-        pValues[2].Value <<= OUString(pNext->GetComment());
+        pValues[2].Value <<= pNext->GetComment();
         pValues[3].Name = UNO_NAME_REDLINE_TYPE;
         pValues[3].Value <<= lcl_RedlineTypeToOUString(pNext->GetType());
     }
@@ -293,13 +292,13 @@ uno::Any  SwXRedlinePortion::GetPropertyValue( const OUString& rPropertyName, co
 {
     uno::Any aRet;
     if(rPropertyName == UNO_NAME_REDLINE_AUTHOR)
-        aRet <<= OUString(rRedline.GetAuthorString());
+        aRet <<= rRedline.GetAuthorString();
     else if(rPropertyName == UNO_NAME_REDLINE_DATE_TIME)
     {
         aRet <<= lcl_DateTimeToUno(rRedline.GetTimeStamp());
     }
     else if(rPropertyName == UNO_NAME_REDLINE_COMMENT)
-        aRet <<= OUString(rRedline.GetComment());
+        aRet <<= rRedline.GetComment();
     else if(rPropertyName == UNO_NAME_REDLINE_TYPE)
     {
         aRet <<= lcl_RedlineTypeToOUString(rRedline.GetType());
@@ -311,9 +310,8 @@ uno::Any  SwXRedlinePortion::GetPropertyValue( const OUString& rPropertyName, co
     }
     else if (rPropertyName == UNO_NAME_REDLINE_IDENTIFIER)
     {
-        OUStringBuffer sBuf;
-        sBuf.append( sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(&rRedline) ) );
-        aRet <<= sBuf.makeStringAndClear();
+        aRet <<= OUString::number(
+            sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(&rRedline) ) );
     }
     else if (rPropertyName == UNO_NAME_IS_IN_HEADER_FOOTER)
     {
@@ -336,20 +334,18 @@ uno::Sequence< beans::PropertyValue > SwXRedlinePortion::CreateRedlineProperties
     const SwRedlineData* pNext = rRedline.GetRedlineData().Next();
     beans::PropertyValue* pRet = aRet.getArray();
 
-    OUStringBuffer sRedlineIdBuf;
-    sRedlineIdBuf.append( sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(&rRedline) ) );
-
     sal_Int32 nPropIdx  = 0;
     pRet[nPropIdx].Name = UNO_NAME_REDLINE_AUTHOR;
-    pRet[nPropIdx++].Value <<= OUString(rRedline.GetAuthorString());
+    pRet[nPropIdx++].Value <<= rRedline.GetAuthorString();
     pRet[nPropIdx].Name = UNO_NAME_REDLINE_DATE_TIME;
     pRet[nPropIdx++].Value <<= lcl_DateTimeToUno(rRedline.GetTimeStamp());
     pRet[nPropIdx].Name = UNO_NAME_REDLINE_COMMENT;
-    pRet[nPropIdx++].Value <<= OUString(rRedline.GetComment());
+    pRet[nPropIdx++].Value <<= rRedline.GetComment();
     pRet[nPropIdx].Name = UNO_NAME_REDLINE_TYPE;
     pRet[nPropIdx++].Value <<= lcl_RedlineTypeToOUString(rRedline.GetType());
     pRet[nPropIdx].Name = UNO_NAME_REDLINE_IDENTIFIER;
-    pRet[nPropIdx++].Value <<= sRedlineIdBuf.makeStringAndClear();
+    pRet[nPropIdx++].Value <<= OUString::number(
+        sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(&rRedline) ) );
     pRet[nPropIdx].Name = UNO_NAME_IS_COLLAPSED;
     sal_Bool bTmp = !rRedline.HasMark();
     pRet[nPropIdx++].Value.setValue(&bTmp, ::getBooleanCppuType()) ;
commit f0d05ed0358fa41b6d67caa51c07aaf9d1520841
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun May 25 10:33:07 2014 +0200

    sal_uInt16 to size_t
    
    Change-Id: I03d205d8c11be7e5b5aca3c711dd26e52f174fff

diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx
index 887b84f..2b0ae04 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -1032,14 +1032,14 @@ static void lcl_FillRedlineArray(
     SwXRedlinePortion_ImplList& rRedArr )
 {
     const SwRedlineTbl& rRedTbl = rDoc.GetRedlineTbl();
-    sal_uInt16 nRedTblCount = rRedTbl.size();
+    const size_t nRedTblCount = rRedTbl.size();
 
     if ( nRedTblCount > 0 )
     {
         const SwPosition* pStart = rUnoCrsr.GetPoint();
         const SwNodeIndex nOwnNode = pStart->nNode;
 
-        for(sal_uInt16 nRed = 0; nRed < nRedTblCount; nRed++)
+        for(size_t nRed = 0; nRed < nRedTblCount; ++nRed)
         {
             const SwRangeRedline* pRedline = rRedTbl[nRed];
             const SwPosition* pRedStart = pRedline->Start();
diff --git a/sw/source/core/unocore/unoredline.cxx b/sw/source/core/unocore/unoredline.cxx
index 314178d..d66263a 100644
--- a/sw/source/core/unocore/unoredline.cxx
+++ b/sw/source/core/unocore/unoredline.cxx
@@ -278,7 +278,7 @@ void SwXRedlinePortion::Validate() throw( uno::RuntimeException )
     SwDoc* pDoc = pUnoCrsr->GetDoc();
     const SwRedlineTbl& rRedTbl = pDoc->GetRedlineTbl();
     bool bFound = false;
-    for(sal_uInt16 nRed = 0; nRed < rRedTbl.size() && !bFound; nRed++)
+    for(size_t nRed = 0; nRed < rRedTbl.size() && !bFound; nRed++)
         bFound = &m_rRedline == rRedTbl[nRed];
     if(!bFound)
         throw uno::RuntimeException();
commit 88c397aaac462ccc2b800b614bfa427d71a8011a
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun May 25 10:24:44 2014 +0200

    Use literal ASCII strings directly
    
    Change-Id: I759c9dc5d698bc4444aa941907fbc1302e2d984c

diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx
index eace1ac..1c16911 100644
--- a/sw/source/core/unocore/unorefmk.cxx
+++ b/sw/source/core/unocore/unorefmk.cxx
@@ -260,8 +260,8 @@ void SwXReferenceMark::Impl::InsertRefMark(SwPaM& rPam,
 
     if (!pTxtAttr)
     {
-        throw uno::RuntimeException(OUString(
-            "SwXReferenceMark::InsertRefMark(): cannot insert attribute"), 0);
+        throw uno::RuntimeException(
+            "SwXReferenceMark::InsertRefMark(): cannot insert attribute", 0);
     }
 
     m_pMarkFmt = &pTxtAttr->GetRefMark();
@@ -980,16 +980,16 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
     if (!m_pImpl->m_bIsDescriptor)
     {

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list