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

Matteo Casalin matteo.casalin at yahoo.com
Sat May 10 07:45:12 PDT 2014


 sw/source/core/unocore/unotbl.cxx         |  291 ++++++++++++++----------------
 sw/source/core/unocore/unotext.cxx        |   17 -
 sw/source/core/view/pagepreviewlayout.cxx |   85 ++------
 sw/source/core/view/printdata.cxx         |   24 +-
 sw/source/core/view/viewimp.cxx           |    2 
 sw/source/core/view/viewsh.cxx            |   12 -
 sw/source/core/view/vprint.cxx            |   17 -
 sw/source/filter/ww8/ww8scan.cxx          |   82 ++++----
 8 files changed, 235 insertions(+), 295 deletions(-)

New commits:
commit b7b1572bcbda4ddca1057766ef0e59f52bc93eef
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun May 4 19:50:03 2014 +0200

    Function description says negative values mean errors
    
    Change-Id: Ief7639dc857c3123a1696d2221e6c64cd2276397

diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 6e91132..5560ecf 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -388,7 +388,7 @@ void sw_GetCellPosition(const OUString &rCellName,
             rRow    = rCellName.copy(nRowPos).toInt32() - 1; // - 1 because indices ought to be 0 based
         }
     }
-    OSL_ENSURE( rColumn != -1 && rRow != -1, "failed to get column or row index" );
+    OSL_ENSURE( rColumn >= 0 && rRow >= 0, "failed to get column or row index" );
 }
 
 /** compare position of two cells (check rows first)
commit 94e3f3e5015e53b5f3c8e5775b668e0bc12ab457
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun May 4 19:33:14 2014 +0200

    Simplify sw_GetCellPosition
    
    Change-Id: If672256b85c1e0a6534055844c3df936c0636c3f

diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index d07c8c1..6e91132 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -352,42 +352,40 @@ void sw_GetCellPosition(const OUString &rCellName,
                         sal_Int32 &rColumn, sal_Int32 &rRow)
 {
     rColumn = rRow = -1;    // default return values indicating failure
-    sal_Int32 nLen = rCellName.getLength();
+    const sal_Int32 nLen = rCellName.getLength();
     if (nLen)
     {
-        const sal_Unicode *pBuf = rCellName.getStr();
-        const sal_Unicode *pEnd = pBuf + nLen;
-        while (pBuf < pEnd && !('0' <= *pBuf && *pBuf <= '9'))
-            ++pBuf;
-        // start of number found?
-        if (pBuf < pEnd && ('0' <= *pBuf && *pBuf <= '9'))
+        sal_Int32 nRowPos = 0;
+        while (nRowPos<nLen)
         {
-            OUString aColTxt(rCellName.getStr(), pBuf - rCellName.getStr());
-            OUString aRowTxt(pBuf, (rCellName.getStr() + nLen - pBuf));
-            if (!aColTxt.isEmpty() && !aRowTxt.isEmpty())
+            if (rCellName[nRowPos]>='0' && rCellName[nRowPos]<='9')
             {
-                sal_Int32 nColIdx = 0;
-                sal_Int32 nLength = aColTxt.getLength();
-                for (sal_Int32 i = 0;  i < nLength;  ++i)
+                break;
+            }
+            ++nRowPos;
+        }
+        if (nRowPos>0 && nRowPos<nLen)
+        {
+            sal_Int32 nColIdx = 0;
+            for (sal_Int32 i = 0;  i < nRowPos;  ++i)
+            {
+                nColIdx *= 52;
+                if (i < nRowPos - 1)
+                    ++nColIdx;
+                const sal_Unicode cChar = rCellName[i];
+                if ('A' <= cChar && cChar <= 'Z')
+                    nColIdx += cChar - 'A';
+                else if ('a' <= cChar && cChar <= 'z')
+                    nColIdx += 26 + cChar - 'a';
+                else
                 {
-                    nColIdx = 52 * nColIdx;
-                    if (i < nLength - 1)
-                        ++nColIdx;
-                    sal_Unicode cChar = aColTxt[i];
-                    if ('A' <= cChar && cChar <= 'Z')
-                        nColIdx = nColIdx + (cChar - 'A');
-                    else if ('a' <= cChar && cChar <= 'z')
-                        nColIdx = nColIdx + (26 + cChar - 'a');
-                    else
-                    {
-                        nColIdx = -1;   // sth failed
-                        break;
-                    }
+                    nColIdx = -1;   // sth failed
+                    break;
                 }
-
-                rColumn = nColIdx;
-                rRow    = aRowTxt.toInt32() - 1;    // - 1 because indices ought to be 0 based
             }
+
+            rColumn = nColIdx;
+            rRow    = rCellName.copy(nRowPos).toInt32() - 1; // - 1 because indices ought to be 0 based
         }
     }
     OSL_ENSURE( rColumn != -1 && rRow != -1, "failed to get column or row index" );
commit 541dcc5b21add7d12a456931344b4c7c77e1cbc6
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun May 4 15:08:43 2014 +0200

    OUString: remove temporaries and concatenated appends, constify
    
    Change-Id: Iea37617435e69a51bb0d70740092f0489f58e41a

diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index b562ff1..d07c8c1 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -279,7 +279,7 @@ static uno::Any lcl_GetSpecialProperty(SwFrmFmt* pFmt, const SfxItemPropertySimp
                    sPDesc = SwStyleNameMapper::GetProgName(pDsc->GetName(), nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC );
                 }
             }
-            aRet <<= OUString(sPDesc);
+            aRet <<= sPDesc;
         }
         break;
 
@@ -494,12 +494,11 @@ OUString sw_GetCellName( sal_Int32 nColumn, sal_Int32 nRow )
     }
 #endif
 
-    OUString sCellName;
     if (nColumn < 0 || nRow < 0)
-        return sCellName;
+        return OUString();
+    OUString sCellName;
     sw_GetTblBoxColStr( static_cast< sal_uInt16 >(nColumn), sCellName );
-    sCellName += OUString::number( nRow + 1 );
-    return sCellName;
+    return sCellName + OUString::number( nRow + 1 );
 }
 
 /** Find the top left or bottom right corner box in given table.
@@ -575,7 +574,7 @@ void SwRangeDescriptor::Normalize()
 static SwXCell* lcl_CreateXCell(SwFrmFmt* pFmt, sal_Int32 nColumn, sal_Int32 nRow)
 {
     SwXCell* pXCell = 0;
-    OUString sCellName = sw_GetCellName(nColumn, nRow);
+    const OUString sCellName = sw_GetCellName(nColumn, nRow);
     SwTable* pTable = SwTable::FindTable( pFmt );
     SwTableBox* pBox = (SwTableBox*)pTable->GetTblBox( sCellName );
     if(pBox)
@@ -1098,7 +1097,7 @@ void SwXCell::setPropertyValue(const OUString& rPropertyName, const uno::Any& aV
             }
             else
             {
-                throw beans::UnknownPropertyException(OUString( "No redline type property: " ), static_cast < cppu::OWeakObject * > ( this ) );
+                throw beans::UnknownPropertyException("No redline type property: ", static_cast < cppu::OWeakObject * > ( this ) );
             }
         }
         else
@@ -1164,7 +1163,7 @@ uno::Any SwXCell::getPropertyValue(const OUString& rPropertyName)
             }
             break;
             case FN_UNO_CELL_NAME:
-                aRet <<= OUString ( pBox->GetName() );
+                aRet <<= pBox->GetName();
             break;
             case FN_UNO_REDLINE_NODE_START:
             case FN_UNO_REDLINE_NODE_END:
@@ -1389,7 +1388,7 @@ void SwXTextTableRow::setPropertyValue(const OUString& rPropertyName, const uno:
                 }
                 else
                 {
-                    throw beans::UnknownPropertyException(OUString( "No redline type property: " ), static_cast < cppu::OWeakObject * > ( this ) );
+                    throw beans::UnknownPropertyException("No redline type property: ", static_cast < cppu::OWeakObject * > ( this ) );
                 }
             }
             else
@@ -1398,7 +1397,7 @@ void SwXTextTableRow::setPropertyValue(const OUString& rPropertyName, const uno:
                     m_pPropSet->getPropertyMap().getByName(rPropertyName);
                 SwDoc* pDoc = pFmt->GetDoc();
                 if (!pEntry)
-                    throw beans::UnknownPropertyException(OUString( "Unknown property: " ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+                    throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
                 if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
                     throw beans::PropertyVetoException("Property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
 
@@ -1460,7 +1459,7 @@ uno::Any SwXTextTableRow::getPropertyValue(const OUString& rPropertyName) throw(
             const SfxItemPropertySimpleEntry* pEntry =
                                     m_pPropSet->getPropertyMap().getByName(rPropertyName);
             if (!pEntry)
-                throw beans::UnknownPropertyException(OUString( "Unknown property: " ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+                throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
 
             switch(pEntry->nWID)
             {
@@ -1620,7 +1619,7 @@ OUString SwXTextTableCursor::getRangeName()
         const SwStartNode* pNode = pTblCrsr->GetPoint()->nNode.GetNode().FindTableBoxStartNode();
         const SwTable* pTable = SwTable::FindTable( GetFrmFmt() );
         const SwTableBox* pEndBox = pTable->GetTblBox( pNode->GetIndex());
-        OUString aTmp( pEndBox->GetName() );
+        aRet = pEndBox->GetName();
 
         if(pTblCrsr->HasMark())
         {
@@ -1636,17 +1635,14 @@ OUString SwXTextTableCursor::getRangeName()
                     pEndBox = pTmpBox;
                 }
 
-                aTmp  = pStartBox->GetName();
-                aTmp += ":";
-                aTmp += pEndBox->GetName();
+                aRet = pStartBox->GetName() + ":" + pEndBox->GetName();
             }
         }
-        aRet = aTmp;
     }
     return aRet;
 }
 
-sal_Bool SwXTextTableCursor::gotoCellByName(const OUString& CellName, sal_Bool Expand)
+sal_Bool SwXTextTableCursor::gotoCellByName(const OUString& sCellName, sal_Bool Expand)
     throw( uno::RuntimeException, std::exception )
 {
     SolarMutexGuard aGuard;
@@ -1656,7 +1652,6 @@ sal_Bool SwXTextTableCursor::gotoCellByName(const OUString& CellName, sal_Bool E
     {
         SwUnoTableCrsr* pTblCrsr = dynamic_cast<SwUnoTableCrsr*>(pUnoCrsr);
         lcl_CrsrSelect( pTblCrsr, Expand );
-        OUString sCellName(CellName);
         bRet = pTblCrsr->GotoTblBox(sCellName);
     }
     return bRet;
@@ -1868,7 +1863,7 @@ void SwXTextTableCursor::setPropertyValue(const OUString& rPropertyName, const u
             }
         }
         else
-            throw beans::UnknownPropertyException(OUString( "Unknown property: " ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+            throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
     }
 }
 
@@ -1930,7 +1925,7 @@ uno::Any SwXTextTableCursor::getPropertyValue(const OUString& rPropertyName)
             }
         }
         else
-            throw beans::UnknownPropertyException(OUString( "Unknown property: " ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+            throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
     }
     return aRet;
 }
@@ -2275,7 +2270,7 @@ uno::Reference< table::XTableColumns >  SwXTextTable::getColumns(void) throw( un
     return xRet;
 }
 
-uno::Reference< table::XCell > SwXTextTable::getCellByName(const OUString& CellName) throw( uno::RuntimeException, std::exception )
+uno::Reference< table::XCell > SwXTextTable::getCellByName(const OUString& sCellName) throw( uno::RuntimeException, std::exception )
 {
     SolarMutexGuard aGuard;
     uno::Reference< table::XCell >  xRet;
@@ -2283,7 +2278,6 @@ uno::Reference< table::XCell > SwXTextTable::getCellByName(const OUString& CellN
     if(pFmt)
     {
         SwTable* pTable = SwTable::FindTable( pFmt );
-        OUString sCellName(CellName);
         SwTableBox* pBox = (SwTableBox*)pTable->GetTblBox( sCellName );
         if(pBox)
         {
@@ -2318,7 +2312,7 @@ uno::Sequence< OUString > SwXTextTable::getCellNames(void) throw( uno::RuntimeEx
     return uno::Sequence< OUString >();
 }
 
-uno::Reference< text::XTextTableCursor > SwXTextTable::createCursorByCellName(const OUString& CellName)
+uno::Reference< text::XTextTableCursor > SwXTextTable::createCursorByCellName(const OUString& sCellName)
     throw (uno::RuntimeException, std::exception)
 {
     SolarMutexGuard aGuard;
@@ -2327,7 +2321,6 @@ uno::Reference< text::XTextTableCursor > SwXTextTable::createCursorByCellName(co
     if(pFmt)
     {
         SwTable* pTable = SwTable::FindTable( pFmt );
-        OUString sCellName(CellName);
         SwTableBox* pBox = (SwTableBox*)pTable->GetTblBox( sCellName );
         if(pBox && pBox->getRowSpan() > 0 )
         {
@@ -2394,11 +2387,10 @@ void SwXTextTable::attachToRange(const uno::Reference< text::XTextRange > & xTex
                 if(!m_sTableName.isEmpty())
                 {
                     sal_uInt16 nIndex = 1;
-                    const OUString sTmpName(m_sTableName);
-                    OUString sTmpNameIndex(sTmpName);
+                    OUString sTmpNameIndex(m_sTableName);
                     while(pDoc->FindTblFmtByName( sTmpNameIndex, true ) && nIndex < USHRT_MAX)
                     {
-                        sTmpNameIndex = sTmpName + OUString::number(nIndex++);
+                        sTmpNameIndex = m_sTableName + OUString::number(nIndex++);
                     }
                     pDoc->SetTableName( *pTblFmt, sTmpNameIndex);
                 }
@@ -2497,9 +2489,7 @@ uno::Reference< table::XCellRange >  SwXTextTable::GetRangeByName(SwFrmFmt* pFmt
 {
     SolarMutexGuard aGuard;
     uno::Reference< table::XCellRange >  aRef;
-    OUString sTLName(rTLName);
-    OUString sBRName(rBRName);
-    const SwTableBox* pTLBox = pTable->GetTblBox( sTLName );
+    const SwTableBox* pTLBox = pTable->GetTblBox( rTLName );
     if(pTLBox)
     {
         // invalidate all actions
@@ -2510,7 +2500,7 @@ uno::Reference< table::XCellRange >  SwXTextTable::GetRangeByName(SwFrmFmt* pFmt
         SwUnoCrsr* pUnoCrsr = pFmt->GetDoc()->CreateUnoCrsr(aPos, true);
         pUnoCrsr->Move( fnMoveForward, fnGoNode );
         pUnoCrsr->SetRemainInSection( false );
-        const SwTableBox* pBRBox = pTable->GetTblBox( sBRName );
+        const SwTableBox* pBRBox = pTable->GetTblBox( rBRName );
         if(pBRBox)
         {
             pUnoCrsr->SetMark();
@@ -2549,8 +2539,8 @@ uno::Reference< table::XCellRange >  SwXTextTable::getCellRangeByPosition(sal_In
             aDesc.nBottom = nBottom;
             aDesc.nLeft   = nLeft;
             aDesc.nRight  = nRight;
-            OUString sTLName = sw_GetCellName(aDesc.nLeft, aDesc.nTop);
-            OUString sBRName = sw_GetCellName(aDesc.nRight, aDesc.nBottom);
+            const OUString sTLName = sw_GetCellName(aDesc.nLeft, aDesc.nTop);
+            const OUString sBRName = sw_GetCellName(aDesc.nRight, aDesc.nBottom);
 
             // please note that according to the 'if' statement at the begin
             // sTLName:sBRName already denotes the normalized range string
@@ -2563,7 +2553,7 @@ uno::Reference< table::XCellRange >  SwXTextTable::getCellRangeByPosition(sal_In
     return aRef;
 }
 
-uno::Reference< table::XCellRange >  SwXTextTable::getCellRangeByName(const OUString& aRange)
+uno::Reference< table::XCellRange >  SwXTextTable::getCellRangeByName(const OUString& sRange)
     throw (uno::RuntimeException, std::exception)
 {
     SolarMutexGuard aGuard;
@@ -2574,9 +2564,9 @@ uno::Reference< table::XCellRange >  SwXTextTable::getCellRangeByName(const OUSt
         SwTable* pTable = SwTable::FindTable( pFmt );
         if(!pTable->IsTblComplex())
         {
-            OUString sRange(aRange);
-            OUString sTLName(sRange.getToken(0, ':'));
-            OUString sBRName(sRange.getToken(1, ':'));
+            sal_Int32 nPos = 0;
+            const OUString sTLName(sRange.getToken(0, ':', nPos));
+            const OUString sBRName(sRange.getToken(0, ':', nPos));
             if(sTLName.isEmpty() || sBRName.isEmpty())
                 throw uno::RuntimeException();
             SwRangeDescriptor aDesc;
@@ -3029,7 +3019,7 @@ void SwXTextTable::sort(const uno::Sequence< beans::PropertyValue >& rDescriptor
     }
 }
 
-void SwXTextTable::autoFormat(const OUString& aName)
+void SwXTextTable::autoFormat(const OUString& sAutoFmtName)
     throw (lang::IllegalArgumentException, uno::RuntimeException,
            std::exception)
 {
@@ -3040,8 +3030,6 @@ void SwXTextTable::autoFormat(const OUString& aName)
         SwTable* pTable = SwTable::FindTable( pFmt );
         if(!pTable->IsTblComplex())
         {
-
-            OUString sAutoFmtName(aName);
             SwTableAutoFmtTbl aAutoFmtTbl;
             aAutoFmtTbl.Load();
             for (size_t i = aAutoFmtTbl.size(); i;)
@@ -3335,7 +3323,7 @@ uno::Any SwXTextTable::getPropertyValue(const OUString& rPropertyName)
                                 m_pPropSet->getPropertyMap().getByName(rPropertyName);
 
     if (!pEntry)
-        throw beans::UnknownPropertyException(OUString( "Unknown property: " ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+        throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
 
     if(pFmt)
     {
@@ -3842,8 +3830,8 @@ uno::Reference< table::XCellRange >  SwXCellRange::getCellRangeByPosition(
             aNewDesc.nLeft   = nLeft + aRgDesc.nLeft;
             aNewDesc.nRight  = nRight + aRgDesc.nLeft;
             aNewDesc.Normalize();
-            OUString sTLName = sw_GetCellName(aNewDesc.nLeft, aNewDesc.nTop);
-            OUString sBRName = sw_GetCellName(aNewDesc.nRight, aNewDesc.nBottom);
+            const OUString sTLName = sw_GetCellName(aNewDesc.nLeft, aNewDesc.nTop);
+            const OUString sBRName = sw_GetCellName(aNewDesc.nRight, aNewDesc.nBottom);
             const SwTableBox* pTLBox = pTable->GetTblBox( sTLName );
             if(pTLBox)
             {
@@ -3881,9 +3869,9 @@ uno::Reference< table::XCellRange >  SwXCellRange::getCellRangeByName(const OUSt
         throw( uno::RuntimeException, std::exception )
 {
     SolarMutexGuard aGuard;
-    OUString sRange(rRange);
-    OUString sTLName(sRange.getToken(0, ':'));
-    OUString sBRName(sRange.getToken(1, ':'));
+    sal_Int32 nPos = 0;
+    const OUString sTLName(rRange.getToken(0, ':', nPos));
+    const OUString sBRName(rRange.getToken(0, ':', nPos));
     if(sTLName.isEmpty() || sBRName.isEmpty())
         throw uno::RuntimeException();
     SwRangeDescriptor aDesc;
@@ -4016,7 +4004,7 @@ void SwXCellRange::setPropertyValue(const OUString& rPropertyName, const uno::An
             }
         }
         else
-            throw beans::UnknownPropertyException(OUString( "Unknown property: " ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+            throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
     }
 }
 
@@ -4098,7 +4086,7 @@ uno::Any SwXCellRange::getPropertyValue(const OUString& rPropertyName)
             }
         }
         else
-           throw beans::UnknownPropertyException(OUString( "Unknown property: " ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+           throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
     }
     return aRet;
 }
@@ -4243,9 +4231,8 @@ void SwXCellRange::GetDataSequence(
                                 nFIndex = pNumFormatter->GetStandardIndex( eLang );
                             }
 
-                            OUString aTxt( lcl_getString(*pXCell) );
                             double fTmp;
-                            if (pNumFormatter->IsNumberFormat( aTxt, nFIndex, fTmp ))
+                            if (pNumFormatter->IsNumberFormat( lcl_getString(*pXCell), nFIndex, fTmp ))
                                 fVal = fTmp;
                         }
                         pDblData[nDtaCnt++] = fVal;
@@ -4828,7 +4815,7 @@ void SwXTableRows::insertByIndex(sal_Int32 nIndex, sal_Int32 nCount)
                 throw aExcept;
             }
 
-            OUString sTLName = sw_GetCellName(0, nIndex);
+            const OUString sTLName = sw_GetCellName(0, nIndex);
             const SwTableBox* pTLBox = pTable->GetTblBox( sTLName );
             bool bAppend = false;
             if(!pTLBox)
@@ -4890,7 +4877,7 @@ void SwXTableRows::removeByIndex(sal_Int32 nIndex, sal_Int32 nCount)
                 SwUnoCrsr* pUnoCrsr = pFrmFmt->GetDoc()->CreateUnoCrsr(aPos, true);
                 pUnoCrsr->Move( fnMoveForward, fnGoNode );
                 pUnoCrsr->SetRemainInSection( false );
-                OUString sBLName = sw_GetCellName(0, nIndex + nCount - 1);
+                const OUString sBLName = sw_GetCellName(0, nIndex + nCount - 1);
                 const SwTableBox* pBLBox = pTable->GetTblBox( sBLName );
                 if(pBLBox)
                 {
@@ -5042,7 +5029,7 @@ void SwXTableColumns::insertByIndex(sal_Int32 nIndex, sal_Int32 nCount)
                 throw aExcept;
             }
 
-            OUString sTLName = sw_GetCellName(nIndex, 0);
+            const OUString sTLName = sw_GetCellName(nIndex, 0);
             const SwTableBox* pTLBox = pTable->GetTblBox( sTLName );
             bool bAppend = false;
             if(!pTLBox)
@@ -5088,7 +5075,7 @@ void SwXTableColumns::removeByIndex(sal_Int32 nIndex, sal_Int32 nCount)
         SwTable* pTable = SwTable::FindTable( pFrmFmt );
         if(!pTable->IsTblComplex())
         {
-            OUString sTLName = sw_GetCellName(nIndex, 0);
+            const OUString sTLName = sw_GetCellName(nIndex, 0);
             const SwTableBox* pTLBox = pTable->GetTblBox( sTLName );
             if(pTLBox)
             {
@@ -5102,7 +5089,7 @@ void SwXTableColumns::removeByIndex(sal_Int32 nIndex, sal_Int32 nCount)
                 SwUnoCrsr* pUnoCrsr = pFrmFmt->GetDoc()->CreateUnoCrsr(aPos, true);
                 pUnoCrsr->Move( fnMoveForward, fnGoNode );
                 pUnoCrsr->SetRemainInSection( false );
-                OUString sTRName = sw_GetCellName(nIndex + nCount - 1, 0);
+                const OUString sTRName = sw_GetCellName(nIndex + nCount - 1, 0);
                 const SwTableBox* pTRBox = pTable->GetTblBox( sTRName );
                 if(pTRBox)
                 {
commit 84eda0e656e2a698996b269a4ff495717cddaa7b
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun May 4 11:53:55 2014 +0200

    Use more proper integer types
    
    Change-Id: Ia16638564b54d4ac0fb1ce2ede41f0c76cc7df53

diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 6d9d518..b562ff1 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -238,7 +238,7 @@ static uno::Any lcl_GetSpecialProperty(SwFrmFmt* pFmt, const SfxItemPropertySimp
         case  FN_TABLE_HEADLINE_COUNT:
         {
             SwTable* pTable = SwTable::FindTable( pFmt );
-            sal_uInt16 nRepeat = pTable->GetRowsToRepeat();
+            const sal_uInt16 nRepeat = pTable->GetRowsToRepeat();
             if(pEntry->nWID == FN_TABLE_HEADLINE_REPEAT)
             {
                 sal_Bool bTemp = nRepeat > 0;
@@ -314,7 +314,7 @@ static uno::Any lcl_GetSpecialProperty(SwFrmFmt* pFmt, const SfxItemPropertySimp
             if(FN_UNO_REDLINE_NODE_END == pEntry->nWID)
                 pTblNode = pTblNode->EndOfSectionNode();
             const SwRedlineTbl& rRedTbl = pFmt->GetDoc()->GetRedlineTbl();
-            for(sal_uInt16 nRed = 0; nRed < rRedTbl.size(); nRed++)
+            for(size_t nRed = 0; nRed < rRedTbl.size(); ++nRed)
             {
                 const SwRangeRedline* pRedline = rRedTbl[nRed];
                 const SwNode* pRedPointNode = pRedline->GetNode(true);
@@ -587,11 +587,11 @@ static SwXCell* lcl_CreateXCell(SwFrmFmt* pFmt, sal_Int32 nColumn, sal_Int32 nRo
 
 static void lcl_InspectLines(SwTableLines& rLines, std::vector<OUString*>& rAllNames)
 {
-    for( sal_uInt16 i = 0; i < rLines.size(); i++ )
+    for( size_t i = 0; i < rLines.size(); ++i )
     {
         SwTableLine* pLine = rLines[i];
         SwTableBoxes& rBoxes = pLine->GetTabBoxes();
-        for(sal_uInt16 j = 0; j < rBoxes.size(); j++)
+        for(size_t j = 0; j < rBoxes.size(); ++j)
         {
             SwTableBox* pBox = rBoxes[j];
             if(!pBox->GetName().isEmpty() && pBox->getRowSpan() > 0 )
@@ -1524,7 +1524,7 @@ SwTableLine* SwXTextTableRow::FindLine(SwTable* pTable, SwTableLine* pLine)
 {
     SwTableLine* pRet = 0;
     SwTableLines &rLines = pTable->GetTabLines();
-    for(sal_uInt16 i = 0; i < rLines.size(); i++)
+    for(size_t i = 0; i < rLines.size(); ++i)
         if(rLines[i] == pLine)
         {
             pRet = pLine;
@@ -2306,7 +2306,7 @@ uno::Sequence< OUString > SwXTextTable::getCellNames(void) throw( uno::RuntimeEx
         SwTableLines& rTblLines = pTable->GetTabLines();
         std::vector<OUString*> aAllNames;
         lcl_InspectLines(rTblLines, aAllNames);
-        uno::Sequence< OUString > aRet( static_cast<sal_uInt16>(aAllNames.size()) );
+        uno::Sequence< OUString > aRet( static_cast<sal_Int32>(aAllNames.size()) );
         OUString* pArray = aRet.getArray();
         for( size_t i = 0; i < aAllNames.size(); ++i)
         {
@@ -2604,8 +2604,8 @@ uno::Sequence< uno::Sequence< uno::Any > > SAL_CALL SwXTextTable::getDataArray()
     // see SwXTextTable::getData(...) also
 
     SolarMutexGuard aGuard;
-    sal_Int16 nRowCount = getRowCount();
-    sal_Int16 nColCount = getColumnCount();
+    const sal_uInt16 nRowCount = getRowCount();
+    const sal_uInt16 nColCount = getColumnCount();
     if(!nRowCount || !nColCount)
     {
         uno::RuntimeException aRuntime;
@@ -2659,8 +2659,8 @@ void SAL_CALL SwXTextTable::setDataArray(
     // see SwXTextTable::setData(...) also
 
     SolarMutexGuard aGuard;
-    sal_Int16 nRowCount = getRowCount();
-    sal_Int16 nColCount = getColumnCount();
+    const sal_uInt16 nRowCount = getRowCount();
+    const sal_uInt16 nColCount = getColumnCount();
 
     SwFrmFmt* pFmt = GetFrmFmt();
     if(pFmt)
@@ -2724,8 +2724,8 @@ uno::Sequence< uno::Sequence< double > > SwXTextTable::getData(void)
                                         throw( uno::RuntimeException, std::exception )
 {
     SolarMutexGuard aGuard;
-    sal_Int16 nRowCount = getRowCount();
-    sal_Int16 nColCount = getColumnCount();
+    const sal_uInt16 nRowCount = getRowCount();
+    const sal_uInt16 nColCount = getColumnCount();
     if(!nRowCount || !nColCount)
     {
         uno::RuntimeException aRuntime;
@@ -2739,12 +2739,12 @@ uno::Sequence< uno::Sequence< double > > SwXTextTable::getData(void)
     {
         uno::Sequence< double >* pArray = aRowSeq.getArray();
 
-        sal_uInt16 nRowStart = bFirstRowAsLabel ? 1 : 0;
+        const sal_uInt16 nRowStart = bFirstRowAsLabel ? 1 : 0;
         for(sal_uInt16 nRow = nRowStart; nRow < nRowCount; nRow++)
         {
             uno::Sequence< double >  aColSeq(bFirstColumnAsLabel ? nColCount - 1 : nColCount);
             double* pColArray = aColSeq.getArray();
-            sal_uInt16 nColStart = bFirstColumnAsLabel ? 1 : 0;
+            const sal_uInt16 nColStart = bFirstColumnAsLabel ? 1 : 0;
             for(sal_uInt16 nCol = nColStart; nCol < nColCount; nCol++)
             {
                 uno::Reference< table::XCell >  xCell = getCellByPosition(nCol, nRow);
@@ -2766,8 +2766,8 @@ void SwXTextTable::setData(const uno::Sequence< uno::Sequence< double > >& rData
                                         throw( uno::RuntimeException, std::exception )
 {
     SolarMutexGuard aGuard;
-    sal_Int16 nRowCount = getRowCount();
-    sal_Int16 nColCount = getColumnCount();
+    const sal_uInt16 nRowCount = getRowCount();
+    const sal_uInt16 nColCount = getColumnCount();
     bool bChanged = false;
 
     if(!nRowCount || !nColCount)
@@ -2780,7 +2780,7 @@ void SwXTextTable::setData(const uno::Sequence< uno::Sequence< double > >& rData
     SwFrmFmt* pFmt = GetFrmFmt();
     if(pFmt )
     {
-        sal_uInt16 nRowStart = bFirstRowAsLabel ? 1 : 0;
+        const sal_uInt16 nRowStart = bFirstRowAsLabel ? 1 : 0;
         if(rData.getLength() < nRowCount - nRowStart)
         {
             throw uno::RuntimeException();
@@ -2789,7 +2789,7 @@ void SwXTextTable::setData(const uno::Sequence< uno::Sequence< double > >& rData
         for(sal_uInt16 nRow = nRowStart; nRow < nRowCount; nRow++)
         {
             const uno::Sequence< double >& rColSeq = pRowArray[nRow - nRowStart];
-            sal_uInt16 nColStart = bFirstColumnAsLabel ? 1 : 0;
+            const sal_uInt16 nColStart = bFirstColumnAsLabel ? 1 : 0;
             if(rColSeq.getLength() < nColCount - nColStart)
             {
                 throw uno::RuntimeException();
@@ -2816,7 +2816,7 @@ void SwXTextTable::setData(const uno::Sequence< uno::Sequence< double > >& rData
 uno::Sequence< OUString > SwXTextTable::getRowDescriptions(void) throw( uno::RuntimeException, std::exception )
 {
     SolarMutexGuard aGuard;
-    sal_Int16 nRowCount = getRowCount();
+    const sal_uInt16 nRowCount = getRowCount();
     if(!nRowCount)
     {
         uno::RuntimeException aRuntime;
@@ -2831,7 +2831,7 @@ uno::Sequence< OUString > SwXTextTable::getRowDescriptions(void) throw( uno::Run
         OUString* pArray = aRet.getArray();
         if(bFirstColumnAsLabel)
         {
-            sal_uInt16 nStart = bFirstRowAsLabel ? 1 : 0;
+            const sal_uInt16 nStart = bFirstRowAsLabel ? 1 : 0;
             for(sal_uInt16 i = nStart; i < nRowCount; i++)
             {
                 uno::Reference< table::XCell >  xCell = getCellByPosition(0, i);
@@ -2860,7 +2860,7 @@ void SwXTextTable::setRowDescriptions(const uno::Sequence< OUString >& rRowDesc)
     SwFrmFmt* pFmt = GetFrmFmt();
     if(pFmt)
     {
-        sal_Int16 nRowCount = getRowCount();
+        const sal_uInt16 nRowCount = getRowCount();
         if(!nRowCount || rRowDesc.getLength() < (bFirstRowAsLabel ? nRowCount - 1 : nRowCount))
         {
             throw uno::RuntimeException();
@@ -2868,7 +2868,7 @@ void SwXTextTable::setRowDescriptions(const uno::Sequence< OUString >& rRowDesc)
         const OUString* pArray = rRowDesc.getConstArray();
         if(bFirstColumnAsLabel)
         {
-            sal_uInt16 nStart = bFirstRowAsLabel ? 1 : 0;
+            const sal_uInt16 nStart = bFirstRowAsLabel ? 1 : 0;
             for(sal_uInt16 i = nStart; i < nRowCount; i++)
             {
                 uno::Reference< table::XCell >  xCell = getCellByPosition(0, i);
@@ -2893,7 +2893,7 @@ uno::Sequence< OUString > SwXTextTable::getColumnDescriptions(void)
                                                 throw( uno::RuntimeException, std::exception )
 {
     SolarMutexGuard aGuard;
-    sal_Int16 nColCount = getColumnCount();
+    const sal_uInt16 nColCount = getColumnCount();
     if(!nColCount)
     {
         uno::RuntimeException aRuntime;
@@ -2907,7 +2907,7 @@ uno::Sequence< OUString > SwXTextTable::getColumnDescriptions(void)
         OUString* pArray = aRet.getArray();
         if(bFirstRowAsLabel)
         {
-            sal_uInt16 nStart = bFirstColumnAsLabel ? 1 : 0;
+            const sal_uInt16 nStart = bFirstColumnAsLabel ? 1 : 0;
             for(sal_uInt16 i = nStart; i < nColCount; i++)
             {
                 uno::Reference< table::XCell >  xCell = getCellByPosition(i, 0);
@@ -2933,7 +2933,7 @@ uno::Sequence< OUString > SwXTextTable::getColumnDescriptions(void)
 void SwXTextTable::setColumnDescriptions(const uno::Sequence< OUString >& rColumnDesc) throw( uno::RuntimeException, std::exception )
 {
     SolarMutexGuard aGuard;
-    sal_Int16 nColCount = getColumnCount();
+    const sal_uInt16 nColCount = getColumnCount();
     if(!nColCount)
     {
         uno::RuntimeException aRuntime;
@@ -2946,7 +2946,7 @@ void SwXTextTable::setColumnDescriptions(const uno::Sequence< OUString >& rColum
         const OUString* pArray = rColumnDesc.getConstArray();
         if(bFirstRowAsLabel && rColumnDesc.getLength() >= nColCount - (bFirstColumnAsLabel ? 1 : 0))
         {
-            sal_uInt16 nStart = bFirstColumnAsLabel ? 1 : 0;
+            const sal_uInt16 nStart = bFirstColumnAsLabel ? 1 : 0;
             for(sal_uInt16 i = nStart; i < nColCount; i++)
             {
                 uno::Reference< table::XCell >  xCell = getCellByPosition(i, 0);
@@ -3044,7 +3044,7 @@ void SwXTextTable::autoFormat(const OUString& aName)
             OUString sAutoFmtName(aName);
             SwTableAutoFmtTbl aAutoFmtTbl;
             aAutoFmtTbl.Load();
-            for (sal_uInt16 i = aAutoFmtTbl.size(); i;)
+            for (size_t i = aAutoFmtTbl.size(); i;)
                 if( sAutoFmtName == aAutoFmtTbl[ --i ].GetName() )
                 {
                     SwSelBoxes aBoxes;
@@ -3254,19 +3254,19 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName, const uno::An
                         !aTableBorderDistances.IsBottomDistanceValid ))
                         break;
 
-                    sal_uInt16 nLeftDistance =     convertMm100ToTwip( aTableBorderDistances.LeftDistance);
-                    sal_uInt16 nRightDistance =    convertMm100ToTwip( aTableBorderDistances.RightDistance);
-                    sal_uInt16 nTopDistance =      convertMm100ToTwip( aTableBorderDistances.TopDistance);
-                    sal_uInt16 nBottomDistance =   convertMm100ToTwip( aTableBorderDistances.BottomDistance);
+                    const sal_uInt16 nLeftDistance =   convertMm100ToTwip(aTableBorderDistances.LeftDistance);
+                    const sal_uInt16 nRightDistance =  convertMm100ToTwip(aTableBorderDistances.RightDistance);
+                    const sal_uInt16 nTopDistance =    convertMm100ToTwip(aTableBorderDistances.TopDistance);
+                    const sal_uInt16 nBottomDistance = convertMm100ToTwip(aTableBorderDistances.BottomDistance);
                     SwDoc* pDoc = pFmt->GetDoc();
                     SwTable* pTable = SwTable::FindTable( pFmt );
                     SwTableLines &rLines = pTable->GetTabLines();
                     pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_START, NULL);
-                    for(sal_uInt16 i = 0; i < rLines.size(); i++)
+                    for(size_t i = 0; i < rLines.size(); ++i)
                     {
                         SwTableLine* pLine = rLines[i];
                         SwTableBoxes& rBoxes = pLine->GetTabBoxes();
-                        for(sal_uInt16 k = 0; k < rBoxes.size(); k++)
+                        for(size_t k = 0; k < rBoxes.size(); ++k)
                         {
                             SwTableBox* pBox = rBoxes[k];
                             const SwFrmFmt* pBoxFmt = pBox->GetFrmFmt();
@@ -3470,11 +3470,11 @@ uno::Any SwXTextTable::getPropertyValue(const OUString& rPropertyName)
                     sal_uInt16 nTopDistance = 0;
                     sal_uInt16 nBottomDistance = 0;
 
-                    for(sal_uInt16 i = 0; i < rLines.size(); i++)
+                    for(size_t i = 0; i < rLines.size(); ++i)
                     {
                         const SwTableLine* pLine = rLines[i];
                         const SwTableBoxes& rBoxes = pLine->GetTabBoxes();
-                        for(sal_uInt16 k = 0; k < rBoxes.size(); k++)
+                        for(size_t k = 0; k < rBoxes.size(); ++k)
                         {
                             const SwTableBox* pBox = rBoxes[k];
                             SwFrmFmt* pBoxFmt = pBox->GetFrmFmt();
@@ -3622,7 +3622,7 @@ void SwXTextTable::setName(const OUString& rName) throw( uno::RuntimeException,
         const OUString aOldName( pFmt->GetName() );
         SwFrmFmt* pTmpFmt;
         const SwFrmFmts* pTbl = pFmt->GetDoc()->GetTblFrmFmts();
-        for( sal_uInt16 i = pTbl->size(); i; )
+        for( size_t i = pTbl->size(); i; )
             if( !( pTmpFmt = (*pTbl)[ --i ] )->IsDefault() &&
                 pTmpFmt->GetName() == rName &&
                             pFmt->GetDoc()->IsUsed( *pTmpFmt ))
@@ -3660,7 +3660,7 @@ void SwXTextTable::setName(const OUString& rName) throw( uno::RuntimeException,
 sal_uInt16 SwXTextTable::getRowCount(void)
 {
     SolarMutexGuard aGuard;
-    sal_Int16 nRet = 0;
+    sal_uInt16 nRet = 0;
     SwFrmFmt* pFmt = GetFrmFmt();
     if(pFmt)
     {
@@ -3677,7 +3677,7 @@ sal_uInt16 SwXTextTable::getColumnCount(void)
 {
     SolarMutexGuard aGuard;
     SwFrmFmt* pFmt = GetFrmFmt();
-    sal_Int16 nRet = 0;
+    sal_uInt16 nRet = 0;
     if(pFmt)
     {
         SwTable* pTable = SwTable::FindTable( pFmt );
@@ -4136,8 +4136,8 @@ void SwXCellRange::GetDataSequence(
 
     // compare to SwXCellRange::getDataArray (note different return types though)
 
-    sal_Int16 nRowCount = getRowCount();
-    sal_Int16 nColCount = getColumnCount();
+    const sal_uInt16 nRowCount = getRowCount();
+    const sal_uInt16 nColCount = getColumnCount();
 
     if(!nRowCount || !nColCount)
     {
@@ -4272,8 +4272,8 @@ uno::Sequence< uno::Sequence< uno::Any > > SAL_CALL SwXCellRange::getDataArray()
     throw (uno::RuntimeException, std::exception)
 {
     SolarMutexGuard aGuard;
-    sal_Int16 nRowCount = getRowCount();
-    sal_Int16 nColCount = getColumnCount();
+    const sal_uInt16 nRowCount = getRowCount();
+    const sal_uInt16 nColCount = getColumnCount();
 
     if(!nRowCount || !nColCount)
     {
@@ -4327,8 +4327,8 @@ void SAL_CALL SwXCellRange::setDataArray(
     throw (uno::RuntimeException, std::exception)
 {
     SolarMutexGuard aGuard;
-    sal_Int16 nRowCount = getRowCount();
-    sal_Int16 nColCount = getColumnCount();
+    const sal_uInt16 nRowCount = getRowCount();
+    const sal_uInt16 nColCount = getColumnCount();
     if(!nRowCount || !nColCount)
     {
         uno::RuntimeException aRuntime;
@@ -4389,8 +4389,8 @@ void SAL_CALL SwXCellRange::setDataArray(
 uno::Sequence< uno::Sequence< double > > SwXCellRange::getData(void) throw( uno::RuntimeException, std::exception )
 {
     SolarMutexGuard aGuard;
-    sal_Int16 nRowCount = getRowCount();
-    sal_Int16 nColCount = getColumnCount();
+    const sal_uInt16 nRowCount = getRowCount();
+    const sal_uInt16 nColCount = getColumnCount();
 
     if(!nRowCount || !nColCount)
     {
@@ -4404,12 +4404,12 @@ uno::Sequence< uno::Sequence< double > > SwXCellRange::getData(void) throw( uno:
     {
         uno::Sequence< double >* pRowArray = aRowSeq.getArray();
 
-        sal_uInt16 nRowStart = bFirstRowAsLabel ? 1 : 0;
+        const sal_uInt16 nRowStart = bFirstRowAsLabel ? 1 : 0;
         for(sal_uInt16 nRow = nRowStart; nRow < nRowCount; nRow++)
         {
             uno::Sequence< double > aColSeq(bFirstColumnAsLabel ? nColCount - 1 : nColCount);
             double * pArray = aColSeq.getArray();
-            sal_uInt16 nColStart = bFirstColumnAsLabel ? 1 : 0;
+            const sal_uInt16 nColStart = bFirstColumnAsLabel ? 1 : 0;
             for(sal_uInt16 nCol = nColStart; nCol < nColCount; nCol++)
             {
                 uno::Reference< table::XCell >  xCell = getCellByPosition(nCol, nRow);
@@ -4429,8 +4429,8 @@ void SwXCellRange::setData(const uno::Sequence< uno::Sequence< double > >& rData
                                                 throw( uno::RuntimeException, std::exception )
 {
     SolarMutexGuard aGuard;
-    sal_Int16 nRowCount = getRowCount();
-    sal_Int16 nColCount = getColumnCount();
+    const sal_uInt16 nRowCount = getRowCount();
+    const sal_uInt16 nColCount = getColumnCount();
     if(!nRowCount || !nColCount)
     {
         uno::RuntimeException aRuntime;
@@ -4440,7 +4440,7 @@ void SwXCellRange::setData(const uno::Sequence< uno::Sequence< double > >& rData
     SwFrmFmt* pFmt = GetFrmFmt();
     if(pFmt )
     {
-        sal_uInt16 nRowStart = bFirstRowAsLabel ? 1 : 0;
+        const sal_uInt16 nRowStart = bFirstRowAsLabel ? 1 : 0;
         if(rData.getLength() < nRowCount - nRowStart)
         {
             throw uno::RuntimeException();
@@ -4449,7 +4449,7 @@ void SwXCellRange::setData(const uno::Sequence< uno::Sequence< double > >& rData
         for(sal_uInt16 nRow = nRowStart; nRow < nRowCount; nRow++)
         {
             const uno::Sequence< double >& rColSeq = pRowArray[nRow - nRowStart];
-            sal_uInt16 nColStart = bFirstColumnAsLabel ? 1 : 0;
+            const sal_uInt16 nColStart = bFirstColumnAsLabel ? 1 : 0;
             if(rColSeq.getLength() < nColCount - nColStart)
             {
                 throw uno::RuntimeException();
@@ -4473,7 +4473,7 @@ uno::Sequence< OUString > SwXCellRange::getRowDescriptions(void)
                                             throw( uno::RuntimeException, std::exception )
 {
     SolarMutexGuard aGuard;
-    sal_Int16 nRowCount = getRowCount();
+    const sal_uInt16 nRowCount = getRowCount();
     if(!nRowCount)
     {
         uno::RuntimeException aRuntime;
@@ -4487,7 +4487,7 @@ uno::Sequence< OUString > SwXCellRange::getRowDescriptions(void)
         OUString* pArray = aRet.getArray();
         if(bFirstColumnAsLabel)
         {
-            sal_uInt16 nStart = bFirstRowAsLabel ? 1 : 0;
+            const sal_uInt16 nStart = bFirstRowAsLabel ? 1 : 0;
             for(sal_uInt16 i = nStart; i < nRowCount; i++)
             {
                 uno::Reference< table::XCell >  xCell = getCellByPosition(0, i);
@@ -4517,7 +4517,7 @@ void SwXCellRange::setRowDescriptions(const uno::Sequence< OUString >& rRowDesc)
     SwFrmFmt* pFmt = GetFrmFmt();
     if(pFmt)
     {
-        sal_Int16 nRowCount = getRowCount();
+        const sal_uInt16 nRowCount = getRowCount();
         if(!nRowCount || rRowDesc.getLength() < (bFirstRowAsLabel ? nRowCount - 1 : nRowCount))
         {
             throw uno::RuntimeException();
@@ -4525,7 +4525,7 @@ void SwXCellRange::setRowDescriptions(const uno::Sequence< OUString >& rRowDesc)
         const OUString* pArray = rRowDesc.getConstArray();
         if(bFirstColumnAsLabel)
         {
-            sal_uInt16 nStart = bFirstRowAsLabel ? 1 : 0;
+            const sal_uInt16 nStart = bFirstRowAsLabel ? 1 : 0;
             for(sal_uInt16 i = nStart; i < nRowCount; i++)
             {
                 uno::Reference< table::XCell >  xCell = getCellByPosition(0, i);
@@ -4549,7 +4549,7 @@ uno::Sequence< OUString > SwXCellRange::getColumnDescriptions(void)
                                         throw( uno::RuntimeException, std::exception )
 {
     SolarMutexGuard aGuard;
-    sal_Int16 nColCount = getColumnCount();
+    const sal_uInt16 nColCount = getColumnCount();
     if(!nColCount)
     {
         uno::RuntimeException aRuntime;
@@ -4563,7 +4563,7 @@ uno::Sequence< OUString > SwXCellRange::getColumnDescriptions(void)
         OUString* pArray = aRet.getArray();
         if(bFirstRowAsLabel)
         {
-            sal_uInt16 nStart = bFirstColumnAsLabel ? 1 : 0;
+            const sal_uInt16 nStart = bFirstColumnAsLabel ? 1 : 0;
             for(sal_uInt16 i = nStart; i < nColCount; i++)
             {
                 uno::Reference< table::XCell >  xCell = getCellByPosition(i, 0);
@@ -4590,14 +4590,14 @@ void SwXCellRange::setColumnDescriptions(const uno::Sequence< OUString >& Column
                                                         throw( uno::RuntimeException, std::exception )
 {
     SolarMutexGuard aGuard;
-    sal_Int16 nColCount = getColumnCount();
+    const sal_uInt16 nColCount = getColumnCount();
     SwFrmFmt* pFmt = GetFrmFmt();
     if(pFmt)
     {
         const OUString* pArray = ColumnDesc.getConstArray();
         if(bFirstRowAsLabel && ColumnDesc.getLength() >= nColCount - (bFirstColumnAsLabel ? 1 : 0))
         {
-            sal_uInt16 nStart = bFirstColumnAsLabel ? 1 : 0;
+            const sal_uInt16 nStart = bFirstColumnAsLabel ? 1 : 0;
             for(sal_uInt16 i = nStart; i < nColCount; i++)
             {
                 uno::Reference< table::XCell >  xCell = getCellByPosition(i, 0);
@@ -4766,9 +4766,9 @@ uno::Any SwXTableRows::getByIndex(sal_Int32 nIndex)
     else
     {
         SwTable* pTable = SwTable::FindTable( pFrmFmt );
-        if( (sal_uInt16)pTable->GetTabLines().size() > nIndex)
+        if( pTable->GetTabLines().size() > static_cast<size_t>(nIndex))
         {
-            SwTableLine* pLine = pTable->GetTabLines()[(sal_uInt16)nIndex];
+            SwTableLine* pLine = pTable->GetTabLines()[nIndex];
             SwIterator<SwXTextTableRow,SwFmt> aIter( *pFrmFmt );
             SwXTextTableRow* pXRow = aIter.First();
             while( pXRow )
@@ -4820,8 +4820,8 @@ void SwXTableRows::insertByIndex(sal_Int32 nIndex, sal_Int32 nCount)
         SwTable* pTable = SwTable::FindTable( pFrmFmt );
         if(!pTable->IsTblComplex())
         {
-            sal_uInt16 nRowCount = pTable->GetTabLines().size();
-            if (nCount <= 0 || !(0 <= nIndex && nIndex <= nRowCount))
+            const size_t nRowCount = pTable->GetTabLines().size();
+            if (nCount <= 0 || !(0 <= nIndex && static_cast<size_t>(nIndex) <= nRowCount))
             {
                 uno::RuntimeException aExcept;
                 aExcept.Message = "Illegal arguments";
@@ -4988,7 +4988,7 @@ uno::Any SwXTableColumns::getByIndex(sal_Int32 nIndex)
         throw uno::RuntimeException();
     else
     {
-        sal_uInt16 nCount = 0;
+        size_t nCount = 0;
         SwTable* pTable = SwTable::FindTable( pFrmFmt );
         if(!pTable->IsTblComplex())
         {
@@ -4996,7 +4996,7 @@ uno::Any SwXTableColumns::getByIndex(sal_Int32 nIndex)
             SwTableLine* pLine = rLines.front();
             nCount = pLine->GetTabBoxes().size();
         }
-        if(nCount <= nIndex || nIndex < 0)
+        if(nIndex < 0 || nCount <= static_cast<size_t>(nIndex))
             throw lang::IndexOutOfBoundsException();
         xRet = uno::Reference<uno::XInterface>();   //!! writer tables do not have columns !!
     }
@@ -5034,8 +5034,8 @@ void SwXTableColumns::insertByIndex(sal_Int32 nIndex, sal_Int32 nCount)
         {
             SwTableLines& rLines = pTable->GetTabLines();
             SwTableLine* pLine = rLines.front();
-            sal_uInt16 nColCount = pLine->GetTabBoxes().size();
-            if (nCount <= 0 || !(0 <= nIndex && nIndex <= nColCount))
+            const size_t nColCount = pLine->GetTabBoxes().size();
+            if (nCount <= 0 || !(0 <= nIndex && static_cast<size_t>(nIndex) <= nColCount))
             {
                 uno::RuntimeException aExcept;
                 aExcept.Message = "Illegal arguments";
commit f671abf276e9fefbf80beb79471504366472264b
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun May 4 11:00:37 2014 +0200

    OUString: avoid temporaries and concatenated appends
    
    Change-Id: I55843e876f1a01c7800cd638fc0ec0bae4933994

diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index 8184230..c03b895 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -515,7 +515,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception)
     if (!xContent.is())
     {
         lang::IllegalArgumentException aIllegal;
-        aIllegal.Message += "second parameter invalid";
+        aIllegal.Message = "second parameter invalid";
         throw aIllegal;
     }
     if(!GetDoc())
@@ -1142,8 +1142,7 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
     if (!pEntry)
     {
         beans::UnknownPropertyException aExcept;
-        aExcept.Message = "Unknown property: ";
-        aExcept.Message += rPropertyName;
+        aExcept.Message = "Unknown property: " + rPropertyName;
         throw aExcept;
     }
 
@@ -2025,10 +2024,7 @@ lcl_DebugCellProperties(
             for (sal_Int32  nDebugProperty = 0;
                  nDebugProperty < nDebugCellProperties; ++nDebugProperty)
             {
-                const OUString sName =
-                    rDebugCellProperties[nDebugProperty].Name;
-                sNames += sName;
-                sNames += OUString('-');
+                sNames += rDebugCellProperties[nDebugProperty].Name + OUString('-');
             }
             sNames += OUString('+');
         }
@@ -2593,8 +2589,7 @@ public:
     SwFrmFmt & GetHeadFootFmtOrThrow() {
         SwFrmFmt *const pFmt( GetHeadFootFmt() );
         if (!pFmt) {
-            throw uno::RuntimeException(OUString(
-                    "SwXHeadFootText: disposed or invalid"), 0);
+            throw uno::RuntimeException("SwXHeadFootText: disposed or invalid", 0);
         }
         return *pFmt;
     }
commit f8d2c6386b1ca3c7f81c816dfcc5023dc6cbb485
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun May 4 10:41:32 2014 +0200

    sal_uInt16 to size_t
    
    Change-Id: I25e92cc92aaa2b5b808b7c369101055b5f77aff3

diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index f364a28..8184230 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -1156,12 +1156,12 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
         case FN_UNO_REDLINE_NODE_END:
         {
             const SwRedlineTbl& rRedTbl = GetDoc()->GetRedlineTbl();
-            const sal_uInt16 nRedTblCount = rRedTbl.size();
+            const size_t nRedTblCount = rRedTbl.size();
             if (nRedTblCount > 0)
             {
                 SwStartNode const*const pStartNode = GetStartNode();
                 const sal_uLong nOwnIndex = pStartNode->EndOfSectionIndex();
-                for (sal_uInt16 nRed = 0; nRed < nRedTblCount; nRed++)
+                for (size_t nRed = 0; nRed < nRedTblCount; ++nRed)
                 {
                     SwRangeRedline const*const pRedline = rRedTbl[nRed];
                     SwPosition const*const pRedStart = pRedline->Start();
commit 38b4fe56499ad30c4e57fdddd5c7957191e8a348
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun May 4 09:53:01 2014 +0200

    Simplify IsPreviewPosInDocPreviewPage
    
    Change-Id: I6c1a57dc7095125f36ffe5ad0a4fd54ba240287f

diff --git a/sw/source/core/view/pagepreviewlayout.cxx b/sw/source/core/view/pagepreviewlayout.cxx
index c36b786..f4d41ff 100644
--- a/sw/source/core/view/pagepreviewlayout.cxx
+++ b/sw/source/core/view/pagepreviewlayout.cxx
@@ -916,8 +916,6 @@ bool SwPagePreviewLayout::IsPreviewPosInDocPreviewPage( const Point  _aPreviewPo
                                                     bool&        _obPosInEmptyPage,
                                                     sal_uInt16&  _onPageNum ) const
 {
-    bool bIsPosInsideDoc;
-
     // initialize variable parameter values.
     _orDocPos.X() = 0;
     _orDocPos.Y() = 0;
@@ -928,29 +926,22 @@ bool SwPagePreviewLayout::IsPreviewPosInDocPreviewPage( const Point  _aPreviewPo
             std::find_if( maPreviewPages.begin(), maPreviewPages.end(),
                           PreviewPosInsidePagePred( _aPreviewPos ) );
 
-    if ( aFoundPreviewPageIter == maPreviewPages.end() )
-        // given preview position outside a document page.
-        bIsPosInsideDoc = false;
-    else
+    if ( aFoundPreviewPageIter != maPreviewPages.end() )
     {
+        // given preview position is inside a document page.
         _onPageNum = (*aFoundPreviewPageIter)->pPage->GetPhyPageNum();
-        if ( (*aFoundPreviewPageIter)->pPage->IsEmptyPage() )
-        {
-            // given preview position inside an empty page
-            bIsPosInsideDoc = false;
-            _obPosInEmptyPage = true;
-        }
-        else
+        _obPosInEmptyPage = (*aFoundPreviewPageIter)->pPage->IsEmptyPage();
+        if ( !_obPosInEmptyPage )
         {
             // given preview position inside a normal page
-            bIsPosInsideDoc = true;
             _orDocPos = _aPreviewPos -
                         (*aFoundPreviewPageIter)->aPreviewWinPos +
                         (*aFoundPreviewPageIter)->aLogicPos;
+            return true;
         }
     }
 
-    return bIsPosInsideDoc;
+    return false;
 }
 
 /** determine window page scroll amount */
