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

Matteo Casalin matteo.casalin at yahoo.com
Sat Sep 6 03:14:52 PDT 2014


 sw/inc/editsh.hxx                                       |    2 
 sw/inc/expfld.hxx                                       |   10 
 sw/inc/ftnidx.hxx                                       |    2 
 sw/source/core/access/accfrmobjmap.cxx                  |    4 
 sw/source/core/access/accfrmobjslist.cxx                |   10 
 sw/source/core/access/accfrmobjslist.hxx                |    2 
 sw/source/core/access/accportions.cxx                   |   13 -
 sw/source/core/access/accportions.hxx                   |   10 
 sw/source/core/crsr/trvlfnfl.cxx                        |    6 
 sw/source/core/doc/DocumentContentOperationsManager.cxx |   12 -
 sw/source/core/doc/docftn.cxx                           |   14 -
 sw/source/core/doc/doclay.cxx                           |    2 
 sw/source/core/doc/ftnidx.cxx                           |   28 +-
 sw/source/core/docnode/ndsect.cxx                       |    2 
 sw/source/core/draw/dcontact.cxx                        |    4 
 sw/source/core/draw/dview.cxx                           |    5 
 sw/source/core/edit/edattr.cxx                          |    6 
 sw/source/core/fields/expfld.cxx                        |   11 
 sw/source/core/frmedt/feshview.cxx                      |   10 
 sw/source/core/frmedt/fetab.cxx                         |    2 
 sw/source/core/inc/SwPortionHandler.hxx                 |    8 
 sw/source/core/inc/noteurl.hxx                          |    3 
 sw/source/core/inc/scriptinfo.hxx                       |   25 +-
 sw/source/core/inc/sortedobjs.hxx                       |   12 -
 sw/source/core/layout/anchoredobject.cxx                |   16 -
 sw/source/core/layout/atrfrm.cxx                        |    2 
 sw/source/core/layout/calcmove.cxx                      |    6 
 sw/source/core/layout/flowfrm.cxx                       |    7 
 sw/source/core/layout/fly.cxx                           |   36 +--
 sw/source/core/layout/flycnt.cxx                        |    2 
 sw/source/core/layout/flylay.cxx                        |   10 
 sw/source/core/layout/frmtool.cxx                       |   32 +-
 sw/source/core/layout/hffrm.cxx                         |   11 
 sw/source/core/layout/layact.cxx                        |   20 -
 sw/source/core/layout/laycache.cxx                      |    4 
 sw/source/core/layout/objectformatter.cxx               |    9 
 sw/source/core/layout/objectformatterlayfrm.cxx         |    9 
 sw/source/core/layout/objectformattertxtfrm.cxx         |   13 -
 sw/source/core/layout/pagechg.cxx                       |   33 +-
 sw/source/core/layout/paintfrm.cxx                      |    6 
 sw/source/core/layout/sectfrm.cxx                       |    9 
 sw/source/core/layout/sortedobjs.cxx                    |   16 -
 sw/source/core/layout/ssfrm.cxx                         |   20 -
 sw/source/core/layout/tabfrm.cxx                        |   10 
 sw/source/core/layout/trvlfrm.cxx                       |    6 
 sw/source/core/layout/wsfrm.cxx                         |   26 +-
 sw/source/core/text/EnhancedPDFExportHelper.cxx         |   30 +-
 sw/source/core/text/atrstck.cxx                         |   13 -
 sw/source/core/text/frmcrsr.cxx                         |   20 -
 sw/source/core/text/frmform.cxx                         |    2 
 sw/source/core/text/frmpaint.cxx                        |    4 
 sw/source/core/text/guess.cxx                           |    6 
 sw/source/core/text/inftxt.hxx                          |   15 -
 sw/source/core/text/itradj.cxx                          |   14 -
 sw/source/core/text/itratr.cxx                          |  178 +++++++---------
 sw/source/core/text/itratr.hxx                          |    2 
 sw/source/core/text/itrcrsr.cxx                         |   14 -
 sw/source/core/text/itrform2.cxx                        |   40 +--
 sw/source/core/text/itrpaint.cxx                        |    4 
 sw/source/core/text/noteurl.cxx                         |   21 -
 sw/source/core/text/porexp.cxx                          |    9 
 sw/source/core/text/porfld.cxx                          |   66 ++---
 sw/source/core/text/porfly.cxx                          |    2 
 sw/source/core/text/porlay.cxx                          |   87 +++----
 sw/source/core/text/porlin.cxx                          |    3 
 sw/source/core/text/pormulti.cxx                        |   22 -
 sw/source/core/text/pormulti.hxx                        |    2 
 sw/source/core/text/porref.cxx                          |    3 
 sw/source/core/text/porrst.cxx                          |    4 
 sw/source/core/text/portox.cxx                          |    3 
 sw/source/core/text/portxt.cxx                          |    2 
 sw/source/core/text/redlnitr.cxx                        |   21 -
 sw/source/core/text/txtdrop.cxx                         |    7 
 sw/source/core/text/txtfly.cxx                          |   28 +-
 sw/source/core/text/txtfrm.cxx                          |   16 -
 sw/source/core/text/txtftn.cxx                          |   10 
 sw/source/core/text/txthyph.cxx                         |   12 -
 sw/source/core/text/xmldump.cxx                         |   14 -
 sw/source/core/tox/tox.cxx                              |  110 +++------
 sw/source/core/txtnode/atrftn.cxx                       |   56 ++---
 sw/source/core/txtnode/atrtox.cxx                       |    2 
 sw/source/core/txtnode/fntcache.cxx                     |   99 +++-----
 sw/source/core/txtnode/fntcap.cxx                       |   12 -
 sw/source/core/txtnode/ndtxt.cxx                        |  118 ++--------
 sw/source/core/txtnode/swfont.cxx                       |   16 -
 sw/source/core/txtnode/thints.cxx                       |   16 -
 sw/source/core/txtnode/txatritr.cxx                     |    6 
 sw/source/core/txtnode/txtatr2.cxx                      |    6 
 sw/source/core/undo/rolbck.cxx                          |   18 -
 sw/source/core/undo/undobj.cxx                          |    2 
 sw/source/core/unocore/unoobj2.cxx                      |    2 
 sw/source/core/view/viewsh.cxx                          |    3 
 sw/source/ui/fldui/fldref.cxx                           |   18 -
 93 files changed, 737 insertions(+), 927 deletions(-)

New commits:
commit 0a26e27d789736f87607435b9df3206274f0a363
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Fri Sep 5 08:54:40 2014 +0200

    sal_uInt16: use more proper types, avoid unneeded casts, constify
    
    Change-Id: Ic30441307eaa391868ffbb85a67d1c0327258084

diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index b3960cc..83767a7 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -1076,14 +1076,14 @@ void SwTaggedPDFHelper::BeginBlockStructureElements()
                 // This is the default. If the paragraph could not be mapped to
                 // any of the standard pdf tags, we write a user defined tag
                 // <stylename> with role = P
-                nPDFType = static_cast<sal_uInt16>(vcl::PDFWriter::Paragraph);
+                nPDFType = vcl::PDFWriter::Paragraph;
                 aPDFType = sStyleName;
 
                 // Quotations: BlockQuote
 
                 if (sStyleName.equalsAscii(aQuotations))
                 {
-                    nPDFType = static_cast<sal_uInt16>(vcl::PDFWriter::BlockQuote);
+                    nPDFType = vcl::PDFWriter::BlockQuote;
                     aPDFType = OUString(aBlockQuoteString);
                 }
 
@@ -1091,7 +1091,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements()
 
                 else if (sStyleName.equalsAscii(aCaption))
                 {
-                    nPDFType = static_cast<sal_uInt16>(vcl::PDFWriter::Caption);
+                    nPDFType = vcl::PDFWriter::Caption;
                     aPDFType = OUString(aCaptionString);
                 }
 
@@ -1099,7 +1099,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements()
 
                 else if (sParentStyleName.equalsAscii(aCaption))
                 {
-                    nPDFType = static_cast<sal_uInt16>(vcl::PDFWriter::Caption);
+                    nPDFType = vcl::PDFWriter::Caption;
                     aPDFType = sStyleName + aCaptionString;
                 }
 
@@ -1107,7 +1107,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements()
 
                 else if (sStyleName.equalsAscii(aHeading))
                 {
-                    nPDFType = static_cast<sal_uInt16>(vcl::PDFWriter::Heading);
+                    nPDFType = vcl::PDFWriter::Heading;
                     aPDFType = OUString(aHString);
                 }
 
