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

Matteo Casalin matteo.casalin at yahoo.com
Sat Nov 23 05:21:12 PST 2013


 sw/inc/pam.hxx                               |   12 +-
 sw/source/core/crsr/pam.cxx                  |   12 +-
 sw/source/core/crsr/swcrsr.cxx               |   81 ++++++---------
 sw/source/core/doc/doc.cxx                   |   33 ++----
 sw/source/core/text/itratr.cxx               |   12 +-
 sw/source/core/undo/untbl.cxx                |    2 
 sw/source/core/unocore/unoflatpara.cxx       |    4 
 sw/source/core/unocore/unoftn.cxx            |    2 
 sw/source/filter/ascii/ascatr.cxx            |   20 +--
 sw/source/filter/inc/msfilter.hxx            |    6 -
 sw/source/filter/ww8/attributeoutputbase.hxx |    2 
 sw/source/filter/ww8/docxattributeoutput.cxx |   10 -
 sw/source/filter/ww8/docxattributeoutput.hxx |    2 
 sw/source/filter/ww8/docxexport.cxx          |   11 --
 sw/source/filter/ww8/docxexport.hxx          |    2 
 sw/source/filter/ww8/rtfattributeoutput.cxx  |    2 
 sw/source/filter/ww8/rtfattributeoutput.hxx  |    2 
 sw/source/filter/ww8/rtfexport.cxx           |    2 
 sw/source/filter/ww8/rtfexport.hxx           |    2 
 sw/source/filter/ww8/rtfsdrexport.cxx        |   11 --
 sw/source/filter/ww8/writerwordglue.cxx      |   10 -
 sw/source/filter/ww8/wrtw8esh.cxx            |   30 ++---
 sw/source/filter/ww8/wrtw8nds.cxx            |  144 +++++++++++++--------------
 sw/source/filter/ww8/wrtww8.cxx              |    9 -
 sw/source/filter/ww8/wrtww8.hxx              |   59 +++++------
 sw/source/filter/ww8/ww8attributeoutput.hxx  |    2 
 sw/source/filter/ww8/ww8par.cxx              |   27 -----
 sw/source/filter/ww8/ww8par.hxx              |   10 -
 sw/source/filter/ww8/ww8par3.cxx             |   17 +--
 sw/source/filter/ww8/ww8par5.cxx             |    2 
 30 files changed, 248 insertions(+), 292 deletions(-)

New commits:
commit bcdfbc777af3fac3c115cdca63a3c9b580416a23
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Fri Nov 22 23:55:07 2013 +0100

    else is not needed after continue or return
    
    Change-Id: If2d3f3ca1b7cbf5cb9273043d0299c41286898e7

diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index ad75959..5b7ab4a 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -1195,7 +1195,7 @@ void MSWord_SdrAttrIter::OutAttr( sal_Int32 nSwPos )
                     OutEEField(*(i->pAttr));
                     continue;
                 }
-                else if (nWhich == EE_FEATURE_TAB)
+                if (nWhich == EE_FEATURE_TAB)
                 {
                     m_rExport.WriteChar(0x9);
                     continue;
@@ -1257,7 +1257,7 @@ const SfxPoolItem* MSWord_SdrAttrIter::HasTextItem(sal_uInt16 nWhich) const
         {
             if (nWhich == i->pAttr->Which() && nTmpSwPos >= i->nStart && nTmpSwPos < i->nEnd)
                 return i->pAttr;    // Found
-            else if (nTmpSwPos < i->nStart)
+            if (nTmpSwPos < i->nStart)
                 return NULL;        // dann kommt da nichts mehr
         }
     }
commit 9497b37373dee60485aa3ae8983b8b4d32f936b0
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Fri Nov 22 23:37:59 2013 +0100

    Reduce scope
    
    Change-Id: Ic04a48c1a1230824b9676a6d7615b2eb39608985

diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index 10b97cc..ad75959 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -1185,12 +1185,11 @@ void MSWord_SdrAttrIter::OutAttr( sal_Int32 nSwPos )
         const SfxItemPool& rDstPool = m_rExport.pDoc->GetAttrPool();
 
         nTmpSwPos = nSwPos;
-        sal_uInt16 nWhich, nSlotId;
         for(std::vector<EECharAttrib>::const_iterator i = aTxtAtrArr.begin(); i < aTxtAtrArr.end(); ++i)
         {
             if (nSwPos >= i->nStart && nSwPos < i->nEnd)
             {
-                nWhich = i->pAttr->Which();
+                sal_uInt16 nWhich = i->pAttr->Which();
                 if (nWhich == EE_FEATURE_FIELD)
                 {
                     OutEEField(*(i->pAttr));
@@ -1201,8 +1200,8 @@ void MSWord_SdrAttrIter::OutAttr( sal_Int32 nSwPos )
                     m_rExport.WriteChar(0x9);
                     continue;
                 }
-                nSlotId = pSrcPool->GetSlotId(nWhich);
 
+                const sal_uInt16 nSlotId = pSrcPool->GetSlotId(nWhich);
                 if (nSlotId && nWhich != nSlotId)
                 {
                     nWhich = rDstPool.GetWhich(nSlotId);
commit 686edf1a795b79fcbe8f97b63d81e0536ba18d90
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Fri Nov 22 22:55:29 2013 +0100

    Bail out early
    
    Change-Id: I6dfa1ae680a71fef55fdd7e891cfa058a05dffa0

diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index a136113..695c113 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -1180,24 +1180,22 @@ int SwWW8AttrIter::OutAttrWithRange(sal_Int32 nPos)
 
 bool SwWW8AttrIter::IsRedlineAtEnd( sal_Int32 nEnd ) const
 {
-    bool bRet = false;
     // search next Redline
     for( sal_uInt16 nPos = nCurRedlinePos;
         nPos < m_rExport.pDoc->GetRedlineTbl().size(); ++nPos )
     {
         const SwPosition* pEnd = m_rExport.pDoc->GetRedlineTbl()[ nPos ]->End();
-        if( pEnd->nNode == rNd )
+        if( pEnd->nNode != rNd )
         {
-            if( pEnd->nContent.GetIndex() == nEnd )
-            {
-                bRet = true;
-                break;
-            }
-        }
-        else
             break;
+        }
+
+        if( pEnd->nContent.GetIndex() == nEnd )
+        {
+            return true;
+        }
     }
-    return bRet;
+    return false;
 }
 
 const SwRedlineData* SwWW8AttrIter::GetRedline( sal_Int32 nPos )
commit 26201202b7df6885891ea23cf9ab59206c5ddcb7
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Fri Nov 22 22:36:02 2013 +0100

    No need for an else after a break
    
    Change-Id: I538fbbe5e628d03b4e641c5eb558b30d7654333e

diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index bdc09eb..a136113 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -526,11 +526,9 @@ void SwWW8AttrIter::OutFlys(sal_Int32 nSwPos)
 
         if ( nPos != nSwPos )
             break;
-        else
-        {
-            m_rExport.AttrOutput().OutputFlyFrame( *maFlyIter );
-            ++maFlyIter;
-        }
+
+        m_rExport.AttrOutput().OutputFlyFrame( *maFlyIter );
+        ++maFlyIter;
     }
 }
 
commit 19646b84f9fd71e0b9cb79a2685a4075f5cfc174
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Fri Nov 22 22:34:35 2013 +0100

    Reduce scope of some variables and simplify checks
    
    Change-Id: Ice6ce4c13040fc0ad7aa4fb9c95144d0a130f2b6

diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 74dfd1c..bdc09eb 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -236,27 +236,29 @@ sal_Int32 lcl_getMinPos( sal_Int32 pos1, sal_Int32 pos2 )
 
 sal_Int32 SwWW8AttrIter::SearchNext( sal_Int32 nStartPos )
 {
-    sal_Int32 nPos;
-    sal_Int32 nMinPos = SAL_MAX_INT32;
-    sal_Int32 i=0;
-
     const OUString aTxt = rNd.GetTxt();
     sal_Int32 fieldEndPos = aTxt.indexOf(CH_TXT_ATR_FIELDEND, nStartPos);
     sal_Int32 fieldStartPos = aTxt.indexOf(CH_TXT_ATR_FIELDSTART, nStartPos);
     sal_Int32 formElementPos = aTxt.indexOf(CH_TXT_ATR_FORMELEMENT, nStartPos);
 
-    sal_Int32 pos = lcl_getMinPos( fieldEndPos, fieldStartPos );
-    pos = lcl_getMinPos( pos, formElementPos );
+    const sal_Int32 pos = lcl_getMinPos(
+        lcl_getMinPos( fieldEndPos, fieldStartPos ),
+        formElementPos );
 
-    if (pos != -1)
-        nMinPos = pos;
+    sal_Int32 nMinPos = (pos>=0) ? pos : SAL_MAX_INT32;
 
     // first the redline, then the attributes
     if( pCurRedline )
     {
         const SwPosition* pEnd = pCurRedline->End();
-        if (pEnd->nNode == rNd && ((i = pEnd->nContent.GetIndex()) >= nStartPos) && i < nMinPos )
+        if (pEnd->nNode == rNd)
+        {
+            const sal_Int32 i = pEnd->nContent.GetIndex();
+            if ( i >= nStartPos && i < nMinPos )
+            {
                 nMinPos = i;
+            }
+        }
     }
 
     if ( nCurRedlinePos < m_rExport.pDoc->GetRedlineTbl().size() )
@@ -277,17 +279,21 @@ sal_Int32 SwWW8AttrIter::SearchNext( sal_Int32 nStartPos )
 
             if( pStt->nNode == rNd )
             {
-                if( ( i = pStt->nContent.GetIndex() ) >= nStartPos &&
-                    i < nMinPos )
+                const sal_Int32 i = pStt->nContent.GetIndex();
+                if( i >= nStartPos && i < nMinPos )
                     nMinPos = i;
             }
             else
                 break;
 
-            if( pEnd->nNode == rNd &&
-                ( i = pEnd->nContent.GetIndex() ) < nMinPos &&
-                i >= nStartPos )
+            if( pEnd->nNode == rNd )
+            {
+                const sal_Int32 i = pEnd->nContent.GetIndex();
+                if( i >= nStartPos && i < nMinPos )
+                {
                     nMinPos = i;
+                }
+            }
         }
     }
 
@@ -302,10 +308,10 @@ sal_Int32 SwWW8AttrIter::SearchNext( sal_Int32 nStartPos )
 
 // can be optimized if we consider that the TxtAttrs are sorted by start position.
 // but then we'd have to save 2 indices