commit 655703fce5a6b6868dbaecb190ac80153a7fa27f
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun May 4 09:47:46 2014 +0200

    Simplify return paths/expressions
    
    Change-Id: I198b3d349934837f7b7e6b49bf4b2a7785736a61

diff --git a/sw/source/core/view/pagepreviewlayout.cxx b/sw/source/core/view/pagepreviewlayout.cxx
index edc9b6c..c36b786 100644
--- a/sw/source/core/view/pagepreviewlayout.cxx
+++ b/sw/source/core/view/pagepreviewlayout.cxx
@@ -708,8 +708,6 @@ bool SwPagePreviewLayout::SetBookPreviewMode( const bool _bEnableBookPreview,
                                               sal_uInt16& _onStartPageNum,
                                               Rectangle&  _orDocPreviewPaintRect )
 {
-    bool bRet = false;
-
     if ( mbBookPreview != _bEnableBookPreview)
     {
         mbBookPreview = _bEnableBookPreview;
@@ -731,10 +729,10 @@ bool SwPagePreviewLayout::SetBookPreviewMode( const bool _bEnableBookPreview,
             mbBookPreviewModeToggled = false;
         }
 
-        bRet = true;
+        return true;
     }
 
-    return bRet;
+    return false;
 }
 
 // methods to determine new data for changing the current shown part of the