@@ -1116,7 +1116,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements()
                 if ( pTxtNd->IsOutline() )
                 {
                     int nRealLevel = pTxtNd->GetAttrOutlineLevel()-1;
-                   nRealLevel = nRealLevel > 5 ? 5 : nRealLevel;
+                    nRealLevel = nRealLevel > 5 ? 5 : nRealLevel;
 
                     nPDFType =  static_cast<sal_uInt16>(vcl::PDFWriter::H1 + nRealLevel);
                     switch(nRealLevel)
@@ -1375,7 +1375,7 @@ void SwTaggedPDFHelper::BeginInlineStructureElements()
                 else
                 {
                     const LanguageType nCurrentLanguage = rInf.GetFont()->GetLanguage();
-                    const sal_uInt16 nFont = rInf.GetFont()->GetActual();
+                    const sal_uInt8 nFont = rInf.GetFont()->GetActual();
                     const LanguageType nDefaultLang = SwEnhancedPDFExportHelper::GetDefaultLanguage();
 
                     if ( UNDERLINE_NONE    != rInf.GetFont()->GetUnderline() ||
@@ -1699,8 +1699,8 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
                         const bool bHeaderFooter = pDoc->IsInHeaderFooter( aPos.nNode );
 
                         // Create links for all selected rectangles:
-                        const sal_uInt16 nNumOfRects = aTmp.size();
-                        for ( sal_uInt16 i = 0; i < nNumOfRects; ++i )
+                        const size_t nNumOfRects = aTmp.size();
+                        for ( size_t i = 0; i < nNumOfRects; ++i )
                         {
                             // Link Rectangle
                             const SwRect& rLinkRect( aTmp[ i ] );
@@ -1739,8 +1739,8 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
         // HYPERLINKS (Graphics, Frames, OLEs )
 
         const SwFrmFmts* pTbl = pDoc->GetSpzFrmFmts();
-        const sal_uInt16 nSpzFrmFmtsCount = pTbl->size();
-        for( sal_uInt16 n = 0; n < nSpzFrmFmtsCount; ++n )
+        const size_t nSpzFrmFmtsCount = pTbl->size();
+        for( size_t n = 0; n < nSpzFrmFmtsCount; ++n )
         {
             const SwFrmFmt* pFrmFmt = (*pTbl)[n];
             const SfxPoolItem* pItem;
@@ -1868,8 +1868,8 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
                         const bool bHeaderFooter = pDoc->IsInHeaderFooter( aPos.nNode );
 
                         // Create links for all selected rectangles:
-                        const sal_uInt16 nNumOfRects = aTmp.size();
-                        for ( sal_uInt16 i = 0; i < nNumOfRects; ++i )
+                        const size_t nNumOfRects = aTmp.size();
+                        for ( size_t i = 0; i < nNumOfRects; ++i )
                         {
                             // Link rectangle
                             const SwRect& rLinkRect( aTmp[ i ] );
@@ -1908,8 +1908,8 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
 
         // FOOTNOTES
 
-        const sal_uInt16 nFtnCount = pDoc->GetFtnIdxs().size();
-        for ( sal_uInt16 nIdx = 0; nIdx < nFtnCount; ++nIdx )
+        const size_t nFtnCount = pDoc->GetFtnIdxs().size();
+        for ( size_t nIdx = 0; nIdx < nFtnCount; ++nIdx )
         {
             // Set cursor to text node that contains the footnote:
             const SwTxtFtn* pTxtFtn = pDoc->GetFtnIdxs()[ nIdx ];
diff --git a/sw/source/core/text/atrstck.cxx b/sw/source/core/text/atrstck.cxx
index d0d3f02..14e6717 100644
--- a/sw/source/core/text/atrstck.cxx
+++ b/sw/source/core/text/atrstck.cxx
@@ -68,8 +68,7 @@
  * NUM_DEFAULT_VALUES.
  * Also adjust NUM_ATTRIBUTE_STACKS in atrhndl.hxx.
  */
-const sal_uInt8 StackPos[ static_cast<sal_uInt16>(RES_TXTATR_WITHEND_END) -
-                     static_cast<sal_uInt16>(RES_CHRATR_BEGIN) + 1 ] =
+const sal_uInt8 StackPos[ RES_TXTATR_WITHEND_END - RES_CHRATR_BEGIN + 1 ] =
 {
      0, //                                       //  0
      1, // RES_CHRATR_CASEMAP = RES_CHRATR_BEGIN //  1
@@ -508,7 +507,7 @@ void SwAttrHandler::PopAndChg( const SwTxtAttr& rAttr, SwFont& rFnt )
             if ( bRet )
             {
                 // we remove rAttr from the appropriate stack
-                sal_uInt16 nStackPos = StackPos[ i ];
+                const sal_uInt16 nStackPos = StackPos[ i ];
                 aAttrStack[ nStackPos ].Remove( rAttr );
                 // reset font according to attribute on top of stack
                 // or default value
@@ -590,7 +589,7 @@ void SwAttrHandler::ActivateTop( SwFont& rFnt, const sal_uInt16 nAttr )
     {
         // ruby stack has no more attributes
         // check, if an rotation attribute has to be applied
-        sal_uInt16 nTwoLineStack = StackPos[ RES_CHRATR_TWO_LINES ];
+        const sal_uInt16 nTwoLineStack = StackPos[ RES_CHRATR_TWO_LINES ];
         bool bTwoLineAct = false;
         const SwTxtAttr* pTwoLineAttr = aAttrStack[ nTwoLineStack ].Top();
 
@@ -607,7 +606,7 @@ void SwAttrHandler::ActivateTop( SwFont& rFnt, const sal_uInt16 nAttr )
             return;
 
         // eventually, an rotate attribute has to be activated
-        sal_uInt16 nRotateStack = StackPos[ RES_CHRATR_ROTATE ];
+        const sal_uInt16 nRotateStack = StackPos[ RES_CHRATR_ROTATE ];
         const SwTxtAttr* pRotateAttr = aAttrStack[ nRotateStack ].Top();
 
         if ( pRotateAttr )
@@ -809,7 +808,7 @@ void SwAttrHandler::FontChg(const SfxPoolItem& rItem, SwFont& rFnt, bool bPush )
             if ( bRuby )
                 break;
 
-            sal_uInt16 nTwoLineStack = StackPos[ RES_CHRATR_TWO_LINES ];
+            const sal_uInt16 nTwoLineStack = StackPos[ RES_CHRATR_TWO_LINES ];
             bool bTwoLineAct = false;
             const SwTxtAttr* pTwoLineAttr = aAttrStack[ nTwoLineStack ].Top();
 
@@ -847,7 +846,7 @@ void SwAttrHandler::FontChg(const SfxPoolItem& rItem, SwFont& rFnt, bool bPush )
             if ( bRuby )
                 break;
 
-            sal_uInt16 nRotateStack = StackPos[ RES_CHRATR_ROTATE ];
+            const sal_uInt16 nRotateStack = StackPos[ RES_CHRATR_ROTATE ];
             const SwTxtAttr* pRotateAttr = aAttrStack[ nRotateStack ].Top();
 
             if ( pRotateAttr )
commit ba0498a696423036360f51b15f9e21f180c7dedf
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Thu Sep 4 00:21:14 2014 +0200

    Use more suitable integer types, avoid conversions, constify
    
    Change-Id: I6b7a3b763ea3e2dc6d327c61668fa413fbc60a07

diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx
index e1b771d..b18d2bf 100644
--- a/sw/source/core/text/frmcrsr.cxx
+++ b/sw/source/core/text/frmcrsr.cxx
@@ -1348,7 +1348,7 @@ void SwTxtFrm::FillCrsrPos( SwFillData& rFill ) const
     }
     SwFont *pFnt;
     SwTxtFmtColl* pColl = GetTxtNode()->GetTxtColl();
-    sal_uInt16 nFirst = GetTxtNode()->GetSwAttrSet().GetULSpace().GetLower();
+    SwTwips nFirst = GetTxtNode()->GetSwAttrSet().GetULSpace().GetLower();
     SwTwips nDiff = rFill.Y() - Frm().Bottom();
     if( nDiff < nFirst )
         nDiff = -1;
@@ -1392,7 +1392,7 @@ void SwTxtFrm::FillCrsrPos( SwFillData& rFill ) const
             nFirst = 0;
         }
         else if( nDist < nFirst )
-            nFirst = nFirst - (sal_uInt16)nDist;
+            nFirst = nFirst - nDist;
         else
             nFirst = 0;
         nDist = std::max( nDist, long( GetLineSpace() ) );
@@ -1522,7 +1522,7 @@ void SwTxtFrm::FillCrsrPos( SwFillData& rFill ) const
                             const SvxTabStopItem& rTab =
                                 (const SvxTabStopItem &)pSet->
                                 GetPool()->GetDefaultItem( RES_PARATR_TABSTOP );
-                            sal_uInt16 nDefTabDist = (sal_uInt16)rTab[0].GetTabPos();
+                            const SwTwips nDefTabDist = rTab[0].GetTabPos();
                             nRightTab = nLeftTab - nTxtLeft;
                             nRightTab /= nDefTabDist;
                             nRightTab = nRightTab * nDefTabDist + nTxtLeft;
diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx
index df7195a..4b480cd4 100644
--- a/sw/source/core/text/frmpaint.cxx
+++ b/sw/source/core/text/frmpaint.cxx
@@ -108,7 +108,7 @@ SwExtraPainter::SwExtraPainter( const SwTxtFrm *pFrm, SwViewShell *pVwSh,
         if( aRect.Bottom() > nBottom )
             aRect.Bottom( nBottom );
     }
-    sal_uInt16 nVirtPageNum = 0;
+    int nVirtPageNum = 0;
     if( bLineNum )
     {
         /* Initializes the Members necessary for line numbering:
@@ -483,7 +483,7 @@ bool SwTxtFrm::PaintEmpty( const SwRect &rRect, bool bCheck ) const
             const IDocumentRedlineAccess* pIDRA = rTxtNode.getIDocumentRedlineAccess();
             if( IDocumentRedlineAccess::IsShowChanges( pIDRA->GetRedlineMode() ) )
             {
-                sal_uInt16 nRedlPos = pIDRA->GetRedlinePos( rTxtNode, USHRT_MAX );
+                const sal_uInt16 nRedlPos = pIDRA->GetRedlinePos( rTxtNode, USHRT_MAX );
                 if( USHRT_MAX != nRedlPos )
                 {
                     SwAttrHandler aAttrHandler;
commit aaa5ed55b1c66888ad62951baaa2559d0f1bff87
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Wed Sep 3 20:39:27 2014 +0200

    No need to differentiate between 1 and 2: only !=0 matters
    
    Change-Id: I981472a0b33c6f35f87d891fc7b70c92e621bf95

diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx
index 93c9ea1..e1b771d 100644
--- a/sw/source/core/text/frmcrsr.cxx
+++ b/sw/source/core/text/frmcrsr.cxx
@@ -651,16 +651,8 @@ bool SwTxtFrm::_GetCrsrOfst(SwPosition* pPos, const Point& rPoint,
 bool SwTxtFrm::GetCrsrOfst(SwPosition* pPos, Point& rPoint,
                                SwCrsrMoveState* pCMS, bool ) const
 {
-    sal_uInt16 nChgFrm = 2;
-    if( pCMS )
-    {
-        if( MV_UPDOWN == pCMS->eState )
-            nChgFrm = 0;
-        else if( MV_SETONLYTEXT == pCMS->eState ||
-                 MV_TBLSEL == pCMS->eState )
-            nChgFrm = 1;
-    }
-    return _GetCrsrOfst( pPos, rPoint, nChgFrm != 0, pCMS );
+    const bool bChgFrm = !(pCMS && MV_UPDOWN == pCMS->eState);
+    return _GetCrsrOfst( pPos, rPoint, bChgFrm, pCMS );
 }
 
 /*
commit bce2c9d473dde0114d81d15a6fb217ae71669092
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Wed Sep 3 08:35:32 2014 +0200

    Reduce scope and avoid casts at each call-place
    
    Change-Id: Iade7f5e174b74ea156c0e0bafc5c7c72e4b86dbd

diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx
index 3bc0a0f..95feb44 100644
--- a/sw/source/core/text/guess.cxx
+++ b/sw/source/core/text/guess.cxx
@@ -136,7 +136,7 @@ bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf,
 
             // save maximum width for later use
             if ( nMaxSizeDiff )
-                rInf.SetMaxWidthDiff( (sal_uLong)&rPor, nMaxSizeDiff );
+                rInf.SetMaxWidthDiff( &rPor, nMaxSizeDiff );
 
             nBreakWidth += nLeftRightBorderSpace;
 
@@ -188,7 +188,7 @@ bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf,
 
             // save maximum width for later use
             if ( nMaxSizeDiff )
-                rInf.SetMaxWidthDiff( (sal_uLong)&rPor, nMaxSizeDiff );
+                rInf.SetMaxWidthDiff( &rPor, nMaxSizeDiff );
 
             nBreakWidth += nLeftRightBorderSpace;
 
@@ -508,7 +508,7 @@ bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf,
 
         // save maximum width for later use
         if ( nMaxSizeDiff )
-            rInf.SetMaxWidthDiff( (sal_uLong)&rPor, nMaxSizeDiff );
+            rInf.SetMaxWidthDiff( &rPor, nMaxSizeDiff );
 
         nBreakWidth += nItalic + nLeftRightBorderSpace;
     }
diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx
index d04e59b..2307627 100644
--- a/sw/source/core/text/inftxt.hxx
+++ b/sw/source/core/text/inftxt.hxx
@@ -140,10 +140,11 @@ public:
     friend SvStream & WriteSwTxtInfo( SvStream &rOS, const SwTxtInfo &rInf );
 };
 
-typedef ::std::map< sal_uLong, sal_IntPtr > SwTxtPortionMap;
-
 class SwTxtSizeInfo : public SwTxtInfo
 {
+private:
+    typedef ::std::map< sal_uIntPtr, sal_uInt16 > SwTxtPortionMap;
+
 protected:
     // during formatting, a small database is built, mapping portion pointers
     // to their maximum size (used for kana compression)
@@ -337,13 +338,13 @@ public:
     // space among compressed kanas.
     // During formatting, the maximum values of compressable portions are
     // stored in m_aMaxWidth and discarded after a line has been formatted.
-    inline void SetMaxWidthDiff( sal_uLong nKey, sal_uInt16 nVal )
+    inline void SetMaxWidthDiff( const void *nKey, sal_uInt16 nVal )
     {
-        m_aMaxWidth.insert( ::std::make_pair( nKey, nVal ) );
+        m_aMaxWidth.insert( ::std::make_pair( reinterpret_cast<sal_uIntPtr>(nKey), nVal ) );
     };
-    inline sal_uInt16 GetMaxWidthDiff( sal_uLong nKey )
+    inline sal_uInt16 GetMaxWidthDiff( const void *nKey )
     {
-        SwTxtPortionMap::iterator it = m_aMaxWidth.find( nKey );
+        SwTxtPortionMap::iterator it = m_aMaxWidth.find( reinterpret_cast<sal_uIntPtr>(nKey) );
 
         if( it != m_aMaxWidth.end() )
             return it->second;
diff --git a/sw/source/core/text/itradj.cxx b/sw/source/core/text/itradj.cxx
index dc30c60..b2af4d6 100644
--- a/sw/source/core/text/itradj.cxx
+++ b/sw/source/core/text/itradj.cxx
@@ -421,11 +421,11 @@ SwTwips SwTxtAdjuster::CalcKanaAdj( SwLineLayout* pCurrent )
         {
             // get maximum portion width from info structure, calculated
             // during text formatting
-            sal_uInt16 nMaxWidthDiff = GetInfo().GetMaxWidthDiff( (sal_uLong)pPos );
+            sal_uInt16 nMaxWidthDiff = GetInfo().GetMaxWidthDiff( pPos );
 
             // check, if information is stored under other key
             if ( !nMaxWidthDiff && pPos == pCurrent->GetFirstPortion() )
-                nMaxWidthDiff = GetInfo().GetMaxWidthDiff( (sal_uLong)pCurrent );
+                nMaxWidthDiff = GetInfo().GetMaxWidthDiff( pCurrent );
 
             // calculate difference between portion width and max. width
             nKanaDiffSum += nMaxWidthDiff;
@@ -501,11 +501,11 @@ SwTwips SwTxtAdjuster::CalcKanaAdj( SwLineLayout* pCurrent )
 
             // get maximum portion width from info structure, calculated
             // during text formatting
-            sal_uInt16 nMaxWidthDiff = GetInfo().GetMaxWidthDiff( (sal_uLong)pPos );
+            sal_uInt16 nMaxWidthDiff = GetInfo().GetMaxWidthDiff( pPos );
 
             // check, if information is stored under other key
             if ( !nMaxWidthDiff && pPos == pCurrent->GetFirstPortion() )
-                nMaxWidthDiff = GetInfo().GetMaxWidthDiff( (sal_uLong)pCurrent );
+                nMaxWidthDiff = GetInfo().GetMaxWidthDiff( pCurrent );
             nKanaDiffSum += nMaxWidthDiff;
             pPos->Width( nMinWidth +
                        ( ( 10000 - nCompress ) * nMaxWidthDiff ) / 10000 );
commit 6f8a26668e559f3fd4c7699c3ff7acfa3f8f604c
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Wed Sep 3 01:38:38 2014 +0200

    sal_uInt16 to more proper types
    
    Change-Id: I3728f29e6cb869b3b5e27afd2c1dcdf857fd96de

diff --git a/sw/source/core/text/itradj.cxx b/sw/source/core/text/itradj.cxx
index c113ec1..dc30c60 100644
--- a/sw/source/core/text/itradj.cxx
+++ b/sw/source/core/text/itradj.cxx
@@ -404,7 +404,7 @@ SwTwips SwTxtAdjuster::CalcKanaAdj( SwLineLayout* pCurrent )
     pCurrent->SetKanaComp( pNewKana );
 
     const sal_uInt16 nNull = 0;
-    sal_uInt16 nKanaIdx = 0;
+    size_t nKanaIdx = 0;
     long nKanaDiffSum = 0;
     SwTwips nRepaintOfst = 0;
     SwTwips nX = 0;
@@ -725,8 +725,8 @@ SwFlyPortion *SwTxtAdjuster::CalcFlyPortion( const long nRealWidth,
             aLocal.Left( nCurrWidth );
 
         // If the rect is wider than the line, we adjust it to the right size
-        sal_uInt16 nLocalWidth = sal_uInt16( aLocal.Left() + aLocal.Width() );
-        if( nRealWidth < long( nLocalWidth ) )
+        const long nLocalWidth = aLocal.Left() + aLocal.Width();
+        if( nRealWidth < nLocalWidth )
             aLocal.Width( nRealWidth - aLocal.Left() );
         GetInfo().GetParaPortion()->SetFly( true );
         pFlyPortion = new SwFlyPortion( aLocal );
commit a219bbb62f974020fac0799143fbc51c385bb460
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Mon Sep 1 23:36:14 2014 +0200

    Simplify by early bailout
    
    Change-Id: I9815ced0495f3066f8b6477794f33bbd77c613ca

diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index 378004d..3c4451c 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -421,125 +421,116 @@ static void lcl_MinMaxNode( SwFrmFmt* pNd, SwMinMaxNodeArgs* pIn )
 {
     const SwFmtAnchor& rFmtA = pNd->GetAnchor();
 
-    bool bCalculate = false;
     if ((FLY_AT_PARA == rFmtA.GetAnchorId()) ||
         (FLY_AT_CHAR == rFmtA.GetAnchorId()))
     {
-        bCalculate = true;
-    }
-
-    if (bCalculate)
-    {
         const SwPosition *pPos = rFmtA.GetCntntAnchor();
         OSL_ENSURE(pPos && pIn, "Unexpected NULL arguments");
         if (!pPos || !pIn || pIn->nIndx != pPos->nNode.GetIndex())
-            bCalculate = false;
+            return;
     }
 
-    if (bCalculate)
+    long nMin, nMax;
+    SwHTMLTableLayout *pLayout = 0;
+    const bool bIsDrawFrmFmt = pNd->Which()==RES_DRAWFRMFMT;
+    if( !bIsDrawFrmFmt )
     {
-        long nMin, nMax;
-        SwHTMLTableLayout *pLayout = 0;
-        const bool bIsDrawFrmFmt = pNd->Which()==RES_DRAWFRMFMT;
-        if( !bIsDrawFrmFmt )
+        // Does the frame contain a table at the start or the end?
+        const SwNodes& rNodes = pNd->GetDoc()->GetNodes();
+        const SwFmtCntnt& rFlyCntnt = pNd->GetCntnt();
+        sal_uLong nStt = rFlyCntnt.GetCntntIdx()->GetIndex();
+        SwTableNode* pTblNd = rNodes[nStt+1]->GetTableNode();
+        if( !pTblNd )
         {
-            // Does the frame contain a table at the start or the end?
-            const SwNodes& rNodes = pNd->GetDoc()->GetNodes();
-            const SwFmtCntnt& rFlyCntnt = pNd->GetCntnt();
-            sal_uLong nStt = rFlyCntnt.GetCntntIdx()->GetIndex();
-            SwTableNode* pTblNd = rNodes[nStt+1]->GetTableNode();
-            if( !pTblNd )
-            {
-                SwNode *pNd2 = rNodes[nStt];
-                pNd2 = rNodes[pNd2->EndOfSectionIndex()-1];
-                if( pNd2->IsEndNode() )
-                    pTblNd = pNd2->StartOfSectionNode()->GetTableNode();
-            }
-
-            if( pTblNd )
-                pLayout = pTblNd->GetTable().GetHTMLTableLayout();
+            SwNode *pNd2 = rNodes[nStt];
+            pNd2 = rNodes[pNd2->EndOfSectionIndex()-1];
+            if( pNd2->IsEndNode() )
+                pTblNd = pNd2->StartOfSectionNode()->GetTableNode();
         }
 
-        const SwFmtHoriOrient& rOrient = pNd->GetHoriOrient();
-        sal_Int16 eHoriOri = rOrient.GetHoriOrient();
+        if( pTblNd )
+            pLayout = pTblNd->GetTable().GetHTMLTableLayout();
+    }
+
+    const SwFmtHoriOrient& rOrient = pNd->GetHoriOrient();
+    sal_Int16 eHoriOri = rOrient.GetHoriOrient();
 
-        long nDiff;
-        if( pLayout )
+    long nDiff;
+    if( pLayout )
+    {
+        nMin = pLayout->GetMin();
+        nMax = pLayout->GetMax();
+        nDiff = nMax - nMin;
+    }
+    else
+    {
+        if( bIsDrawFrmFmt )
         {
-            nMin = pLayout->GetMin();
-            nMax = pLayout->GetMax();
-            nDiff = nMax - nMin;
+            const SdrObject* pSObj = pNd->FindSdrObject();
+            if( pSObj )
+                nMin = pSObj->GetCurrentBoundRect().GetWidth();
+            else
+                nMin = 0;
+
         }
         else
         {
-            if( bIsDrawFrmFmt )
-            {
-                const SdrObject* pSObj = pNd->FindSdrObject();
-                if( pSObj )
-                    nMin = pSObj->GetCurrentBoundRect().GetWidth();
-                else
-                nMin = 0;
-
-            }
-            else
-            {
-                const SwFmtFrmSize &rSz = pNd->GetFrmSize();
-                nMin = rSz.GetWidth();
-            }
-            nMax = nMin;
-            nDiff = 0;
+            const SwFmtFrmSize &rSz = pNd->GetFrmSize();
+            nMin = rSz.GetWidth();
         }
+        nMax = nMin;
+        nDiff = 0;
+    }
 
-        const SvxLRSpaceItem &rLR = pNd->GetLRSpace();
-        nMin += rLR.GetLeft();
-        nMin += rLR.GetRight();
-        nMax += rLR.GetLeft();
-        nMax += rLR.GetRight();
+    const SvxLRSpaceItem &rLR = pNd->GetLRSpace();
+    nMin += rLR.GetLeft();
+    nMin += rLR.GetRight();
+    nMax += rLR.GetLeft();
+    nMax += rLR.GetRight();
 
-        if( SURROUND_THROUGHT == pNd->GetSurround().GetSurround() )
-        {
-            pIn->Minimum( nMin );
-            return;
-        }
+    if( SURROUND_THROUGHT == pNd->GetSurround().GetSurround() )
+    {
+        pIn->Minimum( nMin );
+        return;
+    }
 
-        // Frames, which are left- or right-aligned are only party considered
-        // when calculating the maximum, since the border is already being considered.
-        // Only if the frame extends into the text body, this part is being added
-        switch( eHoriOri )
+    // Frames, which are left- or right-aligned are only party considered
+    // when calculating the maximum, since the border is already being considered.
+    // Only if the frame extends into the text body, this part is being added
+    switch( eHoriOri )
+    {
+        case text::HoriOrientation::RIGHT:
         {
-            case text::HoriOrientation::RIGHT:
+            if( nDiff )
             {
-                if( nDiff )
-                {
-                    pIn->nRightRest -= pIn->nRightDiff;
-                    pIn->nRightDiff = nDiff;
-                }
-                if( text::RelOrientation::FRAME != rOrient.GetRelationOrient() )
-                {
-                    if( pIn->nRightRest > 0 )
-                        pIn->nRightRest = 0;
-                }
-                pIn->nRightRest -= nMin;
-                break;
+                pIn->nRightRest -= pIn->nRightDiff;
+                pIn->nRightDiff = nDiff;
             }
-            case text::HoriOrientation::LEFT:
+            if( text::RelOrientation::FRAME != rOrient.GetRelationOrient() )
             {
-                if( nDiff )
-                {
-                    pIn->nLeftRest -= pIn->nLeftDiff;
-                    pIn->nLeftDiff = nDiff;
-                }
-                if( text::RelOrientation::FRAME != rOrient.GetRelationOrient() &&
-                    pIn->nLeftRest < 0 )
-                    pIn->nLeftRest = 0;
-                pIn->nLeftRest -= nMin;
-                break;
+                if( pIn->nRightRest > 0 )
+                    pIn->nRightRest = 0;
             }
-            default:
+            pIn->nRightRest -= nMin;
+            break;
+        }
+        case text::HoriOrientation::LEFT:
+        {
+            if( nDiff )
             {
-                pIn->nMaxWidth += nMax;
-                pIn->Minimum( nMin );
+                pIn->nLeftRest -= pIn->nLeftDiff;
+                pIn->nLeftDiff = nDiff;
             }
+            if( text::RelOrientation::FRAME != rOrient.GetRelationOrient() &&
+                pIn->nLeftRest < 0 )
+                pIn->nLeftRest = 0;
+            pIn->nLeftRest -= nMin;
+            break;
+        }
+        default:
+        {
+            pIn->nMaxWidth += nMax;
+            pIn->Minimum( nMin );
         }
     }
 }
commit 6f9f11d4a3d5eb489b4c112f2c41af91136adc89
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Mon Sep 1 23:31:22 2014 +0200

    sal_uInt16 to more proper types, group a test into a bool
    
    Change-Id: I4763e1dfd3d674d36063bada83373a6e45c97303

diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index d7f648f..378004d 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -143,7 +143,8 @@ bool SwAttrIter::SeekStartAndChgAttrIter( OutputDevice* pOut, const bool bParaFo
 
     nStartIndex = 0;
     nEndIndex = 0;
-    nPos = nChgCnt = 0;
+    nPos = 0;
+    nChgCnt = 0;
     if( nPropFont )
         pFnt->SetProportion( nPropFont );
     if( pRedln )
@@ -439,8 +440,8 @@ static void lcl_MinMaxNode( SwFrmFmt* pNd, SwMinMaxNodeArgs* pIn )
     {
         long nMin, nMax;
         SwHTMLTableLayout *pLayout = 0;
-        sal_uInt16 nWhich = pNd->Which();
-        if( RES_DRAWFRMFMT != nWhich )
+        const bool bIsDrawFrmFmt = pNd->Which()==RES_DRAWFRMFMT;
+        if( !bIsDrawFrmFmt )
         {
             // Does the frame contain a table at the start or the end?
             const SwNodes& rNodes = pNd->GetDoc()->GetNodes();
@@ -471,7 +472,7 @@ static void lcl_MinMaxNode( SwFrmFmt* pNd, SwMinMaxNodeArgs* pIn )
         }
         else
         {
-            if( RES_DRAWFRMFMT == nWhich )
+            if( bIsDrawFrmFmt )
             {
                 const SdrObject* pSObj = pNd->FindSdrObject();
                 if( pSObj )
@@ -608,7 +609,7 @@ void SwTxtNode::GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rMa
     aIter.SeekAndChgAttrIter( nIdx, pOut );
     sal_Int32 nLen = m_Text.getLength();
     long nAktWidth = 0;
-    sal_uInt16 nAdd = 0;
+    long nAdd = 0;
     SwMinMaxArgs aArg( pOut, pSh, rMin, rMax, rAbsMin );
     while( nIdx < nLen )
     {
diff --git a/sw/source/core/text/itratr.hxx b/sw/source/core/text/itratr.hxx
index edd51dc..81aa9fd4 100644
--- a/sw/source/core/text/itratr.hxx
+++ b/sw/source/core/text/itratr.hxx
@@ -48,7 +48,7 @@ protected:
 
 private:
     OutputDevice *pLastOut;
-    sal_uInt16 nChgCnt;
+    short nChgCnt;
     SwRedlineItr *pRedln;
     size_t nStartIndex;
     size_t nEndIndex;
commit 4f31a00fd0bec1e083d630e3a642e451f8f1f714
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Mon Sep 1 22:45:46 2014 +0200

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

diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index 7b436dc..05c1d1c 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -62,7 +62,7 @@ static void lcl_GetCharRectInsideField( SwTxtSizeInfo& rInf, SwRect& rOrig,
 
     if ( rPor.InFldGrp() && !((SwFldPortion&)rPor).GetExp().isEmpty() )
     {
-        const sal_uInt16 nCharOfst = rCMS.pSpecialPos->nCharOfst;
+        const sal_Int32 nCharOfst = rCMS.pSpecialPos->nCharOfst;
         sal_Int32 nFldIdx = 0;
         sal_Int32 nFldLen = 0;
 
@@ -256,7 +256,7 @@ void SwTxtMargin::CtorInitTxtMargin( SwTxtFrm *pNewFrm, SwTxtSizeInfo *pNewInf )
                     break;
                     case SVX_LINE_SPACE_MIN:
                     {
-                        if( nFirstLineOfs < sal_uInt16( pSpace->GetLineHeight() ) )
+                        if( nFirstLineOfs < pSpace->GetLineHeight() )
                             nFirstLineOfs = pSpace->GetLineHeight();
                         break;
                     }
@@ -281,7 +281,7 @@ void SwTxtMargin::CtorInitTxtMargin( SwTxtFrm *pNewFrm, SwTxtSizeInfo *pNewInf )
                         nTmp /= 100;
                         if( !nTmp )
                             ++nTmp;
-                        nFirstLineOfs = (sal_uInt16)nTmp;
+                        nFirstLineOfs = nTmp;
                         break;
                     }
                     case SVX_INTER_LINE_SPACE_FIX:
@@ -416,8 +416,8 @@ bool SwTxtCursor::GetEndCharRect( SwRect* pOrig, const sal_Int32 nOfst,
     // If necessary, as catch up, do the adjustment
     GetAdjusted();
 
-    sal_uInt16 nX = 0;
-    sal_uInt16 nLast = 0;
+    long nX = 0;
+    long nLast = 0;
     SwLinePortion *pPor = pCurr->GetFirstPortion();
 
     sal_uInt16 nTmpHeight, nTmpAscent;
@@ -1572,7 +1572,7 @@ sal_Int32 SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint,
 
             if( ((SwMultiPortion*)pPor)->HasBrackets() )
             {
-                sal_uInt16 nPreWidth = ((SwDoubleLinePortion*)pPor)->PreWidth();
+                const sal_uInt16 nPreWidth = ((SwDoubleLinePortion*)pPor)->PreWidth();
                 if ( nX > nPreWidth )
                     nX = nX - nPreWidth;
                 else
commit 7ea772887bee9dde7aeb6fa3673496c7b44f525c
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Aug 31 23:07:04 2014 +0200

    Use arithmetic instead of while loop
    
    Change-Id: I35738f09ec562815f74643a547505efb6d9a0bfe

diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index e4bfb85..94156d5 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -1699,10 +1699,8 @@ void SwTxtFormatter::CalcRealHeight( bool bNewLine )
         const bool bRubyTop = ! pGrid->GetRubyTextBelow();
 
         nLineHeight = nGridWidth + nRubyHeight;
-        const sal_uInt16 nLineDist = nLineHeight;
-
-        while ( pCurr->Height() > nLineHeight )
-            nLineHeight = nLineHeight + nLineDist;
+        const sal_uInt16 nAmpRatio = (pCurr->Height() + nLineHeight - 1)/nLineHeight;
+        nLineHeight *= nAmpRatio;
 
         const sal_uInt16 nAsc = pCurr->GetAscent() +
                       ( bRubyTop ?
commit bbf64c7802ad729082434abb03a5851b5e6b3bb0
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Aug 31 22:52:10 2014 +0200

    sal_uInt16 to more proper types, constify, avoid unneeded casts
    
    Change-Id: I6e7d2c9861e9e004a48595d77b919c37409142f1

diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 3e221ef..e4bfb85 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -277,7 +277,7 @@ SwLinePortion *SwTxtFormatter::Underflow( SwTxtFormatInfo &rInf )
     {
         if( pPor->InTxtGrp() && !pPor->InExpGrp() )
         {
-            sal_uInt16 nOldWhich = pCurr->GetWhichPor();
+            const sal_uInt16 nOldWhich = pCurr->GetWhichPor();
             *(SwLinePortion*)pCurr = *pPor;
             pCurr->SetPortion( pPor->GetPortion() );
             pCurr->SetWhichPor( nOldWhich );
@@ -600,7 +600,7 @@ void SwTxtFormatter::BuildPortions( SwTxtFormatInfo &rInf )
                 if( nTmp == pScriptInfo->NextScriptChg( nTmp - 1 ) &&
                     nTmp != rInf.GetTxt().getLength() )
                 {
-                    sal_uInt16 nDist = (sal_uInt16)(rInf.GetFont()->GetHeight()/5);
+                    const sal_uInt16 nDist = (sal_uInt16)(rInf.GetFont()->GetHeight()/5);
 
                     if( nDist )
                     {
@@ -1699,12 +1699,12 @@ void SwTxtFormatter::CalcRealHeight( bool bNewLine )
         const bool bRubyTop = ! pGrid->GetRubyTextBelow();
 
         nLineHeight = nGridWidth + nRubyHeight;
-        sal_uInt16 nLineDist = nLineHeight;
+        const sal_uInt16 nLineDist = nLineHeight;
 
         while ( pCurr->Height() > nLineHeight )
             nLineHeight = nLineHeight + nLineDist;
 
-        sal_uInt16 nAsc = pCurr->GetAscent() +
+        const sal_uInt16 nAsc = pCurr->GetAscent() +
                       ( bRubyTop ?
                        ( nLineHeight - pCurr->Height() + nRubyHeight ) / 2 :
                        ( nLineHeight - pCurr->Height() - nRubyHeight ) / 2 );
@@ -1776,7 +1776,7 @@ void SwTxtFormatter::CalcRealHeight( bool bNewLine )
                 case SVX_LINE_SPACE_FIX:
                 {
                     nLineHeight = pSpace->GetLineHeight();
-                    sal_uInt16 nAsc = ( 4 * nLineHeight ) / 5;  // 80%
+                    const sal_uInt16 nAsc = ( 4 * nLineHeight ) / 5;  // 80%
                     if( nAsc < pCurr->GetAscent() ||
                         nLineHeight - nAsc < pCurr->Height() - pCurr->GetAscent() )
                         pCurr->SetClipping( true );
@@ -1827,7 +1827,7 @@ void SwTxtFormatter::CalcRealHeight( bool bNewLine )
             if ( bVert )
                 nTmpY = pFrm->SwitchHorizontalToVertical( nTmpY );
             nTmpY = (*fnRect->fnYDiff)( nTmpY, RegStart() );
-            sal_uInt16 nDiff = sal_uInt16( nTmpY % RegDiff() );
+            const sal_uInt16 nDiff = sal_uInt16( nTmpY % RegDiff() );
             if( nDiff )
                 nLineHeight += RegDiff() - nDiff;
         }
@@ -1866,7 +1866,7 @@ void SwTxtFormatter::FeedInf( SwTxtFormatInfo &rInf ) const
     rInf.Right( nTmpRight );
     rInf.First( nTmpFirst );
 
-    rInf.RealWidth( sal_uInt16(rInf.Right()) - sal_uInt16(GetLeftMargin()) );
+    rInf.RealWidth( sal_uInt16(rInf.Right() - GetLeftMargin()) );
     rInf.Width( rInf.RealWidth() );
     if( ((SwTxtFormatter*)this)->GetRedln() )
     {
@@ -2023,7 +2023,7 @@ void SwTxtFormatter::UpdatePos( SwLineLayout *pCurrent, Point aStart,
     long nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc;
     pCurrent->MaxAscentDescent( nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc );
 
-    sal_uInt16 nTmpHeight = pCurrent->GetRealHeight();
+    const sal_uInt16 nTmpHeight = pCurrent->GetRealHeight();
     sal_uInt16 nAscent = pCurrent->GetAscent() + nTmpHeight - pCurrent->Height();
     objectpositioning::AsCharFlags nFlags = AS_CHAR_ULSPACE;
     if( GetMulti() )
@@ -2176,7 +2176,7 @@ bool SwTxtFormatter::ChkFlyUnderflow( SwTxtFormatInfo &rInf ) const
     {
         // First we check, whether a fly overlaps with the line.
         // = GetLineHeight()
-        const long nHeight = GetCurr()->GetRealHeight();
+        const sal_uInt16 nHeight = GetCurr()->GetRealHeight();
         SwRect aLine( GetLeftMargin(), Y(), rInf.RealWidth(), nHeight );
 
         SwRect aLineVert( aLine );
@@ -2216,9 +2216,9 @@ bool SwTxtFormatter::ChkFlyUnderflow( SwTxtFormatInfo &rInf ) const
                     {
                         // To be evaluated during reformat of this line:
                         // RealHeight including spacing
-                        rInf.SetLineHeight( sal_uInt16(nHeight) );
+                        rInf.SetLineHeight( nHeight );
                         // Height without extra spacing
-                        rInf.SetLineNettoHeight( sal_uInt16( pCurr->Height() ) );
+                        rInf.SetLineNettoHeight( pCurr->Height() );
                         return true;
                     }
                 }
@@ -2228,8 +2228,8 @@ bool SwTxtFormatter::ChkFlyUnderflow( SwTxtFormatInfo &rInf ) const
                 // The fly portion is not intersected by a fly anymore
                 if ( ! aInter.IsOver( aLine ) )
                 {
-                    rInf.SetLineHeight( sal_uInt16(nHeight) );
-                    rInf.SetLineNettoHeight( sal_uInt16( pCurr->Height() ) );
+                    rInf.SetLineHeight( nHeight );
+                    rInf.SetLineNettoHeight( pCurr->Height() );
                     return true;
                 }
                 else
@@ -2243,8 +2243,8 @@ bool SwTxtFormatter::ChkFlyUnderflow( SwTxtFormatInfo &rInf ) const
                     if( ! aInter.HasArea() ||
                         ((SwFlyPortion*)pPos)->GetFixWidth() != aInter.Width() )
                     {
-                        rInf.SetLineHeight( sal_uInt16(nHeight) );
-                        rInf.SetLineNettoHeight( sal_uInt16( pCurr->Height() ) );
+                        rInf.SetLineHeight( nHeight );
+                        rInf.SetLineNettoHeight( pCurr->Height() );
                         return true;
                     }
                 }
@@ -2754,9 +2754,9 @@ namespace {
             // if anything has changed, we carefully have to adjust the right
             // repaint position
             long nPOfst = 0;
-            sal_uInt16 nCnt = 0;
-            sal_uInt16 nX = 0;
-            sal_uInt16 nIdx = rThis.GetInfo().GetLineStart();
+            size_t nCnt = 0;
+            long nX = 0;
+            sal_Int32 nIdx = rThis.GetInfo().GetLineStart();
             SwLinePortion* pPor = rCurr.GetFirstPortion();
 
             while ( pPor )
diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx
index c9f8ff1..f1f2a20 100644
--- a/sw/source/core/text/itrpaint.cxx
+++ b/sw/source/core/text/itrpaint.cxx
@@ -558,7 +558,7 @@ void SwTxtPainter::CheckSpecialUnderline( const SwLinePortion* pPor,
         sal_uLong nSumHeight = 0;
         sal_uLong nBold = 0;
         sal_uInt16 nMaxBaseLineOfst = 0;
-        sal_uInt16 nNumberOfPortions = 0;
+        int nNumberOfPortions = 0;
 
         while( nTmpIdx <= nUnderEnd && pPor )
         {
@@ -583,7 +583,7 @@ void SwTxtPainter::CheckSpecialUnderline( const SwLinePortion* pPor,
                 // and the font of the lowest portion.
                 if ( nAdjustBaseLine )
                 {
-                    sal_uInt16 nTmpBaseLineOfst = AdjustBaseLine( *pCurr, pPor );
+                    const sal_uInt16 nTmpBaseLineOfst = AdjustBaseLine( *pCurr, pPor );
                     if ( nMaxBaseLineOfst < nTmpBaseLineOfst )
                     {
                         nMaxBaseLineOfst = nTmpBaseLineOfst;
commit dab5d58acc983c6234bcd2975eb0e8678608743e
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Aug 31 20:01:13 2014 +0200

    SwNoteURL: remove Count and GetURLNote, used only internally
    
    Directly access data member and switch from sal_uInt16 to size_t
    
    Change-Id: I8544463dabc099aa94ae0281e636dbf7835c23b4

diff --git a/sw/source/core/inc/noteurl.hxx b/sw/source/core/inc/noteurl.hxx
index 08516da..d1a853c 100644
--- a/sw/source/core/inc/noteurl.hxx
+++ b/sw/source/core/inc/noteurl.hxx
@@ -49,11 +49,8 @@ class SwNoteURL
     SwURLNoteList aList;
 public:
     SwNoteURL() {}
-    sal_uInt16 Count() const { return aList.size(); }
     void InsertURLNote( const OUString& rURL, const OUString& rTarget,
                  const SwRect& rRect );
-    const SwURLNote& GetURLNote( sal_uInt16 nPos ) const
-        { return aList[ nPos ]; }
     void FillImageMap( ImageMap* pMap, const Point& rPos, const MapMode& rMap );
 };
 
diff --git a/sw/source/core/text/noteurl.cxx b/sw/source/core/text/noteurl.cxx
index b70191d..8057e1d 100644
--- a/sw/source/core/text/noteurl.cxx
+++ b/sw/source/core/text/noteurl.cxx
@@ -30,9 +30,8 @@ SwNoteURL *pNoteURL = NULL;
 void SwNoteURL::InsertURLNote( const OUString& rURL, const OUString& rTarget,
     const SwRect& rRect )
 {
-    sal_uInt16 i;
-    sal_uInt16 nCount = aList.size();
-    for( i = 0; i < nCount; i++ )
+    const size_t nCount = aList.size();
+    for( size_t i = 0; i < nCount; ++i )
         if( rRect == aList[i].GetRect() )
             return;
 
@@ -44,13 +43,13 @@ void SwNoteURL::FillImageMap( ImageMap *pMap, const Point &rPos,
     const MapMode& rMap )
 {
     OSL_ENSURE( pMap, "FillImageMap: No ImageMap, no cookies!" );
-    sal_uInt16 nCount = Count();
+    const size_t nCount = aList.size();
     if( nCount )
     {
         MapMode aMap( MAP_100TH_MM );
-        for( sal_uInt16 i = 0; i < nCount; ++i )
+        for( size_t i = 0; i < nCount; ++i )
         {
-            const SwURLNote &rNote = GetURLNote( i );
+            const SwURLNote &rNote = aList[i];
             SwRect aSwRect( rNote.GetRect() );
             aSwRect -= rPos;
             Rectangle aRect( OutputDevice::LogicToLogic( aSwRect.SVRect(),
commit bdf00bafb4bf6d5cc135c28c78cc740543eca309
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Aug 31 19:56:38 2014 +0200

    Simplify by early bailout
    
    Change-Id: Id6697760f6037f3a11d5b72d1727e48fb3ec6b56

diff --git a/sw/source/core/text/noteurl.cxx b/sw/source/core/text/noteurl.cxx
index 36fb723..b70191d 100644
--- a/sw/source/core/text/noteurl.cxx
+++ b/sw/source/core/text/noteurl.cxx
@@ -34,12 +34,10 @@ void SwNoteURL::InsertURLNote( const OUString& rURL, const OUString& rTarget,
     sal_uInt16 nCount = aList.size();
     for( i = 0; i < nCount; i++ )
         if( rRect == aList[i].GetRect() )
-            break;
-    if( i == nCount )
-    {
-        SwURLNote *pNew = new SwURLNote( rURL, rTarget, rRect );
-        aList.push_back( pNew );
-    }
+            return;
+
+    SwURLNote *pNew = new SwURLNote( rURL, rTarget, rRect );
+    aList.push_back( pNew );
 }
 
 void SwNoteURL::FillImageMap( ImageMap *pMap, const Point &rPos,
commit 55e866c5c1018b28a55bd8383677de61fe582a90
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Aug 31 19:46:27 2014 +0200

    Remove unneeded cast
    
    Change-Id: Ia5ed84488d14e6e779d62e9903c1350b703ad3c6

diff --git a/sw/source/core/text/porexp.cxx b/sw/source/core/text/porexp.cxx
index b959694..f3e59e0 100644
--- a/sw/source/core/text/porexp.cxx
+++ b/sw/source/core/text/porexp.cxx
@@ -217,8 +217,7 @@ void SwPostItsPortion::Paint( const SwTxtPaintInfo &rInf ) const
 sal_uInt16 SwPostItsPortion::GetViewWidth( const SwTxtSizeInfo &rInf ) const
 {
     // Nicht zu fassen: PostIts sind immer zu sehen.
-    return rInf.OnWin() ?
-                (sal_uInt16)rInf.GetOpt().GetPostItsWidth( rInf.GetOut() ) : 0;
+    return rInf.OnWin() ? rInf.GetOpt().GetPostItsWidth( rInf.GetOut() ) : 0;
 }
 
 bool SwPostItsPortion::Format( SwTxtFormatInfo &rInf )
commit 043d405472e650e777d4f21eab34de6f00e3a1ca
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Aug 31 19:33:56 2014 +0200

    Use for loops and more proper integer types, constify
    
    Change-Id: I3d4dc54f4178b5607dc75352696228410d08e38e

diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index 80cde63..a7dd858 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -289,7 +289,7 @@ bool SwFldPortion::Format( SwTxtFormatInfo &rInf )
     sal_Int32 nRest;
     bool bFull = false;
     bool bEOL = false;
-    long nTxtRest = rInf.GetTxt().getLength() - rInf.GetIdx();
+    const sal_Int32 nTxtRest = rInf.GetTxt().getLength() - rInf.GetIdx();
     {
         SwFldSlot aDiffTxt( &rInf, this );
         SwLayoutModeModifier aLayoutModeModifier( *rInf.GetOut() );
@@ -320,7 +320,7 @@ bool SwFldPortion::Format( SwTxtFormatInfo &rInf )
         // gesetzt und wird in nRest uebertragen. Ansonsten bleibt die
         // Laenge erhalten und wuerde auch in nRest einfliessen!
         SetLen(0);
-        const sal_uInt16 nFollow = IsFollow() ? 0 : 1;
+        const sal_Int32 nFollow = IsFollow() ? 0 : 1;
 
         // So komisch es aussieht, die Abfrage auf GetLen() muss wegen der
         // ExpandPortions _hinter_ aDiffTxt (vgl. SoftHyphs)
@@ -904,7 +904,7 @@ void SwGrfNumPortion::Paint( const SwTxtPaintInfo &rInf ) const
 
     if( bReplace )
     {
-        sal_uInt16 nTmpH = GetPortion() ? GetPortion()->GetAscent() : 120;
+        const long nTmpH = GetPortion() ? GetPortion()->GetAscent() : 120;
         aSize = Size( nTmpH, nTmpH );
         aPos.Y() = rInf.Y() - nTmpH;
     }
@@ -1062,8 +1062,7 @@ SwCombinedPortion::SwCombinedPortion( const OUString &rTxt )
         sal_uInt8 nScr = SW_SCRIPTS;
         for( sal_Int32 i = 0; i < rTxt.getLength(); ++i )
         {
-            sal_uInt16 nScript = g_pBreakIt->GetBreakIter()->getScriptType( rTxt, i );
-            switch ( nScript ) {
+            switch ( g_pBreakIt->GetBreakIter()->getScriptType( rTxt, i ) ) {
                 case i18n::ScriptType::LATIN : nScr = SW_LATIN; break;
                 case i18n::ScriptType::ASIAN : nScr = SW_CJK; break;
                 case i18n::ScriptType::COMPLEX : nScr = SW_CTL; break;
@@ -1073,7 +1072,7 @@ SwCombinedPortion::SwCombinedPortion( const OUString &rTxt )
     }
     else
     {
-        for( sal_uInt16 i = 0; i < 6; ++i )
+        for( int i = 0; i < 6; ++i )
             aScrType[i] = 0;
     }
     memset( &aWidth, 0, sizeof(aWidth) );
@@ -1091,22 +1090,21 @@ void SwCombinedPortion::Paint( const SwTxtPaintInfo &rInf ) const
         if( rInf.OnWin() && pPortion && !pPortion->Width() )
             pPortion->PrePaint( rInf, this );
 
-        sal_Int32 nCount = aExpand.getLength();
+        const sal_Int32 nCount = aExpand.getLength();
         if( !nCount )
             return;
         OSL_ENSURE( nCount < 7, "Too much combined characters" );
 
         // the first character of the second row
-        sal_uInt16 nTop = ( nCount + 1 ) / 2;
+        const sal_Int32 nTop = ( nCount + 1 ) / 2;
 
         SwFont aTmpFont( *rInf.GetFont() );
         aTmpFont.SetProportion( nProportion );  // a smaller font
         SwFontSave aFontSave( rInf, &aTmpFont );
 
-        sal_uInt16 i = 0;
         Point aOldPos = rInf.GetPos();
         Point aOutPos( aOldPos.X(), aOldPos.Y() - nUpPos );// Y of the first row
-        while( i < nCount )
+        for( sal_Int32 i = 0 ; i < nCount; ++i )
         {
             if( i == nTop ) // change the row
                 aOutPos.Y() = aOldPos.Y() + nLowPos;    // Y of the second row
@@ -1126,7 +1124,6 @@ void SwCombinedPortion::Paint( const SwTxtPaintInfo &rInf ) const
             }
             ((SwTxtPaintInfo&)rInf).SetPos( aOutPos );
             rInf.DrawText( aExpand, *this, i, 1 );
-            ++i;
         }
         // rInf is const, so we have to take back our manipulations
         ((SwTxtPaintInfo&)rInf).SetPos( aOldPos );
@@ -1135,7 +1132,7 @@ void SwCombinedPortion::Paint( const SwTxtPaintInfo &rInf ) const
 
 bool SwCombinedPortion::Format( SwTxtFormatInfo &rInf )
 {
-    sal_Int32 nCount = aExpand.getLength();
+    const sal_Int32 nCount = aExpand.getLength();
     if( !nCount )
     {
         Width( 0 );
@@ -1145,14 +1142,12 @@ bool SwCombinedPortion::Format( SwTxtFormatInfo &rInf )
     OSL_ENSURE( nCount < 7, "Too much combined characters" );
     // If there are leading "weak"-scripttyped characters in this portion,
     // they get the actual scripttype.
-    sal_uInt16 i = 0;
-    while( i < nCount && SW_SCRIPTS == aScrType[i] )
-        aScrType[i++] = rInf.GetFont()->GetActual();
+    for( sal_Int32 i = 0; i < nCount && SW_SCRIPTS == aScrType[i]; ++i )
+        aScrType[i] = rInf.GetFont()->GetActual();
     if( nCount > 4 )
     {
         // more than four? Ok, then we need the 2/3 font width
-        i = 0;
-        while( i < aExpand.getLength() )
+        for( sal_Int32 i = 0; i < aExpand.getLength(); ++i )
         {
             OSL_ENSURE( aScrType[i] < SW_SCRIPTS, "Combined: Script fault" );
             if( !aWidth[ aScrType[i] ] )
@@ -1161,11 +1156,10 @@ bool SwCombinedPortion::Format( SwTxtFormatInfo &rInf )
                 aWidth[ aScrType[i] ] =
                         static_cast<sal_uInt16>(2 * rInf.GetOut()->GetFontMetric().GetSize().Width() / 3);
             }
-            ++i;
         }
     }
 
-    sal_uInt16 nTop = ( nCount + 1 ) / 2; // the first character of the second line
+    const sal_Int32 nTop = ( nCount + 1 ) / 2; // the first character of the second line
     SwViewShell *pSh = rInf.GetTxtFrm()->getRootFrm()->GetCurrShell();
     SwFont aTmpFont( *rInf.GetFont() );
     SwFontSave aFontSave( rInf, &aTmpFont );
@@ -1182,7 +1176,6 @@ bool SwCombinedPortion::Format( SwTxtFormatInfo &rInf )
     {
         nProportion -= 5;
         aTmpFont.SetProportion( nProportion );
-        i = 0;
         memset( &aPos, 0, sizeof(aPos) );
         nMaxDescent = 0;
         nMaxAscent = 0;
@@ -1194,7 +1187,7 @@ bool SwCombinedPortion::Format( SwTxtFormatInfo &rInf )
         // ascent member of the portion, the descent in nLowPos.
         // The ascent, descent and width of the second line are stored in the
         // local nMaxAscent, nMaxDescent and nMaxWidth variables.
-        while( i < nCount )
+        for( sal_Int32 i = 0; i < nCount; ++i )
         {
             sal_uInt8 nScrp = aScrType[i];
             aTmpFont.SetActual( nScrp );
@@ -1207,7 +1200,7 @@ bool SwCombinedPortion::Format( SwTxtFormatInfo &rInf )
 
             SwDrawTextInfo aDrawInf( pSh, *rInf.GetOut(), 0, aExpand, i, 1 );
             Size aSize = aTmpFont._GetTxtSize( aDrawInf );
-            sal_uInt16 nAsc = aTmpFont.GetAscent( pSh, *rInf.GetOut() );
+            const sal_uInt16 nAsc = aTmpFont.GetAscent( pSh, *rInf.GetOut() );
             aPos[ i ] = (sal_uInt16)aSize.Width();
             if( i == nTop ) // enter the second line
             {
@@ -1219,7 +1212,7 @@ bool SwCombinedPortion::Format( SwTxtFormatInfo &rInf )
                 nMaxDescent = 0;
                 nMaxWidth = 0;
             }
-            nMaxWidth = nMaxWidth + aPos[ i++ ];
+            nMaxWidth = nMaxWidth + aPos[ i ];
             if( nAsc > nMaxAscent )
                 nMaxAscent = nAsc;
             if( aSize.Height() - nAsc > nMaxDescent )
commit 04ee8ea4bd129fada31f91d7fa4784eab12894d0
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Aug 31 19:17:33 2014 +0200

    Remove unneeded local scope
    
    Change-Id: I51fe6e130006fdca547abe99a44117f710d1e776

diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index aed4bc8..80cde63 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -192,25 +192,22 @@ void SwFldPortion::CheckScript( const SwTxtSizeInfo &rInf )
     if( GetExpTxt( rInf, aTxt ) && !aTxt.isEmpty() && g_pBreakIt->GetBreakIter().is() )
     {
         sal_uInt8 nActual = pFnt ? pFnt->GetActual() : rInf.GetFont()->GetActual();
-        sal_uInt16 nScript;
+        sal_uInt16 nScript = g_pBreakIt->GetBreakIter()->getScriptType( aTxt, 0 );
+        sal_Int32 nChg = 0;
+        if( i18n::ScriptType::WEAK == nScript )
         {
-            nScript = g_pBreakIt->GetBreakIter()->getScriptType( aTxt, 0 );
-            sal_Int32 nChg = 0;
-            if( i18n::ScriptType::WEAK == nScript )
-            {
-                nChg = g_pBreakIt->GetBreakIter()->endOfScript(aTxt,0,nScript);
-                if (nChg < aTxt.getLength() && nChg >= 0)
-                    nScript = g_pBreakIt->GetBreakIter()->getScriptType( aTxt, nChg );
-            }
+            nChg = g_pBreakIt->GetBreakIter()->endOfScript(aTxt,0,nScript);
+            if (nChg < aTxt.getLength() && nChg >= 0)
+                nScript = g_pBreakIt->GetBreakIter()->getScriptType( aTxt, nChg );
+        }
 
-            // nNextScriptChg will be evaluated during SwFldPortion::Format()
+        // nNextScriptChg will be evaluated during SwFldPortion::Format()
 
-            if (nChg < aTxt.getLength() && nChg >= 0)
-                nNextScriptChg = g_pBreakIt->GetBreakIter()->endOfScript( aTxt, nChg, nScript );
-            else
-                nNextScriptChg = aTxt.getLength();
+        if (nChg < aTxt.getLength() && nChg >= 0)
+            nNextScriptChg = g_pBreakIt->GetBreakIter()->endOfScript( aTxt, nChg, nScript );
+        else
+            nNextScriptChg = aTxt.getLength();
 
-        }
         sal_uInt8 nTmp;
         switch ( nScript ) {
             case i18n::ScriptType::LATIN : nTmp = SW_LATIN; break;
commit c49faa1447801a885fd0c25910a4a5d7ea24ed77
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Aug 31 17:55:44 2014 +0200

    Use enumeration directly
    
    Change-Id: I5b537bb863eafa9e508c7298c611b0d1c0145d77

diff --git a/sw/source/core/inc/scriptinfo.hxx b/sw/source/core/inc/scriptinfo.hxx
index 1ad55c4..bdc47ca 100644
--- a/sw/source/core/inc/scriptinfo.hxx
+++ b/sw/source/core/inc/scriptinfo.hxx
@@ -35,6 +35,9 @@ typedef std::list< sal_Int32 > PositionList;
 // encapsultes information about script changes
 class SwScriptInfo
 {
+public:
+    enum CompType { KANA, SPECIAL_LEFT, SPECIAL_RIGHT, NONE };
+
 private:
     //! Records a single change in script type.
     struct ScriptChangeInfo
@@ -64,10 +67,14 @@ private:
     {
         sal_Int32 position; //!< Character position where the change occurs.
         sal_Int32 length;   //!< Length of the segment.
-        sal_uInt8       type;     //!< Type of compression that we change to.
-        inline CompressionChangeInfo(sal_Int32 pos, sal_Int32 len, sal_uInt8 typ) : position(pos), length(len), type(typ) {};
+        CompType  type;     //!< Type of compression that we change to.
+        inline CompressionChangeInfo(sal_Int32 pos, sal_Int32 len, CompType typ) : position(pos), length(len), type(typ) {};
     };
     std::vector<CompressionChangeInfo> aCompressionChanges;
+#ifdef DBG_UTIL
+    CompType DbgCompType( const sal_Int32 nPos ) const;
+#endif
+
     sal_Int32 nInvalidityPos;
     sal_uInt8 nDefaultDir;
 
@@ -83,7 +90,6 @@ private:
     size_t HasKana( sal_Int32 nStart, const sal_Int32 nEnd ) const;
 
 public:
-    enum CompType { KANA, SPECIAL_LEFT, SPECIAL_RIGHT, NONE };
 
     SwScriptInfo();
     ~SwScriptInfo();
@@ -153,7 +159,7 @@ public:
         OSL_ENSURE( nCnt < aCompressionChanges.size(),"No CompressionLen today!");
         return aCompressionChanges[ nCnt ].length;
     }
-    sal_uInt8 GetCompType( const size_t nCnt ) const
+    CompType GetCompType( const size_t nCnt ) const
     {
         OSL_ENSURE( nCnt < aCompressionChanges.size(),"No CompressionType today!");
         return aCompressionChanges[ nCnt ].type;
@@ -181,10 +187,6 @@ public:
                            const sal_uInt8* pLevel = 0 ) const;
     sal_uInt8 DirType( const sal_Int32 nPos ) const;
 
-#ifdef DBG_UTIL
-    sal_uInt8 CompType( const sal_Int32 nPos ) const;
-#endif
-
     // HIDDEN TEXT STUFF START
 
 /** Hidden text range information - static and non-version
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index d7c50be..f861a0b 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -856,8 +856,8 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, bool bRTL )
         if ( CHARCOMPRESS_NONE != aCompEnum &&
              i18n::ScriptType::ASIAN == nScript )
         {
-            sal_uInt8 ePrevState = NONE;
-            sal_uInt8 eState;
+            CompType ePrevState = NONE;
+            CompType eState = NONE;
             sal_Int32 nPrevChg = nLastCompression;
 
             while ( nLastCompression < nChg )
@@ -881,7 +881,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, bool bRTL )
                     eState = SPECIAL_RIGHT;
                     break;
                 default:
-                    eState = static_cast<sal_uInt8>( ( 0x3040 <= cChar && 0x3100 > cChar ) ? KANA : NONE );
+                    eState = ( 0x3040 <= cChar && 0x3100 > cChar ) ? KANA : NONE;
                 }
 
                 // insert range of compressable characters
@@ -1468,7 +1468,7 @@ bool SwScriptInfo::IsInHiddenRange( const SwTxtNode& rNode, sal_Int32 nPos )
 
 #ifdef DBG_UTIL
 // returns the type of the compressed character
-sal_uInt8 SwScriptInfo::CompType( const sal_Int32 nPos ) const
+SwScriptInfo::CompType SwScriptInfo::DbgCompType( const sal_Int32 nPos ) const
 {
     const size_t nEnd = CountCompChg();
     for( size_t nX = 0; nX < nEnd; ++nX )
@@ -1545,9 +1545,9 @@ long SwScriptInfo::Compress( long* pKernArray, sal_Int32 nIdx, sal_Int32 nLen,
     long nLast = nI ? pKernArray[ nI - 1 ] : 0;
     do
     {
-        const sal_uInt8 nType = GetCompType( nCompIdx );
+        const CompType nType = GetCompType( nCompIdx );
 #ifdef DBG_UTIL
-        SAL_WARN_IF( nType != CompType( nIdx ), "sw.core", "Gimme the right type!" );
+        SAL_WARN_IF( nType != DbgCompType( nIdx ), "sw.core", "Gimme the right type!" );
 #endif
         nCompLen += nIdx;
         if( nCompLen > nLen )
commit a048b088819442ef1c437c6ecd8904a690b254f2
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Aug 31 17:54:02 2014 +0200

    HasKana() can be private
    
    Change-Id: I6c26cbf71214dbd307291fdbb63dd3af74a3a4e5

diff --git a/sw/source/core/inc/scriptinfo.hxx b/sw/source/core/inc/scriptinfo.hxx
index b7734fb..1ad55c4 100644
--- a/sw/source/core/inc/scriptinfo.hxx
+++ b/sw/source/core/inc/scriptinfo.hxx
@@ -78,6 +78,9 @@ private:
     void ClearKashidaInvalid(sal_Int32 nKashPos);
     bool MarkOrClearKashidaInvalid(sal_Int32 nStt, sal_Int32 nLen, bool bMark, sal_Int32 nMarkCount);
     bool IsKashidaLine(sal_Int32 nCharIdx) const;
+    // examines the range [ nStart, nStart + nEnd ] if there are kanas
+    // returns start index of kana entry in array, otherwise SAL_MAX_SIZE
+    size_t HasKana( sal_Int32 nStart, const sal_Int32 nEnd ) const;
 
 public:
     enum CompType { KANA, SPECIAL_LEFT, SPECIAL_RIGHT, NONE };
@@ -246,10 +249,6 @@ public:
 
     // HIDDEN TEXT STUFF END
 
-    // examines the range [ nStart, nStart + nEnd ] if there are kanas
-    // returns start index of kana entry in array, otherwise SAL_MAX_SIZE
-    size_t HasKana( sal_Int32 nStart, const sal_Int32 nEnd ) const;
-
     // modifies the kerning array according to a given compress value
     long Compress( long* pKernArray, sal_Int32 nIdx, sal_Int32 nLen,
                    const sal_uInt16 nCompress, const sal_uInt16 nFontHeight,
commit bc3b71a93edd2ee57b6b01f41094705bcb6b3830
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Aug 31 17:43:26 2014 +0200

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

diff --git a/sw/source/core/inc/scriptinfo.hxx b/sw/source/core/inc/scriptinfo.hxx
index 6ed3509..b7734fb 100644
--- a/sw/source/core/inc/scriptinfo.hxx
+++ b/sw/source/core/inc/scriptinfo.hxx
@@ -247,8 +247,8 @@ public:
     // HIDDEN TEXT STUFF END
 
     // examines the range [ nStart, nStart + nEnd ] if there are kanas
-    // returns start index of kana entry in array, otherwise USHRT_MAX
-    sal_uInt16 HasKana( sal_Int32 nStart, const sal_Int32 nEnd ) const;
+    // returns start index of kana entry in array, otherwise SAL_MAX_SIZE
+    size_t HasKana( sal_Int32 nStart, const sal_Int32 nEnd ) const;
 
     // modifies the kerning array according to a given compress value
     long Compress( long* pKernArray, sal_Int32 nIdx, sal_Int32 nLen,
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index a080fb4..d7c50be 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -286,7 +286,7 @@ void SwLineLayout::CalcLine( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf )
         }
         else
         {
-            sal_uInt16 nLineHeight = Height();
+            const sal_uInt16 nLineHeight = Height();
             Init( GetPortion() );
             SwLinePortion *pPos = pPortion;
             SwLinePortion *pLast = this;
@@ -602,14 +602,9 @@ SwScriptInfo::~SwScriptInfo()
 sal_uInt8 SwScriptInfo::WhichFont( sal_Int32 nIdx, const OUString* pTxt, const SwScriptInfo* pSI )
 {
     assert((pSI || pTxt) && "How should I determine the script type?");
-    sal_uInt16 nScript;
-
-    // First we try to use our SwScriptInfo
-    if ( pSI )
-        nScript = pSI->ScriptType( nIdx );
-    else
-        // Ok, we have to ask the break iterator
-        nScript = g_pBreakIt->GetRealScriptOfText( *pTxt, nIdx );
+    const sal_uInt16 nScript = pSI
+        ? pSI->ScriptType( nIdx )                         // use our SwScriptInfo if available
+        : g_pBreakIt->GetRealScriptOfText( *pTxt, nIdx ); // else  ask the break iterator
 
     switch ( nScript ) {
         case i18n::ScriptType::LATIN : return SW_LATIN;
@@ -662,11 +657,11 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, bool bRTL )
     nDefaultDir = static_cast<sal_uInt8>(bRTL ? UBIDI_RTL : UBIDI_LTR);
 
     // counter for script info arrays
-    sal_uInt16 nCnt = 0;
+    size_t nCnt = 0;
     // counter for compression information arrays
-    sal_uInt16 nCntComp = 0;
+    size_t nCntComp = 0;
     // counter for kashida array
-    sal_uInt16 nCntKash = 0;
+    size_t nCntKash = 0;
 
     sal_uInt8 nScript = i18n::ScriptType::LATIN;
 
@@ -938,7 +933,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, bool bRTL )
                 sal_Unicode cCh;
                 sal_Unicode cPrevCh = 0;
 
-                sal_uInt16 nPriorityLevel = 7; // 0..6 = level found
+                int nPriorityLevel = 7;    // 0..6 = level found
                                            // 7 not found
 
                 sal_Int32 nWordLen = rWord.getLength();
@@ -1134,7 +1129,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, bool bRTL )
         // 1. All text in RTL runs will use the CTL font
         // #i89825# change the script type also to CTL (hennerdrewes)
         // 2. Text in embedded LTR runs that does not have any strong LTR characters (numbers!)
-        for ( sal_uInt32 nDirIdx = 0; nDirIdx < aDirectionChanges.size(); ++nDirIdx )
+        for ( size_t nDirIdx = 0; nDirIdx < aDirectionChanges.size(); ++nDirIdx )
         {
             const sal_uInt8 nCurrDirType = GetDirType( nDirIdx );
                 // nStart ist start of RTL run:
@@ -1237,8 +1232,8 @@ void SwScriptInfo::UpdateBidiInfo( const OUString& rTxt )
 //         and Complex ( Hebrew, Arabian )
 sal_Int32 SwScriptInfo::NextScriptChg(const sal_Int32 nPos)  const
 {
-    sal_uInt16 nEnd = CountScriptChg();
-    for( sal_uInt16 nX = 0; nX < nEnd; ++nX )
+    const size_t nEnd = CountScriptChg();
+    for( size_t nX = 0; nX < nEnd; ++nX )
     {
         if( nPos < GetScriptChg( nX ) )
             return GetScriptChg( nX );
@@ -1250,8 +1245,8 @@ sal_Int32 SwScriptInfo::NextScriptChg(const sal_Int32 nPos)  const
 // returns the script of the character at the input position
 sal_uInt8 SwScriptInfo::ScriptType(const sal_Int32 nPos) const
 {
-    sal_uInt16 nEnd = CountScriptChg();
-    for( sal_uInt16 nX = 0; nX < nEnd; ++nX )
+    const size_t nEnd = CountScriptChg();
+    for( size_t nX = 0; nX < nEnd; ++nX )
     {
         if( nPos < GetScriptChg( nX ) )
             return GetScriptType( nX );
@@ -1264,9 +1259,9 @@ sal_uInt8 SwScriptInfo::ScriptType(const sal_Int32 nPos) const
 sal_Int32 SwScriptInfo::NextDirChg( const sal_Int32 nPos,
                                      const sal_uInt8* pLevel )  const
 {
-    sal_uInt8 nCurrDir = pLevel ? *pLevel : 62;
-    sal_uInt16 nEnd = CountDirChg();
-    for( sal_uInt16 nX = 0; nX < nEnd; ++nX )
+    const sal_uInt8 nCurrDir = pLevel ? *pLevel : 62;
+    const size_t nEnd = CountDirChg();
+    for( size_t nX = 0; nX < nEnd; ++nX )
     {
         if( nPos < GetDirChg( nX ) &&
             ( nX + 1 == nEnd || GetDirType( nX + 1 ) <= nCurrDir ) )
@@ -1278,8 +1273,8 @@ sal_Int32 SwScriptInfo::NextDirChg( const sal_Int32 nPos,
 
 sal_uInt8 SwScriptInfo::DirType(const sal_Int32 nPos) const
 {
-    sal_uInt16 nEnd = CountDirChg();
-    for( sal_uInt16 nX = 0; nX < nEnd; ++nX )
+    const size_t nEnd = CountDirChg();
+    for( size_t nX = 0; nX < nEnd; ++nX )
     {
         if( nPos < GetDirChg( nX ) )
             return GetDirType( nX );
@@ -1298,7 +1293,7 @@ sal_Int32 SwScriptInfo::MaskHiddenRanges( const SwTxtNode& rNode, OUStringBuffer
     PositionList aList;
     sal_Int32 nHiddenStart;
     sal_Int32 nHiddenEnd;
-    sal_uInt16 nNumOfHiddenChars = 0;
+    sal_Int32 nNumOfHiddenChars = 0;
     GetBoundsOfHiddenRange( rNode, 0, nHiddenStart, nHiddenEnd, &aList );
     PositionList::const_reverse_iterator rFirst( aList.end() );
     PositionList::const_reverse_iterator rLast( aList.begin() );
@@ -1435,8 +1430,8 @@ bool SwScriptInfo::GetBoundsOfHiddenRange( sal_Int32 nPos, sal_Int32& rnStartPos
     rnStartPos = COMPLETE_STRING;
     rnEndPos = 0;
 
-    sal_uInt16 nEnd = CountHiddenChg();
-    for( sal_uInt16 nX = 0; nX < nEnd; ++nX )
+    const size_t nEnd = CountHiddenChg();
+    for( size_t nX = 0; nX < nEnd; ++nX )
     {
         const sal_Int32 nHiddenStart = GetHiddenChg( nX++ );
         const sal_Int32 nHiddenEnd = GetHiddenChg( nX );
@@ -1453,7 +1448,7 @@ bool SwScriptInfo::GetBoundsOfHiddenRange( sal_Int32 nPos, sal_Int32& rnStartPos
 
     if ( pList )
     {
-        for( sal_uInt16 nX = 0; nX < nEnd; ++nX )
+        for( size_t nX = 0; nX < nEnd; ++nX )
         {
             pList->push_back( GetHiddenChg( nX++ ) );
             pList->push_back( GetHiddenChg( nX ) );
@@ -1475,10 +1470,10 @@ bool SwScriptInfo::IsInHiddenRange( const SwTxtNode& rNode, sal_Int32 nPos )
 // returns the type of the compressed character
 sal_uInt8 SwScriptInfo::CompType( const sal_Int32 nPos ) const
 {
-    sal_uInt16 nEnd = CountCompChg();
-    for( sal_uInt16 nX = 0; nX < nEnd; ++nX )
+    const size_t nEnd = CountCompChg();
+    for( size_t nX = 0; nX < nEnd; ++nX )
     {
-        sal_Int32 nChg = GetCompStart( nX );
+        const sal_Int32 nChg = GetCompStart( nX );
 
         if ( nPos < nChg )
             return NONE;
@@ -1492,24 +1487,24 @@ sal_uInt8 SwScriptInfo::CompType( const sal_Int32 nPos ) const
 
 // returns, if there are compressable kanas or specials
 // between nStart and nEnd
-sal_uInt16 SwScriptInfo::HasKana( sal_Int32 nStart, const sal_Int32 nLen ) const
+size_t SwScriptInfo::HasKana( sal_Int32 nStart, const sal_Int32 nLen ) const
 {
-    sal_uInt16 nCnt = CountCompChg();
+    const size_t nCnt = CountCompChg();
     sal_Int32 nEnd = nStart + nLen;
 
-    for( sal_uInt16 nX = 0; nX < nCnt; ++nX )
+    for( size_t nX = 0; nX < nCnt; ++nX )
     {
         sal_Int32 nKanaStart  = GetCompStart( nX );
         sal_Int32 nKanaEnd = nKanaStart + GetCompLen( nX );
 
         if ( nKanaStart >= nEnd )
-            return USHRT_MAX;
+            return SAL_MAX_SIZE;
 
         if ( nStart < nKanaEnd )
             return nX;
     }
 
-    return USHRT_MAX;
+    return SAL_MAX_SIZE;
 }
 
 long SwScriptInfo::Compress( long* pKernArray, sal_Int32 nIdx, sal_Int32 nLen,
@@ -1518,21 +1513,21 @@ long SwScriptInfo::Compress( long* pKernArray, sal_Int32 nIdx, sal_Int32 nLen,
 {
     SAL_WARN_IF( !nCompress, "sw.core", "Compression without compression?!" );
     SAL_WARN_IF( !nLen, "sw.core", "Compression without text?!" );
-    sal_uInt16 nCompCount = CountCompChg();
+    const size_t nCompCount = CountCompChg();
 
     // In asian typography, there are full width and half width characters.
     // Full width punctuation characters can be compressed by 50%
     // to determine this, we compare the font width with 75% of its height
-    sal_uInt16 nMinWidth = ( 3 * nFontHeight ) / 4;
+    const long nMinWidth = ( 3 * nFontHeight ) / 4;
 
-    sal_uInt16 nCompIdx = HasKana( nIdx, nLen );
+    size_t nCompIdx = HasKana( nIdx, nLen );
 
-    if ( USHRT_MAX == nCompIdx )
+    if ( SAL_MAX_SIZE == nCompIdx )
         return 0;
 
     sal_Int32 nChg = GetCompStart( nCompIdx );
     sal_Int32 nCompLen = GetCompLen( nCompIdx );
-    sal_uInt16 nI = 0;
+    sal_Int32 nI = 0;
     nLen += nIdx;
 
     if( nChg > nIdx )
@@ -1550,7 +1545,7 @@ long SwScriptInfo::Compress( long* pKernArray, sal_Int32 nIdx, sal_Int32 nLen,
     long nLast = nI ? pKernArray[ nI - 1 ] : 0;
     do
     {
-        sal_uInt16 nType = GetCompType( nCompIdx );
+        const sal_uInt8 nType = GetCompType( nCompIdx );
 #ifdef DBG_UTIL
         SAL_WARN_IF( nType != CompType( nIdx ), "sw.core", "Gimme the right type!" );
 #endif
commit e24a3daf040410bd9fb2eb6cdd7095a659427441
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Aug 31 14:35:49 2014 +0200

    Use more proper types, constify, avoid unneeded conversions
    
    Change-Id: I7f1f587c39b9221363e90aea2cf7ed468ce5aac0

diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx
index ebd76e1..8aa72f7 100644
--- a/sw/source/core/text/pormulti.cxx
+++ b/sw/source/core/text/pormulti.cxx
@@ -103,7 +103,7 @@ void SwMultiPortion::CalcSize( SwTxtFormatter& rLine, SwTxtFormatInfo &rInf )
         sal_uInt16 nTmp = ((SwDoubleLinePortion*)this)->GetBrackets()->nHeight;
         if( nTmp > Height() )
         {
-            sal_uInt16 nAdd = ( nTmp - Height() ) / 2;
+            const sal_uInt16 nAdd = ( nTmp - Height() ) / 2;
             GetRoot().SetAscent( GetRoot().GetAscent() + nAdd );
             GetRoot().Height( GetRoot().Height() + nAdd );
             Height( nTmp );
@@ -329,7 +329,7 @@ void SwDoubleLinePortion::PaintBracket( SwTxtPaintInfo &rInf,
     sal_Unicode cCh = bOpen ? pBracket->cPre : pBracket->cPost;
     if( !cCh )
         return;
-    sal_uInt16 nChWidth = bOpen ? PreWidth() : PostWidth();
+    const sal_uInt16 nChWidth = bOpen ? PreWidth() : PostWidth();
     if( !nChWidth )
         return;
     if( !bOpen )
@@ -411,7 +411,7 @@ void SwDoubleLinePortion::FormatBrackets( SwTxtFormatInfo &rInf, SwTwips& nMaxWi
             pTmpFnt->SetActual( pBracket->nPostScript );
         SwFontSave aSave( rInf, pTmpFnt );
         SwPosSize aSize = rInf.GetTxtSize( aStr );
-        sal_uInt16 nTmpAsc = rInf.GetAscent();
+        const sal_uInt16 nTmpAsc = rInf.GetAscent();
         if( nTmpAsc > pBracket->nAscent )
         {
             pBracket->nHeight += nTmpAsc - pBracket->nAscent;
@@ -637,7 +637,7 @@ void SwRubyPortion::_Adjust( SwTxtFormatInfo &rInf )
     }
     sal_uInt16 nLeft = 0;   // the space in front of the first letter
     sal_uInt16 nRight = 0;  // the space at the end of the last letter
-    sal_uInt16 nSub = 0;
+    sal_Int32 nSub = 0;
     switch ( nAdjustment )
     {
         case 1: nRight = static_cast<sal_uInt16>(nLineDiff / 2);    // no break
@@ -1304,8 +1304,8 @@ void SwTxtPainter::PaintMultiPortion( const SwRect &rPaint,
 
     // old values must be saved and restored at the end
     sal_Int32 nOldLen = GetInfo().GetLen();
-    sal_uInt16 nOldX = sal_uInt16(GetInfo().X());
-    long nOldY = GetInfo().Y();
+    const SwTwips nOldX = GetInfo().X();
+    const SwTwips nOldY = GetInfo().Y();
     sal_Int32 nOldIdx = GetInfo().GetIdx();
 
     SwSpaceManipulator aManip( GetInfo(), rMulti );
@@ -1338,7 +1338,7 @@ void SwTxtPainter::PaintMultiPortion( const SwRect &rPaint,
         GetInfo().SetIdx( nTmpOldIdx );
     }
 
-    sal_uInt16 nTmpX = sal_uInt16(GetInfo().X());
+    const SwTwips nTmpX = GetInfo().X();
 
     SwLineLayout* pLay = &rMulti.GetRoot();// the first line of the multiportion
     SwLinePortion* pPor = pLay->GetFirstPortion();//first portion of these line
@@ -1624,14 +1624,14 @@ bool SwTxtFormatter::BuildMultiPortion( SwTxtFormatInfo &rInf,
     SwMultiPortion& rMulti )
 {
     SwTwips nMaxWidth = rInf.Width();
-    sal_uInt16 nOldX = 0;
+    SwTwips nOldX = 0;
 
     if( rMulti.HasBrackets() )
     {
         sal_Int32 nOldIdx = rInf.GetIdx();
         rInf.SetIdx( ((SwDoubleLinePortion&)rMulti).GetBrackets()->nStart );
         SeekAndChg( rInf );
-        nOldX = sal_uInt16(GetInfo().X());
+        nOldX = GetInfo().X();
         ((SwDoubleLinePortion&)rMulti).FormatBrackets( rInf, nMaxWidth );
         rInf.SetIdx( nOldIdx );
     }
@@ -2254,7 +2254,7 @@ SwTxtCursorSave::SwTxtCursorSave( SwTxtCursor* pTxtCursor,
     {
         bSpaceChg = pMulti->ChgSpaceAdd( pTxtCursor->pCurr, nSpaceAdd );
 
-        sal_uInt16 nSpaceCnt;
+        sal_Int32 nSpaceCnt;
         if ( pMulti->IsDouble() )
         {
             pTxtCursor->SetPropFont( 50 );
@@ -2284,7 +2284,7 @@ SwTxtCursorSave::~SwTxtCursorSave()
 {
     if( bSpaceChg )
         SwDoubleLinePortion::ResetSpaceAdd( pTxtCrsr->pCurr );
-    pTxtCrsr->pCurr->Width( sal_uInt16(nWidth) );
+    pTxtCrsr->pCurr->Width( nWidth );
     pTxtCrsr->pCurr = pCurr;
     pTxtCrsr->nStart = nStart;
     pTxtCrsr->SetPropFont( nOldProp );
diff --git a/sw/source/core/text/pormulti.hxx b/sw/source/core/text/pormulti.hxx
index ca6d804..850d323 100644
--- a/sw/source/core/text/pormulti.hxx
+++ b/sw/source/core/text/pormulti.hxx
@@ -236,8 +236,8 @@ class SwTxtCursorSave
 {
     SwTxtCursor* pTxtCrsr;
     SwLineLayout* pCurr;
-    SwTwips nWidth;
     sal_Int32 nStart;
+    sal_uInt16 nWidth;
     sal_uInt8 nOldProp;
     bool bSpaceChg;
 public:
commit dc925031190414ecf0fc09afb5b7e2ecfe7df95e
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Aug 31 12:55:04 2014 +0200

    Use more proper types, constify, avoid magic numbers
    
    Change-Id: I15d0fd7de815398ae7323209c5e1d3613b722401

diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx
index 5c80ebd..17a30fe 100644
--- a/sw/source/core/text/porrst.cxx
+++ b/sw/source/core/text/porrst.cxx
@@ -250,7 +250,7 @@ SwTwips SwTxtFrm::EmptyHeight() const
     const IDocumentRedlineAccess* pIDRA = rTxtNode.getIDocumentRedlineAccess();
     if( IDocumentRedlineAccess::IsShowChanges( pIDRA->GetRedlineMode() ) )
     {
-        sal_uInt16 nRedlPos = pIDRA->GetRedlinePos( rTxtNode, USHRT_MAX );
+        const sal_uInt16 nRedlPos = pIDRA->GetRedlinePos( rTxtNode, USHRT_MAX );
         if( USHRT_MAX != nRedlPos )
         {
             SwAttrHandler aAttrHandler;
@@ -405,7 +405,7 @@ bool SwTxtFrm::FillRegister( SwTwips& rRegStart, sal_uInt16& rRegDiff )
                                 break;
                                 case SVX_LINE_SPACE_MIN:
                                 {
-                                    if( rRegDiff < sal_uInt16( rSpace.GetLineHeight() ) )
+                                    if( rRegDiff < rSpace.GetLineHeight() )
                                         rRegDiff = rSpace.GetLineHeight();
                                     break;
                                 }
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index cb35fd2..4f17702 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -470,7 +470,7 @@ void SwTxtPortion::FormatEOL( SwTxtFormatInfo &rInf )
     {
         // calculate number of blanks
         sal_Int32 nX = rInf.GetIdx() - 1;
-        sal_uInt16 nHoleLen = 1;
+        sal_Int32 nHoleLen = 1;
         while( nX && nHoleLen < GetLen() && CH_BLANK == rInf.GetChar( --nX ) )
             nHoleLen++;
 
diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx
index 828f6ef9..8427364 100644
--- a/sw/source/core/text/redlnitr.cxx
+++ b/sw/source/core/text/redlnitr.cxx
@@ -94,16 +94,15 @@ void SwAttrIter::CtorInitAttrIter( SwTxtNode& rTxtNode, SwScriptInfo& rScrInf, S
         pFnt->SetActual( SwScriptInfo::WhichFont( 0, 0, pScriptInfo ) );
 
         sal_Int32 nChg = 0;
-        sal_uInt16 nCnt = 0;
+        size_t nCnt = 0;
 
         do
         {
             if ( nCnt >= pScriptInfo->CountScriptChg() )
                 break;
             nChg = pScriptInfo->GetScriptChg( nCnt );
-            sal_uInt16 nScript = pScriptInfo->GetScriptType( nCnt++ );
-            sal_uInt8 nTmp = 4;
-            switch ( nScript ) {
+            int nTmp = SW_SCRIPTS;
+            switch ( pScriptInfo->GetScriptType( nCnt++ ) ) {
                 case i18n::ScriptType::ASIAN :
                     if( !aMagicNo[SW_CJK] ) nTmp = SW_CJK; break;
                 case i18n::ScriptType::COMPLEX :
@@ -111,7 +110,7 @@ void SwAttrIter::CtorInitAttrIter( SwTxtNode& rTxtNode, SwScriptInfo& rScrInf, S
                 default:
                     if( !aMagicNo[SW_LATIN ] ) nTmp = SW_LATIN;
             }
-            if( nTmp < 4 )
+            if( nTmp < SW_SCRIPTS )
             {
                 pFnt->ChkMagic( pShell, nTmp );
                 pFnt->GetMagic( aMagicNo[ nTmp ], aFntIdx[ nTmp ], nTmp );
@@ -133,7 +132,7 @@ void SwAttrIter::CtorInitAttrIter( SwTxtNode& rTxtNode, SwScriptInfo& rScrInf, S
     const bool bShow = IDocumentRedlineAccess::IsShowChanges( pIDRA->GetRedlineMode() );
     if( pExtInp || bShow )
     {
-        sal_uInt16 nRedlPos = pIDRA->GetRedlinePos( rTxtNode, USHRT_MAX );
+        const sal_uInt16 nRedlPos = pIDRA->GetRedlinePos( rTxtNode, USHRT_MAX );
         if( pExtInp || USHRT_MAX != nRedlPos )
         {
             const std::vector<sal_uInt16> *pArr = 0;
@@ -364,7 +363,7 @@ bool SwRedlineItr::_ChkSpecialUnderline() const
     // below the base line
     for (size_t i = 0; i < m_Hints.size(); ++i)
     {
-        sal_uInt16 nWhich = m_Hints[i]->Which();
+        const sal_uInt16 nWhich = m_Hints[i]->Which();
         if( RES_CHRATR_UNDERLINE == nWhich ||
             RES_CHRATR_ESCAPEMENT == nWhich )
             return true;
@@ -442,11 +441,11 @@ short SwExtend::Enter(SwFont& rFnt, sal_Int32 nNew)
 bool SwExtend::_Leave(SwFont& rFnt, sal_Int32 nNew)
 {
     OSL_ENSURE( Inside(), "SwExtend: Leave without Enter" );
-    sal_uInt16 nOldAttr = rArr[ nPos - nStart ];
+    const sal_uInt16 nOldAttr = rArr[ nPos - nStart ];
     nPos = nNew;
     if( Inside() )
     {   // We stayed within the ExtendText-section
-        sal_uInt16 nAttr = rArr[ nPos - nStart ];
+        const sal_uInt16 nAttr = rArr[ nPos - nStart ];
         if( nOldAttr != nAttr ) // Is there an (inner) change of attributes?
         {
             rFnt = *pFnt;
@@ -473,8 +472,8 @@ sal_Int32 SwExtend::Next( sal_Int32 nNext )
     else if( nPos < nEnd )
     {
         sal_Int32 nIdx = nPos - nStart;
-        sal_uInt16 nAttr = rArr[ nIdx ];
-        while( ++nIdx < (sal_Int32)rArr.size() && nAttr == rArr[ nIdx ] )
+        const sal_uInt16 nAttr = rArr[ nIdx ];
+        while( static_cast<size_t>(++nIdx) < rArr.size() && nAttr == rArr[ nIdx ] )
             ; //nothing
         nIdx = nIdx + nStart;
         if( nNext > nIdx )
commit 698ee302a289c1cd5581b4415f06ade8af448c0e
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Aug 31 12:36:59 2014 +0200

    sal_uInt16 to more proper types
    
    Change-Id: I2ad19b46825650f448f921e2bbc1b71ec6314be8

diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx
index ef53b01..27e713a 100644
--- a/sw/source/core/text/txtdrop.cxx
+++ b/sw/source/core/text/txtdrop.cxx
@@ -297,7 +297,7 @@ void SwDropPortion::PaintDrop( const SwTxtPaintInfo &rInf ) const
     const sal_uInt16 nOldWidth  = Width();
     const sal_uInt16 nOldAscent = GetAscent();
     const SwTwips nOldPosY  = rInf.Y();
-    const sal_uInt16 nOldPosX   = (sal_uInt16)rInf.X();
+    const SwTwips nOldPosX  = rInf.X();
     const SwParaPortion *pPara = rInf.GetParaPortion();
     const Point aOutPos( nOldPosX + nX, nOldPosY - pPara->GetAscent()
                          - pPara->GetRealHeight() + pPara->Height() );
@@ -609,7 +609,7 @@ void SwTxtPainter::PaintDropPortion()
 
     // MarginPortion und Adjustment!
     const SwLinePortion *pPor = pCurr->GetFirstPortion();
-    sal_uInt16 nX = 0;
+    long nX = 0;
     while( pPor && !pPor->IsDropPortion() )
     {
         nX = nX + pPor->Width();
@@ -759,8 +759,7 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTxtFormatInfo &rInf )
                 SwFont& rFnt = pCurrPart->GetFont();
 
                 // Get height including proportion
-                const sal_uInt16 nCurrHeight =
-                         (sal_uInt16)rFnt.GetHeight( rFnt.GetActual() );
+                const long nCurrHeight = rFnt.GetHeight( rFnt.GetActual() );
 
                 // Get without proportion
                 const sal_uInt8 nOldProp = rFnt.GetPropr();
commit e510bd6362d748bb7347fc3e487945fad852195f
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Fri Aug 29 08:00:04 2014 +0200

    sal_uInt16: use more proper types, avoid unneeded conversions, constify
    
    Change-Id: I1ee108cca17964e20a9cd780d07f8912d6828fdc

diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx
index d221596..de4ecc3 100644
--- a/sw/source/core/text/txtfly.cxx
+++ b/sw/source/core/text/txtfly.cxx
@@ -281,10 +281,10 @@ const SwRect SwContourCache::ContourRect( const SwFmt* pFmt,
 
     LongDqPtr pTmp = pTextRanger[ 0 ]->GetTextRanges( aRange );
 
-    sal_uInt16 nCount;
-    if( 0 != ( nCount = pTmp->size() ) )
+    const size_t nCount = pTmp->size();
+    if( 0 != nCount )
     {
-        sal_uInt16 nIdx = 0;
+        size_t nIdx = 0;
         while( nIdx < nCount && (*pTmp)[ nIdx ] < nXPos )
             ++nIdx;
         bool bOdd = (nIdx % 2);
@@ -503,8 +503,8 @@ bool SwTxtFly::DrawTextOpaque( SwDrawTextInfo &rInf )
     SwAnchoredObjList::size_type nCount( bOn ? GetAnchoredObjList()->size() : 0 );
     if ( bOn && nCount > 0 )
     {
-        sal_uInt16 nHellId = pPage->getRootFrm()->GetCurrShell()->getIDocumentDrawModelAccess()->GetHellId();
-        for( sal_uInt16 i = 0; i < nCount; ++i )
+        const sal_uInt16 nHellId = pPage->getRootFrm()->GetCurrShell()->getIDocumentDrawModelAccess()->GetHellId();
+        for( SwAnchoredObjList::size_type i = 0; i < nCount; ++i )
         {
             // #i68520#
             const SwAnchoredObject* pTmpAnchoredObj = (*mpAnchoredObjList)[i];
@@ -568,7 +568,7 @@ bool SwTxtFly::DrawTextOpaque( SwDrawTextInfo &rInf )
     {
         // What a huge effort ...
         SwSaveClip aClipVout( rInf.GetpOut() );
-        for( sal_uInt16 i = 0; i < aRegion.size(); ++i )
+        for( size_t i = 0; i < aRegion.size(); ++i )
         {
             SwRect &rRect = aRegion[i];
             if( rRect != aRegion.GetOrigin() )
@@ -592,8 +592,8 @@ void SwTxtFly::DrawFlyRect( OutputDevice* pOut, const SwRect &rRect,
     SwAnchoredObjList::size_type nCount( bOn ? GetAnchoredObjList()->size() : 0 );
     if ( bOn && nCount > 0 )
     {
-        sal_uInt16 nHellId = pPage->getRootFrm()->GetCurrShell()->getIDocumentDrawModelAccess()->GetHellId();
-        for( sal_uInt16 i = 0; i < nCount; ++i )
+        const sal_uInt16 nHellId = pPage->getRootFrm()->GetCurrShell()->getIDocumentDrawModelAccess()->GetHellId();
+        for( SwAnchoredObjList::size_type i = 0; i < nCount; ++i )
         {
             // #i68520#
             const SwAnchoredObject* pAnchoredObjTmp = (*mpAnchoredObjList)[i];
@@ -635,7 +635,7 @@ void SwTxtFly::DrawFlyRect( OutputDevice* pOut, const SwRect &rRect,
         }
     }
 
-    for( sal_uInt16 i = 0; i < aRegion.size(); ++i )
+    for( size_t i = 0; i < aRegion.size(); ++i )
     {
         if ( bNoGraphic )
         {
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 8814f1e..0c0e311 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -998,7 +998,7 @@ void SwTxtFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew )
                     nLen = 1;
 
                 _InvalidateRange( SwCharRange( nPos, nLen) );
-                sal_uInt16 nTmp = ((SwUpdateAttr*)pNew)->getWhichAttr();
+                const sal_uInt16 nTmp = ((SwUpdateAttr*)pNew)->getWhichAttr();
 
                 if( ! nTmp || RES_TXTATR_CHARFMT == nTmp || RES_TXTATR_AUTOFMT == nTmp ||
                     RES_FMT_CHG == nTmp || RES_ATTRSET_CHG == nTmp )
@@ -1161,7 +1161,7 @@ void SwTxtFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew )
                 SwSortedObjs *pObjs = GetDrawObjs();
                 for ( size_t i = 0; GetDrawObjs() && i < pObjs->size(); ++i )
                 {
-                    SwAnchoredObject* pAnchoredObj = (*pObjs)[sal_uInt16(i)];
+                    SwAnchoredObject* pAnchoredObj = (*pObjs)[i];
                     if ( pAnchoredObj->ISA(SwFlyFrm) )
                     {
                         SwFlyFrm *pFly = static_cast<SwFlyFrm*>(pAnchoredObj);
diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx
index a20ba33..d9cf3dc 100644
--- a/sw/source/core/text/txtftn.cxx
+++ b/sw/source/core/text/txtftn.cxx
@@ -973,7 +973,7 @@ SwNumberPortion *SwTxtFormatter::NewFtnNumPortion( SwTxtFormatInfo &rInf ) const
 OUString lcl_GetPageNumber( const SwPageFrm* pPage )
 {
     OSL_ENSURE( pPage, "GetPageNumber: Homeless TxtFrm" );
-    sal_uInt16 nVirtNum = pPage->GetVirtPageNum();
+    const sal_uInt16 nVirtNum = pPage->GetVirtPageNum();
     const SvxNumberType& rNum = pPage->GetPageDesc()->GetNumType();
     return rNum.GetNumStr( nVirtNum );
 }
@@ -1188,7 +1188,7 @@ sal_Int32 SwTxtFormatter::FormatQuoVadis( const sal_Int32 nOffset )
         pCurrPor = pQuo;
     }
 
-    pCurr->Width( pCurr->Width() + sal_uInt16( nQuoWidth ) );
+    pCurr->Width( pCurr->Width() + nQuoWidth );
 
     // Und noch einmal adjustieren wegen des Adjustment und nicht zu Letzt
     // wegen folgendem Sonderfall: In der Zeile hat der DummUser durchgaengig
commit cb93afeafa9671d33eb6e20188d4599e3101bb35
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Thu Aug 28 22:14:02 2014 +0200

    Cleanup some core-case loops left untouched by my previous commit
    
    Change-Id: I0e9575a5ed5e2a4aebe112bf41fb07f179b3f411

diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 3c50f2f..ec2be6b 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -1485,18 +1485,15 @@ void CalcCntnt( SwLayoutFrm *pLay,
                 bool bAgain = false;
                 SwPageFrm* pPageFrm = pFrm->FindPageFrm();
                 size_t nCnt = pFrm->GetDrawObjs()->size();
-                for ( size_t i = 0; i < nCnt; ++i )
+                size_t i = 0;
+                while ( i < nCnt )
                 {
                     // #i28701#
                     SwAnchoredObject* pAnchoredObj = (*pFrm->GetDrawObjs())[i];
-                    // determine, if anchored object has to be formatted.
-                    if ( pAnchoredObj->PositionLocked() )
-                    {
-                        continue;
-                    }
 
-                    // format anchored object
-                    if ( pAnchoredObj->IsFormatPossible() )
+                    // determine if anchored object has to be
+                    // formatted and, in case, format it
+                    if ( !pAnchoredObj->PositionLocked() && pAnchoredObj->IsFormatPossible() )
                     {
                         // #i43737# - no invalidation of
                         // anchored object needed - causes loops for as-character
@@ -1557,10 +1554,12 @@ void CalcCntnt( SwLayoutFrm *pLay,
                             break;
                         if ( pFrm->GetDrawObjs()->size() < nCnt )
                         {
-                            --i;
                             --nCnt;
+                            // Do not increment index, in this case
+                            continue;
                         }
                     }
+                    ++i;
                 }
 
                 // #i28701# - restart layout process, if
diff --git a/sw/source/core/layout/hffrm.cxx b/sw/source/core/layout/hffrm.cxx
index 6eae4c5..a014a5b 100644
--- a/sw/source/core/layout/hffrm.cxx
+++ b/sw/source/core/layout/hffrm.cxx
@@ -646,9 +646,10 @@ bool SwHeadFootFrm::GetEatSpacing() const
 
 void DelFlys( SwLayoutFrm *pFrm, SwPageFrm *pPage )
 {
-    for ( int i = 0; pPage->GetSortedObjs() &&
-                        pPage->GetSortedObjs()->size() &&
-                        i < (int)pPage->GetSortedObjs()->size(); ++i )
+    size_t i = 0;
+    while ( pPage->GetSortedObjs() &&
+            pPage->GetSortedObjs()->size() &&
+            i < pPage->GetSortedObjs()->size() )
     {
         SwAnchoredObject* pObj = (*pPage->GetSortedObjs())[i];
         if ( pObj->ISA(SwFlyFrm) )
@@ -657,9 +658,11 @@ void DelFlys( SwLayoutFrm *pFrm, SwPageFrm *pPage )
             if ( pFrm->IsAnLower( pFlyFrm ) )
             {
                 delete pFlyFrm;
-                --i;
+                // Do not increment index, in this case
+                continue;
             }
         }
+        ++i;
     }
 }
 
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index 2634148..c274279 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -812,8 +812,8 @@ void SwPageFrm::Cut()
         // move Flys whose anchor is on a different page (draw objects are not relevant here)
         if ( GetSortedObjs() )
         {
-            for ( int i = 0; GetSortedObjs() &&
-                             (sal_uInt16)i < GetSortedObjs()->size(); ++i )
+            size_t i = 0;
+            while ( GetSortedObjs() && i < GetSortedObjs()->size() )
             {
                 // #i28701#
                 SwAnchoredObject* pAnchoredObj = (*GetSortedObjs())[i];
@@ -826,11 +826,13 @@ void SwPageFrm::Cut()
                     if ( pAnchPage && (pAnchPage != this) )
                     {
                         MoveFly( pFly, pAnchPage );
-                        --i;
                         pFly->InvalidateSize();
                         pFly->_InvalidatePos();
+                        // Do not increment index, in this case
+                        continue;
                     }
                 }
+                ++i;
             }
         }
         // cleanup Window
@@ -1469,9 +1471,8 @@ void SwRootFrm::AssertPageFlys( SwPageFrm *pPage )
         if ( pPage->GetSortedObjs() )
         {
             pPage->GetSortedObjs();
-            for ( int i = 0;
-                  pPage->GetSortedObjs() && sal_uInt16(i) < pPage->GetSortedObjs()->size();
-                  ++i)
+            size_t i = 0;
+            while ( pPage->GetSortedObjs() && i< pPage->GetSortedObjs()->size() )
             {
                 // #i28701#
                 SwFrmFmt& rFmt = (*pPage->GetSortedObjs())[i]->GetFrmFmt();
@@ -1494,9 +1495,11 @@ void SwRootFrm::AssertPageFlys( SwPageFrm *pPage )
 #else
                         rFmt.NotifyClients( 0, (SwFmtAnchor*)&rAnch );
 #endif
-                        --i;
+                        // Do not increment index, in this case
+                        continue;
                     }
                 }
+                ++i;
             }
         }
         pPage = (SwPageFrm*)pPage->GetNext();
commit 4d8701537f444b57d6fad085ad325ef64310b784
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Thu Aug 28 21:51:04 2014 +0200

    SwSortedObjs: Count() to size() and use size_t consistently
    
    Change-Id: I80fa39e9790a0dfff9d4afb534be119eb593b60d

diff --git a/sw/source/core/access/accfrmobjmap.cxx b/sw/source/core/access/accfrmobjmap.cxx
index e669699..2f387eb 100644
--- a/sw/source/core/access/accfrmobjmap.cxx
+++ b/sw/source/core/access/accfrmobjmap.cxx
@@ -66,7 +66,7 @@ SwAccessibleChildMap::SwAccessibleChildMap( const SwRect& rVisArea,
         const SwSortedObjs *pObjs = pPgFrm->GetSortedObjs();
         if ( pObjs )
         {
-            for( sal_uInt16 i=0; i<pObjs->Count(); i++ )
+            for( size_t i=0; i<pObjs->size(); ++i )
             {
                 aLower = (*pObjs)[i]->GetDrawObj();
                 if ( aLower.GetBox( rAccMap ).IsOver( rVisArea ) )
@@ -81,7 +81,7 @@ SwAccessibleChildMap::SwAccessibleChildMap( const SwRect& rVisArea,
         const SwSortedObjs *pObjs = rFrm.GetDrawObjs();
         if ( pObjs )
         {
-            for( sal_uInt16 i=0; i<pObjs->Count(); i++ )
+            for( size_t i=0; i<pObjs->size(); ++i )
             {
                 aLower = (*pObjs)[i]->GetDrawObj();
                 if ( aLower.IsBoundAsChar() &&
diff --git a/sw/source/core/access/accfrmobjslist.cxx b/sw/source/core/access/accfrmobjslist.cxx
index 697e3d9..68f9fbf 100644
--- a/sw/source/core/access/accfrmobjslist.cxx
+++ b/sw/source/core/access/accfrmobjslist.cxx
@@ -41,7 +41,7 @@ SwAccessibleChildSList_const_iterator::SwAccessibleChildSList_const_iterator(
         {
             const SwPageFrm& rPgFrm = static_cast< const SwPageFrm& >( rFrm );
             const SwSortedObjs *pObjs = rPgFrm.GetSortedObjs();
-            if( pObjs && pObjs->Count() )
+            if( pObjs && pObjs->size() )
             {
                 aCurr = (*pObjs)[nNextObj++]->GetDrawObj();
             }
@@ -49,12 +49,12 @@ SwAccessibleChildSList_const_iterator::SwAccessibleChildSList_const_iterator(
         else if( rFrm.IsTxtFrm() )
         {
             const SwSortedObjs *pObjs = rFrm.GetDrawObjs();
-            if ( pObjs && pObjs->Count() )
+            if ( pObjs && pObjs->size() )
             {
                 aCurr = (*pObjs)[nNextObj++]->GetDrawObj();
                 while( aCurr.IsValid() && !aCurr.IsBoundAsChar() )
                 {
-                    aCurr = (nNextObj < pObjs->Count())
+                    aCurr = (nNextObj < pObjs->size())
                             ? (*pObjs)[nNextObj++]->GetDrawObj()
                             : static_cast< const SdrObject *>( 0 );
                 }
@@ -108,14 +108,14 @@ SwAccessibleChildSList_const_iterator& SwAccessibleChildSList_const_iterator::ne
         {
             const SwPageFrm& rPgFrm = static_cast< const SwPageFrm& >( rFrm );
             const SwSortedObjs *pObjs = rPgFrm.GetSortedObjs();
-            aCurr = ( pObjs && nNextObj < pObjs->Count() )
+            aCurr = ( pObjs && nNextObj < pObjs->size() )
                     ? (*pObjs)[nNextObj++]->GetDrawObj()
                     : static_cast< const SdrObject *>( 0 );
         }
         else if( rFrm.IsTxtFrm() )
         {
             const SwSortedObjs* pObjs = rFrm.GetDrawObjs();
-            const sal_uInt32 nObjsCount = pObjs ? pObjs->Count() : 0;
+            const size_t nObjsCount = pObjs ? pObjs->size() : 0;
             aCurr = ( pObjs && nNextObj < nObjsCount )
                     ? (*pObjs)[nNextObj++]->GetDrawObj()
                     : static_cast< const SdrObject *>( 0 );
diff --git a/sw/source/core/access/accfrmobjslist.hxx b/sw/source/core/access/accfrmobjslist.hxx
index d54a631..d009ed7 100644
--- a/sw/source/core/access/accfrmobjslist.hxx
+++ b/sw/source/core/access/accfrmobjslist.hxx
@@ -33,7 +33,7 @@ private:
 
     const SwAccessibleChildSList& rList;    // The frame we are iterating over
     sw::access::SwAccessibleChild aCurr;    // The current object
-    sal_uInt16 nNextObj;                    // The index of the current sdr object
+    size_t nNextObj;                        // The index of the current sdr object
 
     inline SwAccessibleChildSList_const_iterator( const SwAccessibleChildSList& rLst )
         : rList( rLst )
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index 2b04375..0fb8c41 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -558,7 +558,7 @@ SwPosFlyFrms SwDoc::GetAllFlyFmts( const SwPaM* pCmpRange, bool bDrawAlso,
         if( pPage->GetSortedObjs() )
         {
             SwSortedObjs &rObjs = *pPage->GetSortedObjs();
-            for( sal_uInt16 i = 0; i < rObjs.Count(); ++i)
+            for( size_t i = 0; i < rObjs.size(); ++i)
             {
                 SwAnchoredObject* pAnchoredObj = rObjs[i];
                 if ( pAnchoredObj->ISA(SwFlyFrm) )
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index 1eec8a3..47d1a8d 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -500,7 +500,7 @@ void SwFlyDrawContact::MoveObjToVisibleLayer( SdrObject* _pDrawObj )
     }
     if ( pFlyFrm->GetDrawObjs() )
     {
-        for ( sal_uInt8 i = 0; i < pFlyFrm->GetDrawObjs()->Count(); ++i)
+        for ( size_t i = 0; i < pFlyFrm->GetDrawObjs()->size(); ++i)
         {
             // #i28701# - consider type of objects in sorted object list.
             SdrObject* pObj = (*pFlyFrm->GetDrawObjs())[i]->DrawObj();
@@ -535,7 +535,7 @@ void SwFlyDrawContact::MoveObjToInvisibleLayer( SdrObject* _pDrawObj )
     pFlyFrm->DeleteCnt();
     if ( pFlyFrm->GetDrawObjs() )
     {
-        for ( sal_uInt8 i = 0; i < pFlyFrm->GetDrawObjs()->Count(); ++i)
+        for ( size_t i = 0; i < pFlyFrm->GetDrawObjs()->size(); ++i)
         {
             // #i28701# - consider type of objects in sorted object list.
             SdrObject* pObj = (*pFlyFrm->GetDrawObjs())[i]->DrawObj();
diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx
index 5890121..8e6ef06 100644
--- a/sw/source/core/draw/dview.cxx
+++ b/sw/source/core/draw/dview.cxx
@@ -258,10 +258,9 @@ SdrObject* SwDrawView::GetMaxToTopObj( SdrObject* pObj ) const
                 if ( pPage->GetSortedObjs() )
                 {
                     size_t nOrdNum = 0;
-                    for ( sal_uInt16 i = 0; i < pPage->GetSortedObjs()->Count(); ++i )
+                    for ( size_t i = 0; i < pPage->GetSortedObjs()->size(); ++i )
                     {
-                        const SdrObject *pO =
-                                    (*pPage->GetSortedObjs())[i]->GetDrawObj();
+                        const SdrObject *pO = (*pPage->GetSortedObjs())[i]->GetDrawObj();
 
                         if ( pO->GetOrdNumDirect() > nOrdNum )
                         {
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index 97c064c..d64644e 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -415,15 +415,13 @@ bool SwFEShell::MoveAnchor( sal_uInt16 nDir )
                 SwFlyFrm* pNewFly = NULL;
                 if( pPage->GetSortedObjs() )
                 {
-                    int i;
                     bool bOld = false;
                     Point aCenter( pOld->Frm().Left() + pOld->Frm().Width()/2,
                                    pOld->Frm().Top() + pOld->Frm().Height()/2 );
                     Point aBest;
-                    for( i = 0; (sal_uInt16)i<pPage->GetSortedObjs()->Count(); ++i )
+                    for( size_t i = 0; i<pPage->GetSortedObjs()->size(); ++i )
                     {
-                        SwAnchoredObject* pAnchObj =
-                                                (*pPage->GetSortedObjs())[i];
+                        SwAnchoredObject* pAnchObj = (*pPage->GetSortedObjs())[i];
                         if( pAnchObj->ISA(SwFlyFrm) )
                         {
                             SwFlyFrm* pTmp = static_cast<SwFlyFrm*>(pAnchObj);
@@ -759,8 +757,8 @@ static void lcl_NotifyNeighbours( const SdrMarkList *pLst )
             aRect = GetBoundRectOfAnchoredObj( pO );
         }
 

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list