-        for( i = 0; i < pTxtAttrs->Count(); i++ )
+        for( sal_uInt16 i = 0; i < pTxtAttrs->Count(); i++ )
         {
             const SwTxtAttr* pHt = (*pTxtAttrs)[i];
-            nPos = *pHt->GetStart();    // first Attr characters
+            sal_Int32 nPos = *pHt->GetStart();    // first Attr characters
             if( nPos >= nStartPos && nPos <= nMinPos )
                 nMinPos = nPos;
 
@@ -343,7 +349,7 @@ sal_Int32 SwWW8AttrIter::SearchNext( sal_Int32 nStartPos )
     {
         const SwPosition &rAnchor = maFlyIter->GetPosition();
 
-        nPos = rAnchor.nContent.GetIndex();
+        sal_Int32 nPos = rAnchor.nContent.GetIndex();
         if (nPos >= nStartPos && nPos <= nMinPos)
             nMinPos = nPos;
 
commit 21a887124cdd3e2dcdd58df411271a275acac06b
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Fri Nov 22 21:08:44 2013 +0100

    Simplify lcl_getMinPos
    
    Change-Id: Ibf272e1bd1a0c76b0f07dfe136197043fb3e15e2

diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 0122fe3..74dfd1c 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -224,20 +224,14 @@ SwWW8AttrIter::SwWW8AttrIter(MSWordExportBase& rWr, const SwTxtNode& rTxtNd) :
 
 sal_Int32 lcl_getMinPos( sal_Int32 pos1, sal_Int32 pos2 )
 {
-    sal_Int32 min = -1;
-    if ( pos1 == -1 && pos2 != -1 )
-        min = pos2;
-    else if ( pos2 == -1 && pos1 != -1 )
-        min = pos1;
-    else if ( pos1 != -1 && pos2 != -1 )
-    {
-        if ( pos1 < pos2 )
-            min = pos1;
-        else
-            min = pos2;
+    if ( pos1 >= 0 && pos2 >= 0 )
+    {
+        // both valid: return minimum one
+        return std::min(pos1, pos2);
     }
 
-    return min;
+    // return the valid one, if any, or -1
+    return std::max(pos1, pos2);
 }
 
 sal_Int32 SwWW8AttrIter::SearchNext( sal_Int32 nStartPos )
commit d3cb483e7fa127886877dba08c285f47093c27d8
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Fri Nov 22 20:29:26 2013 +0100

    xub_StrLen to sal_Int32
    
    Change-Id: I7f30e122a44eda7ee1c93595029ec15b6b426d6c

diff --git a/sw/source/filter/inc/msfilter.hxx b/sw/source/filter/inc/msfilter.hxx
index 30a5997..08975da 100644
--- a/sw/source/filter/inc/msfilter.hxx
+++ b/sw/source/filter/inc/msfilter.hxx
@@ -430,11 +430,11 @@ namespace sw
 
         struct CharRunEntry
         {
-            xub_StrLen mnEndPos;
+            sal_Int32 mnEndPos;
             sal_uInt16 mnScript;
             rtl_TextEncoding meCharSet;
             bool mbRTL;
-            CharRunEntry(xub_StrLen nEndPos, sal_uInt16 nScript,
+            CharRunEntry(sal_Int32 nEndPos, sal_uInt16 nScript,
                 rtl_TextEncoding eCharSet, bool bRTL)
             : mnEndPos(nEndPos), mnScript(nScript), meCharSet(eCharSet),
             mbRTL(bRTL)
@@ -475,7 +475,7 @@ namespace sw
             @see #i22537# for example
         */
         CharRuns GetPseudoCharRuns(const SwTxtNode& rTxtNd,
-            xub_StrLen nStart = 0, bool bSplitOnCharSet = false);
+            sal_Int32 nStart = 0, bool bSplitOnCharSet = false);
     }
 }
 
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index 58b681e..b6d91c9 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -120,7 +120,7 @@ bool DocxExport::CollapseScriptsforWordOk( sal_uInt16 nScript, sal_uInt16 nWhich
     return true;
 }
 
-void DocxExport::AppendBookmarks( const SwTxtNode& rNode, xub_StrLen nAktPos, xub_StrLen nLen )
+void DocxExport::AppendBookmarks( const SwTxtNode& rNode, sal_Int32 nAktPos, sal_Int32 nLen )
 {
     std::vector< OUString > aStarts;
     std::vector< OUString > aEnds;
diff --git a/sw/source/filter/ww8/docxexport.hxx b/sw/source/filter/ww8/docxexport.hxx
index 3815459..080c507 100644
--- a/sw/source/filter/ww8/docxexport.hxx
+++ b/sw/source/filter/ww8/docxexport.hxx
@@ -106,7 +106,7 @@ public:
     /// Guess the script (asian/western).
     virtual bool CollapseScriptsforWordOk( sal_uInt16 nScript, sal_uInt16 nWhich );
 
-    virtual void AppendBookmarks( const SwTxtNode& rNode, xub_StrLen nAktPos, xub_StrLen nLen );
+    virtual void AppendBookmarks( const SwTxtNode& rNode, sal_Int32 nAktPos, sal_Int32 nLen );
 
     virtual void AppendBookmark( const OUString& rName, bool bSkip = false );
 
diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx
index 05647b9..a711ec8 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -122,7 +122,7 @@ bool RtfExport::CollapseScriptsforWordOk( sal_uInt16 nScript, sal_uInt16 nWhich
     return true;
 }
 
-void RtfExport::AppendBookmarks( const SwTxtNode& rNode, xub_StrLen nAktPos, xub_StrLen nLen )
+void RtfExport::AppendBookmarks( const SwTxtNode& rNode, sal_Int32 nAktPos, sal_Int32 nLen )
 {
     SAL_INFO("sw.rtf", OSL_THIS_FUNC);
 
diff --git a/sw/source/filter/ww8/rtfexport.hxx b/sw/source/filter/ww8/rtfexport.hxx
index e77adf9..886322f 100644
--- a/sw/source/filter/ww8/rtfexport.hxx
+++ b/sw/source/filter/ww8/rtfexport.hxx
@@ -69,7 +69,7 @@ public:
     /// Guess the script (asian/western).
     virtual bool CollapseScriptsforWordOk( sal_uInt16 nScript, sal_uInt16 nWhich );
 
-    virtual void AppendBookmarks( const SwTxtNode& rNode, xub_StrLen nAktPos, xub_StrLen nLen );
+    virtual void AppendBookmarks( const SwTxtNode& rNode, sal_Int32 nAktPos, sal_Int32 nLen );
 
     virtual void AppendBookmark( const OUString& rName, bool bSkip = false );
 
diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx
index 7fc6061..c02dbea 100644
--- a/sw/source/filter/ww8/writerwordglue.cxx
+++ b/sw/source/filter/ww8/writerwordglue.cxx
@@ -324,9 +324,9 @@ namespace myImplHelpers
         : public std::unary_function<const sw::util::CharRunEntry&, bool>
     {
     private:
-        xub_StrLen mnStart;
+        sal_Int32 mnStart;
     public:
-        IfBeforeStart(xub_StrLen nStart) : mnStart(nStart) {}
+        IfBeforeStart(sal_Int32 nStart) : mnStart(nStart) {}
         bool operator()(const sw::util::CharRunEntry &rEntry) const
         {
             return rEntry.mnEndPos < mnStart;
@@ -502,7 +502,7 @@ namespace sw
         }
 
         CharRuns GetPseudoCharRuns(const SwTxtNode& rTxtNd,
-            xub_StrLen nTxtStart, bool bSplitOnCharSet)
+            sal_Int32 nTxtStart, bool bSplitOnCharSet)
         {
             const OUString &rTxt = rTxtNd.GetTxt();
 
@@ -540,11 +540,11 @@ namespace sw
             typedef std::vector<DirEntry> DirChanges;
             typedef DirChanges::const_iterator cDirIter;
 
-            typedef std::pair<xub_StrLen, sal_Int16> CharSetEntry;
+            typedef std::pair<sal_Int32, sal_Int16> CharSetEntry;
             typedef std::vector<CharSetEntry> CharSetChanges;
             typedef CharSetChanges::const_iterator cCharSetIter;
 
-            typedef std::pair<xub_StrLen, sal_uInt16> ScriptEntry;
+            typedef std::pair<sal_Int32, sal_uInt16> ScriptEntry;
             typedef std::vector<ScriptEntry> ScriptChanges;
             typedef ScriptChanges::const_iterator cScriptIter;
 
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 26ab20e..0122fe3 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -224,7 +224,7 @@ SwWW8AttrIter::SwWW8AttrIter(MSWordExportBase& rWr, const SwTxtNode& rTxtNd) :
 
 sal_Int32 lcl_getMinPos( sal_Int32 pos1, sal_Int32 pos2 )
 {
-    xub_StrLen min = -1;
+    sal_Int32 min = -1;
     if ( pos1 == -1 && pos2 != -1 )
         min = pos2;
     else if ( pos2 == -1 && pos1 != -1 )
@@ -595,7 +595,7 @@ const SfxPoolItem* SwWW8AttrIter::HasTextItem( sal_uInt16 nWhich ) const
     const SwpHints* pTxtAttrs = rNd.GetpSwpHints();
     if (pTxtAttrs && !m_rExport.m_aCurrentCharPropStarts.empty())
     {
-        xub_StrLen nTmpSwPos = m_rExport.m_aCurrentCharPropStarts.top();
+        const sal_Int32 nTmpSwPos = m_rExport.m_aCurrentCharPropStarts.top();
         for (sal_uInt16 i = 0; i < pTxtAttrs->Count(); ++i)
         {
             const SwTxtAttr* pHt = (*pTxtAttrs)[i];
@@ -1591,11 +1591,11 @@ void WW8AttributeOutput::FormatDrop( const SwTxtNode& rNode, const SwFmtDrop &rS
     m_rWW8Export.pO->clear();
 }
 
-xub_StrLen MSWordExportBase::GetNextPos( SwWW8AttrIter* aAttrIter, const SwTxtNode& rNode, xub_StrLen nAktPos  )
+sal_Int32 MSWordExportBase::GetNextPos( SwWW8AttrIter* aAttrIter, const SwTxtNode& rNode, sal_Int32 nAktPos )
 {
     // Get the bookmarks for the normal run
-    xub_StrLen nNextPos = aAttrIter->WhereNext();
-    xub_StrLen nNextBookmark = nNextPos;
+    const sal_Int32 nNextPos = aAttrIter->WhereNext();
+    sal_Int32 nNextBookmark = nNextPos;
 
     if( nNextBookmark > nAktPos ) //no need to search for bookmarks otherwise (checked in UpdatePosition())
     {
@@ -1605,9 +1605,9 @@ xub_StrLen MSWordExportBase::GetNextPos( SwWW8AttrIter* aAttrIter, const SwTxtNo
     return std::min( nNextPos, nNextBookmark );
 }
 
-void MSWordExportBase::UpdatePosition( SwWW8AttrIter* aAttrIter, xub_StrLen nAktPos, xub_StrLen /*nEnd*/ )
+void MSWordExportBase::UpdatePosition( SwWW8AttrIter* aAttrIter, sal_Int32 nAktPos, sal_Int32 /*nEnd*/ )
 {
-    xub_StrLen nNextPos;
+    sal_Int32 nNextPos;
 
     // go to next attribute if no bookmark is found or if the bookmark is behind the next attribute position
     // It may happened that the WhereNext() wasn't used in the previous increment because there was a
@@ -1617,8 +1617,8 @@ void MSWordExportBase::UpdatePosition( SwWW8AttrIter* aAttrIter, xub_StrLen nAkt
         aAttrIter->NextPos();
 }
 
-bool MSWordExportBase::GetBookmarks( const SwTxtNode& rNd, xub_StrLen nStt,
-                    xub_StrLen nEnd, IMarkVector& rArr )
+bool MSWordExportBase::GetBookmarks( const SwTxtNode& rNd, sal_Int32 nStt,
+                    sal_Int32 nEnd, IMarkVector& rArr )
 {
     IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
     sal_uLong nNd = rNd.GetIndex( );
@@ -1632,8 +1632,8 @@ bool MSWordExportBase::GetBookmarks( const SwTxtNode& rNd, xub_StrLen nStt,
         if ( pMark->GetMarkStart().nNode == nNd ||
              pMark->GetMarkEnd().nNode == nNd )
         {
-            xub_StrLen nBStart = pMark->GetMarkStart().nContent.GetIndex();
-            xub_StrLen nBEnd = pMark->GetMarkEnd().nContent.GetIndex();
+            const sal_Int32 nBStart = pMark->GetMarkStart().nContent.GetIndex();
+            const sal_Int32 nBEnd = pMark->GetMarkEnd().nContent.GetIndex();
 
             // Keep only the bookmars starting or ending in the snippet
             bool bIsStartOk = ( pMark->GetMarkStart().nNode == nNd ) && ( nBStart >= nStt ) && ( nBStart <= nEnd );
@@ -1662,14 +1662,14 @@ public:
     }
 };
 
-bool MSWordExportBase::NearestBookmark( xub_StrLen& rNearest, const xub_StrLen nAktPos, bool bNextPositionOnly )
+bool MSWordExportBase::NearestBookmark( sal_Int32& rNearest, const sal_Int32 nAktPos, bool bNextPositionOnly )
 {
     bool bHasBookmark = false;
 
     if ( !m_rSortedMarksStart.empty() )
     {
         IMark* pMarkStart = m_rSortedMarksStart.front();
-        xub_StrLen nNext = pMarkStart->GetMarkStart().nContent.GetIndex();
+        const sal_Int32 nNext = pMarkStart->GetMarkStart().nContent.GetIndex();
         if( !bNextPositionOnly || (nNext > nAktPos ))
         {
             rNearest = nNext;
@@ -1680,7 +1680,7 @@ bool MSWordExportBase::NearestBookmark( xub_StrLen& rNearest, const xub_StrLen n
     if ( !m_rSortedMarksEnd.empty() )
     {
         IMark* pMarkEnd = m_rSortedMarksEnd[0];
-        xub_StrLen nNext = pMarkEnd->GetMarkEnd().nContent.GetIndex();
+        const sal_Int32 nNext = pMarkEnd->GetMarkEnd().nContent.GetIndex();
         if( !bNextPositionOnly || nNext > nAktPos )
         {
             if ( !bHasBookmark )
@@ -1694,7 +1694,7 @@ bool MSWordExportBase::NearestBookmark( xub_StrLen& rNearest, const xub_StrLen n
     return bHasBookmark;
 }
 
-void MSWordExportBase::GetSortedBookmarks( const SwTxtNode& rNode, xub_StrLen nAktPos, xub_StrLen nLen )
+void MSWordExportBase::GetSortedBookmarks( const SwTxtNode& rNode, sal_Int32 nAktPos, sal_Int32 nLen )
 {
     IMarkVector aMarksStart;
     if ( GetBookmarks( rNode, nAktPos, nAktPos + nLen, aMarksStart ) )
@@ -1810,7 +1810,7 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode )
     do {
         const SwRedlineData* pRedlineData = aAttrIter.GetRedline( nAktPos );
 
-        xub_StrLen nNextAttr = GetNextPos( &aAttrIter, rNode, nAktPos );
+        sal_Int32 nNextAttr = GetNextPos( &aAttrIter, rNode, nAktPos );
         // Is this the only run in this paragraph and it's empty?
         bool bSingleEmptyRun = nAktPos == 0 && nNextAttr == 0;
         AttrOutput().StartRun( pRedlineData, bSingleEmptyRun );
@@ -1827,11 +1827,11 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode )
         bool bTxtAtr = aAttrIter.IsTxtAttr( nAktPos );
         nOpenAttrWithRange += aAttrIter.OutAttrWithRange(nAktPos);
 
-        xub_StrLen nLen = nNextAttr - nAktPos;
+        sal_Int32 nLen = nNextAttr - nAktPos;
         if ( !bTxtAtr && nLen )
         {
             sal_Unicode ch = aStr[nAktPos];
-            int ofs = ( ch == CH_TXT_ATR_FIELDSTART || ch == CH_TXT_ATR_FIELDEND || ch == CH_TXT_ATR_FORMELEMENT? 1: 0 );
+            const sal_Int32 ofs = ( ch == CH_TXT_ATR_FIELDSTART || ch == CH_TXT_ATR_FIELDEND || ch == CH_TXT_ATR_FORMELEMENT? 1 : 0 );
 
             IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
             if ( ch == CH_TXT_ATR_FIELDSTART )
@@ -1935,9 +1935,9 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode )
                 if ( isDropdownOrCheckbox )
                     AppendBookmark( pFieldmark->GetName(), false );
             }
-            nLen -= static_cast< sal_Int32 >( ofs );
+            nLen -= ofs;
 
-            OUString aSnippet( aAttrIter.GetSnippet( aStr, nAktPos + static_cast< sal_Int32 >( ofs ), nLen ) );
+            OUString aSnippet( aAttrIter.GetSnippet( aStr, nAktPos + ofs, nLen ) );
             if ( ( nTxtTyp == TXT_EDN || nTxtTyp == TXT_FTN ) && nAktPos == 0 && nLen > 0 )
             {
                 // Insert tab for aesthetic puposes #i24762#
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index e6f7ea1..1a4e658 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -1344,12 +1344,11 @@ WW8_CP WW8_WrPct::Fc2Cp( sal_uLong nFc ) const
     return nFc + aPcts.back().GetStartCp();
 }
 
-void WW8Export::AppendBookmarks( const SwTxtNode& rNd,
-    xub_StrLen nAktPos, xub_StrLen nLen )
+void WW8Export::AppendBookmarks( const SwTxtNode& rNd, sal_Int32 nAktPos, sal_Int32 nLen )
 {
     std::vector< const ::sw::mark::IMark* > aArr;
     sal_uInt16 nCntnt;
-    xub_StrLen nAktEnd = nAktPos + nLen;
+    const sal_Int32 nAktEnd = nAktPos + nLen;
     if( GetWriter().GetBookmarks( rNd, nAktPos, nAktEnd, aArr ))
     {
         sal_uLong nNd = rNd.GetIndex(), nSttCP = Fc2Cp( Strm().Tell() );
@@ -1748,8 +1747,8 @@ void MSWordExportBase::WriteSpecialText( sal_uLong nStart, sal_uLong nEnd, sal_u
     nTxtTyp = nOldTyp;
 }
 
-void WW8Export::OutSwString(const OUString& rStr, xub_StrLen nStt,
-    xub_StrLen nLen, bool bUnicode, rtl_TextEncoding eChrSet)
+void WW8Export::OutSwString(const OUString& rStr, sal_Int32 nStt,
+    sal_Int32 nLen, bool bUnicode, rtl_TextEncoding eChrSet)
 
 {
     SAL_INFO( "sw.ww8.level2", "<OutSwString>" );
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index 212b274..23a964f 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -455,7 +455,7 @@ public:
     SwNumRuleTbl* pUsedNumTbl;  // alle used NumRules
     const SwTxtNode *mpTopNodeOfHdFtPage; ///< Top node of host page when in hd/ft
     std::map< sal_uInt16, sal_uInt16 > aRuleDuplicates; //map to Duplicated numrules
-    std::stack< xub_StrLen > m_aCurrentCharPropStarts; ///< To remember the position in a run.
+    std::stack< sal_Int32 > m_aCurrentCharPropStarts; ///< To remember the position in a run.
     WW8_WrtBookmarks* pBkmks;
     WW8_WrtRedlineAuthor* pRedlAuthors;
     BitmapPalette* pBmpPal;
@@ -644,7 +644,7 @@ public:
     /// has two
     virtual bool CollapseScriptsforWordOk( sal_uInt16 nScript, sal_uInt16 nWhich ) = 0;
 
-    virtual void AppendBookmarks( const SwTxtNode& rNd, xub_StrLen nAktPos, xub_StrLen nLen ) = 0;
+    virtual void AppendBookmarks( const SwTxtNode& rNd, sal_Int32 nAktPos, sal_Int32 nLen ) = 0;
 
     virtual void AppendBookmark( const OUString& rName, bool bSkip = false ) = 0;
     //For i120928,add this interface to export graphic of bullet
@@ -756,10 +756,10 @@ protected:
     virtual void ExportDocument_Impl() = 0;
 
     /// Get the next position in the text node to output
-    virtual xub_StrLen GetNextPos( SwWW8AttrIter* pAttrIter, const SwTxtNode& rNode, xub_StrLen nAktPos );
+    virtual sal_Int32 GetNextPos( SwWW8AttrIter* pAttrIter, const SwTxtNode& rNode, sal_Int32 nAktPos );
 
     /// Update the information for GetNextPos().
-    virtual void UpdatePosition( SwWW8AttrIter* pAttrIter, xub_StrLen nAktPos, xub_StrLen nEnd );
+    virtual void UpdatePosition( SwWW8AttrIter* pAttrIter, sal_Int32 nAktPos, sal_Int32 nEnd );
 
     /// Output SwTxtNode
     virtual void OutputTextNode( const SwTxtNode& );
@@ -815,12 +815,11 @@ protected:
     /// Find the nearest bookmark from the current position.
     ///
     /// Returns false when there is no bookmark.
-    bool NearestBookmark( xub_StrLen& rNearest, const xub_StrLen nAktPos, bool bNextPositionOnly );
+    bool NearestBookmark( sal_Int32& rNearest, const sal_Int32 nAktPos, bool bNextPositionOnly );
 
-    void GetSortedBookmarks( const SwTxtNode& rNd, xub_StrLen nAktPos,
-                xub_StrLen nLen );
+    void GetSortedBookmarks( const SwTxtNode& rNd, sal_Int32 nAktPos, sal_Int32 nLen );
 
-    bool GetBookmarks( const SwTxtNode& rNd, xub_StrLen nStt, xub_StrLen nEnd,
+    bool GetBookmarks( const SwTxtNode& rNd, sal_Int32 nStt, sal_Int32 nEnd,
             IMarkVector& rArr );
 
     const NfKeywordTable & GetNfKeywordTable();
@@ -1015,7 +1014,7 @@ public:
     bool TestOleNeedsGraphic(const SwAttrSet& rSet, SvStorageRef xOleStg,
         SvStorageRef xObjStg, OUString &rStorageName, SwOLENode *pOLENd);
 
-    virtual void AppendBookmarks( const SwTxtNode& rNd, xub_StrLen nAktPos, xub_StrLen nLen );
+    virtual void AppendBookmarks( const SwTxtNode& rNd, sal_Int32 nAktPos, sal_Int32 nLen );
     virtual void AppendBookmark( const OUString& rName, bool bSkip = false );
 
     virtual void ExportGrfBullet(const SwTxtNode& rNd);
@@ -1031,7 +1030,7 @@ public:
     virtual void WriteCR( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner = ww8::WW8TableNodeInfoInner::Pointer_t() );
     void WriteChar( sal_Unicode c );
 
-    void OutSwString(const OUString&, xub_StrLen nStt, xub_StrLen nLen,
+    void OutSwString(const OUString&, sal_Int32 nStt, sal_Int32 nLen,
         bool bUnicode, rtl_TextEncoding eChrSet);
 
     WW8_CP Fc2Cp( sal_uLong nFc ) const          { return pPiece->Fc2Cp( nFc ); }
commit 4963072118a37ade94430ce08592680e11484593
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Fri Nov 22 16:48:02 2013 +0100

    ww8: remove unused AttribHere class
    
    Change-Id: I3bc56192095d6564046115520626289c62d7234d

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index f8b7466..747796e 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -2419,18 +2419,6 @@ void wwSectionManager::SetHdFt(wwSection &rSection, int nSect,
 
 }
 
-class AttribHere : public std::unary_function<const xub_StrLen*, bool>
-{
-private:
-    xub_StrLen nPosition;
-public:
-    AttribHere(xub_StrLen nPos) : nPosition(nPos) {}
-    bool operator()(const xub_StrLen *pPosition) const
-    {
-        return (*pPosition >= nPosition);
-    }
-};
-
 void SwWW8ImplReader::AppendTxtNode(SwPosition& rPos)
 {
     SwTxtNode* pTxt = pPaM->GetNode()->GetTxtNode();
commit 0d45804d5f2a7402d6a7213eec895e5fef4d831f
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Fri Nov 22 16:37:53 2013 +0100

    xub_StrLen to sal_Int32
    
    Change-Id: I395e62831f624b05e2979169440ff8663f76e835

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 6a1c048..f8b7466 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -2974,11 +2974,7 @@ bool SwWW8ImplReader::ReadPlainChars(WW8_CP& rPos, sal_Int32 nEnd, sal_Int32 nCp
     // Reset Unicode flag and correct FilePos if needed.
     // Note: Seek is not expensive, as we're checking inline whether or not
     // the correct FilePos has already been reached.
-    xub_StrLen nStrLen;
-    if (nValidStrLen <= (STRING_MAXLEN-1))
-        nStrLen = writer_cast<xub_StrLen>(nValidStrLen);
-    else
-        nStrLen = STRING_MAXLEN-1;
+    const sal_Int32 nStrLen = std::min(nValidStrLen, SAL_MAX_INT32-1);
 
     const rtl_TextEncoding eSrcCharSet = bVer67 ? GetCurrentCharSet() :
         RTL_TEXTENCODING_MS_1252;
@@ -3002,13 +2998,13 @@ bool SwWW8ImplReader::ReadPlainChars(WW8_CP& rPos, sal_Int32 nEnd, sal_Int32 nCp
     // read the stream data
     sal_uInt8   nBCode = 0;
     sal_uInt16 nUCode;
-    xub_StrLen nL2;
 
     sal_uInt16 nCTLLang = 0;
     const SfxPoolItem * pItem = GetFmtAttr(RES_CHRATR_CTL_LANGUAGE);
     if (pItem != NULL)
         nCTLLang = dynamic_cast<const SvxLanguageItem *>(pItem)->GetLanguage();
 
+    sal_Int32 nL2;
     for( nL2 = 0; nL2 < nStrLen; ++nL2, ++pWork )
     {
         if (bIsUnicode)
@@ -3061,10 +3057,9 @@ bool SwWW8ImplReader::ReadPlainChars(WW8_CP& rPos, sal_Int32 nEnd, sal_Int32 nCp
 
     if (nL2)
     {
-        xub_StrLen nEndUsed = nL2;
-
-        if (!bIsUnicode)
-            nEndUsed = Custom8BitToUnicode(hConverter, p8Bits, nL2, pBuffer, nStrLen);
+        const sal_Int32 nEndUsed = !bIsUnicode
+            ? Custom8BitToUnicode(hConverter, p8Bits, nL2, pBuffer, nStrLen)
+            : nL2;
 
         for( sal_Int32 nI = 0; nI < nStrLen; ++nI, ++pBuffer )
             if (m_bRegardHindiDigits && bBidi && LangUsesHindiNumbers(nCTLLang))
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 28dca2e..e04d00a 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -403,8 +403,8 @@ class Position
 public:
     SwNodeIndex maMkNode;
     SwNodeIndex maPtNode;
-    xub_StrLen mnMkCntnt;
-    xub_StrLen mnPtCntnt;
+    sal_Int32 mnMkCntnt;
+    sal_Int32 mnPtCntnt;
     Position(const SwPaM &rPaM);
     Position(const Position &rEntry);
 private:
@@ -513,13 +513,13 @@ namespace sw
         {
         private:
             SwNodeIndex maPtNode;
-            xub_StrLen mnPtCntnt;
+            sal_Int32 mnPtCntnt;
         public:
             Position(const SwPosition &rPos);
             Position(const Position &rPos);
             operator SwPosition() const;
             SwNodeIndex GetPtNode() { return maPtNode; };
-            xub_StrLen GetPtCntnt() { return mnPtCntnt; };
+            sal_Int32 GetPtCntnt() { return mnPtCntnt; };
         };
     }
 }
@@ -542,7 +542,7 @@ class WW8FieldEntry
         void Swap(WW8FieldEntry &rOther) throw();
 
         SwNodeIndex GetPtNode() { return maStartPos.GetPtNode(); };
-        xub_StrLen GetPtCntnt() { return maStartPos.GetPtCntnt(); };
+        sal_Int32 GetPtCntnt() { return maStartPos.GetPtCntnt(); };
 
         OUString GetBookmarkName();
         OUString GetBookmarkCode();
commit a8a8080e7626f6f60743caf9a235eee5f814d6b3
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Fri Nov 22 15:52:31 2013 +0100

    Don't subtract 1 to just add it back
    
    Change-Id: I2d7e08b70047c98e9164b8b733bae50ca8872142

diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index a63a4c1..0cdc6bd 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -847,10 +847,8 @@ bool WW8ListManager::ReadLVL(SwNumFmt& rNumFmt, SfxItemSet*& rpItemSet,
         if (nUpperLevel)
         {
             sal_uInt8 nOneBasedNextNoIndex = aOfsNumsXCH[nUpperLevel-1];
-            sal_Int32 nNextNoIndex =
-                nOneBasedNextNoIndex > 0 ? nOneBasedNextNoIndex -1 : SAL_MAX_INT32;
-            if (nNextNoIndex != SAL_MAX_INT32)
-                ++nNextNoIndex;
+            const sal_Int32 nNextNoIndex =
+                nOneBasedNextNoIndex > 0 ? nOneBasedNextNoIndex : SAL_MAX_INT32;
             if (sNumString.getLength() > nNextNoIndex)
                 lcl_CopyGreaterEight(sPostfix, sNumString, nNextNoIndex);
         }
commit b8411d40587b9eb4b666d2394708dfaf8f06ab99
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Fri Nov 22 15:37:32 2013 +0100

    xub_StrLen to sal_Int32 and some optimizations
    
    Change-Id: I49d398ab9f086c769941767bb4431bbbb96f56b0

diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx b/sw/source/filter/ww8/attributeoutputbase.hxx
index 34e62ee..f37ebff 100644
--- a/sw/source/filter/ww8/attributeoutputbase.hxx
+++ b/sw/source/filter/ww8/attributeoutputbase.hxx
@@ -199,7 +199,7 @@ public:
     virtual void RawText( const OUString& rText, bool bForceUnicode, rtl_TextEncoding eCharSet ) = 0;
 
     /// Output ruby start.
-    virtual void StartRuby( const SwTxtNode& rNode, xub_StrLen nPos, const SwFmtRuby& rRuby ) = 0;
+    virtual void StartRuby( const SwTxtNode& rNode, sal_Int32 nPos, const SwFmtRuby& rRuby ) = 0;
 
     /// Output ruby end.
     virtual void EndRuby() = 0;
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 054e946..6b02a07 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -121,6 +121,8 @@
 #include <com/sun/star/xml/sax/XSAXSerializable.hpp>
 #include <com/sun/star/text/GraphicCrop.hpp>
 
+#include <algorithm>
+
 #if OSL_DEBUG_LEVEL > 1
 #include <stdio.h>
 #endif
@@ -1281,7 +1283,7 @@ void DocxAttributeOutput::RawText( const OUString& /*rText*/, bool /*bForceUnico
     OSL_TRACE("TODO DocxAttributeOutput::RawText( const String& rText, bool bForceUnicode, rtl_TextEncoding eCharSet )" );
 }
 
-void DocxAttributeOutput::StartRuby( const SwTxtNode& rNode, xub_StrLen nPos, const SwFmtRuby& rRuby )
+void DocxAttributeOutput::StartRuby( const SwTxtNode& rNode, sal_Int32 nPos, const SwFmtRuby& rRuby )
 {
     OSL_TRACE("TODO DocxAttributeOutput::StartRuby( const SwTxtNode& rNode, const SwFmtRuby& rRuby )" );
     m_pSerializer->startElementNS( XML_w, XML_ruby, FSEND );
@@ -3622,7 +3624,7 @@ void DocxAttributeOutput::WriteOutliner(const OutlinerParaObject& rParaObj)
             aAttrIter.NextPara( n );
 
         OUString aStr( rEditObj.GetText( n ));
-        xub_StrLen nAktPos = 0;
+        sal_Int32 nAktPos = 0;
         sal_Int32 nEnd = aStr.getLength();
 
         m_pSerializer->startElementNS( XML_w, XML_p, FSEND );
@@ -3633,9 +3635,7 @@ void DocxAttributeOutput::WriteOutliner(const OutlinerParaObject& rParaObj)
         m_pSerializer->endElementNS(XML_w, XML_pPr);
 
         do {
-            xub_StrLen nNextAttr = aAttrIter.WhereNext();
-            if( nNextAttr > nEnd )
-                nNextAttr = nEnd;
+            const sal_Int32 nNextAttr = std::min(aAttrIter.WhereNext(), nEnd);
 
             m_pSerializer->startElementNS( XML_w, XML_r, FSEND );
 
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index 2099116..8ddfc14 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -153,7 +153,7 @@ public:
     virtual void RawText( const OUString& rText, bool bForceUnicode, rtl_TextEncoding eCharSet );
 
     /// Output ruby start.
-    virtual void StartRuby( const SwTxtNode& rNode, xub_StrLen nPos, const SwFmtRuby& rRuby );
+    virtual void StartRuby( const SwTxtNode& rNode, sal_Int32 nPos, const SwFmtRuby& rRuby );
 
     /// Output ruby end.
     virtual void EndRuby();
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index e29cd64f..58b681e 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -1038,16 +1038,13 @@ void DocxExport::WriteOutliner(const OutlinerParaObject& rParaObj, sal_uInt8 nTy
         AttrOutput().StartParagraph( ww8::WW8TableNodeInfo::Pointer_t());
         rtl_TextEncoding eChrSet = aAttrIter.GetNodeCharSet();
         OUString aStr( rEditObj.GetText( n ));
-        xub_StrLen nAktPos = 0;
-        sal_Int32  nEnd = aStr.getLength();
+        sal_Int32 nAktPos = 0;
+        const sal_Int32 nEnd = aStr.getLength();
         do {
             AttrOutput().StartRun( NULL );
-            xub_StrLen nNextAttr = aAttrIter.WhereNext();
+            const sal_Int32 nNextAttr = std::min(aAttrIter.WhereNext(), nEnd);
             rtl_TextEncoding eNextChrSet = aAttrIter.GetNextCharSet();
 
-            if( nNextAttr > nEnd )
-                nNextAttr = nEnd;
-
             bool bTxtAtr = aAttrIter.IsTxtAttr( nAktPos );
             if( !bTxtAtr )
             {
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 3415be7..16f6174 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -455,7 +455,7 @@ void RtfAttributeOutput::RawText( const OUString& rText, bool /*bForceUnicode*/,
     m_aRunText->append(msfilter::rtfutil::OutString(rText, eCharSet));
 }
 
-void RtfAttributeOutput::StartRuby( const SwTxtNode& /*rNode*/, xub_StrLen /*nPos*/, const SwFmtRuby& /*rRuby*/ )
+void RtfAttributeOutput::StartRuby( const SwTxtNode& /*rNode*/, sal_Int32 /*nPos*/, const SwFmtRuby& /*rRuby*/ )
 {
     SAL_INFO("sw.rtf", "TODO: " << OSL_THIS_FUNC);
 }
diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx b/sw/source/filter/ww8/rtfattributeoutput.hxx
index 60de3e4..e92388f 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.hxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.hxx
@@ -86,7 +86,7 @@ public:
     virtual void RawText( const OUString& rText, bool bForceUnicode, rtl_TextEncoding eCharSet );
 
     /// Output ruby start.
-    virtual void StartRuby( const SwTxtNode& rNode, xub_StrLen nPos, const SwFmtRuby& rRuby );
+    virtual void StartRuby( const SwTxtNode& rNode, sal_Int32 nPos, const SwFmtRuby& rRuby );
 
     /// Output ruby end.
     virtual void EndRuby();
diff --git a/sw/source/filter/ww8/rtfsdrexport.cxx b/sw/source/filter/ww8/rtfsdrexport.cxx
index 5218e3b..a1bb872 100644
--- a/sw/source/filter/ww8/rtfsdrexport.cxx
+++ b/sw/source/filter/ww8/rtfsdrexport.cxx
@@ -28,6 +28,8 @@
 #include <svx/unoapi.hxx>
 #include <vcl/cvtgrf.hxx>
 
+#include <algorithm>
+
 using namespace sw::util;
 using namespace css;
 
@@ -540,19 +542,16 @@ void RtfSdrExport::WriteOutliner(const OutlinerParaObject& rParaObj)
         rtl_TextEncoding eChrSet = aAttrIter.GetNodeCharSet();
 
         OUString aStr( rEditObj.GetText( n ));
-        xub_StrLen nAktPos = 0;
-        sal_Int32  nEnd = aStr.getLength();
+        sal_Int32 nAktPos = 0;
+        const sal_Int32 nEnd = aStr.getLength();
 
         aAttrIter.OutParaAttr(false);
         m_rAttrOutput.RunText().append(m_rAttrOutput.Styles().makeStringAndClear());
 
         do {
-            xub_StrLen nNextAttr = aAttrIter.WhereNext();
+            const sal_Int32 nNextAttr = std::min(aAttrIter.WhereNext(), nEnd);
             rtl_TextEncoding eNextChrSet = aAttrIter.GetNextCharSet();
 
-            if( nNextAttr > nEnd )
-                nNextAttr = nEnd;
-
             aAttrIter.OutAttr( nAktPos );
             m_rAttrOutput.RunText().append('{').append(m_rAttrOutput.Styles().makeStringAndClear()).append(SAL_NEWLINE_STRING);
             bool bTxtAtr = aAttrIter.IsTxtAttr( nAktPos );
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index 599e0ad..10b97cc 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -101,6 +101,8 @@
 #include <svl/urihelper.hxx>
 #include <unotools/saveopt.hxx>
 
+#include <algorithm>
+
 using ::editeng::SvxBorderLine;
 using namespace com::sun::star;
 using namespace sw::util;
@@ -1103,12 +1105,12 @@ rtl_TextEncoding MSWord_SdrAttrIter::GetNextCharSet() const
 }
 
 // der erste Parameter in SearchNext() liefert zurueck, ob es ein TxtAtr ist.
-xub_StrLen MSWord_SdrAttrIter::SearchNext( xub_StrLen nStartPos )
+sal_Int32 MSWord_SdrAttrIter::SearchNext( sal_Int32 nStartPos )
 {
-    xub_StrLen nMinPos = STRING_MAXLEN;
+    sal_Int32 nMinPos = SAL_MAX_INT32;
     for(std::vector<EECharAttrib>::const_iterator i = aTxtAtrArr.begin(); i < aTxtAtrArr.end(); ++i)
     {
-        xub_StrLen nPos = i->nStart; // gibt erstes Attr-Zeichen
+        sal_Int32 nPos = i->nStart; // gibt erstes Attr-Zeichen
         if( nPos >= nStartPos && nPos <= nMinPos )
         {
             nMinPos = nPos;
@@ -1170,7 +1172,7 @@ void MSWord_SdrAttrIter::OutEEField(const SfxPoolItem& rHt)
     }
 }
 
-void MSWord_SdrAttrIter::OutAttr( xub_StrLen nSwPos )
+void MSWord_SdrAttrIter::OutAttr( sal_Int32 nSwPos )
 {
     OutParaAttr(true);
 
@@ -1226,7 +1228,7 @@ void MSWord_SdrAttrIter::OutAttr( xub_StrLen nSwPos )
     }
 }
 
-bool MSWord_SdrAttrIter::IsTxtAttr(xub_StrLen nSwPos)
+bool MSWord_SdrAttrIter::IsTxtAttr(sal_Int32 nSwPos)
 {
     for (std::vector<EECharAttrib>::const_iterator i = aTxtAtrArr.begin(); i < aTxtAtrArr.end(); ++i)
     {
@@ -1364,15 +1366,12 @@ void WW8Export::WriteOutliner(const OutlinerParaObject& rParaObj, sal_uInt8 nTyp
         OSL_ENSURE( pO->empty(), " pO ist am Zeilenanfang nicht leer" );
 
         OUString aStr( rEditObj.GetText( n ));
-        xub_StrLen nAktPos = 0;
-        sal_Int32  nEnd = aStr.getLength();
+        sal_Int32 nAktPos = 0;
+        const sal_Int32 nEnd = aStr.getLength();
         do {
-            xub_StrLen nNextAttr = aAttrIter.WhereNext();
+            const sal_Int32 nNextAttr = std::min(aAttrIter.WhereNext(), nEnd);
             rtl_TextEncoding eNextChrSet = aAttrIter.GetNextCharSet();
 
-            if( nNextAttr > nEnd )
-                nNextAttr = nEnd;
-
             bool bTxtAtr = aAttrIter.IsTxtAttr( nAktPos );
             if( !bTxtAtr )
                 OutSwString( aStr, nAktPos, nNextAttr - nAktPos,
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 72ad2fe..26ab20e 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -240,11 +240,11 @@ sal_Int32 lcl_getMinPos( sal_Int32 pos1, sal_Int32 pos2 )
     return min;
 }
 
-xub_StrLen SwWW8AttrIter::SearchNext( xub_StrLen nStartPos )
+sal_Int32 SwWW8AttrIter::SearchNext( sal_Int32 nStartPos )
 {
-    xub_StrLen nPos;
-    xub_StrLen nMinPos = STRING_MAXLEN;
-    xub_StrLen i=0;
+    sal_Int32 nPos;
+    sal_Int32 nMinPos = SAL_MAX_INT32;
+    sal_Int32 i=0;
 
     const OUString aTxt = rNd.GetTxt();
     sal_Int32 fieldEndPos = aTxt.indexOf(CH_TXT_ATR_FIELDEND, nStartPos);
@@ -379,7 +379,7 @@ static bool lcl_isFontsizeItem( const SfxPoolItem& rItem )
             rItem.Which( ) == RES_CHRATR_CTL_FONTSIZE );
 }
 
-void SwWW8AttrIter::OutAttr( xub_StrLen nSwPos, bool bRuby )
+void SwWW8AttrIter::OutAttr( sal_Int32 nSwPos, bool bRuby )
 {
     m_rExport.AttrOutput().RTLAndCJKState( IsCharRTL(), GetScript() );
 
@@ -512,7 +512,7 @@ void SwWW8AttrIter::OutAttr( xub_StrLen nSwPos, bool bRuby )
     }
 }
 
-void SwWW8AttrIter::OutFlys(xub_StrLen nSwPos)
+void SwWW8AttrIter::OutFlys(sal_Int32 nSwPos)
 {
     /*
      #i2916#
@@ -534,7 +534,7 @@ void SwWW8AttrIter::OutFlys(xub_StrLen nSwPos)
     }
 }
 
-bool SwWW8AttrIter::IsTxtAttr( xub_StrLen nSwPos )
+bool SwWW8AttrIter::IsTxtAttr( sal_Int32 nSwPos )
 {
     // search for attrs with dummy character or content
     if (const SwpHints* pTxtAttrs = rNd.GetpSwpHints())
@@ -641,7 +641,7 @@ const SfxPoolItem& SwWW8AttrIter::GetItem(sal_uInt16 nWhich) const
     return pRet ? *pRet : rNd.SwCntntNode::GetAttr(nWhich);
 }
 
-void WW8AttributeOutput::StartRuby( const SwTxtNode& rNode, xub_StrLen /*nPos*/, const SwFmtRuby& rRuby )
+void WW8AttributeOutput::StartRuby( const SwTxtNode& rNode, sal_Int32 /*nPos*/, const SwFmtRuby& rRuby )
 {
     OUString aStr( FieldString( ww::eEQ ) );
     aStr += "\\* jc";
@@ -1119,7 +1119,7 @@ void AttributeOutputBase::TOXMark( const SwTxtNode& rNode, const SwTOXMark& rAtt
         FieldVanish( sTxt, eType );
 }
 
-int SwWW8AttrIter::OutAttrWithRange(xub_StrLen nPos)
+int SwWW8AttrIter::OutAttrWithRange(sal_Int32 nPos)
 {
     int nRet = 0;
     if ( const SwpHints* pTxtAttrs = rNd.GetpSwpHints() )
@@ -1180,7 +1180,7 @@ int SwWW8AttrIter::OutAttrWithRange(xub_StrLen nPos)
     return nRet;
 }
 
-bool SwWW8AttrIter::IsRedlineAtEnd( xub_StrLen nEnd ) const
+bool SwWW8AttrIter::IsRedlineAtEnd( sal_Int32 nEnd ) const
 {
     bool bRet = false;
     // search next Redline
@@ -1202,7 +1202,7 @@ bool SwWW8AttrIter::IsRedlineAtEnd( xub_StrLen nEnd ) const
     return bRet;
 }
 
-const SwRedlineData* SwWW8AttrIter::GetRedline( xub_StrLen nPos )
+const SwRedlineData* SwWW8AttrIter::GetRedline( sal_Int32 nPos )
 {
     if( pCurRedline )
     {
@@ -1396,8 +1396,8 @@ Convert characters that need to be converted, the basic replacements and the
 ridicously complicated title case attribute mapping to hardcoded upper case
 because word doesn't have the feature
 */
-OUString SwWW8AttrIter::GetSnippet(const OUString &rStr, xub_StrLen nAktPos,
-    xub_StrLen nLen) const
+OUString SwWW8AttrIter::GetSnippet(const OUString &rStr, sal_Int32 nAktPos,
+    sal_Int32 nLen) const
 {
     if (!nLen)
         return OUString();
@@ -1801,7 +1801,7 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode )
     sal_Int32 nAktPos = 0;
     sal_Int32 const nEnd = aStr.getLength();
     bool bRedlineAtEnd = false;
-    int nOpenAttrWithRange = 0;
+    sal_Int32 nOpenAttrWithRange = 0;
 
     ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner;
     if ( pTextNodeInfo.get() != NULL )
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index 3e2dbff..212b274 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -1406,13 +1406,13 @@ private:
     std::vector<const EECharAttrib*> aChrTxtAtrArr;
     std::vector<rtl_TextEncoding> aChrSetArr;
     sal_Int32 nPara;
-    xub_StrLen nAktSwPos;
-    xub_StrLen nTmpSwPos;                   // for HasItem()
+    sal_Int32 nAktSwPos;
+    sal_Int32 nTmpSwPos;                   // for HasItem()
     rtl_TextEncoding eNdChrSet;
     sal_uInt16 nScript;
     sal_uInt8 mnTyp;
 
-    xub_StrLen SearchNext( xub_StrLen nStartPos );
+    sal_Int32 SearchNext( sal_Int32 nStartPos );
     void SetCharSet(const EECharAttrib& rTxtAttr, bool bStart);
 
     //No copying
@@ -1425,15 +1425,15 @@ public:
     void OutParaAttr(bool bCharAttr);
     void OutEEField(const SfxPoolItem& rHt);
 
-    bool IsTxtAttr(xub_StrLen nSwPos);
+    bool IsTxtAttr(sal_Int32 nSwPos);
 
-    void NextPos() { if ( nAktSwPos < STRING_NOTFOUND ) nAktSwPos = SearchNext( nAktSwPos + 1 ); }
+    void NextPos() { if ( nAktSwPos < SAL_MAX_INT32 ) nAktSwPos = SearchNext( nAktSwPos + 1 ); }
 
-    void OutAttr( xub_StrLen nSwPos );
+    void OutAttr( sal_Int32 nSwPos );
     virtual const SfxPoolItem* HasTextItem( sal_uInt16 nWhich ) const;
     virtual const SfxPoolItem& GetItem( sal_uInt16 nWhich ) const;
-    bool OutAttrWithRange(xub_StrLen nPos);
-    xub_StrLen WhereNext() const                { return nAktSwPos; }
+    bool OutAttrWithRange(sal_Int32 nPos);
+    sal_Int32 WhereNext() const                { return nAktSwPos; }
     rtl_TextEncoding GetNextCharSet() const;
     rtl_TextEncoding GetNodeCharSet() const     { return eNdChrSet; }
 };
@@ -1459,7 +1459,7 @@ private:
     bool mbCharIsRTL;
 
     const SwRedline* pCurRedline;
-    xub_StrLen nAktSwPos;
+    sal_Int32 nAktSwPos;
     sal_uInt16 nCurRedlinePos;
 
     bool mbParaIsRTL;
@@ -1469,7 +1469,7 @@ private:
     sw::Frames maFlyFrms;     // #i2916#
     sw::FrameIter maFlyIter;
 
-    xub_StrLen SearchNext( xub_StrLen nStartPos );
+    sal_Int32 SearchNext( sal_Int32 nStartPos );
     void FieldVanish( const OUString& rTxt );
 
     void OutSwFmtRefMark(const SwFmtRefMark& rAttr, bool bStart);
@@ -1482,27 +1482,27 @@ private:
 public:
     SwWW8AttrIter( MSWordExportBase& rWr, const SwTxtNode& rNd );
 
-    bool IsTxtAttr( xub_StrLen nSwPos );
-    bool IsRedlineAtEnd( xub_StrLen nPos ) const;
+    bool IsTxtAttr( sal_Int32 nSwPos );
+    bool IsRedlineAtEnd( sal_Int32 nPos ) const;
     bool IsDropCap( int nSwPos );
     bool RequiresImplicitBookmark();
 
-    void NextPos() { if ( nAktSwPos < STRING_NOTFOUND ) nAktSwPos = SearchNext( nAktSwPos + 1 ); }
+    void NextPos() { if ( nAktSwPos < SAL_MAX_INT32 ) nAktSwPos = SearchNext( nAktSwPos + 1 ); }
 
-    void OutAttr( xub_StrLen nSwPos, bool bRuby = false );
+    void OutAttr( sal_Int32 nSwPos, bool bRuby = false );
     virtual const SfxPoolItem* HasTextItem( sal_uInt16 nWhich ) const;
     virtual const SfxPoolItem& GetItem( sal_uInt16 nWhich ) const;
-    int OutAttrWithRange(xub_StrLen nPos);
-    const SwRedlineData* GetRedline( xub_StrLen nPos );
-    void OutFlys(xub_StrLen nSwPos);
+    int OutAttrWithRange(sal_Int32 nPos);
+    const SwRedlineData* GetRedline( sal_Int32 nPos );
+    void OutFlys(sal_Int32 nSwPos);
 
-    xub_StrLen WhereNext() const    { return nAktSwPos; }
+    sal_Int32 WhereNext() const { return nAktSwPos; }
     sal_uInt16 GetScript() const { return mnScript; }
     bool IsCharRTL() const { return mbCharIsRTL; }
     bool IsParaRTL() const { return mbParaIsRTL; }
     rtl_TextEncoding GetCharSet() const { return meChrSet; }
-    OUString GetSnippet(const OUString &rStr, xub_StrLen nAktPos,
-        xub_StrLen nLen) const;
+    OUString GetSnippet(const OUString &rStr, sal_Int32 nAktPos,
+        sal_Int32 nLen) const;
     const SwFmtDrop& GetSwFmtDrop() const { return mrSwFmtDrop; }
 };
 
diff --git a/sw/source/filter/ww8/ww8attributeoutput.hxx b/sw/source/filter/ww8/ww8attributeoutput.hxx
index 1a3f14b..cea26ef 100644
--- a/sw/source/filter/ww8/ww8attributeoutput.hxx
+++ b/sw/source/filter/ww8/ww8attributeoutput.hxx
@@ -71,7 +71,7 @@ public:
     virtual void RawText( const OUString& rText, bool bForceUnicode, rtl_TextEncoding eCharSet );
 
     /// Output ruby start.
-    virtual void StartRuby( const SwTxtNode& rNode, xub_StrLen nPos, const SwFmtRuby& rRuby );
+    virtual void StartRuby( const SwTxtNode& rNode, sal_Int32 nPos, const SwFmtRuby& rRuby );
 
     /// Output ruby end.
     virtual void EndRuby();
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index 25da902..a63a4c1 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -491,11 +491,10 @@ WW8LSTInfo* WW8ListManager::GetLSTByListId( sal_uInt32 nIdLst ) const
 }
 
 static void lcl_CopyGreaterEight(OUString &rDest, OUString &rSrc,
-    sal_Int32 nStart, sal_Int32 nLen = STRING_LEN)
+    sal_Int32 nStart, sal_Int32 nLen = SAL_MAX_INT32)
 {
-    if (nLen > rSrc.getLength() || nLen == STRING_LEN)
-        nLen = rSrc.getLength();
-    for( sal_Int32 nI = nStart; nI < nLen; ++nI)
+    const sal_Int32 nMaxLen = std::min(rSrc.getLength(), nLen);
+    for( sal_Int32 nI = nStart; nI < nMaxLen; ++nI)
     {
         sal_Unicode nChar = rSrc[nI];
         if (nChar > WW8ListManager::nMaxLevel)
@@ -840,17 +839,17 @@ bool WW8ListManager::ReadLVL(SwNumFmt& rNumFmt, SfxItemSet*& rpItemSet,
         */
         //First number appears at
         sal_uInt8 nOneBasedFirstNoIndex = aOfsNumsXCH[0];
-        xub_StrLen nFirstNoIndex =
-            nOneBasedFirstNoIndex > 0 ? nOneBasedFirstNoIndex -1 : STRING_LEN;
+        const sal_Int32 nFirstNoIndex =
+            nOneBasedFirstNoIndex > 0 ? nOneBasedFirstNoIndex -1 : SAL_MAX_INT32;
         lcl_CopyGreaterEight(sPrefix, sNumString, 0, nFirstNoIndex);
 
         //Next number appears at
         if (nUpperLevel)
         {
             sal_uInt8 nOneBasedNextNoIndex = aOfsNumsXCH[nUpperLevel-1];
-            xub_StrLen nNextNoIndex =
-                nOneBasedNextNoIndex > 0 ? nOneBasedNextNoIndex -1 : STRING_LEN;
-            if (nNextNoIndex != STRING_LEN)
+            sal_Int32 nNextNoIndex =
+                nOneBasedNextNoIndex > 0 ? nOneBasedNextNoIndex -1 : SAL_MAX_INT32;
+            if (nNextNoIndex != SAL_MAX_INT32)
                 ++nNextNoIndex;
             if (sNumString.getLength() > nNextNoIndex)
                 lcl_CopyGreaterEight(sPostfix, sNumString, nNextNoIndex);
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index 9a4b5db..f0eaf85 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -2144,7 +2144,7 @@ eF_ResT SwWW8ImplReader::Read_F_Macro( WW8FieldDesc*, OUString& rStr)
     bool bBracket  = false;
     WW8ReadFieldParams aReadParam( rStr );
 
-    xub_StrLen nOffset = 0;
+    sal_Int32 nOffset = 0;
 
     for (;;)
     {
commit ace51a616c3fc6abdb0df6ed4b0686eb6525848a
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Thu Nov 21 18:21:18 2013 +0100

    xub_StrLen to sal_Int32
    
    Change-Id: Iedc8eec38c0ea490b1b8da4ff7ca9237a77505b2

diff --git a/sw/source/filter/ascii/ascatr.cxx b/sw/source/filter/ascii/ascatr.cxx
index a49ef13..7a3cf92 100644
--- a/sw/source/filter/ascii/ascatr.cxx
+++ b/sw/source/filter/ascii/ascatr.cxx
@@ -44,31 +44,31 @@ class SwASC_AttrIter
 {
     SwASCWriter& rWrt;
     const SwTxtNode& rNd;
-    xub_StrLen nAktSwPos;
+    sal_Int32 nAktSwPos;
 
-    xub_StrLen SearchNext( xub_StrLen nStartPos );
+    sal_Int32 SearchNext( sal_Int32 nStartPos );
 
 public:
-    SwASC_AttrIter( SwASCWriter& rWrt, const SwTxtNode& rNd, xub_StrLen nStt );
+    SwASC_AttrIter( SwASCWriter& rWrt, const SwTxtNode& rNd, sal_Int32 nStt );
 
     void NextPos()
     {
         nAktSwPos = SearchNext( nAktSwPos + 1 );
     }
 
-    xub_StrLen WhereNext() const
+    sal_Int32 WhereNext() const
     {
         return nAktSwPos;
     }
 
-    bool OutAttr( xub_StrLen nSwPos );
+    bool OutAttr( sal_Int32 nSwPos );
 };
 
 
 SwASC_AttrIter::SwASC_AttrIter(
     SwASCWriter& rWr,
     const SwTxtNode& rTxtNd,
-    xub_StrLen nStt )
+    sal_Int32 nStt )
     : rWrt( rWr )
     , rNd( rTxtNd )
     , nAktSwPos( 0 )
@@ -77,9 +77,9 @@ SwASC_AttrIter::SwASC_AttrIter(
 }
 
 
-xub_StrLen SwASC_AttrIter::SearchNext( xub_StrLen nStartPos )
+sal_Int32 SwASC_AttrIter::SearchNext( sal_Int32 nStartPos )
 {
-    xub_StrLen nMinPos = STRING_MAXLEN;
+    sal_Int32 nMinPos = SAL_MAX_INT32;
     const SwpHints* pTxtAttrs = rNd.GetpSwpHints();
     if( pTxtAttrs )
     {
@@ -90,7 +90,7 @@ xub_StrLen SwASC_AttrIter::SearchNext( xub_StrLen nStartPos )
             const SwTxtAttr* pHt = (*pTxtAttrs)[i];
             if ( pHt->HasDummyChar() )
             {
-                xub_StrLen nPos = *pHt->GetStart();
+                sal_Int32 nPos = *pHt->GetStart();
 
                 if( nPos >= nStartPos && nPos <= nMinPos )
                     nMinPos = nPos;
@@ -118,7 +118,7 @@ xub_StrLen SwASC_AttrIter::SearchNext( xub_StrLen nStartPos )
 }
 
 
-bool SwASC_AttrIter::OutAttr( xub_StrLen nSwPos )
+bool SwASC_AttrIter::OutAttr( sal_Int32 nSwPos )
 {
     bool bRet = false;
     const SwpHints* pTxtAttrs = rNd.GetpSwpHints();
commit cd4628ae161609b5372905ad6fbc618193a2d3ee
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Thu Nov 21 17:51:25 2013 +0100

    Clarify loop condition
    
    Change-Id: Ia6131a9964288e781bb76d59e24591b3cb375db9

diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index 6a608f4..743ce9e 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -1031,12 +1031,16 @@ sal_uInt16 SwTxtNode::GetWidthOfLeadingTabs() const
     sal_uInt16 nRet = 0;
 
     sal_Int32 nIdx = 0;
-    sal_Unicode cCh;
 
-    while ( nIdx < GetTxt().getLength() &&
-             ( '\t' == ( cCh = GetTxt()[nIdx] ) ||
-                ' ' == cCh ) )
+    while ( nIdx < GetTxt().getLength() )
+    {
+        const sal_Unicode cCh = GetTxt()[nIdx];
+        if ( cCh!='\t' && cCh!=' ' )
+        {
+            break;
+        }
         ++nIdx;
+    }
 
     if ( nIdx > 0 )
     {
commit c936dace9ad275debc300afe09bb96c939e2b6c0
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Thu Nov 21 17:25:20 2013 +0100

    Bail out early
    
    Change-Id: Ib137aeb14405e99adbfcadaf8b3b0408c217093d

diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 6382d74..b5603fd 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -2357,16 +2357,15 @@ bool SwDoc::HasInvisibleContent() const
 
 bool SwDoc::RestoreInvisibleContent()
 {
-    bool bRet = false;
     SwUndoId nLastUndoId(UNDO_EMPTY);
     if (GetIDocumentUndoRedo().GetLastUndoInfo(0, & nLastUndoId)
         && (UNDO_UI_DELETE_INVISIBLECNTNT == nLastUndoId))
     {
         GetIDocumentUndoRedo().Undo();
         GetIDocumentUndoRedo().ClearRedo();
-        bRet = true;
+        return true;
     }
-    return bRet;
+    return false;
 }
 
 bool SwDoc::ConvertFieldsToText()
@@ -2589,9 +2588,6 @@ void SwDoc::ChgTOX(SwTOXBase & rTOX, const SwTOXBase & rNew)
 
 OUString SwDoc::GetPaMDescr(const SwPaM & rPam) const
 {
-    OUString aResult;
-    bool bOK = false;
-
     if (rPam.GetNode(sal_True) == rPam.GetNode(sal_False))
     {
         SwTxtNode * pTxtNode = rPam.GetNode(sal_True)->GetTxtNode();
@@ -2601,28 +2597,23 @@ OUString SwDoc::GetPaMDescr(const SwPaM & rPam) const
             const sal_Int32 nStart = rPam.Start()->nContent.GetIndex();
             const sal_Int32 nEnd = rPam.End()->nContent.GetIndex();
 
-            aResult += SW_RES(STR_START_QUOTE);
-            aResult += ShortenString(pTxtNode->GetTxt().
-                                         copy(nStart, nEnd - nStart),
-                                     nUndoStringLength,
-                                     OUString(SW_RES(STR_LDOTS)));
-            aResult += SW_RES(STR_END_QUOTE);
-
-            bOK = true;
+            return SW_RESSTR(STR_START_QUOTE)
+                + ShortenString(pTxtNode->GetTxt().copy(nStart, nEnd - nStart),
+                                nUndoStringLength,
+                                SW_RESSTR(STR_LDOTS))
+                + SW_RESSTR(STR_END_QUOTE);
         }
     }
     else if (0 != rPam.GetNode(sal_True))
     {
         if (0 != rPam.GetNode(sal_False))
-            aResult += SW_RES(STR_PARAGRAPHS);
-
-        bOK = true;
+        {
+            return SW_RESSTR(STR_PARAGRAPHS);
+        }
+        return OUString();
     }
 
-    if (! bOK)
-        aResult += "??";
-
-    return aResult;
+    return OUString("??");
 }
 
 SwField * SwDoc::GetFieldAtPos(const SwPosition & rPos)
commit 4187c8e2adfbb89c80f270efe17d099b56c564be
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Wed Nov 20 01:52:30 2013 +0100

    Share common code of if/else branches
    
    Change-Id: I0641d37dbde2e8dc734d2a8cb7ef598aeb5f028e

diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index 96e7696..7241157 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -2195,19 +2195,11 @@ SwCursor* SwTableCursor::MakeBoxSels( SwCursor* pAktCrsr )
             if( !pNd->IsCntntNode() )
                 pNd = rNds.GoNextSection( &aIdx, sal_True, sal_False );
 
-            SwPaM* pNew;
-            if( pAktCrsr->GetNext() == pAktCrsr && !pAktCrsr->HasMark() )
-            {
-                pNew = pAktCrsr;
-                pNew->GetPoint()->nNode = *pNd;
-                pNew->GetPoint()->nContent.Assign( (SwCntntNode*)pNd, 0 );
-            }
-            else
-            {
-                pNew = pAktCrsr->Create( pAktCrsr );
-                pNew->GetPoint()->nNode = *pNd;
-                pNew->GetPoint()->nContent.Assign( (SwCntntNode*)pNd, 0 );
-            }
+            SwPaM *const pNew = (pAktCrsr->GetNext() == pAktCrsr && !pAktCrsr->HasMark())
+                ? pAktCrsr
+                : pAktCrsr->Create( pAktCrsr );
+            pNew->GetPoint()->nNode = *pNd;
+            pNew->GetPoint()->nContent.Assign( (SwCntntNode*)pNd, 0 );
             pNew->SetMark();
 
             SwPosition* pPos = pNew->GetPoint();
commit 595f47a8c6462b8e111b96c90bc8abe575a77440
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Nov 17 18:42:40 2013 +0100

    int/sal_Bool to bool, bEnde to bEnd
    
    Change-Id: Ie569c505f9e0f7dcd939fc6e7aafc9b88542b7b2

diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index dcd81fb..96e7696 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -244,7 +244,7 @@ sal_Bool SwCursor::IsSelOvr( int eFlags )
             // set cursor to new position:
             SwNodeIndex aIdx( rPtIdx );
             sal_Int32 nCntntPos = pSavePos->nCntnt;
-            int bGoNxt = pSavePos->nNode < rPtIdx.GetIndex();
+            bool bGoNxt = pSavePos->nNode < rPtIdx.GetIndex();
             SwCntntNode* pCNd = bGoNxt
                 ? rNds.GoNextSection( &rPtIdx, bSkipOverHiddenSections, bSkipOverProtectSections)
                 : rNds.GoPrevSection( &rPtIdx, bSkipOverHiddenSections, bSkipOverProtectSections);
@@ -255,7 +255,7 @@ sal_Bool SwCursor::IsSelOvr( int eFlags )
                     : rNds.GoPrevSection( &rPtIdx, bSkipOverHiddenSections, bSkipOverProtectSections);
             }
 
-            int bIsValidPos = 0 != pCNd;
+            bool bIsValidPos = 0 != pCNd;
             const bool bValidNodesRange = bIsValidPos &&
                 ::CheckNodesRange( rPtIdx, aIdx, true );
             if( !bValidNodesRange )
@@ -263,7 +263,7 @@ sal_Bool SwCursor::IsSelOvr( int eFlags )
                 rPtIdx = pSavePos->nNode;
                 if( 0 == ( pCNd = rPtIdx.GetNode().GetCntntNode() ) )
                 {
-                    bIsValidPos = sal_False;
+                    bIsValidPos = false;
                     nCntntPos = 0;
                     rPtIdx = aIdx;
                     if( 0 == ( pCNd = rPtIdx.GetNode().GetCntntNode() ) )
@@ -330,7 +330,7 @@ sal_Bool SwCursor::IsSelOvr( int eFlags )
         {
             // skip to the next/prev valid paragraph with a layout
             SwNodeIndex& rPtIdx = GetPoint()->nNode;
-            int bGoNxt = pSavePos->nNode < rPtIdx.GetIndex();
+            bool bGoNxt = pSavePos->nNode < rPtIdx.GetIndex();
             while( 0 != ( pFrm = ( bGoNxt ? pFrm->GetNextCntntFrm() : pFrm->GetPrevCntntFrm() ))
                    && 0 == pFrm->Frm().Height() )
                 ;
@@ -582,7 +582,7 @@ sal_Bool SwCursor::IsInProtectTable( sal_Bool bMove, sal_Bool bChgCrsr )
         // if there is another StartNode after the EndNode of a cell then
         // there is another cell
         SwNodeIndex aCellStt( *GetNode()->FindTableBoxStartNode()->EndOfSectionNode(), 1 );
-        sal_Bool bProt = sal_True;
+        bool bProt = true;
 GoNextCell:
         do {
             if( !aCellStt.GetNode().IsStartNode() )
@@ -621,7 +621,7 @@ SetNextCrsr:
         else if( pNd->IsTableNode() && aCellStt++ )
             goto GoNextCell;
 
-        bProt = sal_False; // index is now on a content node
+        bProt = false; // index is now on a content node
         goto SetNextCrsr;
     }
 
@@ -631,7 +631,7 @@ SetNextCrsr:
         // exists a previous cell
         SwNodeIndex aCellStt( *GetNode()->FindTableBoxStartNode(), -1 );
         SwNode* pNd;
-        sal_Bool bProt = sal_True;
+        bool bProt = true;
 GoPrevCell:
         do {
             if( !( pNd = &aCellStt.GetNode())->IsEndNode() )
@@ -669,7 +669,7 @@ SetPrevCrsr:
         else if( pNd->StartOfSectionNode()->IsTableNode() && aCellStt-- )
             goto GoPrevCell;
 
-        bProt = sal_False; // index is now on a content node
+        bProt = false; // index is now on a content node
         goto SetPrevCrsr;
     }
 }
@@ -729,7 +729,7 @@ static sal_uLong lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurCrsr,
     bool const bDoesUndo = pDoc->GetIDocumentUndoRedo().DoesUndo();
     int nFndRet = 0;
     sal_uLong nFound = 0;
-    int bSrchBkwrd = fnMove == fnMoveBackward, bEnde = sal_False;
+    const bool bSrchBkwrd = fnMove == fnMoveBackward;
     SwPaM *pTmpCrsr = pCurCrsr, *pSaveCrsr = pCurCrsr;
 
     // only create progress bar for ShellCrsr
@@ -746,6 +746,7 @@ static sal_uLong lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurCrsr,
     else
         pSaveCrsr = (SwPaM*)pSaveCrsr->GetPrev();
 
+    bool bEnd = false;
     do {
         aRegion.SetMark();
         // independent from search direction: SPoint is always bigger than mark
@@ -783,7 +784,7 @@ static sal_uLong lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurCrsr,
 
             if( !( eFndRngs & FND_IN_SELALL) )
             {
-                bEnde = sal_True;
+                bEnd = true;
                 break;
             }
 
@@ -799,7 +800,7 @@ static sal_uLong lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurCrsr,
                 }
                 else
                 {
-                    bEnde = sal_True;
+                    bEnd = true;
                     if(RET_CANCEL == nRet)
                     {
                         bCancel = sal_True;
@@ -825,7 +826,7 @@ static sal_uLong lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurCrsr,
             }
         }
 
-        if( bEnde || !( eFndRngs & ( FND_IN_SELALL | FND_IN_SEL )) )
+        if( bEnd || !( eFndRngs & ( FND_IN_SELALL | FND_IN_SEL )) )
             break;
 
         pTmpCrsr = ((SwPaM*)pTmpCrsr->GetNext());
@@ -844,11 +845,11 @@ static sal_uLong lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurCrsr,
     return nFound;
 }
 
-static int lcl_MakeSelFwrd( const SwNode& rSttNd, const SwNode& rEndNd,
-                        SwPaM& rPam, int bFirst )
+static bool lcl_MakeSelFwrd( const SwNode& rSttNd, const SwNode& rEndNd,
+                        SwPaM& rPam, bool bFirst )
 {
     if( rSttNd.GetIndex() + 1 == rEndNd.GetIndex() )
-        return sal_False;
+        return false;
 
     SwNodes& rNds = rPam.GetDoc()->GetNodes();
     rPam.DeleteMark();
@@ -858,29 +859,29 @@ static int lcl_MakeSelFwrd( const SwNode& rSttNd, const SwNode& rEndNd,
         rPam.GetPoint()->nNode = rSttNd;
         pCNd = rNds.GoNext( &rPam.GetPoint()->nNode );
         if( !pCNd )
-            return sal_False;
+            return false;
         pCNd->MakeStartIndex( &rPam.GetPoint()->nContent );
     }
     else if( rSttNd.GetIndex() > rPam.GetPoint()->nNode.GetIndex() ||
              rPam.GetPoint()->nNode.GetIndex() >= rEndNd.GetIndex() )
         // not in this section
-        return sal_False;
+        return false;
 
     rPam.SetMark();
     rPam.GetPoint()->nNode = rEndNd;
     pCNd = rNds.GoPrevious( &rPam.GetPoint()->nNode );
     if( !pCNd )
-        return sal_False;
+        return false;
     pCNd->MakeEndIndex( &rPam.GetPoint()->nContent );
 
     return *rPam.GetMark() < *rPam.GetPoint();
 }
 
-static int lcl_MakeSelBkwrd( const SwNode& rSttNd, const SwNode& rEndNd,
-                        SwPaM& rPam, int bFirst )
+static bool lcl_MakeSelBkwrd( const SwNode& rSttNd, const SwNode& rEndNd,
+                        SwPaM& rPam, bool bFirst )
 {
     if( rEndNd.GetIndex() + 1 == rSttNd.GetIndex() )
-        return sal_False;
+        return false;
 
     SwNodes& rNds = rPam.GetDoc()->GetNodes();
     rPam.DeleteMark();
@@ -890,18 +891,18 @@ static int lcl_MakeSelBkwrd( const SwNode& rSttNd, const SwNode& rEndNd,
         rPam.GetPoint()->nNode = rSttNd;
         pCNd = rNds.GoPrevious( &rPam.GetPoint()->nNode );
         if( !pCNd )
-            return sal_False;
+            return false;
         pCNd->MakeEndIndex( &rPam.GetPoint()->nContent );
     }
     else if( rEndNd.GetIndex() > rPam.GetPoint()->nNode.GetIndex() ||
              rPam.GetPoint()->nNode.GetIndex() >= rSttNd.GetIndex() )
-        return sal_False;       // not in this section
+        return false;       // not in this section
 
     rPam.SetMark();
     rPam.GetPoint()->nNode = rEndNd;
     pCNd = rNds.GoNext( &rPam.GetPoint()->nNode );
     if( !pCNd )
-        return sal_False;
+        return false;
     pCNd->MakeStartIndex( &rPam.GetPoint()->nContent );
 
     return *rPam.GetPoint() < *rPam.GetMark();
@@ -921,7 +922,7 @@ sal_uLong SwCursor::FindAll( SwFindParas& rParas,
     SwMoveFn fnMove = MakeFindRange( nStart, nEnde, &aRegion );
 
     sal_uLong nFound = 0;
-    int bMvBkwrd = fnMove == fnMoveBackward;
+    const bool bMvBkwrd = fnMove == fnMoveBackward;
     sal_Bool bInReadOnly = IsReadOnlyAvailable();
 
     SwCursor* pFndRing = 0;
@@ -1019,8 +1020,8 @@ sal_uLong SwCursor::FindAll( SwFindParas& rParas,
                             : rNds.GetEndOfPostIts().StartOfSectionNode();
 
         if( bMvBkwrd
-            ? lcl_MakeSelBkwrd( rNds.GetEndOfContent(), *pSttNd,*this, sal_False )
-            : lcl_MakeSelFwrd( *pSttNd, rNds.GetEndOfContent(), *this, sal_False ))
+            ? lcl_MakeSelBkwrd( rNds.GetEndOfContent(), *pSttNd, *this, false )
+            : lcl_MakeSelFwrd( *pSttNd, rNds.GetEndOfContent(), *this, false ))
         {
             nFound = lcl_FindSelection( rParas, this, fnMove, pFndRing,
                                         aRegion, eFndRngs, bInReadOnly, bCancel );
@@ -1054,7 +1055,7 @@ sal_uLong SwCursor::FindAll( SwFindParas& rParas,
         // if a GetMark is set then keep the GetMark of the found object
         // This allows spanning an area with this search.
         SwPosition aMarkPos( *GetMark() );
-        int bMarkPos = HasMark() && !eFndRngs;
+        const bool bMarkPos = HasMark() && !eFndRngs;
 
         if( 0 != (nFound = rParas.Find( this, fnMove,
                                         &aRegion, bInReadOnly ) ? 1 : 0)
@@ -2100,17 +2101,17 @@ lcl_SeekEntry(const SwSelBoxes& rTmp, SwStartNode const*const pSrch,
             if( rTmp[ nM ]->GetSttNd() == pSrch )
             {
                 o_rFndPos = nM;
-                return sal_True;
+                return true;
             }
             else if( rTmp[ nM ]->GetSttIdx() < nIdx )
                 nU = nM + 1;
             else if( nM == 0 )
-                return sal_False;
+                return false;
             else
                 nO = nM - 1;
         }
     }
-    return sal_False;
+    return false;
 }
 
 SwCursor* SwTableCursor::MakeBoxSels( SwCursor* pAktCrsr )
commit 8cbcaa0575c11c7bf01191b1c67eeb19ad489421
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Nov 17 17:17:45 2013 +0100

    SwPaM: xub_StrLen to sal_Int32
    
    Change-Id: I553f91c4f49c02b3bcd2a778cbaf871b397ed89b

diff --git a/sw/inc/pam.hxx b/sw/inc/pam.hxx
index 6d543c1..a95a2cf 100644
--- a/sw/inc/pam.hxx
+++ b/sw/inc/pam.hxx
@@ -168,12 +168,12 @@ public:
            long nMkOffset = 0, long nPtOffset = 0, SwPaM* pRing = 0 );
     SwPaM( const SwNode& rMk, const SwNode& rPt,
            long nMkOffset = 0, long nPtOffset = 0, SwPaM* pRing = 0 );
-    SwPaM(  const SwNodeIndex& rMk, xub_StrLen nMkCntnt,
-            const SwNodeIndex& rPt, xub_StrLen nPtCntnt, SwPaM* pRing = 0 );
-    SwPaM(  const SwNode& rMk, xub_StrLen nMkCntnt,
-            const SwNode& rPt, xub_StrLen nPtCntnt, SwPaM* pRing = 0 );
-    SwPaM( const SwNode& rNd, xub_StrLen nCntnt = 0, SwPaM* pRing = 0 );
-    SwPaM( const SwNodeIndex& rNd, xub_StrLen nCntnt = 0, SwPaM* pRing = 0 );
+    SwPaM(  const SwNodeIndex& rMk, sal_Int32 nMkCntnt,
+            const SwNodeIndex& rPt, sal_Int32 nPtCntnt, SwPaM* pRing = 0 );
+    SwPaM(  const SwNode& rMk, sal_Int32 nMkCntnt,
+            const SwNode& rPt, sal_Int32 nPtCntnt, SwPaM* pRing = 0 );
+    SwPaM( const SwNode& rNd, sal_Int32 nCntnt = 0, SwPaM* pRing = 0 );
+    SwPaM( const SwNodeIndex& rNd, sal_Int32 nCntnt = 0, SwPaM* pRing = 0 );
     virtual ~SwPaM();
 
     /// @@@ semantic: no copy ctor.
diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index 15168f6..0eaccbe 100644
--- a/sw/source/core/crsr/pam.cxx
+++ b/sw/source/core/crsr/pam.cxx
@@ -370,8 +370,8 @@ SwPaM::SwPaM( const SwNode& rMark, const SwNode& rPoint,
     m_Bound2.nContent.Assign( m_Bound2.nNode.GetNode().GetCntntNode(), 0 );
 }
 
-SwPaM::SwPaM( const SwNodeIndex& rMark , xub_StrLen nMarkCntnt,
-              const SwNodeIndex& rPoint, xub_StrLen nPointCntnt, SwPaM* pRing )
+SwPaM::SwPaM( const SwNodeIndex& rMark, sal_Int32 nMarkCntnt,
+              const SwNodeIndex& rPoint, sal_Int32 nPointCntnt, SwPaM* pRing )
     : Ring( pRing )
     , m_Bound1( rMark )
     , m_Bound2( rPoint )
@@ -383,8 +383,8 @@ SwPaM::SwPaM( const SwNodeIndex& rMark , xub_StrLen nMarkCntnt,
     m_pMark ->nContent.Assign( rMark .GetNode().GetCntntNode(), nMarkCntnt );
 }
 
-SwPaM::SwPaM( const SwNode& rMark , xub_StrLen nMarkCntnt,
-              const SwNode& rPoint, xub_StrLen nPointCntnt, SwPaM* pRing )
+SwPaM::SwPaM( const SwNode& rMark, sal_Int32 nMarkCntnt,
+              const SwNode& rPoint, sal_Int32 nPointCntnt, SwPaM* pRing )
     : Ring( pRing )
     , m_Bound1( rMark )
     , m_Bound2( rPoint )
@@ -398,7 +398,7 @@ SwPaM::SwPaM( const SwNode& rMark , xub_StrLen nMarkCntnt,
         nMarkCntnt );
 }
 
-SwPaM::SwPaM( const SwNode& rNode, xub_StrLen nCntnt, SwPaM* pRing )
+SwPaM::SwPaM( const SwNode& rNode, sal_Int32 nCntnt, SwPaM* pRing )
     : Ring( pRing )
     , m_Bound1( rNode )
     , m_Bound2( m_Bound1.nNode.GetNode().GetNodes() ) // default initialize
@@ -410,7 +410,7 @@ SwPaM::SwPaM( const SwNode& rNode, xub_StrLen nCntnt, SwPaM* pRing )
         nCntnt );
 }
 
-SwPaM::SwPaM( const SwNodeIndex& rNodeIdx, xub_StrLen nCntnt, SwPaM* pRing )
+SwPaM::SwPaM( const SwNodeIndex& rNodeIdx, sal_Int32 nCntnt, SwPaM* pRing )
     : Ring( pRing )
     , m_Bound1( rNodeIdx )
     , m_Bound2( rNodeIdx.GetNode().GetNodes() ) // default initialize
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index 08701af..1b37616 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -1992,7 +1992,7 @@ CHECKTABLE(pTblNd->GetTable())
             for( sal_uInt16 i = pMoves->size(); i; )
             {
                 SwTxtNode* pTxtNd = 0;
-                sal_uInt16 nDelPos = 0;
+                sal_Int32 nDelPos = 0;
                 SwUndoMove* pUndo = &(*pMoves)[ --i ];
                 if( !pUndo->IsMoveRange() )
                 {
diff --git a/sw/source/core/unocore/unoflatpara.cxx b/sw/source/core/unocore/unoflatpara.cxx
index c378f03..8213e50 100644
--- a/sw/source/core/unocore/unoflatpara.cxx
+++ b/sw/source/core/unocore/unoflatpara.cxx
@@ -220,7 +220,7 @@ void SAL_CALL SwXFlatParagraph::changeText(::sal_Int32 nPos, ::sal_Int32 nLen, c
 
     SwTxtNode* pOldTxtNode = mpTxtNode;
 
-    SwPaM aPaM( *mpTxtNode, static_cast<sal_uInt16>(nPos), *mpTxtNode, static_cast<sal_uInt16>(nPos + nLen) );
+    SwPaM aPaM( *mpTxtNode, nPos, *mpTxtNode, nPos+nLen );
 
     UnoActionContext aAction( mpTxtNode->GetDoc() );
 
@@ -250,7 +250,7 @@ void SAL_CALL SwXFlatParagraph::changeAttributes(::sal_Int32 nPos, ::sal_Int32 n
     if ( !mpTxtNode )
         return;
 
-    SwPaM aPaM( *mpTxtNode, static_cast<sal_uInt16>(nPos), *mpTxtNode, static_cast<sal_uInt16>(nPos + nLen) );
+    SwPaM aPaM( *mpTxtNode, nPos, *mpTxtNode, nPos+nLen );
 
     UnoActionContext aAction( mpTxtNode->GetDoc() );
 
diff --git a/sw/source/core/unocore/unoftn.cxx b/sw/source/core/unocore/unoftn.cxx
index fcefbf0..80f1f47 100644
--- a/sw/source/core/unocore/unoftn.cxx
+++ b/sw/source/core/unocore/unoftn.cxx
@@ -389,7 +389,7 @@ void SAL_CALL SwXFootnote::dispose() throw (uno::RuntimeException)
     SwTxtFtn const*const pTxtFtn = rFmt.GetTxtFtn();
     OSL_ENSURE(pTxtFtn, "no TextNode?");
     SwTxtNode& rTxtNode = const_cast<SwTxtNode&>(pTxtFtn->GetTxtNode());
-    const xub_StrLen nPos = *pTxtFtn->GetStart();
+    const sal_Int32 nPos = *pTxtFtn->GetStart();
     SwPaM aPam(rTxtNode, nPos, rTxtNode, nPos+1);
     GetDoc()->DeleteAndJoin( aPam );
 }


More information about the Libreoffice-commits mailing list