commit df12e42606e77b219b1ec291fa990880bec2dc96
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun May 4 09:36:25 2014 +0200

    No need of else after a return
    
    Change-Id: I7f7bb520085f0d1855dce8656a54e5f72f2b5ed5

diff --git a/sw/source/core/view/pagepreviewlayout.cxx b/sw/source/core/view/pagepreviewlayout.cxx
index 5a24aa3..edc9b6c 100644
--- a/sw/source/core/view/pagepreviewlayout.cxx
+++ b/sw/source/core/view/pagepreviewlayout.cxx
@@ -909,8 +909,7 @@ struct PreviewPosInsidePagePred
             Rectangle aPreviewPageRect( _pPreviewPage->aPreviewWinPos, _pPreviewPage->aPageSize );
             return aPreviewPageRect.IsInside( mnPreviewPos );
         }
-        else
-            return false;
+        return false;
     }
 };
 
@@ -1336,8 +1335,8 @@ const PreviewPage* SwPagePreviewLayout::_GetPreviewPageByPageNum( const sal_uInt
 
     if ( aFoundPreviewPageIter == maPreviewPages.end() )
         return 0;
-    else
-        return (*aFoundPreviewPageIter);
+
+    return (*aFoundPreviewPageIter);
 }
 
 /** determine row the page with the given number is in
@@ -1398,10 +1397,7 @@ Size SwPagePreviewLayout::GetPreviewPageSizeByPageNum( sal_uInt16 _nPageNum ) co
     {
         return pPreviewPage->aPageSize;
     }
-    else
-    {
-        return Size( 0, 0 );
-    }
+    return Size( 0, 0 );
 }
 
 /** get virtual page number by its physical page number
@@ -1415,10 +1411,7 @@ sal_uInt16 SwPagePreviewLayout::GetVirtPageNumByPageNum( sal_uInt16 _nPageNum )
     {
         return pPreviewPage->pPage->GetVirtPageNum();
     }
-    else
-    {
-        return 0;
-    }
+    return 0;
 }
 
 /** Convert absolute to relative page numbers (see PrintEmptyPages) */
commit cd881c2b3d8e2215d42eb9531dd87b8b857826a8
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun May 4 09:30:16 2014 +0200

    Constify sal_uInt16 and sal_Int16 to sal_uInt16
    
    Change-Id: Ie03f3591279f7cedff6f5acf3af46bebf3d2c1b1

diff --git a/sw/source/core/view/pagepreviewlayout.cxx b/sw/source/core/view/pagepreviewlayout.cxx
index 6ba1f69..5a24aa3 100644
--- a/sw/source/core/view/pagepreviewlayout.cxx
+++ b/sw/source/core/view/pagepreviewlayout.cxx
@@ -161,7 +161,7 @@ void SwPagePreviewLayout::_CalcPreviewLayoutSizes()
         // document height
         // determine number of rows needed for <nPages> in preview layout
         // OD 19.02.2003 #107369# - use method <GetRowOfPage(..)>.
-        sal_uInt16 nDocRows = GetRowOfPage( mnPages );
+        const sal_uInt16 nDocRows = GetRowOfPage( mnPages );
         aDocSize.Height() = nDocRows * maMaxPageSize.Height() +
                             (nDocRows+1) * mnYFree;
         maPreviewDocRect.SetPos( Point( 0, 0 ) );
@@ -344,8 +344,8 @@ bool SwPagePreviewLayout::Prepare( const sal_uInt16 _nProposedStartPageNum,
     if ( nProposedStartPageNum > 0 )
     {
         // determine column and row of proposed start page in virtual preview layout
-        sal_uInt16 nColOfProposed = GetColOfPage( nProposedStartPageNum );
-        sal_uInt16 nRowOfProposed = GetRowOfPage( nProposedStartPageNum );
+        const sal_uInt16 nColOfProposed = GetColOfPage( nProposedStartPageNum );
+        const sal_uInt16 nRowOfProposed = GetRowOfPage( nProposedStartPageNum );
         // determine start page
         if ( _bStartWithPageAtFirstCol )
         {
@@ -384,9 +384,9 @@ bool SwPagePreviewLayout::Prepare( const sal_uInt16 _nProposedStartPageNum,
     {
         // determine column and row of proposed start position.
         // Note: paint starts at point (0,0)
-        sal_uInt16 nColOfProposed =
+        const sal_uInt16 nColOfProposed =
                 static_cast<sal_uInt16>(_aProposedStartPos.X() / mnColWidth) + 1;
-        sal_uInt16 nRowOfProposed =
+        const sal_uInt16 nRowOfProposed =
                 static_cast<sal_uInt16>(_aProposedStartPos.Y() / mnRowHeight) + 1;
         // determine start page == page at proposed start position
         // OD 19.02.2003 #107369# - leaving left-top-corner blank is
@@ -853,7 +853,7 @@ bool SwPagePreviewLayout::CalcStartValuesForSelectedPageMove(
     sal_uInt16 nNewStartPage = mnPaintPhyStartPageNum;
     Point aNewStartPos = Point(0,0);
 
-    sal_uInt16 nNewAbsSelectedPageNum = ConvertRelativeToAbsolutePageNum( nNewRelSelectedPageNum );
+    const sal_uInt16 nNewAbsSelectedPageNum = ConvertRelativeToAbsolutePageNum( nNewRelSelectedPageNum );
     if ( !IsPageVisible( nNewAbsSelectedPageNum ) )
     {
         if ( _nHoriMove != 0 && _nVertMove != 0 )
@@ -864,7 +864,7 @@ bool SwPagePreviewLayout::CalcStartValuesForSelectedPageMove(
 
         // new selected page has to be brought into view considering current
         // visible preview.
-        sal_Int16 nTotalRows = GetRowOfPage( mnPages );
+        const sal_uInt16 nTotalRows = GetRowOfPage( mnPages );
         if ( (_nHoriMove > 0 || _nVertMove > 0) &&
              mbDoesLayoutRowsFitIntoWindow &&
              mbDoesLayoutColsFitIntoWindow &&
@@ -1275,7 +1275,7 @@ void SwPagePreviewLayout::_PaintSelectMarkAtPage(
 */
 void SwPagePreviewLayout::MarkNewSelectedPage( const sal_uInt16 _nSelectedPage )
 {
-    sal_uInt16 nOldSelectedPageNum = mnSelectedPageNum;
+    const sal_uInt16 nOldSelectedPageNum = mnSelectedPageNum;
     mnSelectedPageNum = _nSelectedPage;
 
     // re-paint for current selected page in order to umark it.
commit 11a455f9141fd3b9a195b07afddeb0f8735871ed
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sat May 3 23:41:58 2014 +0200

    Simplify GetRowOfPage and GetColOfPage
    
    Change-Id: Iebe6c17a057999a20a46fb6ea756dc1c0a052dbc

diff --git a/sw/source/core/view/pagepreviewlayout.cxx b/sw/source/core/view/pagepreviewlayout.cxx
index 4687640..6ba1f69 100644
--- a/sw/source/core/view/pagepreviewlayout.cxx
+++ b/sw/source/core/view/pagepreviewlayout.cxx
@@ -1357,11 +1357,7 @@ sal_uInt16 SwPagePreviewLayout::GetRowOfPage( sal_uInt16 _nPageNum ) const
         ++_nPageNum;
     }
 
-    sal_uInt16 nRow = (_nPageNum) / mnCols;
-    if ( ( (_nPageNum) % mnCols ) > 0 )
-        ++nRow;
-
-    return nRow;
+    return _nPageNum / mnCols + ((_nPageNum % mnCols)>0 ? 1 : 0);
 }
 
 /** determine column the page with the given number is in
@@ -1381,11 +1377,8 @@ sal_uInt16 SwPagePreviewLayout::GetColOfPage( sal_uInt16 _nPageNum ) const
         ++_nPageNum;
     }
 
-    sal_uInt16 nCol = (_nPageNum) % mnCols;
-    if ( nCol == 0 )
-        nCol = mnCols;
-
-    return nCol;
+    const sal_uInt16 nCol = _nPageNum % mnCols;
+    return nCol ? nCol : mnCols;
 }
 
 Size SwPagePreviewLayout::GetPreviewDocSize() const
commit f9072dfd1595aa45e41393f2e68c2635ba00e82b
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sat May 3 23:15:56 2014 +0200

    Use GetRowOfPage
    
    Change-Id: Ieb6e268223aabea42f5df0d69a8b8d4498eaba77

diff --git a/sw/source/core/view/pagepreviewlayout.cxx b/sw/source/core/view/pagepreviewlayout.cxx
index fe0efbf..4687640 100644
--- a/sw/source/core/view/pagepreviewlayout.cxx
+++ b/sw/source/core/view/pagepreviewlayout.cxx
@@ -826,17 +826,7 @@ bool SwPagePreviewLayout::CalcStartValuesForSelectedPageMove(
     sal_uInt16 nTmpRelSelPageNum = ConvertAbsoluteToRelativePageNum( mnSelectedPageNum );
     sal_uInt16 nNewRelSelectedPageNum = nTmpRelSelPageNum;
 
-    // leaving left-top-corner blank is controlled
-    // by <mbBookPreview>.
-    if ( mbBookPreview )
-    {
-        // Note: consider that left-top-corner is left blank --> +1
-        ++nTmpRelSelPageNum;
-    }
-    sal_uInt16 nTmpCol = nTmpRelSelPageNum % mnCols;
-    sal_uInt16 nCurrRow = nTmpRelSelPageNum / mnCols;
-    if ( nTmpCol > 0 )
-        ++nCurrRow;
+    const sal_uInt16 nCurrRow = GetRowOfPage(nTmpRelSelPageNum);
 
     // determine new selected page number
     {
commit 80016f5f42749a16c822ecfeebb82698f752eba8
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Thu May 1 21:54:52 2014 +0200

    OUString: avoid temporaries and constify
    
    Change-Id: I12762daed58e8006e95cc10c3ba0b1d7564a012e

diff --git a/sw/source/core/view/printdata.cxx b/sw/source/core/view/printdata.cxx
index b6df6d6..ffd0182 100644
--- a/sw/source/core/view/printdata.cxx
+++ b/sw/source/core/view/printdata.cxx
@@ -256,7 +256,7 @@ SwPrintUIOptions::SwPrintUIOptions(
     if (!bWeb)
     {
         // create subgroup for misc options
-        m_aUIProperties[ nIdx++ ].Value = setSubgroupControlOpt("pages", OUString(aLocalizedStrings.GetString(9)), OUString());
+        m_aUIProperties[ nIdx++ ].Value = setSubgroupControlOpt("pages", aLocalizedStrings.GetString(9), OUString());
 
         // create a bool option for printing automatically inserted blank pages
         bDefaultVal = rDefaultPrintData.IsPrintEmptyPages();
@@ -280,12 +280,12 @@ SwPrintUIOptions::SwPrintUIOptions(
     vcl::PrinterOptionsHelper::UIControlOptions aPrintRangeOpt;
     aPrintRangeOpt.maGroupHint = "PrintRange";
     aPrintRangeOpt.mbInternalOnly = true;
-    m_aUIProperties[nIdx++].Value = setSubgroupControlOpt("printrange", OUString(aLocalizedStrings.GetString(26)),
+    m_aUIProperties[nIdx++].Value = setSubgroupControlOpt("printrange", aLocalizedStrings.GetString(26),
                                                            OUString(),
                                                            aPrintRangeOpt);
 
     // create a choice for the content to create
-    OUString aPrintRangeName( "PrintContent" );
+    const OUString aPrintRangeName( "PrintContent" );
     uno::Sequence< OUString > aChoices( 3 );
     uno::Sequence< sal_Bool > aChoicesDisabled( 3 );
     uno::Sequence< OUString > aHelpIds( 3 );
@@ -316,8 +316,9 @@ SwPrintUIOptions::SwPrintUIOptions(
     // print content selection
     vcl::PrinterOptionsHelper::UIControlOptions aContentsOpt;
     aContentsOpt.maGroupHint = "JobPage";
-    m_aUIProperties[nIdx++].Value = setSubgroupControlOpt("extrawriterprintoptions", OUString(aLocalizedStrings.GetString(12)),
-                                                           OUString(), aContentsOpt);
+    m_aUIProperties[nIdx++].Value = setSubgroupControlOpt("extrawriterprintoptions",
+                                                          aLocalizedStrings.GetString(12),
+                                                          OUString(), aContentsOpt);
     // create a list box for notes content
     const sal_Int16 nPrintPostIts = rDefaultPrintData.GetPrintPostIts();
     aChoices.realloc( 5 );
@@ -329,12 +330,12 @@ SwPrintUIOptions::SwPrintUIOptions(
     aHelpIds.realloc( 2 );
     aHelpIds[0] = ".HelpID:vcl:PrintDialog:PrintAnnotationMode:FixedText";
     aHelpIds[1] = ".HelpID:vcl:PrintDialog:PrintAnnotationMode:ListBox";
-    vcl::PrinterOptionsHelper::UIControlOptions aAnnotOpt( OUString( "PrintProspect" ), 0, false );
+    vcl::PrinterOptionsHelper::UIControlOptions aAnnotOpt( "PrintProspect", 0, false );
     aAnnotOpt.mbEnabled = bHasPostIts;
     m_aUIProperties[ nIdx++ ].Value = setChoiceListControlOpt("writercomments",
                                                            aLocalizedStrings.GetString( 17 ),
                                                            aHelpIds,
-                                                           OUString( "PrintAnnotationMode" ),
+                                                           "PrintAnnotationMode",
                                                            aChoices,
                                                            nPrintPostIts,
                                                            uno::Sequence< sal_Bool >(),
@@ -346,7 +347,8 @@ SwPrintUIOptions::SwPrintUIOptions(
 
     if (!bWeb)
     {
-        m_aUIProperties[nIdx++].Value = setSubgroupControlOpt("pagesides", OUString(aLocalizedStrings.GetString(18)),
+        m_aUIProperties[nIdx++].Value = setSubgroupControlOpt("pagesides",
+                                                              aLocalizedStrings.GetString(18),
                                                                OUString(), aPageSetOpt);
         uno::Sequence< OUString > aRLChoices( 3 );
         aRLChoices[0] = aLocalizedStrings.GetString( 19 );
@@ -375,7 +377,7 @@ SwPrintUIOptions::SwPrintUIOptions(
 
     // create a bool option for brochure
     bDefaultVal = rDefaultPrintData.IsPrintProspect();
-    OUString aBrochurePropertyName( "PrintProspect" );
+    const OUString aBrochurePropertyName( "PrintProspect" );
     m_aUIProperties[ nIdx++ ].Value = setBoolControlOpt("brochure", aLocalizedStrings.GetString( 23 ),
                                                         ".HelpID:vcl:PrintDialog:PrintProspect:CheckBox",
                                                         aBrochurePropertyName,
@@ -399,7 +401,7 @@ SwPrintUIOptions::SwPrintUIOptions(
         m_aUIProperties[ nIdx++ ].Value = setChoiceListControlOpt("scriptdirection",
                                                                OUString(),
                                                                aBRTLHelpIds,
-                                                               OUString( "PrintProspectRTL" ),
+                                                               "PrintProspectRTL",
                                                                aBRTLChoices,
                                                                nBRTLChoice,
                                                                uno::Sequence< sal_Bool >(),
@@ -482,7 +484,7 @@ bool SwPrintUIOptions::processPropertiesAndCheckFormat( const uno::Sequence< bea
     bool bChanged = processProperties( i_rNewProp );
 
     uno::Reference< awt::XDevice >  xRenderDevice;
-    uno::Any aVal( getValue( OUString( "RenderDevice" ) ) );
+    uno::Any aVal( getValue( "RenderDevice" ) );
     aVal >>= xRenderDevice;
 
     OutputDevice* pOut = 0;
diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx
index 8ed20c6..707370b 100644
--- a/sw/source/core/view/viewimp.cxx
+++ b/sw/source/core/view/viewimp.cxx
@@ -230,7 +230,7 @@ void SwViewImp::MakeDrawView()
             pDrawView = new SwDrawView( *this, pIDDMA->GetDrawModel(), pOutDevForDrawView);
         }
 
-        GetDrawView()->SetActiveLayer(OUString("Heaven"));
+        GetDrawView()->SetActiveLayer("Heaven");
         const SwViewOption* pSwViewOption = GetShell()->GetViewOptions();
         Init(pSwViewOption);
 
commit 25b116838c504abcf94da5a0304d07826e0f9ecd
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Thu May 1 21:49:52 2014 +0200

    sal_uInt16 to sal_uInt32/size_t + constify
    
    Change-Id: I948990f551b4096aa5575090315ab66fc4eb368d

diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 305412d..416b347 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -964,8 +964,8 @@ void SwViewShell::SizeChgNotify()
             const SwPageFrm *pPage;
             if ( pCnt && 0 != (pPage = pCnt->FindPageFrm()) )
             {
-                sal_uInt16 nVirtNum = pPage->GetVirtPageNum();
-                 const SvxNumberType& rNum = pPage->GetPageDesc()->GetNumType();
+                const sal_uInt16 nVirtNum = pPage->GetVirtPageNum();
+                const SvxNumberType& rNum = pPage->GetPageDesc()->GetNumType();
                 OUString sDisplay = rNum.GetNumStr( nVirtNum );
                 PageNumNotify( this, pCnt->GetPhyPageNum(), nVirtNum, sDisplay );
             }
@@ -1073,7 +1073,7 @@ void SwViewShell::VisPortChgd( const SwRect &rRect)
                     {
                         const long nOfst = GetOut()->PixelToLogic(
                             Size(Imp()->GetDrawView()->GetMarkHdlSizePixel()/2,0)).Width();
-                        for ( sal_uInt16 i = 0;
+                        for ( sal_uInt32 i = 0;
                               i < pPage->GetSortedObjs()->Count(); ++i )
                         {
                             SwAnchoredObject* pObj = (*pPage->GetSortedObjs())[i];
@@ -1555,7 +1555,7 @@ bool SwViewShell::CheckInvalidForPaint( const SwRect &rRect )
         {
             //only of interest when something has changed in the visible range
             bool bStop = true;
-            for ( sal_uInt16 i = 0; i < pRegion->size(); ++i )
+            for ( size_t i = 0; i < pRegion->size(); ++i )
             {
                 const SwRect &rTmp = (*pRegion)[i];
                 if ( false == (bStop = rTmp.IsOver( VisArea() )) )
@@ -1577,7 +1577,7 @@ bool SwViewShell::CheckInvalidForPaint( const SwRect &rRect )
             if ( !pRegion->empty() )
             {
                 SwRegionRects aRegion( rRect );
-                for ( sal_uInt16 i = 0; i < pRegion->size(); ++i )
+                for ( size_t i = 0; i < pRegion->size(); ++i )
                 {   const SwRect &rTmp = (*pRegion)[i];
                     if ( !rRect.IsInside( rTmp ) )
                     {
@@ -1590,7 +1590,7 @@ bool SwViewShell::CheckInvalidForPaint( const SwRect &rRect )
                 }
                 if ( bRet )
                 {
-                    for ( sal_uInt16 i = 0; i < aRegion.size(); ++i )
+                    for ( size_t i = 0; i < aRegion.size(); ++i )
                         GetWin()->Invalidate( aRegion[i].SVRect() );
 
                     if ( rRect != VisArea() )
commit 8481a0bb65431d4accaba23cc14946a2316f8b1d
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Thu May 1 21:24:57 2014 +0200

    No need to use/store those OUStrings
    
    Change-Id: Ied28223690f6672fbd99984fb9a5b44353138594

diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx
index 3e2b362..ca3062a 100644
--- a/sw/source/core/view/vprint.cxx
+++ b/sw/source/core/view/vprint.cxx
@@ -22,7 +22,6 @@
 #include <com/sun/star/view/XRenderable.hpp>
 
 #include <hintids.hxx>
-#include <rtl/ustring.hxx>
 #include <sfx2/app.hxx>
 #include <sfx2/objsh.hxx>
 #include <sfx2/prnmon.hxx>
@@ -93,7 +92,6 @@ SwQueuedPaint *SwPaintQueue::pQueue = 0;
 // saves some settings from the draw view
 class SwDrawViewSave
 {
-    OUString sLayerNm;
     SdrView* pDV;
     bool bPrintControls;
 public:
@@ -661,8 +659,7 @@ SwDrawViewSave::SwDrawViewSave( SdrView* pSdrView )
 {
     if ( pDV )
     {
-        sLayerNm = "Controls";
-        bPrintControls = pDV->IsLayerPrintable( sLayerNm );
+        bPrintControls = pDV->IsLayerPrintable( "Controls" );
     }
 }
 
@@ -670,7 +667,7 @@ SwDrawViewSave::~SwDrawViewSave()
 {
     if ( pDV )
     {
-        pDV->SetLayerPrintable( sLayerNm, bPrintControls );
+        pDV->SetLayerPrintable( "Controls", bPrintControls );
     }
 }
 
@@ -687,16 +684,14 @@ void SwViewShell::PrepareForPrint( const SwPrintData &rOptions )
     if ( HasDrawView() )
     {
         SdrView *pDrawView = GetDrawView();
-        OUString sLayerNm;
-        sLayerNm = "Controls";
         // OD 09.01.2003 #i6467# - consider, if view shell belongs to page preview
         if ( !IsPreview() )
         {
-            pDrawView->SetLayerPrintable( sLayerNm, rOptions.bPrintControl );
+            pDrawView->SetLayerPrintable( "Controls", rOptions.bPrintControl );
         }
         else
         {
-            pDrawView->SetLayerVisible( sLayerNm, rOptions.bPrintControl );
+            pDrawView->SetLayerVisible( "Controls", rOptions.bPrintControl );
         }
     }
 }
commit 2ec7049f4885ac8b6a62a4132359a2470194082a
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Thu May 1 21:20:29 2014 +0200

    Constify 2 sal_uInt16
    
    Change-Id: I24cdc87e87f3b7d05678eeb86df9a179cba10328

diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx
index 5898fbd..3e2b362 100644
--- a/sw/source/core/view/vprint.cxx
+++ b/sw/source/core/view/vprint.cxx
@@ -221,7 +221,7 @@ void SwViewShell::ChgAllPageOrientation( sal_uInt16 eOri )
     OSL_ENSURE( mnStartAction, "missing an Action" );
     SET_CURR_SHELL( this );
 
-    sal_uInt16 nAll = GetDoc()->GetPageDescCnt();
+    const sal_uInt16 nAll = GetDoc()->GetPageDescCnt();
     bool bNewOri = Orientation(eOri) == ORIENTATION_PORTRAIT ? sal_False : sal_True;
 
     for( sal_uInt16 i = 0; i < nAll; ++ i )
@@ -261,7 +261,7 @@ void SwViewShell::ChgAllPageSize( Size &rSz )
     SET_CURR_SHELL( this );
 
     SwDoc* pMyDoc = GetDoc();
-    sal_uInt16 nAll = pMyDoc->GetPageDescCnt();
+    const sal_uInt16 nAll = pMyDoc->GetPageDescCnt();
 
     for( sal_uInt16 i = 0; i < nAll; ++i )
     {
commit d9b718e37a0f62c9990105c10285e02e85437e3a
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Thu May 1 12:44:28 2014 +0200

    Constify two OUStrings
    
    Change-Id: Ia136841959480212b2f7e525544e5e2f52064990

diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index f79461f..0807494 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -1909,14 +1909,14 @@ Err:
 
 OUString read_uInt8_BeltAndBracesString(SvStream& rStrm, rtl_TextEncoding eEnc)
 {
-    OUString aRet = read_uInt8_lenPrefixed_uInt8s_ToOUString(rStrm, eEnc);
+    const OUString aRet = read_uInt8_lenPrefixed_uInt8s_ToOUString(rStrm, eEnc);
     rStrm.SeekRel(sizeof(sal_uInt8)); // skip null-byte at end
     return aRet;
 }
 
 OUString read_uInt16_BeltAndBracesString(SvStream& rStrm)
 {
-    OUString aRet = read_uInt16_PascalString(rStrm);
+    const OUString aRet = read_uInt16_PascalString(rStrm);
     rStrm.SeekRel(sizeof(sal_Unicode)); // skip null-byte at end
     return aRet;
 }
commit 207a86dfc5377ed7a8affa365f56a6bae6f889b5
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Wed Apr 30 23:59:46 2014 +0200

    sal_uInt16: constify and reduce scope + int to sal_uInt16
    
    Change-Id: I68757c5e8367d97d707c77df2b7cf5ba6404ab58

diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index cf42ae8..f79461f 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -849,7 +849,7 @@ inline sal_uInt8 Get_Byte( sal_uInt8 *& p )
 
 inline sal_uInt16 Get_UShort( sal_uInt8 *& p )
 {
-    sal_uInt16 n = SVBT16ToShort( *(SVBT16*)p );
+    const sal_uInt16 n = SVBT16ToShort( *(SVBT16*)p );
     p += 2;
     return n;
 }
@@ -980,11 +980,11 @@ void WW8PLCFx_PCDAttrs::GetSprms(WW8PLCFxDesc* p)
         return;
     }
 
-    sal_uInt16 nPrm = SVBT16ToShort( ( (WW8_PCD*)pData )->prm );
+    const sal_uInt16 nPrm = SVBT16ToShort( ( (WW8_PCD*)pData )->prm );
     if ( nPrm & 1 )
     {
         // PRM Variant 2
-        sal_uInt16 nSprmIdx = nPrm >> 1;
+        const sal_uInt16 nSprmIdx = nPrm >> 1;
 
         if( nSprmIdx >= nGrpprls )
         {
@@ -1101,7 +1101,7 @@ void WW8PLCFx_PCDAttrs::GetSprms(WW8PLCFxDesc* p)
                 };
 
                 // find real Sprm Id:
-                sal_uInt16 nSprmId = aSprmId[ nSprmListIdx ];
+                const sal_uInt16 nSprmId = aSprmId[ nSprmListIdx ];
 
                 if( nSprmId )
                 {
@@ -2418,7 +2418,7 @@ void WW8PLCFx_Fc_FKP::WW8Fkp::FillEntry(WW8PLCFx_Fc_FKP::WW8Fkp::Entry &rEntry,
         return;
     }
 
-    sal_uInt16 nAvailableData = sizeof(maRawData)-nDataOffset;
+    const sal_uInt16 nAvailableData = sizeof(maRawData)-nDataOffset;
     OSL_ENSURE(nLen <= nAvailableData, "srpm sequence len is out of range, clipping");
     rEntry.mnLen = std::min(nLen, nAvailableData);
     rEntry.mpData = maRawData + nDataOffset;
@@ -2550,7 +2550,8 @@ WW8PLCFx_Fc_FKP::WW8Fkp::WW8Fkp(ww::WordVersion eVersion, SvStream* pSt,
                                 aEntry.mnLen=0; //Too short, ignore
                         }
 
-                        sal_uInt16 nSpId = aEntry.mnLen ? maSprmParser.GetSprmId(aEntry.mpData) : 0;
+                        const sal_uInt16 nSpId = aEntry.mnLen
+                            ? maSprmParser.GetSprmId(aEntry.mpData) : 0;
 
                         /*
                          If we replace then we throw away the old data, if we
@@ -2564,7 +2565,7 @@ WW8PLCFx_Fc_FKP::WW8Fkp::WW8Fkp(ww::WordVersion eVersion, SvStream* pSt,
                             sal_uInt32 nPos = SVBT32ToUInt32(aEntry.mpData + 2);
                             if (checkSeek(*pDataSt, nPos))
                             {
-                                sal_uInt16 nOrigLen = bExpand ? aEntry.mnLen : 0;
+                                const sal_uInt16 nOrigLen = bExpand ? aEntry.mnLen : 0;
                                 sal_uInt8 *pOrigData = bExpand ? aEntry.mpData : 0;
 
                                 pDataSt->ReadUInt16( aEntry.mnLen );
@@ -3508,7 +3509,7 @@ bool WW8PLCFx_SEPX::Find4Sprms(sal_uInt16 nId1,sal_uInt16 nId2,sal_uInt16 nId3,s
     while (i + maSprmParser.MinSprmLen() <= nSprmSiz)
     {
         // Sprm found?
-        sal_uInt16 nAktId = maSprmParser.GetSprmId(pSp);
+        const sal_uInt16 nAktId = maSprmParser.GetSprmId(pSp);
         bool bOk = true;
         if( nAktId  == nId1 )
             p1 = pSp + maSprmParser.DistanceToData(nId1);
@@ -3522,8 +3523,8 @@ bool WW8PLCFx_SEPX::Find4Sprms(sal_uInt16 nId1,sal_uInt16 nId2,sal_uInt16 nId3,s
             bOk = false;
         bFound |= bOk;
         // increment pointer so that it points to next SPRM
-        sal_uInt16 x = maSprmParser.GetSprmSize(nAktId, pSp);
-        i = i + x;
+        const sal_uInt16 x = maSprmParser.GetSprmSize(nAktId, pSp);
+        i += x;
         pSp += x;
     }
     return bFound;
@@ -3540,7 +3541,7 @@ const sal_uInt8* WW8PLCFx_SEPX::HasSprm( sal_uInt16 nId, sal_uInt8 n2nd ) const
     while (i + maSprmParser.MinSprmLen() <= nSprmSiz)
     {
         // Sprm found?
-        sal_uInt16 nAktId = maSprmParser.GetSprmId(pSp);
+        const sal_uInt16 nAktId = maSprmParser.GetSprmId(pSp);
         if (nAktId == nId)
         {
             sal_uInt8 *pRet = pSp + maSprmParser.DistanceToData(nId);
@@ -3548,8 +3549,8 @@ const sal_uInt8* WW8PLCFx_SEPX::HasSprm( sal_uInt16 nId, sal_uInt8 n2nd ) const
                 return pRet;
         }
         // increment pointer so that it points to next SPRM
-        sal_uInt16 x = maSprmParser.GetSprmSize(nAktId, pSp);
-        i = i + x;
+        const sal_uInt16 x = maSprmParser.GetSprmSize(nAktId, pSp);
+        i += x;
         pSp += x;
     }
 
@@ -4079,7 +4080,7 @@ long WW8PLCFx_Book::GetLen() const
         OSL_ENSURE( !this, "Incorrect call (2) of PLCF_Book::GetLen()" );
         return 0;
     }
-    sal_uInt16 nEndIdx = SVBT16ToShort( *((SVBT16*)p) );
+    const sal_uInt16 nEndIdx = SVBT16ToShort( *((SVBT16*)p) );
     long nNum = pBook[1]->GetPos( nEndIdx );
     nNum -= nStartPos;
     return nNum;
@@ -4326,7 +4327,6 @@ WW8PLCFMan::WW8PLCFMan(WW8ScannerBase* pBase, ManTypes nType, long nStartCp,
     memset( aD, 0, sizeof( aD ) );
     nLineEnd = WW8_CP_MAX;
     nManType = nType;
-    sal_uInt16 i;
 
     if( MAN_MAINTEXT == nType )
     {
@@ -4432,7 +4432,7 @@ WW8PLCFMan::WW8PLCFMan(WW8ScannerBase* pBase, ManTypes nType, long nStartCp,
     // initialisieren der Member-Vars Low-Level
     GetChpPLCF()->ResetAttrStartEnd();
     GetPapPLCF()->ResetAttrStartEnd();
-    for( i=0; i < nPLCF; i++)
+    for( sal_uInt16 i=0; i < nPLCF; ++i)
     {
         WW8PLCFxDesc* p = &aD[i];
 
@@ -4457,7 +4457,7 @@ WW8PLCFMan::WW8PLCFMan(WW8ScannerBase* pBase, ManTypes nType, long nStartCp,
     }
 
     // initialisieren der Member-Vars High-Level
-    for( i=0; i<nPLCF; i++){
+    for( sal_uInt16 i=0; i<nPLCF; ++i){
         WW8PLCFxDesc* p = &aD[i];
 
         if( !p->pPLCFx )
@@ -4504,9 +4504,8 @@ sal_uInt16 WW8PLCFMan::WhereIdx(bool* pbStart, long* pPos) const
     long nNext = LONG_MAX;  // SuchReihenfolge:
     sal_uInt16 nNextIdx = nPLCF;// first ending found ( CHP, PAP, ( SEP ) ),
     bool bStart = true;     // dann Anfaenge finden ( ( SEP ), PAP, CHP )
-    sal_uInt16 i;
     const WW8PLCFxDesc* pD;
-    for (i=0; i < nPLCF; i++)
+    for (sal_uInt16 i=0; i < nPLCF; ++i)
     {
         pD = &aD[i];
         if (pD != pPcdA)
@@ -4520,7 +4519,7 @@ sal_uInt16 WW8PLCFMan::WhereIdx(bool* pbStart, long* pPos) const
             }
         }
     }
-    for (i=nPLCF; i > 0; i--)
+    for (sal_uInt16 i=nPLCF; i > 0; --i)
     {
         pD = &aD[i-1];
         if (pD != pPcdA)
@@ -4561,26 +4560,26 @@ void WW8PLCFMan::SeekPos( long nNewCp )
 
 void WW8PLCFMan::SaveAllPLCFx( WW8PLCFxSaveAll& rSave ) const
 {
-    sal_uInt16 i, n=0;
+    sal_uInt16 n=0;
     if( pPcd )
         pPcd->Save(  rSave.aS[n++] );
     if( pPcdA )
         pPcdA->Save( rSave.aS[n++] );
 
-    for(i=0; i<nPLCF; ++i)
+    for(sal_uInt16 i=0; i<nPLCF; ++i)
         if( pPcd != &aD[i] && pPcdA != &aD[i] )
             aD[i].Save( rSave.aS[n++] );
 }
 
 void WW8PLCFMan::RestoreAllPLCFx( const WW8PLCFxSaveAll& rSave )
 {
-    sal_uInt16 i, n=0;
+    sal_uInt16 n=0;
     if( pPcd )
         pPcd->Restore(  rSave.aS[n++] );
     if( pPcdA )
         pPcdA->Restore( rSave.aS[n++] );
 
-    for(i=0; i<nPLCF; ++i)
+    for(sal_uInt16 i=0; i<nPLCF; ++i)
         if( pPcd != &aD[i] && pPcdA != &aD[i] )
             aD[i].Restore( rSave.aS[n++] );
 }
@@ -4676,7 +4675,7 @@ void WW8PLCFMan::GetNoSprmEnd( short nIdx, WW8PLCFManResult* pRes ) const
 
 bool WW8PLCFMan::TransferOpenSprms(std::stack<sal_uInt16> &rStack)
 {
-    for (int i = 0; i < nPLCF; ++i)
+    for (sal_uInt16 i = 0; i < nPLCF; ++i)
     {
         WW8PLCFxDesc* p = &aD[i];
         if (!p || !p->pIdStk)
@@ -4697,7 +4696,7 @@ void WW8PLCFMan::AdvSprm(short nIdx, bool bStart)
     p->bFirstSprm = false;
     if( bStart )
     {
-        sal_uInt16 nLastId = GetId(p);
+        const sal_uInt16 nLastId = GetId(p);
         p->pIdStk->push(nLastId);   // merke Id fuer Attribut-Ende
 
         if( p->nSprmsLen )
@@ -4707,7 +4706,7 @@ void WW8PLCFMan::AdvSprm(short nIdx, bool bStart)
             if( p->pMemPos )
             {
                 // Length of last sprm
-                sal_uInt16 nSprmL = maSprmParser.GetSprmSize(nLastId, p->pMemPos);
+                const sal_uInt16 nSprmL = maSprmParser.GetSprmSize(nLastId, p->pMemPos);
 
                 // Gesamtlaenge Sprms um SprmLaenge verringern
                 p->nSprmsLen -= nSprmL;
@@ -4859,7 +4858,7 @@ void WW8PLCFMan::AdvNoSprm(short nIdx, bool bStart)
 void WW8PLCFMan::advance()
 {
     bool bStart;
-    sal_uInt16 nIdx = WhereIdx(&bStart);
+    const sal_uInt16 nIdx = WhereIdx(&bStart);
     if (nIdx < nPLCF)
     {
         WW8PLCFxDesc* p = &aD[nIdx];
@@ -4881,7 +4880,7 @@ bool WW8PLCFMan::Get(WW8PLCFManResult* pRes) const
 {
     memset( pRes, 0, sizeof( WW8PLCFManResult ) );
     bool bStart;
-    sal_uInt16 nIdx = WhereIdx(&bStart);
+    const sal_uInt16 nIdx = WhereIdx(&bStart);
 
     if( nIdx >= nPLCF )
     {
@@ -5947,16 +5946,16 @@ WW8Style::WW8Style(SvStream& rStream, WW8Fib& rFibPara)
     if (cbStshi < nMinValidStshi)
         return;
 
-    sal_uInt16 nRead = cbStshi;
+    const sal_uInt16 nRead = cbStshi;
     do
     {
-        sal_uInt16 a16Bit;
-
         rSt.ReadUInt16( cstd );
 
         rSt.ReadUInt16( cbSTDBaseInFile );
 
         if(  6 > nRead ) break;
+
+        sal_uInt16 a16Bit;
         rSt.ReadUInt16( a16Bit );
         fStdStylenamesWritten = a16Bit & 0x0001;
 
@@ -5995,7 +5994,7 @@ WW8Style::WW8Style(SvStream& rStream, WW8Fib& rFibPara)
     //There will be stshi.cstd (cbSTD, STD) pairs in the file following the
     //STSHI. Note that styles can be empty, i.e. cbSTD == 0
     const sal_uInt32 nMinRecordSize = sizeof(sal_uInt16);
-    sal_uInt16 nMaxPossibleRecords = nRemaining/nMinRecordSize;
+    const sal_uInt16 nMaxPossibleRecords = nRemaining/nMinRecordSize;
 
     OSL_ENSURE(cstd <= nMaxPossibleRecords,
         "allegedly more styles that available data\n");
@@ -6013,7 +6012,7 @@ WW8_STD* WW8Style::Read1STDFixed( short& rSkip, short* pcbStd )
     sal_uInt16 cbStd(0);
     rSt.ReadUInt16( cbStd );   // lies Laenge
 
-    sal_uInt16 nRead = cbSTDBaseInFile;
+    const sal_uInt16 nRead = cbSTDBaseInFile;
     if( cbStd >= cbSTDBaseInFile )
     {
         // Fixed part vollst. vorhanden
@@ -6024,10 +6023,9 @@ WW8_STD* WW8Style::Read1STDFixed( short& rSkip, short* pcbStd )
 
         do
         {
-            sal_uInt16 a16Bit;
-
             if( 2 > nRead ) break;
-            a16Bit = 0;
+
+            sal_uInt16 a16Bit = 0;
             rSt.ReadUInt16( a16Bit );
             pStd->sti          =        a16Bit & 0x0fff  ;
             pStd->fScratch     = sal_uInt16(0 != ( a16Bit & 0x1000 ));
@@ -6209,7 +6207,7 @@ namespace
         {
             //p[0] is cbFfnM1, the alleged total length of FFN - 1.
             //i.e. length after cbFfnM1
-            sal_uInt16 cbFfnM1 = *p++;
+            const sal_uInt16 cbFfnM1 = *p++;
             --nRemaining;
 
             if (cbFfnM1 > nRemaining)
@@ -6258,7 +6256,7 @@ WW8Fonts::WW8Fonts( SvStream& rSt, WW8Fib& rFib )
 
     // read all font information
     nFFn = rSt.Read(pA, nFFn);
-    sal_uInt16 nCalcMax = calcMaxFonts(pA, nFFn);
+    const sal_uInt16 nCalcMax = calcMaxFonts(pA, nFFn);
 
     if (eVersion < ww::eWW8)
         nMax = nCalcMax;
@@ -7338,7 +7336,7 @@ sal_uInt8* wwSprmParser::findSprmData(sal_uInt16 nId, sal_uInt8* pSprms,
 {
     while (nLen >= MinSprmLen())
     {
-        sal_uInt16 nAktId = GetSprmId(pSprms);
+        const sal_uInt16 nAktId = GetSprmId(pSprms);
         // gib Zeiger auf Daten
         sal_uInt16 nSize = GetSprmSize(nAktId, pSprms);
 


More information about the Libreoffice-commits mailing list