Resolves: #i17171# Writer paragraph cannot be longer than 65534 characters

Change-Id: I2052ae96571cba8fe2191dff53b1c61c95c94c60
diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
index eebd6168..a50b1fd 100644
--- a/sw/inc/editsh.hxx
+++ b/sw/inc/editsh.hxx
@@ -676,7 +676,7 @@ public:
    void HyphIgnore();

    /// For Inserting SoftHyphen. Position is offset within the syllabificated word.
    void InsertSoftHyph( const xub_StrLen nHyphPos );
    void InsertSoftHyph( const sal_Int32 nHyphPos );

    const SwTable& InsertTable( const SwInsertTableOptions& rInsTblOpts,  ///< ALL_TBL_INS_ATTR
                                sal_uInt16 nRows, sal_uInt16 nCols,
diff --git a/sw/inc/index.hxx b/sw/inc/index.hxx
index 01d07cc..fc2caa5 100644
--- a/sw/inc/index.hxx
+++ b/sw/inc/index.hxx
@@ -23,7 +23,6 @@

#include "rtl/instance.hxx"
#include <tools/solar.h>
#include <tools/string.hxx>
#include <tools/rtti.hxx>
#include <swdllapi.h>

diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx
index 7895d61..73f3884 100644
--- a/sw/inc/redline.hxx
+++ b/sw/inc/redline.hxx
@@ -270,7 +270,7 @@ public:
    void ShowOriginal( sal_uInt16 nLoop = 0 );

    /// Calculates the intersection with text node number nNdIdx.
    void CalcStartEnd( sal_uLong nNdIdx, xub_StrLen& rStart, xub_StrLen& rEnd ) const;
    void CalcStartEnd(sal_uLong nNdIdx, sal_Int32& rStart, sal_Int32& rEnd) const;

    /// Initiate the layout.
    void InvalidateRange();
diff --git a/sw/inc/swtypes.hxx b/sw/inc/swtypes.hxx
index 32ec476..8dec3ff 100644
--- a/sw/inc/swtypes.hxx
+++ b/sw/inc/swtypes.hxx
@@ -58,6 +58,8 @@ typedef long SwTwips;

#define MM50   283  // 1/2 cm in TWIPS.

const sal_Int32 COMPLETE_STRING = SAL_MAX_INT32;

const SwTwips cMinHdFtHeight = 56;

#define MINFLY 23   // Minimal size for FlyFrms.
diff --git a/sw/inc/txatritr.hxx b/sw/inc/txatritr.hxx
index fd75e8834..5ee6d11 100644
--- a/sw/inc/txatritr.hxx
+++ b/sw/inc/txatritr.hxx
@@ -23,8 +23,8 @@
#include <sal/types.h>
#include <editeng/langitem.hxx>
#include <hintids.hxx>
#include <swtypes.hxx>
#include <deque>
#include <tools/string.hxx>

class SwTxtNode;
class SwTxtAttr;
@@ -39,14 +39,14 @@ class SwScriptIterator
    bool bForward;

public:
    SwScriptIterator( const OUString& rStr, xub_StrLen nStart = 0,
    SwScriptIterator( const OUString& rStr, sal_Int32 nStart = 0,
                      bool bFrwrd = true );

    bool Next();

    sal_uInt16 GetCurrScript() const        { return nCurScript; }
    xub_StrLen GetScriptChgPos() const      { return (m_nChgPos == -1) ? STRING_LEN : m_nChgPos; }
    const OUString& GetText() const         { return m_rText; }
    sal_uInt16 GetCurrScript() const { return nCurScript; }
    sal_Int32 GetScriptChgPos() const { return (m_nChgPos == -1) ? COMPLETE_STRING : m_nChgPos; }
    const OUString& GetText() const { return m_rText; }
};


@@ -56,7 +56,7 @@ class SwTxtAttrIterator
    std::deque<const SwTxtAttr*> aStack;
    const SwTxtNode& rTxtNd;
    const SfxPoolItem *pParaItem, *pCurItem;
    xub_StrLen nChgPos;
    sal_Int32 nChgPos;
    sal_uInt16 nAttrPos, nWhichId;
    bool bIsUseGetWhichOfScript;

@@ -65,19 +65,19 @@ class SwTxtAttrIterator

public:
    SwTxtAttrIterator( const SwTxtNode& rTxtNd, sal_uInt16 nWhichId,
                        xub_StrLen nStart = 0, bool bUseGetWhichOfScript = true );
                        sal_Int32 nStart = 0, bool bUseGetWhichOfScript = true );

    bool Next();

    const SfxPoolItem& GetAttr() const  { return *pCurItem; }
    xub_StrLen GetChgPos() const        { return nChgPos; }
    sal_Int32 GetChgPos() const        { return nChgPos; }
};


class SwLanguageIterator : public SwTxtAttrIterator
{
public:
    SwLanguageIterator( const SwTxtNode& rTxtNode, xub_StrLen nStart = 0,
    SwLanguageIterator( const SwTxtNode& rTxtNode, sal_Int32 nStart = 0,
                        sal_uInt16 nWhich = RES_CHRATR_LANGUAGE,
                        bool bUseGetWhichOfScript = true )
        : SwTxtAttrIterator( rTxtNode, nWhich, nStart, bUseGetWhichOfScript )
diff --git a/sw/inc/undobj.hxx b/sw/inc/undobj.hxx
index c40d229..98e3c31 100644
--- a/sw/inc/undobj.hxx
+++ b/sw/inc/undobj.hxx
@@ -153,10 +153,10 @@ protected:
    // MoveFrom:    moves from the UndoNodesArray into the NodesArray.
    void MoveToUndoNds( SwPaM& rPam,
                        SwNodeIndex* pNodeIdx = 0,
                        sal_uLong* pEndNdIdx = 0, xub_StrLen * pEndCntIdx = 0 );
                        sal_uLong* pEndNdIdx = 0, sal_Int32 * pEndCntIdx = 0 );
    void MoveFromUndoNds( SwDoc& rDoc, sal_uLong nNodeIdx,
                          SwPosition& rInsPos,
                          sal_uLong* pEndNdIdx = 0, xub_StrLen * pEndCntIdx = 0 );
                          sal_uLong* pEndNdIdx = 0, sal_Int32 * pEndCntIdx = 0 );

    // These two methods move the SPoint back/forth from PaM. With it
    // a range can be spanned for Undo/Redo. (In this case the SPoint
@@ -207,7 +207,7 @@ class SwUndRng
{
public:
    sal_uLong nSttNode, nEndNode;
    xub_StrLen nSttCntnt, nEndCntnt;
    sal_Int32 nSttCntnt, nEndCntnt;

    SwUndRng();
    SwUndRng( const SwPaM& );
@@ -267,7 +267,7 @@ class SwUndoFlyBase : public SwUndo, private SwUndoSaveSection
protected:
    SwFrmFmt* pFrmFmt;          // The saved FlyFormat.
    sal_uLong nNdPgPos;
    xub_StrLen nCntPos;         // Page at/in paragraph.
    sal_Int32 nCntPos;         // Page at/in paragraph.
    sal_uInt16 nRndId;
    sal_Bool bDelFmt;           // Delete saved format.

@@ -287,9 +287,9 @@ public:
class SwUndoInsLayFmt : public SwUndoFlyBase
{
    sal_uLong mnCrsrSaveIndexPara;           // Cursor position
    xub_StrLen mnCrsrSaveIndexPos;            // for undo
    sal_Int32 mnCrsrSaveIndexPos;            // for undo
public:
    SwUndoInsLayFmt( SwFrmFmt* pFormat, sal_uLong nNodeIdx, xub_StrLen nCntIdx );
    SwUndoInsLayFmt( SwFrmFmt* pFormat, sal_uLong nNodeIdx, sal_Int32 nCntIdx );

    virtual ~SwUndoInsLayFmt();

diff --git a/sw/inc/unocrsrhelper.hxx b/sw/inc/unocrsrhelper.hxx
index a19effc..ae5ffd9 100644
--- a/sw/inc/unocrsrhelper.hxx
+++ b/sw/inc/unocrsrhelper.hxx
@@ -78,7 +78,7 @@ namespace SwUnoCursorHelper
    };

    ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >
        GetNestedTextContent(SwTxtNode & rTextNode, xub_StrLen const nIndex,
        GetNestedTextContent(SwTxtNode & rTextNode, sal_Int32 const nIndex,
            bool const bParent);

    bool                    getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index 6f23da1..8219aed 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -981,14 +981,14 @@ sal_Bool SwAccessibleParagraph::GetTextBoundary(
                            {
                                nLast = nWrongPos
                                        ? pWrongList->Pos( --nWrongPos )
                                        : STRING_LEN;
                                        : COMPLETE_STRING;
                            }
                            if ( nBegin > pWrongList->GetBeginInv() &&
                                 ( nLast == STRING_LEN || nLast < pWrongList->GetEndInv() ) )
                                 ( nLast == COMPLETE_STRING || nLast < pWrongList->GetEndInv() ) )
                            {
                                nLast = min(nBegin, pWrongList->GetEndInv());
                            }
                            else if ( nLast < STRING_LEN )
                            else if ( nLast < COMPLETE_STRING )
                            {
                                nLast += pWrongList->Len( nWrongPos );
                            }
@@ -1001,11 +1001,11 @@ sal_Bool SwAccessibleParagraph::GetTextBoundary(
                            }
                            else
                            {
                                if (STRING_LEN == nLast)//first
                                if (COMPLETE_STRING == nLast)//first
                                {
                                    rBound.endPos = min(nNext, rBound.endPos);
                                }
                                else if(STRING_LEN == nNext)
                                else if(COMPLETE_STRING == nNext)
                                {
                                    rBound.startPos = max(nLast, rBound.startPos);
                                }
diff --git a/sw/source/core/access/parachangetrackinginfo.cxx b/sw/source/core/access/parachangetrackinginfo.cxx
index 0ad7a77..f9d2d5f 100644
--- a/sw/source/core/access/parachangetrackinginfo.cxx
+++ b/sw/source/core/access/parachangetrackinginfo.cxx
@@ -69,10 +69,10 @@ namespace {
            return;
        }

        const xub_StrLen nTxtFrmTextStartPos = rTxtFrm.IsFollow()
        const sal_Int32 nTxtFrmTextStartPos = rTxtFrm.IsFollow()
                                               ? rTxtFrm.GetOfst()
                                               : 0;
        const xub_StrLen nTxtFrmTextEndPos = rTxtFrm.HasFollow()
        const sal_Int32 nTxtFrmTextEndPos = rTxtFrm.HasFollow()
                                             ? rTxtFrm.GetFollow()->GetOfst()
                                             : rTxtFrm.GetTxt().getLength();

@@ -89,8 +89,8 @@ namespace {
                break;
            }

            xub_StrLen nTxtNodeChangeTrackStart( STRING_LEN );
            xub_StrLen nTxtNodeChangeTrackEnd( STRING_LEN );
            sal_Int32 nTxtNodeChangeTrackStart(COMPLETE_STRING);
            sal_Int32 nTxtNodeChangeTrackEnd(COMPLETE_STRING);
            pActRedline->CalcStartEnd( rTxtNode.GetIndex(),
                                       nTxtNodeChangeTrackStart,
                                       nTxtNodeChangeTrackEnd );
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index ee85607..1a29632 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -3058,10 +3058,10 @@ bool SwCrsrShell::SelectHiddenRange()
            const sal_Int32 nPos = rPt.nContent.GetIndex();

            // check if nPos is in hidden range
            xub_StrLen nHiddenStart;
            xub_StrLen nHiddenEnd;
            sal_Int32 nHiddenStart;
            sal_Int32 nHiddenEnd;
            SwScriptInfo::GetBoundsOfHiddenRange( *pNode, nPos, nHiddenStart, nHiddenEnd );
            if ( STRING_LEN != nHiddenStart )
            if ( COMPLETE_STRING != nHiddenStart )
            {
                // make selection:
                m_pCurCrsr->SetMark();
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index 8c1e282..2462fc0 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -422,7 +422,7 @@ sal_Bool SwCursor::IsSelOvr( int eFlags )
                ( nsSwCursorSelOverFlags::SELOVER_TOGGLE & eFlags )
                ? pSavePos->nNode
                : GetMark()->nNode.GetIndex();
            const xub_StrLen nRefContentIdx =
            const sal_Int32 nRefContentIdx =
                ( nsSwCursorSelOverFlags::SELOVER_TOGGLE & eFlags )
                ? pSavePos->nCntnt
                : GetMark()->nContent.GetIndex();
@@ -433,14 +433,14 @@ sal_Bool SwCursor::IsSelOvr( int eFlags )

            if ( pInputFldTxtAttrAtPoint != NULL )
            {
                const xub_StrLen nNewPointPos =
                const sal_Int32 nNewPointPos =
                    bIsForwardSelection ? *(pInputFldTxtAttrAtPoint->End()) : *(pInputFldTxtAttrAtPoint->GetStart());
                GetPoint()->nContent.Assign( pTxtNdAtPoint, nNewPointPos );
            }

            if ( pInputFldTxtAttrAtMark != NULL )
            {
                const xub_StrLen nNewMarkPos =
                const sal_Int32 nNewMarkPos =
                    bIsForwardSelection ? *(pInputFldTxtAttrAtMark->GetStart()) : *(pInputFldTxtAttrAtMark->End());
                GetMark()->nContent.Assign( pTxtNdAtMark, nNewMarkPos );
            }
@@ -1197,7 +1197,7 @@ sal_Bool SwCursor::IsInWordWT( sal_Int16 nWordType ) const
        if(bRet)
        {
            const CharClass& rCC = GetAppCharClass();
            bRet = rCC.isLetterNumeric( pTxtNd->GetTxt(), static_cast<xub_StrLen>(aBoundary.startPos) );
            bRet = rCC.isLetterNumeric( pTxtNd->GetTxt(), static_cast<sal_Int32>(aBoundary.startPos) );
        }
    }
    return bRet;
@@ -1409,7 +1409,7 @@ static OUString lcl_MaskDeletedRedlines( const SwTxtNode* pTxtNd )

                if( nsRedlineType_t::REDLINE_DELETE == pRed->GetType() )
                {
                    xub_StrLen nStart, nEnd;
                    sal_Int32 nStart, nEnd;
                    pRed->CalcStartEnd( pTxtNd->GetIndex(), nStart, nEnd );

                    while ( nStart < nEnd && nStart < sNodeText.getLength() )
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 7e85132..f0f1aa9 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -1986,10 +1986,10 @@ static bool lcl_SpellAndGrammarAgain( const SwNodePtr& rpNd, void* pArgs )
        {
            pTxtNode->SetWrongDirty( true );
            if( pTxtNode->GetWrong() )
                pTxtNode->GetWrong()->SetInvalid( 0, STRING_LEN );
                pTxtNode->GetWrong()->SetInvalid( 0, COMPLETE_STRING );
            pTxtNode->SetGrammarCheckDirty( true );
            if( pTxtNode->GetGrammarCheck() )
                pTxtNode->GetGrammarCheck()->SetInvalid( 0, STRING_LEN );
                pTxtNode->GetGrammarCheck()->SetInvalid( 0, COMPLETE_STRING );
        }
    }
    return true;
@@ -2003,7 +2003,7 @@ static bool lcl_CheckSmartTagsAgain( const SwNodePtr& rpNd, void*  )
        pTxtNode->SetSmartTagDirty( true );
        if( pTxtNode->GetSmartTags() )
        {
                pTxtNode->SetSmartTags( NULL );
            pTxtNode->SetSmartTags( NULL );
        }
    }
    return true;
diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx
index 26afbb3..321a366 100644
--- a/sw/source/core/doc/docfld.cxx
+++ b/sw/source/core/doc/docfld.cxx
@@ -740,8 +740,8 @@ _SetGetExpFld::_SetGetExpFld( const SwNodeIndex& rNdIdx,
}

// Extension for Sections:
// these always have content position 0xffff!
// There is never a field on this, only up to STRING_MAXLEN possible
// these always have content position 0xffffffff!
// There is never a field on this, only up to COMPLETE_STRING possible
_SetGetExpFld::_SetGetExpFld( const SwSectionNode& rSectNd,
                                const SwPosition* pPos )
{
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 9aeb7c4..a994c03 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -3318,7 +3318,7 @@ void SwRangeRedline::InvalidateRange()       // trigger the Layout

/** Calculates the start and end position of the intersection rTmp and
    text node nNdIdx */
void SwRangeRedline::CalcStartEnd( sal_uLong nNdIdx, xub_StrLen& rStart, xub_StrLen& rEnd ) const
void SwRangeRedline::CalcStartEnd( sal_uLong nNdIdx, sal_Int32& rStart, sal_Int32& rEnd ) const
{
    const SwPosition *pRStt = Start(), *pREnd = End();
    if( pRStt->nNode < nNdIdx )
@@ -3326,7 +3326,7 @@ void SwRangeRedline::CalcStartEnd( sal_uLong nNdIdx, xub_StrLen& rStart, xub_Str
        if( pREnd->nNode > nNdIdx )
        {
            rStart = 0;             // Paragraph is completely enclosed
            rEnd = STRING_LEN;
            rEnd = COMPLETE_STRING;
        }
        else
        {
@@ -3342,12 +3342,12 @@ void SwRangeRedline::CalcStartEnd( sal_uLong nNdIdx, xub_StrLen& rStart, xub_Str
        if( pREnd->nNode == nNdIdx )
            rEnd = pREnd->nContent.GetIndex(); // Within the Paragraph
        else
            rEnd = STRING_LEN;      // Paragraph is overlapped in the end
            rEnd = COMPLETE_STRING;      // Paragraph is overlapped in the end
    }
    else
    {
        rStart = STRING_LEN;
        rEnd = STRING_LEN;
        rStart = COMPLETE_STRING;
        rEnd = COMPLETE_STRING;
    }
}

diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index b0519fb2a..4f8bebb 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -1107,10 +1107,10 @@ sal_Bool SwCntntNode::GoNext(SwIndex * pIdx, sal_uInt16 nMode ) const
                // Check if nPos is inside hidden text range:
                if ( CRSR_SKIP_HIDDEN & nMode )
                {
                    xub_StrLen nHiddenStart;
                    xub_StrLen nHiddenEnd;
                    sal_Int32 nHiddenStart;
                    sal_Int32 nHiddenEnd;
                    SwScriptInfo::GetBoundsOfHiddenRange( rTNd, nPos, nHiddenStart, nHiddenEnd );
                    if ( nHiddenStart != STRING_LEN && nHiddenStart != nPos )
                    if ( nHiddenStart != COMPLETE_STRING && nHiddenStart != nPos )
                         nPos = nHiddenEnd;
                }

@@ -1154,10 +1154,10 @@ sal_Bool SwCntntNode::GoPrevious(SwIndex * pIdx, sal_uInt16 nMode ) const
                // Check if nPos is inside hidden text range:
                if ( CRSR_SKIP_HIDDEN & nMode )
                {
                    xub_StrLen nHiddenStart;
                    xub_StrLen nHiddenEnd;
                    sal_Int32 nHiddenStart;
                    sal_Int32 nHiddenEnd;
                    SwScriptInfo::GetBoundsOfHiddenRange( rTNd, nPos, nHiddenStart, nHiddenEnd );
                    if ( nHiddenStart != STRING_LEN  )
                    if ( nHiddenStart != COMPLETE_STRING )
                         nPos = nHiddenStart;
                }

diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index 53a997e..920a389 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -20,6 +20,7 @@
#include <ctype.h>
#include <hintids.hxx>

#include <tools/string.hxx>
#include <unotools/charclass.hxx>

#include <vcl/msgbox.hxx>
diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx
index d7d8e1c..70a756f 100644
--- a/sw/source/core/edit/editsh.cxx
+++ b/sw/source/core/edit/editsh.cxx
@@ -146,7 +146,7 @@ void SwEditShell::Insert2(const OUString &rStr, const bool bForceExpandHints )
            }
            else
            {
                if ( STRING_LEN != pSI->GetInvalidity() )
                if ( COMPLETE_STRING != pSI->GetInvalidityA() )
                    pSI->InitScriptInfo( (SwTxtNode&)rNode );
                nLevel = pSI->DirType( nPrevPos );
            }
diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx
index 3380f53..f03b557 100644
--- a/sw/source/core/edit/edlingu.cxx
+++ b/sw/source/core/edit/edlingu.cxx
@@ -790,7 +790,7 @@ uno::Reference< uno::XInterface >
 *
 * @param nHyphPos Offset in the to be separated word
 */
void SwEditShell::InsertSoftHyph( const xub_StrLen nHyphPos )
void SwEditShell::InsertSoftHyph( const sal_Int32 nHyphPos )
{
    OSL_ENSURE( pHyphIter, "wo ist mein Iterator?" );
    pHyphIter->InsertSoftHyph( nHyphPos );
@@ -972,7 +972,7 @@ bool SwEditShell::GetGrammarCorrection(

                rResult = xGCIterator->checkSentenceAtPosition(
                        xDoc, xFlatPara, aExpandText, lang::Locale(), nStartOfSentence,
                        nEndOfSentence == STRING_LEN ? aExpandText.getLength() : nEndOfSentence,
                        nEndOfSentence == COMPLETE_STRING ? aExpandText.getLength() : nEndOfSentence,
                        rErrorPosInText );
                bRes = true;

@@ -1271,7 +1271,7 @@ static SpellContentPositions lcl_CollectDeletedRedlines(SwEditShell* pSh)

            if( nsRedlineType_t::REDLINE_DELETE == pRed->GetType() )
            {
                xub_StrLen nStart_, nEnd_;
                sal_Int32 nStart_, nEnd_;
                pRed->CalcStartEnd( pTxtNode->GetIndex(), nStart_, nEnd_ );
                sal_Int32 nStart = nStart_;
                sal_Int32 nEnd = nEnd_;
@@ -1721,7 +1721,7 @@ void SwEditShell::IgnoreGrammarErrorAt( SwPaM& rErrorPosition )
    SwNodeIndex aIdx = rErrorPosition.Start()->nNode;
    SwNodeIndex aEndIdx = rErrorPosition.Start()->nNode;
    sal_Int32 nStart = rErrorPosition.Start()->nContent.GetIndex();
    sal_Int32 nEnd = STRING_LEN;
    sal_Int32 nEnd = COMPLETE_STRING;
    while( aIdx <= aEndIdx )
    {
        pNode = aIdx.GetNode().GetTxtNode();
diff --git a/sw/source/core/inc/SwGrammarMarkUp.hxx b/sw/source/core/inc/SwGrammarMarkUp.hxx
index 8a04ac4..25c5991 100644
--- a/sw/source/core/inc/SwGrammarMarkUp.hxx
+++ b/sw/source/core/inc/SwGrammarMarkUp.hxx
@@ -52,7 +52,7 @@ public:
    /* SwWrongList::JoinList() + handling of maSentence */
    void JoinGrammarList( SwGrammarMarkUp* pNext, sal_Int32 nInsertPos );
    /* SwWrongList::ClearList() + handling of maSentence */
    void ClearGrammarList( sal_Int32 nSentenceEnd = STRING_LEN );
    void ClearGrammarList( sal_Int32 nSentenceEnd = COMPLETE_STRING );
    /* setSentence to define the start positionof a sentence,
       at the moment the end position is given by the next start position */
    void setSentence( sal_Int32 nStart );
diff --git a/sw/source/core/inc/UndoCore.hxx b/sw/source/core/inc/UndoCore.hxx
index 13e46ac..44d99e3 100644
--- a/sw/source/core/inc/UndoCore.hxx
+++ b/sw/source/core/inc/UndoCore.hxx
@@ -157,13 +157,13 @@ class SwUndoSetFlyFmt : public SwUndo, public SwClient
    SwFrmFmt* pNewFmt;
    SfxItemSet* pItemSet;               // the re-/ set attributes
    sal_uLong nOldNode, nNewNode;
    xub_StrLen nOldCntnt, nNewCntnt;
    sal_Int32 nOldCntnt, nNewCntnt;
    sal_uInt16 nOldAnchorTyp, nNewAnchorTyp;
    sal_Bool bAnchorChgd;

    void PutAttr( sal_uInt16 nWhich, const SfxPoolItem* pItem );
    void Modify( const SfxPoolItem*, const SfxPoolItem* );
    void GetAnchor( SwFmtAnchor& rAnhor, sal_uLong nNode, xub_StrLen nCntnt );
    void GetAnchor( SwFmtAnchor& rAnhor, sal_uLong nNode, sal_Int32 nCntnt );

public:
    SwUndoSetFlyFmt( SwFrmFmt& rFlyFmt, SwFrmFmt& rNewFrmFmt );
@@ -214,7 +214,7 @@ const int nUndoStringLength = 20;
   @return the shortened string
 */
OUString
ShortenString(const OUString & rStr, xub_StrLen nLength, const OUString & rFillStr);
ShortenString(const OUString & rStr, sal_Int32 nLength, const OUString & rFillStr);
/**
   Denotes special characters in a string.

diff --git a/sw/source/core/inc/UndoSplitMove.hxx b/sw/source/core/inc/UndoSplitMove.hxx
index 3b9e93f..6d00279 100644
--- a/sw/source/core/inc/UndoSplitMove.hxx
+++ b/sw/source/core/inc/UndoSplitMove.hxx
@@ -27,7 +27,7 @@ class SwUndoSplitNode: public SwUndo
    SwHistory* pHistory;
    SwRedlineData* pRedlData;
    sal_uLong nNode;
    xub_StrLen nCntnt;
    sal_Int32 nCntnt;
    sal_Bool bTblFlag : 1;
    sal_Bool bChkTblStt : 1;
    sal_uInt32 nParRsid;
@@ -50,7 +50,7 @@ class SwUndoMove : public SwUndo, private SwUndRng, private SwUndoSaveCntnt
    // nIns..  - source Position of move (after move!)
    // nMv..   - destination position of move (before move!); for REDO
    sal_uLong nDestSttNode, nDestEndNode, nInsPosNode, nMvDestNode;
    xub_StrLen nDestSttCntnt, nDestEndCntnt, nInsPosCntnt, nMvDestCntnt;
    sal_Int32 nDestSttCntnt, nDestEndCntnt, nInsPosCntnt, nMvDestCntnt;

    sal_uInt16 nFtnStt; // StartPos of Footnotes in History

@@ -77,7 +77,7 @@ public:
    sal_Bool IsMoveRange() const        { return bMoveRange; }
    sal_uLong GetEndNode() const        { return nEndNode; }
    sal_uLong GetDestSttNode() const    { return nDestSttNode; }
    xub_StrLen GetDestSttCntnt() const  { return nDestSttCntnt; }
    sal_Int32 GetDestSttCntnt() const  { return nDestSttCntnt; }

    void SetMoveRedlines( bool b )       { bMoveRedlines = b; }
};
diff --git a/sw/source/core/inc/UndoTable.hxx b/sw/source/core/inc/UndoTable.hxx
index 27507ee..e50c42c 100644
--- a/sw/source/core/inc/UndoTable.hxx
+++ b/sw/source/core/inc/UndoTable.hxx
@@ -28,7 +28,6 @@
#include <itabenum.hxx>
#include "boost/noncopyable.hpp"
#include "boost/scoped_ptr.hpp"
#include <tools/string.hxx>

class SfxItemSet;

diff --git a/sw/source/core/inc/drawfont.hxx b/sw/source/core/inc/drawfont.hxx
index 657026c..8b3e67e 100644
--- a/sw/source/core/inc/drawfont.hxx
+++ b/sw/source/core/inc/drawfont.hxx
@@ -49,20 +49,20 @@ class SwDrawTextInfo
    Size m_aSize;
    SwFont *pFnt;
    SwUnderlineFont* pUnderFnt;
    xub_StrLen* pHyphPos;
    sal_Int32* pHyphPos;
    long nLeft;
    long nRight;
    long nKanaDiff;
    xub_StrLen nIdx;
    xub_StrLen nLen;
    xub_StrLen nOfst;
    sal_Int32 nIdx;
    sal_Int32 nLen;
    sal_Int32 nOfst;
    sal_uInt16 nWidth;
    sal_uInt16 nAscent;
    sal_uInt16 nCompress;
    long nSperren;
    long nSpace;
    long nKern;
    xub_StrLen nNumberOfBlanks;
    sal_Int32 nNumberOfBlanks;
    sal_uInt8 nCursorBidiLevel;
    sal_Bool bBullet : 1;
    sal_Bool bUpper : 1;        // for small caps: upper case flag
@@ -103,7 +103,7 @@ public:
#endif

    SwDrawTextInfo( SwViewShell *pS, OutputDevice &rO, const SwScriptInfo* pSI,
                    const OUString &rSt, xub_StrLen nI, xub_StrLen nL,
                    const OUString &rSt, sal_Int32 nI, sal_Int32 nL,
                    sal_uInt16 nW = 0, sal_Bool bB = sal_False )
    {
        pFrm = NULL;
@@ -192,7 +192,7 @@ public:
        return m_aPos;
    }

    xub_StrLen *GetHyphPos() const
    sal_Int32 *GetHyphPos() const
    {
#ifdef DBG_UTIL
        OSL_ENSURE( m_bHyph, "DrawTextInfo: Undefined Hyph Position" );
@@ -247,17 +247,17 @@ public:
        return pUnderFnt;
    }

    xub_StrLen GetIdx() const
    sal_Int32 GetIdx() const
    {
        return nIdx;
    }

    xub_StrLen GetLen() const
    sal_Int32 GetLen() const
    {
        return nLen;
    }

    xub_StrLen GetOfst() const
    sal_Int32 GetOfst() const
    {
#ifdef DBG_UTIL
        OSL_ENSURE( m_bOfst, "DrawTextInfo: Undefined Offset" );
@@ -265,7 +265,7 @@ public:
        return nOfst;
    }

    xub_StrLen GetEnd() const
    sal_Int32 GetEnd() const
    {
        return nIdx + nLen;
    }
@@ -333,7 +333,7 @@ public:
        return nSpace;
    }

    xub_StrLen GetNumberOfBlanks() const
    sal_Int32 GetNumberOfBlanks() const
    {
#ifdef DBG_UTIL
        OSL_ENSURE( m_bNumberOfBlanks, "DrawTextInfo::Undefined NumberOfBlanks" );
@@ -405,7 +405,7 @@ public:
#endif
    }

    void SetHyphPos( xub_StrLen *pNew )
    void SetHyphPos( sal_Int32 *pNew )
    {
        pHyphPos = pNew;
#ifdef DBG_UTIL
@@ -455,17 +455,17 @@ public:
#endif
    }

    void SetIdx( xub_StrLen nNew )
    void SetIdx( sal_Int32 nNew )
    {
        nIdx = nNew;
    }

    void SetLen( xub_StrLen nNew )
    void SetLen( sal_Int32 nNew )
    {
        nLen = nNew;
    }

    void SetOfst( xub_StrLen nNew )
    void SetOfst( sal_Int32 nNew )
    {
        nOfst = nNew;
#ifdef DBG_UTIL
@@ -533,7 +533,7 @@ public:
#endif
    }

    void SetNumberOfBlanks( xub_StrLen nNew )
    void SetNumberOfBlanks( sal_Int32 nNew )
    {
#ifdef DBG_UTIL
        m_bNumberOfBlanks = true;
diff --git a/sw/source/core/inc/fntcache.hxx b/sw/source/core/inc/fntcache.hxx
index 27ac5b4..61e2c2c 100644
--- a/sw/source/core/inc/fntcache.hxx
+++ b/sw/source/core/inc/fntcache.hxx
@@ -81,8 +81,8 @@ class SwFntObj : public SwCacheObj
    static OutputDevice *pPixOut;

    // SMARTTAGS
    void calcLinePos(SwDrawTextInfo& rInf, Point& aStart, Point& aEnd, xub_StrLen nStart,
       xub_StrLen nWrLen, xub_StrLen nCnt, const sal_Bool bSwitchH2V, const sal_Bool bSwitchL2R,
    void calcLinePos(SwDrawTextInfo& rInf, Point& aStart, Point& aEnd, sal_Int32 nStart,
       sal_Int32 nWrLen, sal_Int32 nCnt, const sal_Bool bSwitchH2V, const sal_Bool bSwitchL2R,
       long nHalfSpace, long* pKernArray, const sal_Bool bBidiPor);

public:
@@ -115,7 +115,7 @@ public:
    void   DrawText( SwDrawTextInfo &rInf );
    /// determine the TextSize (of the printer)
    Size  GetTextSize( SwDrawTextInfo &rInf );
    xub_StrLen GetCrsrOfst( SwDrawTextInfo &rInf );
    sal_Int32 GetCrsrOfst( SwDrawTextInfo &rInf );

    void CreateScrFont( const SwViewShell& rSh, const OutputDevice& rOut );
    void CreatePrtFont( const OutputDevice& rOut );
diff --git a/sw/source/core/inc/frminf.hxx b/sw/source/core/inc/frminf.hxx
index 6af9e7d..7388ae6 100644
--- a/sw/source/core/inc/frminf.hxx
+++ b/sw/source/core/inc/frminf.hxx
@@ -46,13 +46,13 @@ public:
    SwTwips GetLineStart() const;

    // return center position of the next character
    SwTwips GetCharPos( xub_StrLen nChar, sal_Bool bCenter = sal_True ) const;
    SwTwips GetCharPos( sal_Int32 nChar, sal_Bool bCenter = sal_True ) const;

    // collect all whitespaces at the beginning and end of a line in Pam
    void GetSpaces( SwPaM &rPam, sal_Bool bWithLineBreak ) const;

    // Is a bullet point/symbol/etc. at the first text position?
    sal_Bool IsBullet( xub_StrLen nTxtPos ) const;
    sal_Bool IsBullet( sal_Int32 nTxtPos ) const;

    // determine intentation for first line
    SwTwips GetFirstIndent() const;
diff --git a/sw/source/core/inc/layact.hxx b/sw/source/core/inc/layact.hxx
index 29f1f82..d0bebc2 100644
--- a/sw/source/core/inc/layact.hxx
+++ b/sw/source/core/inc/layact.hxx
@@ -197,7 +197,7 @@ class SwLayIdle
    SwRootFrm *pRoot;
    SwViewImp  *pImp;           // Hier Meldet sich der Idler an und ab.
    SwCntntNode *pCntntNode;    // Hier wird die aktuelle Cursorposition
    xub_StrLen  nTxtPos;        // zwischengespeichert.
    sal_Int32  nTxtPos;        // zwischengespeichert.
    sal_Bool        bPageValid;     // Konnte die Seite alles validiert werden?
    sal_Bool        bAllValid;      // Konnte alles validiert werden?

diff --git a/sw/source/core/inc/rolbck.hxx b/sw/source/core/inc/rolbck.hxx
index 5b47c86..817f3d9 100644
--- a/sw/source/core/inc/rolbck.hxx
+++ b/sw/source/core/inc/rolbck.hxx
@@ -120,8 +120,8 @@ class SwHistorySetTxt : public SwHistoryHint
    ::std::auto_ptr<SfxPoolItem> m_pAttr;
    SAL_WNODEPRECATED_DECLARATIONS_POP
    const sal_uLong m_nNodeIndex;
    const xub_StrLen m_nStart;
    const xub_StrLen m_nEnd;
    const sal_Int32 m_nStart;
    const sal_Int32 m_nEnd;
    bool m_bFormatIgnoreStart : 1;
    bool m_bFormatIgnoreEnd   : 1;

@@ -142,7 +142,7 @@ class SwHistorySetTxtFld : public SwHistoryHint
    SAL_WNODEPRECATED_DECLARATIONS_POP

    sal_uLong m_nNodeIndex;
    xub_StrLen m_nPos;
    sal_Int32 m_nPos;
    sal_uInt16 m_nFldWhich;

public:
@@ -158,8 +158,8 @@ class SwHistorySetRefMark : public SwHistoryHint
{
    const OUString m_RefName;
    const sal_uLong m_nNodeIndex;
    const xub_StrLen m_nStart;
    const xub_StrLen m_nEnd;
    const sal_Int32 m_nStart;
    const sal_Int32 m_nEnd;

public:
    SwHistorySetRefMark( SwTxtRefMark* pTxtHt, sal_uLong nNode );
@@ -173,8 +173,8 @@ class SwHistorySetTOXMark : public SwHistoryHint
    const OUString m_TOXName;
    const TOXTypes m_eTOXTypes;
    const sal_uLong m_nNodeIndex;
    const xub_StrLen m_nStart;
    const xub_StrLen m_nEnd;
    const sal_Int32 m_nStart;
    const sal_Int32 m_nEnd;

public:
    SwHistorySetTOXMark( SwTxtTOXMark* pTxtHt, sal_uLong nNode );
@@ -186,18 +186,18 @@ public:
class SwHistoryResetTxt : public SwHistoryHint
{
    const sal_uLong m_nNodeIndex;
    const xub_StrLen m_nStart;
    const xub_StrLen m_nEnd;
    const sal_Int32 m_nStart;
    const sal_Int32 m_nEnd;
    const sal_uInt16 m_nAttr;

public:
    SwHistoryResetTxt( sal_uInt16 nWhich, xub_StrLen nStt, xub_StrLen nEnd,
    SwHistoryResetTxt( sal_uInt16 nWhich, sal_Int32 nStt, sal_Int32 nEnd,
                       sal_uLong nNode );
    virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet );

    sal_uInt16 GetWhich() const         { return m_nAttr; }
    sal_uLong GetNode() const           { return m_nNodeIndex; }
    xub_StrLen GetCntnt() const     { return m_nStart; }
    sal_Int32 GetCntnt() const     { return m_nStart; }

};

@@ -208,7 +208,7 @@ class SwHistorySetFootnote : public SwHistoryHint
    SAL_WNODEPRECATED_DECLARATIONS_POP
    const OUString m_FootnoteNumber;
    sal_uLong m_nNodeIndex;
    const xub_StrLen m_nStart;
    const sal_Int32 m_nStart;
    const bool m_bEndNote;

public:
@@ -263,8 +263,8 @@ class SwHistoryBookmark : public SwHistoryHint
        KeyCode m_aKeycode;
        const sal_uLong m_nNode;
        const sal_uLong m_nOtherNode;
        const xub_StrLen m_nCntnt;
        const xub_StrLen m_nOtherCntnt;
        const sal_Int32 m_nCntnt;
        const sal_Int32 m_nOtherCntnt;
        const bool m_bSavePos;
        const bool m_bSaveOtherPos;
        const bool m_bHadOtherPos;
@@ -288,19 +288,19 @@ public:
class SwHistoryResetAttrSet : public SwHistoryHint
{
    const sal_uLong m_nNodeIndex;
    const xub_StrLen m_nStart;
    const xub_StrLen m_nEnd;
    const sal_Int32 m_nStart;
    const sal_Int32 m_nEnd;
    std::vector<sal_uInt16> m_Array;

public:
    SwHistoryResetAttrSet( const SfxItemSet& rSet, sal_uLong nNode,
                        xub_StrLen nStt = STRING_MAXLEN,
                        xub_StrLen nEnd = STRING_MAXLEN );
                        sal_Int32 nStt,
                        sal_Int32 nEnd);
    virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet );

    const std::vector<sal_uInt16>& GetArr() const { return m_Array; }
    sal_uLong GetNode() const               { return m_nNodeIndex; }
    xub_StrLen GetCntnt() const         { return m_nStart; }
    sal_Int32 GetCntnt() const         { return m_nStart; }

};

@@ -308,7 +308,7 @@ class SwHistoryChangeFlyAnchor : public SwHistoryHint
{
    SwFrmFmt & m_rFmt;
    const sal_uLong m_nOldNodeIndex;
    const xub_StrLen m_nOldContentIndex;
    const sal_Int32 m_nOldContentIndex;

public:
    SwHistoryChangeFlyAnchor( SwFrmFmt& rFmt );
@@ -395,8 +395,8 @@ public:
    void CopyAttr(
        SwpHints* pHts,
        const sal_uLong nNodeIdx,
        const xub_StrLen nStart,
        const xub_StrLen nEnd,
        const sal_Int32 nStart,
        const sal_Int32 nEnd,
        const bool bCopyFields );

    void CopyFmtAttr( const SfxItemSet& rSet, sal_uLong nNodeIdx );
@@ -421,7 +421,7 @@ public:

    /// @return true if at least 1 item was inserted
    bool InsertItems( const SfxItemSet& rSet,
        xub_StrLen const nStart, xub_StrLen const nEnd,
        sal_Int32 const nStart, sal_Int32 const nEnd,
        SetAttrMode const nFlags );

    void AddHint( SwTxtAttr* pHt, const bool bNew = false );
diff --git a/sw/source/core/inc/scriptinfo.hxx b/sw/source/core/inc/scriptinfo.hxx
index dc9d766..cebbfdd 100644
--- a/sw/source/core/inc/scriptinfo.hxx
+++ b/sw/source/core/inc/scriptinfo.hxx
@@ -28,7 +28,7 @@
class SwTxtNode;
class Point;
class MultiSelection;
typedef std::list< xub_StrLen > PositionList;
typedef std::list< sal_Int32 > PositionList;

#define SPACING_PRECISION_FACTOR 100

@@ -44,9 +44,9 @@ private:
    //! Records a single change in script type.
    struct ScriptChangeInfo
    {
        xub_StrLen position; //!< Character position at which we change script
        sal_Int32 position; //!< Character position at which we change script
        sal_uInt8       type;     //!< Script type (Latin/Asian/Complex) that we change to.
        inline ScriptChangeInfo(xub_StrLen pos, sal_uInt8 typ) : position(pos), type(typ) {};
        inline ScriptChangeInfo(sal_Int32 pos, sal_uInt8 typ) : position(pos), type(typ) {};
    };
    //TODO - This is sorted, so should probably be a std::set rather than vector.
    //       But we also use random access (probably unnecessarily).
@@ -54,26 +54,26 @@ private:
    //! Records a single change in direction.
    struct DirectionChangeInfo
    {
        xub_StrLen position; //!< Character position at which we change direction.
        sal_Int32 position; //!< Character position at which we change direction.
        sal_uInt8       type;     //!< Direction that we change to.
        inline DirectionChangeInfo(xub_StrLen pos, sal_uInt8 typ) : position(pos), type(typ) {};
        inline DirectionChangeInfo(sal_Int32 pos, sal_uInt8 typ) : position(pos), type(typ) {};
    };
    std::vector<DirectionChangeInfo> aDirectionChanges;
    std::deque< sal_Int32 > aKashida;
    std::deque< sal_Int32 > aKashidaInvalid;
    std::deque< sal_Int32 > aNoKashidaLine;
    std::deque< sal_Int32 > aNoKashidaLineEnd;
    std::deque< xub_StrLen > aHiddenChg;
    std::deque< sal_Int32 > aHiddenChg;
    //! Records a single change in compression.
    struct CompressionChangeInfo
    {
        xub_StrLen position; //!< Character position where the change occurs.
        xub_StrLen length;   //!< Length of the segment.
        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(xub_StrLen pos, xub_StrLen len, sal_uInt8 typ) : position(pos), length(len), type(typ) {};
        inline CompressionChangeInfo(sal_Int32 pos, sal_Int32 len, sal_uInt8 typ) : position(pos), length(len), type(typ) {};
    };
    std::vector<CompressionChangeInfo> aCompressionChanges;
    xub_StrLen nInvalidityPos;
    sal_Int32 nInvalidityPos;
    sal_uInt8 nDefaultDir;

    void UpdateBidiInfo( const OUString& rTxt );
@@ -95,20 +95,43 @@ public:
    void InitScriptInfo( const SwTxtNode& rNode );

    // set/get position from which data is invalid
    inline void SetInvalidity( const xub_StrLen nPos );
    inline xub_StrLen GetInvalidity() const { return nInvalidityPos; };
    void SetInvalidityA(const sal_Int32 nPos)
    {
        if (nPos < nInvalidityPos)
            nInvalidityPos = nPos;
    }
    sal_Int32 GetInvalidityA() const
    {
        return nInvalidityPos;
    }

    // get default direction for paragraph
    inline sal_uInt8 GetDefaultDir() const { return nDefaultDir; };

    // array operations, nCnt refers to array position
    inline size_t CountScriptChg() const;
    inline xub_StrLen GetScriptChg( const size_t nCnt ) const;
    inline sal_uInt8 GetScriptType( const size_t nCnt ) const;
    size_t CountScriptChg() const { return aScriptChanges.size(); }
    sal_Int32 GetScriptChg( const size_t nCnt ) const
    {
        OSL_ENSURE( nCnt < aScriptChanges.size(),"No ScriptChange today!");
        return aScriptChanges[nCnt].position;
    }
    sal_uInt8 GetScriptType( const size_t nCnt ) const
    {
        OSL_ENSURE( nCnt < aScriptChanges.size(),"No ScriptType today!");
        return aScriptChanges[nCnt].type;
    }

    inline size_t CountDirChg() const;
    inline xub_StrLen GetDirChg( const size_t nCnt ) const;
    inline sal_uInt8 GetDirType( const size_t nCnt ) const;
    size_t CountDirChg() const { return aDirectionChanges.size(); }
    sal_Int32 GetDirChg( const size_t nCnt ) const
    {
        OSL_ENSURE( nCnt < aDirectionChanges.size(),"No DirChange today!");
        return aDirectionChanges[ nCnt ].position;
    }
    sal_uInt8 GetDirType( const size_t nCnt ) const
    {
        OSL_ENSURE( nCnt < aDirectionChanges.size(),"No DirType today!");
        return aDirectionChanges[ nCnt ].type;
    }

    size_t CountKashida() const
    {
@@ -121,31 +144,47 @@ public:
        return aKashida[nCnt];
    }

    inline size_t CountCompChg() const;
    inline xub_StrLen GetCompStart( const size_t nCnt ) const;
    inline xub_StrLen GetCompLen( const size_t nCnt ) const;
    inline sal_uInt8 GetCompType( const size_t nCnt ) const;
    size_t CountCompChg() const { return aCompressionChanges.size(); };
    sal_Int32 GetCompStart( const size_t nCnt ) const
    {
        OSL_ENSURE( nCnt < aCompressionChanges.size(),"No CompressionStart today!");
        return aCompressionChanges[ nCnt ].position;
    }
    sal_Int32 GetCompLen( const size_t nCnt ) const
    {
        OSL_ENSURE( nCnt < aCompressionChanges.size(),"No CompressionLen today!");
        return aCompressionChanges[ nCnt ].length;
    }
    sal_uInt8 GetCompType( const size_t nCnt ) const
    {
        OSL_ENSURE( nCnt < aCompressionChanges.size(),"No CompressionType today!");
        return aCompressionChanges[ nCnt ].type;
    }

    inline size_t CountHiddenChg() const;
    inline xub_StrLen GetHiddenChg( const size_t nCnt ) const;
    size_t CountHiddenChg() const { return aHiddenChg.size(); };
    sal_Int32 GetHiddenChg( const size_t nCnt ) const
    {
        OSL_ENSURE( nCnt < aHiddenChg.size(),"No HiddenChg today!");
        return aHiddenChg[ nCnt ];
    }
    static void CalcHiddenRanges(const SwTxtNode& rNode, MultiSelection& rHiddenMulti);
    static void selectHiddenTextProperty(const SwTxtNode& rNode, MultiSelection &rHiddenMulti);
    static void selectRedLineDeleted(const SwTxtNode& rNode, MultiSelection &rHiddenMulti, bool bSelect=true);

    // "high" level operations, nPos refers to string position
    xub_StrLen NextScriptChg( const xub_StrLen nPos ) const;
    sal_uInt8 ScriptType( const xub_StrLen nPos ) const;
    sal_Int32 NextScriptChg( const sal_Int32 nPos ) const;
    sal_uInt8 ScriptType( const sal_Int32 nPos ) const;

    // Returns the position of the next direction level change.
    // If bLevel is set, the position of the next level which is smaller
    // than the level at position nPos is returned. This is required to
    // obtain the end of a SwBidiPortion
    xub_StrLen NextDirChg( const xub_StrLen nPos,
    sal_Int32 NextDirChg( const sal_Int32 nPos,
                           const sal_uInt8* pLevel = 0 ) const;
    sal_uInt8 DirType( const xub_StrLen nPos ) const;
    sal_uInt8 DirType( const sal_Int32 nPos ) const;

#ifdef DBG_UTIL
    sal_uInt8 CompType( const xub_StrLen nPos ) const;
    sal_uInt8 CompType( const sal_Int32 nPos ) const;
#endif

    //
@@ -166,7 +205,7 @@ public:
                The given position that should be checked.
    @param  rnStartPos
                Return parameter for the start position of the hidden range.
                STRING_LEN if nPos is not inside a hidden range.
                COMPLETE_STRING if nPos is not inside a hidden range.
    @param  rnEndPos
                Return parameter for the end position of the hidden range.
                0 if nPos is not inside a hidden range.
@@ -176,13 +215,13 @@ public:
            returns true if there are any hidden characters in this paragraph.

*/
    static bool GetBoundsOfHiddenRange( const SwTxtNode& rNode, xub_StrLen nPos,
                                        xub_StrLen& rnStartPos, xub_StrLen& rnEndPos,
    static bool GetBoundsOfHiddenRange( const SwTxtNode& rNode, sal_Int32 nPos,
                                        sal_Int32& rnStartPos, sal_Int32& rnEndPos,
                                        PositionList* pList = 0 );
    bool GetBoundsOfHiddenRange(  xub_StrLen nPos, xub_StrLen& rnStartPos,
                                  xub_StrLen& rnEndPos, PositionList* pList = 0 ) const;
    bool GetBoundsOfHiddenRange(  sal_Int32 nPos, sal_Int32& rnStartPos,
                                  sal_Int32& rnEndPos, PositionList* pList = 0 ) const;

    static bool IsInHiddenRange( const SwTxtNode& rNode, xub_StrLen nPos );
    static bool IsInHiddenRange( const SwTxtNode& rNode, sal_Int32 nPos );

/** Hidden text attribute handling

@@ -198,9 +237,9 @@ public:
    @param  bDel
                If set, the hidden ranges will be deleted from the text node.
 */
    static sal_uInt16 MaskHiddenRanges(
    static sal_Int32 MaskHiddenRanges(
            const SwTxtNode& rNode, OUStringBuffer& rText,
                                    const xub_StrLen nStt, const xub_StrLen nEnd,
                                    const sal_Int32 nStt, const sal_Int32 nEnd,
                                    const sal_Unicode cChar );

/** Hidden text attribute handling
@@ -218,10 +257,10 @@ public:

    // examines the range [ nStart, nStart + nEnd ] if there are kanas
    // returns start index of kana entry in array, otherwise USHRT_MAX
    sal_uInt16 HasKana( xub_StrLen nStart, const xub_StrLen nEnd ) const;
    sal_uInt16 HasKana( sal_Int32 nStart, const sal_Int32 nEnd ) const;

    // modifies the kerning array according to a given compress value
    long Compress( sal_Int32* pKernArray, xub_StrLen nIdx, xub_StrLen nLen,
    long Compress( sal_Int32* pKernArray, sal_Int32 nIdx, sal_Int32 nLen,
                   const sal_uInt16 nCompress, const sal_uInt16 nFontHeight,
                   Point* pPoint = NULL ) const;

@@ -324,64 +363,9 @@ public:
    static SwScriptInfo* GetScriptInfo( const SwTxtNode& rNode,
                                        sal_Bool bAllowInvalid = sal_False );

    static sal_uInt8 WhichFont( xub_StrLen nIdx, const OUString* pTxt, const SwScriptInfo* pSI );
    static sal_uInt8 WhichFont(sal_Int32 nIdx, const OUString* pTxt, const SwScriptInfo* pSI);
};

inline void SwScriptInfo::SetInvalidity( const xub_StrLen nPos )
{
    if ( nPos < nInvalidityPos )
        nInvalidityPos = nPos;
};
inline size_t SwScriptInfo::CountScriptChg() const { return aScriptChanges.size(); }
inline xub_StrLen SwScriptInfo::GetScriptChg( const size_t nCnt ) const
{
    OSL_ENSURE( nCnt < aScriptChanges.size(),"No ScriptChange today!");
    return aScriptChanges[nCnt].position;
}
inline sal_uInt8 SwScriptInfo::GetScriptType( const size_t nCnt ) const
{
    OSL_ENSURE( nCnt < aScriptChanges.size(),"No ScriptType today!");
    return aScriptChanges[nCnt].type;
}

inline size_t SwScriptInfo::CountDirChg() const { return aDirectionChanges.size(); }
inline xub_StrLen SwScriptInfo::GetDirChg( const size_t nCnt ) const
{
    OSL_ENSURE( nCnt < aDirectionChanges.size(),"No DirChange today!");
    return aDirectionChanges[ nCnt ].position;
}
inline sal_uInt8 SwScriptInfo::GetDirType( const size_t nCnt ) const
{
    OSL_ENSURE( nCnt < aDirectionChanges.size(),"No DirType today!");
    return aDirectionChanges[ nCnt ].type;
}

inline size_t SwScriptInfo::CountCompChg() const { return aCompressionChanges.size(); };
inline xub_StrLen SwScriptInfo::GetCompStart( const size_t nCnt ) const
{
    OSL_ENSURE( nCnt < aCompressionChanges.size(),"No CompressionStart today!");
    return aCompressionChanges[ nCnt ].position;
}
inline xub_StrLen SwScriptInfo::GetCompLen( const size_t nCnt ) const
{
    OSL_ENSURE( nCnt < aCompressionChanges.size(),"No CompressionLen today!");
    return aCompressionChanges[ nCnt ].length;
}

inline sal_uInt8 SwScriptInfo::GetCompType( const size_t nCnt ) const
{
    OSL_ENSURE( nCnt < aCompressionChanges.size(),"No CompressionType today!");
    return aCompressionChanges[ nCnt ].type;
}

inline size_t SwScriptInfo::CountHiddenChg() const { return aHiddenChg.size(); };
inline xub_StrLen SwScriptInfo::GetHiddenChg( const size_t nCnt ) const
{
    OSL_ENSURE( nCnt < aHiddenChg.size(),"No HiddenChg today!");
    return aHiddenChg[ nCnt ];
}


#endif

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/inc/swfont.hxx b/sw/source/core/inc/swfont.hxx
index c46c58f..6e3d432 100644
--- a/sw/source/core/inc/swfont.hxx
+++ b/sw/source/core/inc/swfont.hxx
@@ -79,8 +79,8 @@ class SwSubFont : public SvxFont
    void DrawStretchCapital( SwDrawTextInfo &rInf );
    void DoOnCapitals( SwDoCapitals &rDo );
    void _DrawStretchText( SwDrawTextInfo &rInf );
    xub_StrLen _GetCrsrOfst( SwDrawTextInfo& rInf );
    xub_StrLen GetCapitalCrsrOfst( SwDrawTextInfo& rInf );
    sal_Int32 _GetCrsrOfst( SwDrawTextInfo& rInf );
    sal_Int32 GetCapitalCrsrOfst( SwDrawTextInfo& rInf );

    inline void SetColor( const Color& rColor );
    inline void SetFillColor( const Color& rColor );
@@ -340,10 +340,10 @@ public:

    sal_Int32 GetCapitalBreak( SwViewShell* pSh,  const OutputDevice* pOut,
        const SwScriptInfo* pScript, const OUString& rTxt,
        long nTextWidth, const xub_StrLen nIdx,
        const xub_StrLen nLen );
        long nTextWidth, const sal_Int32 nIdx,
        const sal_Int32 nLen );

    xub_StrLen GetCapitalCrsrOfst( SwDrawTextInfo& rInf )
    sal_Int32 GetCapitalCrsrOfst( SwDrawTextInfo& rInf )
        { return aSub[nActual].GetCapitalCrsrOfst( rInf ); }

    void DrawCapital( SwDrawTextInfo &rInf )
@@ -358,9 +358,9 @@ public:
    Size _GetTxtSize( SwDrawTextInfo& rInf )
        { rInf.SetFont( this ); return aSub[nActual]._GetTxtSize( rInf ); }

    xub_StrLen GetTxtBreak( SwDrawTextInfo& rInf, long nTextWidth );
    sal_Int32 GetTxtBreak( SwDrawTextInfo& rInf, long nTextWidth );

    xub_StrLen _GetCrsrOfst( SwDrawTextInfo& rInf )
    sal_Int32 _GetCrsrOfst( SwDrawTextInfo& rInf )
        { return aSub[nActual]._GetCrsrOfst( rInf ); }

    inline void _DrawText( SwDrawTextInfo &rInf )
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index 10df18e..0000555 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -52,7 +52,7 @@ class SwTxtFrm: public SwCntntFrm
    friend class SwTestFormat;
    friend class WidowsAndOrphans;
    friend class SwTxtFrmLocker;        // duerfen Lock()/Unlock()
    friend bool sw_ChangeOffset( SwTxtFrm* pFrm, xub_StrLen nNew );
    friend bool sw_ChangeOffset( SwTxtFrm* pFrm, sal_Int32 nNew );

    static SwCache *pTxtCache;  //Pointer auf den Line-Cache
    static long nMinPrtLine;    //Diese Linie darf beim Drucken nicht
@@ -77,17 +77,17 @@ class SwTxtFrm: public SwCntntFrm
    SwTwips mnAdditionalFirstLineOffset;


    xub_StrLen nOfst;           //nOfst gibt den Offset im Cntnt (Anzahl Zeichen) an.
    sal_Int32 nOfst;           //nOfst gibt den Offset im Cntnt (Anzahl Zeichen) an.

    sal_uInt16 nCacheIdx;           //Index in den Cache, USHRT_MAX wenn definitiv
                                //kein passendes Objekt im Cache steht.

    //Teilt den Master ab und erzeugt einen Follow oder passt die
    //Daten im Follow an.
           void _AdjustFollow( SwTxtFormatter &rLine, const xub_StrLen nOffset,
                               const xub_StrLen nStrEnd, const sal_uInt8 nMode );
    inline void AdjustFollow( SwTxtFormatter &rLine, const xub_StrLen nOffset,
                              const xub_StrLen nStrEnd, const sal_uInt8 nMode );
           void _AdjustFollow( SwTxtFormatter &rLine, const sal_Int32 nOffset,
                               const sal_Int32 nStrEnd, const sal_uInt8 nMode );
    inline void AdjustFollow( SwTxtFormatter &rLine, const sal_Int32 nOffset,
                              const sal_Int32 nStrEnd, const sal_uInt8 nMode );

    //Iteriert ueber alle Zeilen und stellt das Linespacing
    //entsprechend dem Attribut ein.
@@ -104,7 +104,7 @@ class SwTxtFrm: public SwCntntFrm

    // WidowsAndOrphans, AdjustFrm, AdjustFollow
    void FormatAdjust( SwTxtFormatter &rLine, WidowsAndOrphans &rFrmBreak,
                       const xub_StrLen nStrLen, const sal_Bool bDummy );
                       const sal_Int32 nStrLen, const sal_Bool bDummy );

    sal_Bool bLocked        : 1;        // im Format?
    sal_Bool bFormatted     : 1;        // nach Format auf sal_True
@@ -134,7 +134,7 @@ class SwTxtFrm: public SwCntntFrm
    inline void SetEmpty( const sal_Bool bNew ) { bEmpty = bNew; }
    inline void SetFieldFollow( const sal_Bool bNew ) { bFieldFollow = bNew; }

    sal_Bool IsIdxInside( const xub_StrLen nPos, const xub_StrLen nLen ) const;
    sal_Bool IsIdxInside( const sal_Int32 nPos, const sal_Int32 nLen ) const;

    // Wechselt den Frame oder auch nicht (vgl. FlyCnt)
    sal_Bool _GetCrsrOfst(SwPosition *pPos, const Point &rPoint,
@@ -152,10 +152,10 @@ class SwTxtFrm: public SwCntntFrm
    void FormatOnceMore( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf );

    // formatiert den Follow und sorgt fuer die Entsorgung bei Orphans
    sal_Bool CalcFollow(  const xub_StrLen nTxtOfst );
    sal_Bool CalcFollow(  const sal_Int32 nTxtOfst );

    // korrigiert die Stelle ab der formatiert werden muss.
    xub_StrLen FindBrk(const OUString &rTxt, const sal_Int32 nStart,
    sal_Int32 FindBrk(const OUString &rTxt, const sal_Int32 nStart,
                                       const sal_Int32 nEnd) const;

    // inline-Weiche
@@ -206,10 +206,10 @@ class SwTxtFrm: public SwCntntFrm

    // ST2
    SwWrongList* _SmartTagScan ( OUString aTxtToScan, SwWrongList *pSmartTagList,
                                 xub_StrLen nBegin,xub_StrLen nEnd,
                                 xub_StrLen nInsertPos, xub_StrLen nActPos,
                                 xub_StrLen &nChgStart, xub_StrLen &nChgEnd,
                                 xub_StrLen &nInvStart, xub_StrLen &nInvEnd);
                                 sal_Int32 nBegin,sal_Int32 nEnd,
                                 sal_Int32 nInsertPos, sal_Int32 nActPos,
                                 sal_Int32 &nChgStart, sal_Int32 &nChgEnd,
                                 sal_Int32 &nInvStart, sal_Int32 &nInvEnd);
protected:
    virtual void Modify( const SfxPoolItem*, const SfxPoolItem* );

@@ -221,11 +221,11 @@ public:
    void Init();

    // Wird von FormatSpelling( ) gerufen
    SwRect _AutoSpell( const SwCntntNode*, const SwViewOption&, xub_StrLen );
    SwRect _AutoSpell( const SwCntntNode*, const SwViewOption&, sal_Int32 );
    // is called from the FormatSpelling( ) method
    SwRect SmartTagScan( SwCntntNode* , xub_StrLen );
    SwRect SmartTagScan( SwCntntNode* , sal_Int32 );
    // Wird vom CollectAutoCmplWords gerufen
    void CollectAutoCmplWrds( SwCntntNode* , xub_StrLen );
    void CollectAutoCmplWrds( SwCntntNode* , sal_Int32 );

    // Returns the screen position of rPos. The values are relative to the upper
    // left position of the page frame.
@@ -302,16 +302,16 @@ public:
                            sal_Bool& bRight, sal_Bool bInsertCrsr );

    // Methoden zur Verwaltung von FolgeFrames
           SwCntntFrm *SplitFrm( const xub_StrLen nTxtPos );
           SwCntntFrm *SplitFrm( const sal_Int32 nTxtPos );
           SwCntntFrm *JoinFrm();
    inline xub_StrLen  GetOfst() const { return nOfst; }
           void        _SetOfst( const xub_StrLen nNewOfst );
    inline void        SetOfst ( const xub_StrLen nNewOfst );
    inline void        ManipOfst ( const xub_StrLen nNewOfst ){ nOfst = nNewOfst; }
    inline sal_Int32  GetOfst() const { return nOfst; }
           void        _SetOfst( const sal_Int32 nNewOfst );
    inline void        SetOfst ( const sal_Int32 nNewOfst );
    inline void        ManipOfst ( const sal_Int32 nNewOfst ){ nOfst = nNewOfst; }
           SwTxtFrm   *GetFrmAtPos ( const SwPosition &rPos);
    inline const SwTxtFrm *GetFrmAtPos ( const SwPosition &rPos) const;
           // OD 07.10.2003 #110978# - return <reference> instead of <pointer>
    SwTxtFrm&   GetFrmAtOfst( const xub_StrLen nOfst );
    SwTxtFrm&   GetFrmAtOfst( const sal_Int32 nOfst );
    // Wenn es einen Follow gibt und wir selbst keinen Text enthalten:
    inline sal_Bool IsEmptyMaster() const
        { return GetFollow() && !GetFollow()->GetOfst(); }
@@ -388,7 +388,7 @@ public:

    // Hat der Frm eine lokale Fussnote (in diesem Frm bzw. Follow)?
#ifdef DBG_UTIL
    void CalcFtnFlag( xub_StrLen nStop = STRING_LEN );//For testing SplitFrm
    void CalcFtnFlag( sal_Int32 nStop = COMPLETE_STRING );//For testing SplitFrm
#else
    void CalcFtnFlag();
#endif
@@ -396,7 +396,7 @@ public:
    // Hidden
    sal_Bool IsHiddenNow() const;       // bHidden && pOut == pPrt
    void HideHidden();              // Anhaengsel entfernen wenn Hidden
    void HideFootnotes( xub_StrLen nStart, xub_StrLen nEnd );
    void HideFootnotes( sal_Int32 nStart, sal_Int32 nEnd );

    /** method to hide/show objects

@@ -410,8 +410,8 @@ public:
    void HideAndShowObjects();

    // Ftn
    void RemoveFtn( const xub_StrLen nStart = 0,
                    const xub_StrLen nLen = STRING_LEN );
    void RemoveFtn( const sal_Int32 nStart = 0,
                    const sal_Int32 nLen = COMPLETE_STRING );
    inline SwTwips GetFtnFrmHeight() const;
    SwTxtFrm *FindFtnRef( const SwTxtFtn *pFtn );
    inline const SwTxtFrm *FindFtnRef( const SwTxtFtn *pFtn ) const
@@ -453,7 +453,7 @@ public:
    inline void SetFtn( const sal_Bool bNew ) { bFtn = bNew; }

    // Beruecksichtigung der Follows
    inline sal_Bool IsInside( const xub_StrLen nPos ) const;
    inline sal_Bool IsInside( const sal_Int32 nPos ) const;

    const SwBodyFrm   *FindBodyFrm()   const;

@@ -505,16 +505,16 @@ public:
    sal_uInt16 FirstLineHeight() const;

    // Haengt FlyInCntFrm um, wenn nEnd > Index >= nStart ist.
    void MoveFlyInCnt( SwTxtFrm *pNew, xub_StrLen nStart, xub_StrLen nEnd );
    void MoveFlyInCnt( SwTxtFrm *pNew, sal_Int32 nStart, sal_Int32 nEnd );

    // Berechnet die Position von FlyInCntFrms
    xub_StrLen CalcFlyPos( SwFrmFmt* pSearch );
    sal_Int32 CalcFlyPos( SwFrmFmt* pSearch );

    // Ermittelt die Startposition und Schrittweite des Registers
    sal_Bool FillRegister( SwTwips& rRegStart, sal_uInt16& rRegDiff );


    sal_uInt16 GetLineCount( xub_StrLen nPos );     //Ermittelt die Zeilenanzahl
    sal_uInt16 GetLineCount( sal_Int32 nPos );     //Ermittelt die Zeilenanzahl

    //Fuer die Anzeige der Zeilennummern.
    sal_uLong GetAllLines()  const { return nAllLines; }
@@ -647,7 +647,7 @@ inline SwTwips SwTxtFrm::GrowTst( const SwTwips nGrow )
    return Grow( nGrow, sal_True );
}

inline sal_Bool SwTxtFrm::IsInside( const xub_StrLen nPos ) const
inline sal_Bool SwTxtFrm::IsInside( const sal_Int32 nPos ) const
{
    sal_Bool bRet = sal_True;
    if( nPos < GetOfst() )
@@ -684,13 +684,13 @@ inline const SwTxtFrm *SwTxtFrm::GetFrmAtPos( const SwPosition &rPos) const
}

inline void SwTxtFrm::AdjustFollow( SwTxtFormatter &rLine,
    const xub_StrLen nOffset, const xub_StrLen nStrEnd, const sal_uInt8 nMode )
    const sal_Int32 nOffset, const sal_Int32 nStrEnd, const sal_uInt8 nMode )
{
    if ( HasFollow() )
        _AdjustFollow( rLine, nOffset, nStrEnd, nMode );
}

inline void SwTxtFrm::SetOfst( const xub_StrLen nNewOfst )
inline void SwTxtFrm::SetOfst( const sal_Int32 nNewOfst )
{
    if ( nOfst != nNewOfst )
        _SetOfst( nNewOfst );
diff --git a/sw/source/core/inc/wrong.hxx b/sw/source/core/inc/wrong.hxx
index 1363635..e1ba495 100644
--- a/sw/source/core/inc/wrong.hxx
+++ b/sw/source/core/inc/wrong.hxx
@@ -29,7 +29,7 @@
#include <vector>

#include <tools/color.hxx>
#include <tools/string.hxx>
#include <swtypes.hxx>
#include <viewopt.hxx>

class SwWrongList;
@@ -215,7 +215,7 @@ public:
    inline sal_Bool InsideInvalid( sal_Int32 nChk ) const
        { return nChk >= nBeginInvalid && nChk <= nEndInvalid; }
    void SetInvalid( sal_Int32 nBegin, sal_Int32 nEnd );
    inline void Validate(){ nBeginInvalid = STRING_LEN; }
    inline void Validate(){ nBeginInvalid = COMPLETE_STRING; }
    void Invalidate( sal_Int32 nBegin, sal_Int32 nEnd );
    sal_Bool InvalidateWrong();
    sal_Bool Fresh( sal_Int32 &rStart, sal_Int32 &rEnd, sal_Int32 nPos,
diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx
index af9b41c..3802272 100644
--- a/sw/source/core/layout/anchoreddrawobject.cxx
+++ b/sw/source/core/layout/anchoreddrawobject.cxx
@@ -587,7 +587,7 @@ void SwAnchoredDrawObject::InvalidateObjPos()
            {
                SwTxtFrm* pAnchorTxtFrm( static_cast<SwTxtFrm*>(AnchorFrm()) );
                if ( pAnchorTxtFrm->GetTxtNode()->GetpSwpHints() &&
                     pAnchorTxtFrm->CalcFlyPos( &GetFrmFmt() ) != STRING_LEN )
                     pAnchorTxtFrm->CalcFlyPos( &GetFrmFmt() ) != COMPLETE_STRING )
                {
                    AnchorFrm()->Prepare( PREP_FLY_ATTR_CHG, &GetFrmFmt() );
                }
diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx
index 70f86a7..fce2a3b 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -1333,7 +1333,7 @@ void SwCntntFrm::MakeAll()
                const SwTwips nHDiff = nOldH - (Frm().*fnRect->fnGetHeight)();
                const bool bNoPrepAdjustFrm =
                    nHDiff > 0 && IsInTab() && GetFollow() &&
                    ( 1 == static_cast<SwTxtFrm*>(GetFollow())->GetLineCount( STRING_LEN ) || (static_cast<SwTxtFrm*>(GetFollow())->Frm().*fnRect->fnGetWidth)() < 0 ) &&
                    ( 1 == static_cast<SwTxtFrm*>(GetFollow())->GetLineCount( COMPLETE_STRING ) || (static_cast<SwTxtFrm*>(GetFollow())->Frm().*fnRect->fnGetWidth)() < 0 ) &&
                    GetFollow()->CalcAddLowerSpaceAsLastInTableCell() == nHDiff;
                if ( !bNoPrepAdjustFrm )
                {
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 033ed4a..d6301a4 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -2045,7 +2045,7 @@ sal_Bool SwLayIdle::_DoIdleJob( const SwCntntFrm *pCnt, IdleJobType eJob )
    if( bProcess )
    {
        SwViewShell *pSh = pImp->GetShell();
        if( STRING_LEN == nTxtPos )
        if( COMPLETE_STRING == nTxtPos )
        {
            --nTxtPos;
            if( pSh->ISA(SwCrsrShell) && !((SwCrsrShell*)pSh)->IsTableMode() )
@@ -2175,7 +2175,7 @@ sal_Bool SwLayIdle::DoIdleJob( IdleJobType eJob, sal_Bool bVisAreaOnly )
        pPage = (SwPageFrm*)pRoot->Lower();

    pCntntNode = NULL;
    nTxtPos = STRING_LEN;
    nTxtPos = COMPLETE_STRING;

    while ( pPage )
    {
diff --git a/sw/source/core/layout/laycache.cxx b/sw/source/core/layout/laycache.cxx
index f4b329b..6b63407 100644
--- a/sw/source/core/layout/laycache.cxx
+++ b/sw/source/core/layout/laycache.cxx
@@ -84,7 +84,7 @@ void SwLayoutCache::Read( SvStream &rStream )

//-----------------------------------------------------------------------------

void SwLayCacheImpl::Insert( sal_uInt16 nType, sal_uLong nIndex, xub_StrLen nOffset )
void SwLayCacheImpl::Insert( sal_uInt16 nType, sal_uLong nIndex, sal_Int32 nOffset )
{
    aType.push_back( nType );
    std::vector<sal_uLong>::push_back( nIndex );
@@ -120,9 +120,9 @@ bool SwLayCacheImpl::Read( SvStream& rStream )
            if( (cFlags & 0x01) != 0 )
                aIo.GetStream() >> nOffset;
            else
                nOffset = STRING_LEN;
                nOffset = COMPLETE_STRING;
            aIo.CloseFlagRec();
            Insert( SW_LAYCACHE_IO_REC_PARA, nIndex, (xub_StrLen)nOffset );
            Insert( SW_LAYCACHE_IO_REC_PARA, nIndex, (sal_Int32)nOffset );
            aIo.CloseRec( SW_LAYCACHE_IO_REC_PARA );
            break;
        }
@@ -131,7 +131,7 @@ bool SwLayCacheImpl::Read( SvStream& rStream )
            aIo.OpenFlagRec();
            aIo.GetStream() >> nIndex
                            >> nOffset;
            Insert( SW_LAYCACHE_IO_REC_TABLE, nIndex, (xub_StrLen)nOffset );
            Insert( SW_LAYCACHE_IO_REC_TABLE, nIndex, (sal_Int32)nOffset );
            aIo.CloseFlagRec();
            aIo.CloseRec( SW_LAYCACHE_IO_REC_TABLE );
            break;
@@ -221,7 +221,7 @@ void SwLayoutCache::Write( SvStream &rStream, const SwDoc& rDoc )
                    else if( pTmp->IsTabFrm() )
                    {
                        SwTabFrm* pTab = (SwTabFrm*)pTmp;
                        sal_uLong nOfst = STRING_LEN;
                        sal_uLong nOfst = COMPLETE_STRING;
                        if( pTab->IsFollow() )
                        {
                            // If the table is a follow, we have to look for the
@@ -262,7 +262,7 @@ void SwLayoutCache::Write( SvStream &rStream, const SwDoc& rDoc )
                            // immediately.
                            if( pTab->GetFollow() )
                            {
                                if( nOfst == STRING_LEN )
                                if( nOfst == COMPLETE_STRING )
                                    nOfst = 0;
                                do
                                {
@@ -368,7 +368,7 @@ sal_Bool SwLayoutCache::CompareLayout( const SwDoc& rDoc ) const
                            SW_LAYCACHE_IO_REC_PARA !=
                            pImpl->GetBreakType( nIndex ) ||
                            ( bFollow ? ((SwTxtFrm*)pTmp)->GetOfst()
                              : STRING_LEN ) != pImpl->GetBreakOfst( nIndex ) )
                              : COMPLETE_STRING ) != pImpl->GetBreakOfst( nIndex ) )
                        {
                            return sal_False;
                        }
@@ -378,7 +378,7 @@ sal_Bool SwLayoutCache::CompareLayout( const SwDoc& rDoc ) const
                else if( pTmp->IsTabFrm() )
                {
                    SwTabFrm* pTab = (SwTabFrm*)pTmp;
                    sal_uLong nOfst = STRING_LEN;
                    sal_Int32 nOfst = COMPLETE_STRING;
                    if( pTab->IsFollow() )
                    {
                        nOfst = 0;
@@ -413,7 +413,7 @@ sal_Bool SwLayoutCache::CompareLayout( const SwDoc& rDoc ) const
                        }
                        if( pTab->GetFollow() )
                        {
                            if( nOfst == STRING_LEN )
                            if( nOfst == COMPLETE_STRING )
                                nOfst = 0;
                            do
                            {
@@ -733,7 +733,7 @@ bool SwLayHelper::CheckInsert( sal_uLong nNodeIndex )
        ++nParagraphCnt;
    if( bFirst && pImpl && nIndex < pImpl->size() &&
        pImpl->GetBreakIndex( nIndex ) == nNodeIndex &&
        ( pImpl->GetBreakOfst( nIndex ) < STRING_LEN ||
        ( pImpl->GetBreakOfst( nIndex ) < COMPLETE_STRING ||
          ( ++nIndex < pImpl->size() &&
          pImpl->GetBreakIndex( nIndex ) == nNodeIndex ) ) )
        bFirst = false;
@@ -747,7 +747,7 @@ bool SwLayHelper::CheckInsert( sal_uLong nNodeIndex )
         ( rpFrm->IsTabFrm() && bLongTab )
       )
    {
        sal_uLong nRowCount = 0;
        sal_Int32 nRowCount = 0;
        do
        {
            if( pImpl || bLongTab )
@@ -757,12 +757,12 @@ bool SwLayHelper::CheckInsert( sal_uLong nNodeIndex )
                        pImpl->GetBreakIndex(nIndex) : 0xffff;
                (void)nBrkIndex;
#endif
                xub_StrLen nOfst = STRING_LEN;
                sal_Int32 nOfst = COMPLETE_STRING;
                sal_uInt16 nType = SW_LAYCACHE_IO_REC_PAGES;
                if( bLongTab )
                {
                    rbBreakAfter = sal_True;
                    nOfst = static_cast<xub_StrLen>(nRowCount + nMaxRowPerPage);
                    nOfst = static_cast<sal_Int32>(nRowCount + nMaxRowPerPage);
                }
                else
                {
@@ -778,7 +778,7 @@ bool SwLayHelper::CheckInsert( sal_uLong nNodeIndex )
                    }
                }

                if( nOfst < STRING_LEN )
                if( nOfst < COMPLETE_STRING )
                {
                    bool bSplit = false;
                    sal_uInt16 nRepeat( 0 );
diff --git a/sw/source/core/layout/layhelp.hxx b/sw/source/core/layout/layhelp.hxx
index 61dc7bb..ac7e7c17 100644
--- a/sw/source/core/layout/layhelp.hxx
+++ b/sw/source/core/layout/layhelp.hxx
@@ -52,18 +52,18 @@ typedef boost::ptr_vector<SwFlyCache> SwPageFlyCache;

class SwLayCacheImpl : public std::vector<sal_uLong>
{
    std::deque<xub_StrLen> aOffset;
    std::deque<sal_Int32> aOffset;
    std::vector<sal_uInt16> aType;
    SwPageFlyCache aFlyCache;
    bool bUseFlyCache;
    void Insert( sal_uInt16 nType, sal_uLong nIndex, xub_StrLen nOffset );
    void Insert( sal_uInt16 nType, sal_uLong nIndex, sal_Int32 nOffset );

public:
    SwLayCacheImpl() {}
    bool Read( SvStream& rStream );

    sal_uLong GetBreakIndex( sal_uInt16 nIdx ) const { return std::vector<sal_uLong>::operator[]( nIdx ); }
    xub_StrLen GetBreakOfst( size_t nIdx ) const { return aOffset[ nIdx ]; }
    sal_Int32 GetBreakOfst( size_t nIdx ) const { return aOffset[ nIdx ]; }
    sal_uInt16 GetBreakType( sal_uInt16 nIdx ) const { return aType[ nIdx ]; }

    sal_uInt16 GetFlyCount() const { return aFlyCache.size(); }
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 5f8a584..2db4406 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -5492,7 +5492,7 @@ static SwTwips lcl_CalcHeightOfFirstContentLine( const SwRowFrm& rSourceLine )
                    // would have no follow and thus would add this space.
                    if ( pTmp->IsTxtFrm() &&
                         const_cast<SwTxtFrm*>(static_cast<const SwTxtFrm*>(pTmp))
                                            ->GetLineCount( STRING_LEN ) == 1 )
                                            ->GetLineCount( COMPLETE_STRING ) == 1 )
                    {
                        nTmpHeight += SwFlowFrm::CastFlowFrm(pTmp)
                                        ->CalcAddLowerSpaceAsLastInTableCell();
diff --git a/sw/source/core/text/SwGrammarMarkUp.cxx b/sw/source/core/text/SwGrammarMarkUp.cxx
index 07c7272..7506f85 100644
--- a/sw/source/core/text/SwGrammarMarkUp.cxx
+++ b/sw/source/core/text/SwGrammarMarkUp.cxx
@@ -69,7 +69,7 @@ SwGrammarMarkUp* SwGrammarMarkUp::SplitGrammarList( sal_Int32 nSplitPos )
    {
        if( !pNew ) {
            pNew = new SwGrammarMarkUp();
            pNew->SetInvalid( 0, STRING_LEN );
            pNew->SetInvalid( 0, COMPLETE_STRING );
        }
        pNew->maSentence.insert( pNew->maSentence.begin(), maSentence.begin(), pIter );
        maSentence.erase( maSentence.begin(), pIter );
@@ -96,7 +96,7 @@ void SwGrammarMarkUp::JoinGrammarList( SwGrammarMarkUp* pNext, sal_Int32 nInsert

void SwGrammarMarkUp::ClearGrammarList( sal_Int32 nSentenceEnd )
{
    if( STRING_LEN == nSentenceEnd ) {
    if( COMPLETE_STRING == nSentenceEnd ) {
        ClearList();
        maSentence.clear();
        Validate();
@@ -113,7 +113,7 @@ void SwGrammarMarkUp::ClearGrammarList( sal_Int32 nSentenceEnd )
            ++pLast;
        maSentence.erase( pIter, pLast );
        RemoveEntry( nStart, nSentenceEnd );
        SetInvalid( nSentenceEnd + 1, STRING_LEN );
        SetInvalid( nSentenceEnd + 1, COMPLETE_STRING );
    }
}

@@ -143,13 +143,13 @@ sal_Int32 SwGrammarMarkUp::getSentenceStart( sal_Int32 nPos )
sal_Int32 SwGrammarMarkUp::getSentenceEnd( sal_Int32 nPos )
{
    if( !maSentence.size() )
        return STRING_LEN;
        return COMPLETE_STRING;
    std::vector< sal_Int32 >::iterator pIter = maSentence.begin();
    while( pIter != maSentence.end() && *pIter <= nPos )
        ++pIter;
    if( pIter != maSentence.end() )
        return *pIter;
    return STRING_LEN;
    return COMPLETE_STRING;
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx
index 7f4151f..1e0abda 100644
--- a/sw/source/core/text/frmcrsr.cxx
+++ b/sw/source/core/text/frmcrsr.cxx
@@ -103,7 +103,7 @@ SwTxtFrm *GetAdjFrmAtPos( SwTxtFrm *pFrm, const SwPosition &rPos,
    return pFrmAtPos ? pFrmAtPos : pFrm;
}

bool sw_ChangeOffset( SwTxtFrm* pFrm, xub_StrLen nNew )
bool sw_ChangeOffset( SwTxtFrm* pFrm, sal_Int32 nNew )
{
    // Do not scroll in areas and outside of flies
    OSL_ENSURE( !pFrm->IsFollow(), "Illegal Scrolling by Follow!" );
@@ -142,7 +142,7 @@ bool sw_ChangeOffset( SwTxtFrm* pFrm, xub_StrLen nNew )
 *                      GetFrmAtOfst(), GetFrmAtPos()
 *************************************************************************/

SwTxtFrm& SwTxtFrm::GetFrmAtOfst( const xub_StrLen nWhere )
SwTxtFrm& SwTxtFrm::GetFrmAtOfst( const sal_Int32 nWhere )
{
    SwTxtFrm* pRet = this;
    while( pRet->HasFollow() && nWhere >= pRet->GetFollow()->GetOfst() )
@@ -610,17 +610,17 @@ sal_Bool SwTxtFrm::_GetCrsrOfst(SwPosition* pPos, const Point& rPoint,
            while( aLine.GetLineNr() > 1 )
                aLine.Prev();

        xub_StrLen nOffset = aLine.GetCrsrOfst( pPos, rPoint, bChgFrm, pCMS );
        sal_Int32 nOffset = aLine.GetCrsrOfst( pPos, rPoint, bChgFrm, pCMS );

        if( pCMS && pCMS->eState == MV_NONE && aLine.GetEnd() == nOffset )
            ((SwCrsrMoveState*)pCMS)->eState = MV_RIGHTMARGIN;

    // pPos is a pure IN parameter and must not be evaluated.
    // pIter->GetCrsrOfst returns from a nesting with STRING_LEN.
    // pIter->GetCrsrOfst returns from a nesting with COMPLETE_STRING.
    // If SwTxtIter::GetCrsrOfst calls GetCrsrOfst further by itself
    // nNode changes the position.
    // In such cases, pPos must not be calculated.
        if( STRING_LEN != nOffset )
        if( COMPLETE_STRING != nOffset )
        {
            SwTxtNode* pTxtNd = ((SwTxtFrm*)this)->GetTxtNode();
            pPos->nNode = *pTxtNd;
@@ -705,7 +705,7 @@ sal_Bool SwTxtFrm::LeftMargin(SwPaM *pPam) const
    SwTxtFrm *pFrm = GetAdjFrmAtPos( (SwTxtFrm*)this, *pPam->GetPoint(),
                                     SwTxtCursor::IsRightMargin() );
    pFrm->GetFormatted();
    xub_StrLen nIndx;
    sal_Int32 nIndx;
    if ( pFrm->IsEmpty() )
        nIndx = 0;
    else
@@ -744,7 +744,7 @@ sal_Bool SwTxtFrm::RightMargin(SwPaM *pPam, sal_Bool bAPI) const
    SwTxtFrm *pFrm = GetAdjFrmAtPos( (SwTxtFrm*)this, *pPam->GetPoint(),
                                     SwTxtCursor::IsRightMargin() );
    pFrm->GetFormatted();
    xub_StrLen nRightMargin;
    sal_Int32 nRightMargin;
    if ( IsEmpty() )
        nRightMargin = 0;
    else
@@ -810,10 +810,10 @@ sal_Bool SwTxtFrm::_UnitUp( SwPaM *pPam, const SwTwips nOffset,

    if( !IsEmpty() && !IsHiddenNow() )
    {
        xub_StrLen nFormat = STRING_LEN;
        sal_Int32 nFormat = COMPLETE_STRING;
        do
        {
            if( nFormat != STRING_LEN && !IsFollow() )
            if( nFormat != COMPLETE_STRING && !IsFollow() )
                sw_ChangeOffset( ((SwTxtFrm*)this), nFormat );

            SwTxtSizeInfo aInf( (SwTxtFrm*)this );
@@ -826,7 +826,7 @@ sal_Bool SwTxtFrm::_UnitUp( SwPaM *pPam, const SwTwips nOffset,
                aLine.Top();

            const SwLineLayout *pPrevLine = aLine.GetPrevLine();
            const xub_StrLen nStart = aLine.GetStart();
            const sal_Int32 nStart = aLine.GetStart();
            aLine.GetCharRect( &aCharBox, nPos );

            bool bSecondOfDouble = ( aInf.IsMulti() && ! aInf.IsFirstMulti() );
@@ -835,7 +835,7 @@ sal_Bool SwTxtFrm::_UnitUp( SwPaM *pPam, const SwTwips nOffset,
            if( !pPrevLine && !bSecondOfDouble && GetOfst() && !IsFollow() )
            {
                nFormat = GetOfst();
                xub_StrLen nDiff = aLine.GetLength();
                sal_Int32 nDiff = aLine.GetLength();
                if( !nDiff )
                    nDiff = MIN_OFFSET_STEP;
                if( nFormat > nDiff )
@@ -866,7 +866,7 @@ sal_Bool SwTxtFrm::_UnitUp( SwPaM *pPam, const SwTwips nOffset,
                const sal_uLong nOldNode = pPam->GetPoint()->nNode.GetIndex();
#endif
                // The node should not be changed
                xub_StrLen nTmpOfst = aLine.GetCrsrOfst( pPam->GetPoint(),
                sal_Int32 nTmpOfst = aLine.GetCrsrOfst( pPam->GetPoint(),
                                                         aCharBox.Pos(), sal_False );
#if OSL_DEBUG_LEVEL > 0
                OSL_ENSURE( nOldNode == pPam->GetPoint()->nNode.GetIndex(),
@@ -899,7 +899,7 @@ sal_Bool SwTxtFrm::_UnitUp( SwPaM *pPam, const SwTwips nOffset,
    if ( IsFollow() )
    {
        const SwTxtFrm *pTmpPrev = FindMaster();
        xub_StrLen nOffs = GetOfst();
        sal_Int32 nOffs = GetOfst();
        if( pTmpPrev )
        {
            SwViewShell *pSh = getRootFrm()->GetCurrShell();
@@ -1206,10 +1206,10 @@ sal_Bool SwTxtFrm::_UnitDown(SwPaM *pPam, const SwTwips nOffset,

    if ( !IsEmpty() && !IsHiddenNow() )
    {
        xub_StrLen nFormat = STRING_LEN;
        sal_Int32 nFormat = COMPLETE_STRING;
        do
        {
            if( nFormat != STRING_LEN && !IsFollow() &&
            if( nFormat != COMPLETE_STRING && !IsFollow() &&
                !sw_ChangeOffset( ((SwTxtFrm*)this), nFormat ) )
                break;

@@ -1220,7 +1220,7 @@ sal_Bool SwTxtFrm::_UnitDown(SwPaM *pPam, const SwTwips nOffset,
            aLine.CharCrsrToLine( nPos );

            const SwLineLayout* pNextLine = aLine.GetNextLine();
            const xub_StrLen nStart = aLine.GetStart();
            const sal_Int32 nStart = aLine.GetStart();
            aLine.GetCharRect( &aCharBox, nPos );

            bool bFirstOfDouble = ( aInf.IsMulti() && aInf.IsFirstMulti() );
@@ -1235,7 +1235,7 @@ sal_Bool SwTxtFrm::_UnitDown(SwPaM *pPam, const SwTwips nOffset,
                if ( pNextLine && ! bFirstOfDouble )
                    aLine.NextLine();

                xub_StrLen nTmpOfst = aLine.GetCrsrOfst( pPam->GetPoint(),
                sal_Int32 nTmpOfst = aLine.GetCrsrOfst( pPam->GetPoint(),
                                 aCharBox.Pos(), sal_False );
#if OSL_DEBUG_LEVEL > 0
                OSL_ENSURE( nOldNode == pPam->GetPoint()->nNode.GetIndex(),
@@ -1282,8 +1282,8 @@ sal_Bool SwTxtFrm::_UnitDown(SwPaM *pPam, const SwTwips nOffset,
                {
                    if( nFormat <= GetOfst() )
                    {
                        nFormat = std::min( xub_StrLen( GetOfst() + MIN_OFFSET_STEP ),
                                       static_cast<xub_StrLen>(nTmpLen) );
                        nFormat = std::min( sal_Int32( GetOfst() + MIN_OFFSET_STEP ),
                                       static_cast<sal_Int32>(nTmpLen) );
                        if( nFormat <= GetOfst() )
                            break;
                    }
diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index 872d071..2203996 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -188,7 +188,7 @@ const SwBodyFrm *SwTxtFrm::FindBodyFrm() const
    return 0;
}

sal_Bool SwTxtFrm::CalcFollow( const xub_StrLen nTxtOfst )
sal_Bool SwTxtFrm::CalcFollow( const sal_Int32 nTxtOfst )
{
    SWAP_IF_SWAPPED( this )

@@ -557,7 +557,7 @@ com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop > SwTxtFrm::GetT
 *************************************************************************/

void SwTxtFrm::_AdjustFollow( SwTxtFormatter &rLine,
                             const xub_StrLen nOffset, const xub_StrLen nEnd,
                             const sal_Int32 nOffset, const sal_Int32 nEnd,
                             const sal_uInt8 nMode )
{
    SwFrmSwapper aSwapper( this, sal_False );
@@ -583,7 +583,7 @@ void SwTxtFrm::_AdjustFollow( SwTxtFormatter &rLine,
    // Dancing on the volcano: We'll just format the last line quickly
    // for the QuoVadis stuff.
    // The Offset can move of course:
    const xub_StrLen nNewOfst = ( IsInFtn() && ( !GetIndNext() || HasFollow() ) ) ?
    const sal_Int32 nNewOfst = ( IsInFtn() && ( !GetIndNext() || HasFollow() ) ) ?
                            rLine.FormatQuoVadis(nOffset) : nOffset;

    if( !(nMode & 1) )
@@ -620,7 +620,7 @@ SwCntntFrm *SwTxtFrm::JoinFrm()
    SwTxtFrm *pNxt = pFoll->GetFollow();

    // All footnotes of the to-be-destroyed Follow are relocated to us
    xub_StrLen nStart = pFoll->GetOfst();
    sal_Int32 nStart = pFoll->GetOfst();
    if ( pFoll->HasFtn() )
    {
        const SwpHints *pHints = pFoll->GetTxtNode()->GetpSwpHints();
@@ -660,7 +660,7 @@ SwCntntFrm *SwTxtFrm::JoinFrm()
    }
#endif

    pFoll->MoveFlyInCnt( this, nStart, STRING_LEN );
    pFoll->MoveFlyInCnt( this, nStart, COMPLETE_STRING );
    pFoll->SetFtn( sal_False );
    // #i27138#
    // notify accessibility paragraphs objects about changed CONTENT_FLOWS_FROM/_TO relation.
@@ -683,7 +683,7 @@ SwCntntFrm *SwTxtFrm::JoinFrm()
    return pNxt;
}

SwCntntFrm *SwTxtFrm::SplitFrm( const xub_StrLen nTxtPos )
SwCntntFrm *SwTxtFrm::SplitFrm( const sal_Int32 nTxtPos )
{
    SWAP_IF_SWAPPED( this )

@@ -752,7 +752,7 @@ SwCntntFrm *SwTxtFrm::SplitFrm( const xub_StrLen nTxtPos )
    }
#endif

    MoveFlyInCnt( pNew, nTxtPos, STRING_LEN );
    MoveFlyInCnt( pNew, nTxtPos, COMPLETE_STRING );

    // No SetOfst or CalcFollow, because an AdjustFollow follows immediately anyways

@@ -762,7 +762,7 @@ SwCntntFrm *SwTxtFrm::SplitFrm( const xub_StrLen nTxtPos )
    return pNew;
}

void SwTxtFrm::_SetOfst( const xub_StrLen nNewOfst )
void SwTxtFrm::_SetOfst( const sal_Int32 nNewOfst )
{
    // We do not need to invalidate out Follow.
    // We are a Follow, get formatted right away and call
@@ -969,19 +969,19 @@ sal_Bool SwTxtFrm::CalcPreps()
        if( pFrm->GetOfst() < nNew )\
            pFrm->MoveFlyInCnt( this, 0, nNew );\
        else if( pFrm->GetOfst() > nNew )\
            MoveFlyInCnt( pFrm, nNew, STRING_LEN );\
            MoveFlyInCnt( pFrm, nNew, COMPLETE_STRING );\
    }

void SwTxtFrm::FormatAdjust( SwTxtFormatter &rLine,
                             WidowsAndOrphans &rFrmBreak,
                             const xub_StrLen nStrLen,
                             const sal_Int32 nStrLen,
                             const sal_Bool bDummy )
{
    SWAP_IF_NOT_SWAPPED( this )

    SwParaPortion *pPara = rLine.GetInfo().GetParaPortion();

    xub_StrLen nEnd = rLine.GetStart();
    sal_Int32 nEnd = rLine.GetStart();

    sal_Bool bHasToFit = pPara->IsPrepMustFit();

@@ -1037,7 +1037,7 @@ void SwTxtFrm::FormatAdjust( SwTxtFormatter &rLine,
        // If we're done formatting, we set nEnd to the end.
        // AdjustFollow might execute JoinFrm() because of this.
        // Else, nEnd is the end of the last line in the Master.
        xub_StrLen nOld = nEnd;
        sal_Int32 nOld = nEnd;
        nEnd = rLine.GetEnd();
        if( GetFollow() )
        {
@@ -1147,7 +1147,7 @@ sal_Bool SwTxtFrm::FormatLine( SwTxtFormatter &rLine, const sal_Bool bPrev )
            "SwTxtFrm::FormatLine( rLine, bPrev) with unswapped frame" );
    SwParaPortion *pPara = rLine.GetInfo().GetParaPortion();
    const SwLineLayout *pOldCur = rLine.GetCurr();
    const xub_StrLen nOldLen    = pOldCur->GetLen();
    const sal_Int32 nOldLen    = pOldCur->GetLen();
    const KSHORT nOldAscent = pOldCur->GetAscent();
    const KSHORT nOldHeight = pOldCur->Height();
    const SwTwips nOldWidth = pOldCur->Width() + pOldCur->GetHangingMargin();
@@ -1157,7 +1157,7 @@ sal_Bool SwTxtFrm::FormatLine( SwTxtFormatter &rLine, const sal_Bool bPrev )
    if( rLine.GetCurr()->IsClipping() )
        rLine.CalcUnclipped( nOldTop, nOldBottom );

    const xub_StrLen nNewStart = rLine.FormatLine( rLine.GetStart() );
    const sal_Int32 nNewStart = rLine.FormatLine( rLine.GetStart() );

    OSL_ENSURE( Frm().Pos().Y() + Prt().Pos().Y() == rLine.GetFirstPos(),
            "SwTxtFrm::FormatLine: frame leaves orbit." );
@@ -1268,7 +1268,7 @@ sal_Bool SwTxtFrm::FormatLine( SwTxtFormatter &rLine, const sal_Bool bPrev )
        return sal_True;

    // Reached the Reformat's end?
    const xub_StrLen nEnd = pPara->GetReformat()->Start() +
    const sal_Int32 nEnd = pPara->GetReformat()->Start() +
                        pPara->GetReformat()->Len();

    if( nNewStart <= nEnd )
@@ -1287,19 +1287,19 @@ void SwTxtFrm::_Format( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf,

    // That was too complicated for the C30: aString( GetTxt() );
    const OUString &rString = GetTxtNode()->GetTxt();
    const xub_StrLen nStrLen = rString.getLength();
    const sal_Int32 nStrLen = rString.getLength();

    SwCharRange &rReformat = *(pPara->GetReformat());
    SwRepaint   &rRepaint = *(pPara->GetRepaint());
    SwRepaint *pFreeze = NULL;

    // Due to performance reasons we set rReformat to STRING_LEN in Init()
    // Due to performance reasons we set rReformat to COMPLETE_STRING in Init()
    // In this case we adjust rReformat
    if( rReformat.Len() > nStrLen )
        rReformat.Len() = nStrLen;

    // Optimized:
    xub_StrLen nEnd = rReformat.Start() + rReformat.Len();
    sal_Int32 nEnd = rReformat.Start() + rReformat.Len();
    if( nEnd > nStrLen )
    {
        rReformat.Len() = nStrLen - rReformat.Start();
@@ -1347,7 +1347,7 @@ void SwTxtFrm::_Format( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf,
                    rLine.Top(); // So that NumDone doesn't get confused
                break;
            }
        xub_StrLen nNew = rLine.GetStart() + rLine.GetLength();
        sal_Int32 nNew = rLine.GetStart() + rLine.GetLength();
        if( nNew )
        {
            --nNew;
@@ -1761,7 +1761,7 @@ void SwTxtFrm::Format( const SwBorderAttrs * )
        return;
    }

    const xub_StrLen nStrLen = GetTxtNode()->GetTxt().getLength();
    const sal_Int32 nStrLen = GetTxtNode()->GetTxt().getLength();
    if ( nStrLen || !FormatEmpty() )
    {

@@ -1947,8 +1947,8 @@ sal_Bool SwTxtFrm::FormatQuick( bool bForceQuickFormat )
    if( aLine.GetDropFmt() )
        return sal_False;

    xub_StrLen nStart = GetOfst();
    const xub_StrLen nEnd = GetFollow()
    sal_Int32 nStart = GetOfst();
    const sal_Int32 nEnd = GetFollow()
                      ? GetFollow()->GetOfst() : aInf.GetTxt().getLength();
    do
    {
@@ -1966,7 +1966,7 @@ sal_Bool SwTxtFrm::FormatQuick( bool bForceQuickFormat )
    if( !bForceQuickFormat && nNewHeight != nOldHeight && !IsUndersized() )
    {
        // Attention: This situation can occur due to FormatLevel==12. Don't panic!
        const xub_StrLen nStrt = GetOfst();
        const sal_Int32 nStrt = GetOfst();
        _InvalidateRange( SwCharRange( nStrt, nEnd - nStrt) );
        return sal_False;
    }
diff --git a/sw/source/core/text/frminf.cxx b/sw/source/core/text/frminf.cxx
index 3094dbf..704b649 100644
--- a/sw/source/core/text/frminf.cxx
+++ b/sw/source/core/text/frminf.cxx
@@ -25,12 +25,12 @@
 *                   SwTxtMargin::GetTxtStart()
 *************************************************************************/

xub_StrLen SwTxtMargin::GetTxtStart() const
sal_Int32 SwTxtMargin::GetTxtStart() const
{
    const OUString &rTxt = GetInfo().GetTxt();
    const xub_StrLen nTmpPos = nStart;
    const xub_StrLen nEnd = nTmpPos + pCurr->GetLen();
    xub_StrLen i;
    const sal_Int32 nTmpPos = nStart;
    const sal_Int32 nEnd = nTmpPos + pCurr->GetLen();
    sal_Int32 i;

    for( i = nTmpPos; i < nEnd; ++i )
    {
@@ -45,19 +45,19 @@ xub_StrLen SwTxtMargin::GetTxtStart() const
 *                   SwTxtMargin::GetTxtEnd()
 *************************************************************************/

xub_StrLen SwTxtMargin::GetTxtEnd() const
sal_Int32 SwTxtMargin::GetTxtEnd() const
{
    const OUString &rTxt = GetInfo().GetTxt();
    const xub_StrLen nTmpPos = nStart;
    const xub_StrLen nEnd = nTmpPos + pCurr->GetLen();
    const sal_Int32 nTmpPos = nStart;
    const sal_Int32 nEnd = nTmpPos + pCurr->GetLen();
    sal_Int32 i;
    for( i = nEnd - 1; i >= nTmpPos; --i )
    {
        sal_Unicode aChar = rTxt[i];
        if( CH_TAB != aChar && CH_BREAK != aChar && ' ' != aChar )
            return static_cast<xub_StrLen>(i + 1);
            return static_cast<sal_Int32>(i + 1);
    }
    return static_cast<xub_StrLen>(i + 1);
    return static_cast<sal_Int32>(i + 1);
}

/*************************************************************************
@@ -112,7 +112,7 @@ sal_Bool SwTxtFrmInfo::IsFilled( const sal_uInt8 nPercent ) const
// Where does the text start (without whitespace)? (document global)
SwTwips SwTxtFrmInfo::GetLineStart( const SwTxtCursor &rLine ) const
{
    xub_StrLen nTxtStart = rLine.GetTxtStart();
    sal_Int32 nTxtStart = rLine.GetTxtStart();
    SwTwips nStart;
    if( rLine.GetStart() == nTxtStart )
        nStart = rLine.GetLineStart();
@@ -141,7 +141,7 @@ SwTwips SwTxtFrmInfo::GetLineStart() const
}

// Calculates the character's position and returns the middle position
SwTwips SwTxtFrmInfo::GetCharPos( xub_StrLen nChar, sal_Bool bCenter ) const
SwTwips SwTxtFrmInfo::GetCharPos( sal_Int32 nChar, sal_Bool bCenter ) const
{
    SWRECTFN( pFrm )
    SwFrmSwapper aSwapper( pFrm, sal_True );
@@ -182,7 +182,7 @@ SwTwips SwTxtFrmInfo::GetCharPos( xub_StrLen nChar, sal_Bool bCenter ) const
 *************************************************************************/

SwPaM *AddPam( SwPaM *pPam, const SwTxtFrm* pTxtFrm,
                const xub_StrLen nPos, const xub_StrLen nLen )
                const sal_Int32 nPos, const sal_Int32 nLen )
{
    if( nLen )
    {
@@ -218,7 +218,7 @@ void SwTxtFrmInfo::GetSpaces( SwPaM &rPam, sal_Bool bWithLineBreak ) const

        if( aLine.GetCurr()->GetLen() )
        {
            xub_StrLen nPos = aLine.GetTxtStart();
            sal_Int32 nPos = aLine.GetTxtStart();
            // Do NOT include the blanks/tabs from the first line
            // in the selection
            if( !bFirstLine && nPos > aLine.GetStart() )
@@ -251,7 +251,7 @@ void SwTxtFrmInfo::GetSpaces( SwPaM &rPam, sal_Bool bWithLineBreak ) const

// Is there a bullet/symbol etc. at the text position?
// Fonts: CharSet, SYMBOL und DONTKNOW
sal_Bool SwTxtFrmInfo::IsBullet( xub_StrLen nTxtStart ) const
sal_Bool SwTxtFrmInfo::IsBullet( sal_Int32 nTxtStart ) const
{
    SwTxtSizeInfo aInf( (SwTxtFrm*)pFrm );
    SwTxtMargin aLine( (SwTxtFrm*)pFrm, &aInf );
diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx
index 8239d94..04ff05c 100644
--- a/sw/source/core/text/guess.cxx
+++ b/sw/source/core/text/guess.cxx
@@ -150,7 +150,7 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf,
    }

    bool bHyph = rInf.IsHyphenate() && !rInf.IsHyphForbud();
    xub_StrLen nHyphPos = 0;
    sal_Int32 nHyphPos = 0;

    // nCutPos is the first character not fitting to the current line
    // nHyphPos is the first character not fitting to the current line,
@@ -167,7 +167,7 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf,
        nCutPos = rInf.GetTxtBreak( nLineWidth, nMaxLen, nMaxComp );

#if OSL_DEBUG_LEVEL > 1
        if ( STRING_LEN != nCutPos )
        if ( COMPLETE_STRING != nCutPos )
        {
            sal_uInt16 nMinSize;
            rInf.GetTxtSize( &rSI, rInf.GetIdx(), nCutPos - rInf.GetIdx(),
@@ -210,13 +210,13 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf,
        return sal_False;
    }

    xub_StrLen nPorLen = 0;
    sal_Int32 nPorLen = 0;
    // do not call the break iterator nCutPos is a blank
    sal_Unicode cCutChar = rInf.GetTxt()[ nCutPos ];
    if( CH_BLANK == cCutChar || CH_FULL_BLANK == cCutChar )
    {
        nBreakPos = nCutPos;
        xub_StrLen nX = nBreakPos;
        sal_Int32 nX = nBreakPos;

        const SvxAdjust& rAdjust = rInf.GetTxtFrm()->GetTxtNode()->GetSwAttrSet().GetAdjust().GetAdjust();
        if ( rAdjust == SVX_ADJUST_LEFT )
@@ -252,7 +252,7 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf,
        // into our string. If the line break position is inside of before
        // the field portion, we trigger an underflow.

        xub_StrLen nOldIdx = rInf.GetIdx();
        sal_Int32 nOldIdx = rInf.GetIdx();
        sal_Unicode cFldChr = 0;

#if OSL_DEBUG_LEVEL > 0
@@ -313,13 +313,13 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf,
            const CharClass& rCC = GetAppCharClass();

            // step back until a non-punctuation character is reached
            xub_StrLen nLangIndex = nCutPos;
            sal_Int32 nLangIndex = nCutPos;

            // If a field has been expanded right in front of us we do not
            // step further than the beginning of the expanded field
            // (which is the position of the field placeholder in our
            // original string).
            const xub_StrLen nDoNotStepOver = CH_TXTATR_BREAKWORD == cFldChr ?
            const sal_Int32 nDoNotStepOver = CH_TXTATR_BREAKWORD == cFldChr ?
                                              rInf.GetIdx() - nFieldDiff - 1:
                                              0;

@@ -371,7 +371,7 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf,
            rInf.GetTxt(), nCutPos, aLocale,
            rInf.GetLineStart(), aHyphOpt, aUserOpt );

        nBreakPos = (xub_StrLen)aResult.breakIndex;
        nBreakPos = aResult.breakIndex;

        // if we are formatting multi portions we want to allow line breaks
        // at the border between single line and multi line portion
@@ -385,7 +385,7 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf,

        bHyph = BreakType::HYPHENATION == aResult.breakType;

        if ( bHyph && nBreakPos != STRING_LEN)
        if ( bHyph && nBreakPos != COMPLETE_STRING )
        {
            // found hyphenation position within line
            // nBreakPos is set to the hyphenation position
@@ -426,7 +426,7 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf,
        }
        else if ( !bHyph && nBreakPos >= rInf.GetLineStart() )
        {
            OSL_ENSURE( nBreakPos != STRING_LEN, "we should have found a break pos" );
            OSL_ENSURE( nBreakPos != COMPLETE_STRING, "we should have found a break pos" );

            // found break position within line
            xHyphWord = NULL;
@@ -444,7 +444,7 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf,
                // If a field has been expanded, we do not want to delete any
                // blanks inside the field portion. This would cause an unwanted
                // underflow
                xub_StrLen nX = nBreakPos;
                sal_Int32 nX = nBreakPos;
                while( nX > rInf.GetLineStart() &&
                       ( CH_TXTATR_BREAKWORD != cFldChr || nX > rInf.GetIdx() ) &&
                       ( CH_BLANK == rInf.GetChar( --nX ) ||
@@ -456,16 +456,16 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf,
        }
        else
        {
            // no line break found, setting nBreakPos to STRING_LEN
            // no line break found, setting nBreakPos to COMPLETE_STRING
            // causes a break cut
            nBreakPos = STRING_LEN;
            nBreakPos = COMPLETE_STRING;
            OSL_ENSURE( nCutPos >= rInf.GetIdx(), "Deep cut" );
            nPorLen = nCutPos - rInf.GetIdx();
        }

        if( nBreakPos > nCutPos && nBreakPos != STRING_LEN )
        if( nBreakPos > nCutPos && nBreakPos != COMPLETE_STRING )
        {
            const xub_StrLen nHangingLen = nBreakPos - nCutPos;
            const sal_Int32 nHangingLen = nBreakPos - nCutPos;
            SwPosSize aTmpSize = rInf.GetTxtSize( &rSI, nCutPos,
                                                  nHangingLen, 0 );
            aTmpSize.Width(aTmpSize.Width() + nLeftRightBorderSpace);
@@ -484,7 +484,7 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf,
        {
            if ( nBreakPos < rInf.GetIdx() )
                nBreakPos = nOldIdx - 1;
            else if ( STRING_LEN != nBreakPos )
            else if ( COMPLETE_STRING != nBreakPos )
            {
                OSL_ENSURE( nBreakPos >= nFieldDiff, "I've got field trouble!" );
                nBreakPos = nBreakPos - nFieldDiff;
@@ -534,14 +534,14 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf,
// if hyphenated at this position (old german spelling)

bool SwTxtGuess::AlternativeSpelling( const SwTxtFormatInfo &rInf,
    const xub_StrLen nPos )
    const sal_Int32 nPos )
{
    // get word boundaries
    Boundary aBound =
        g_pBreakIt->GetBreakIter()->getWordBoundary( rInf.GetTxt(), nPos,
        g_pBreakIt->GetLocale( rInf.GetFont()->GetLanguage() ),
        WordType::DICTIONARY_WORD, sal_True );
    nBreakStart = (xub_StrLen)aBound.startPos;
    nBreakStart = aBound.startPos;
    sal_Int32 nWordLen = aBound.endPos - nBreakStart;

    // if everything else fails, we want to cut at nPos
diff --git a/sw/source/core/text/guess.hxx b/sw/source/core/text/guess.hxx
index 48fe7f9..17b8480 100644
--- a/sw/source/core/text/guess.hxx
+++ b/sw/source/core/text/guess.hxx
@@ -34,10 +34,10 @@ class SwTxtGuess
{
    ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XHyphenatedWord >  xHyphWord;
    SwHangingPortion *pHanging; // for hanging punctuation
    xub_StrLen nCutPos;         // this character doesn't fit
    xub_StrLen nBreakStart;     // start index of word containing line break
    xub_StrLen nBreakPos;       // start index of break position
    xub_StrLen nFieldDiff;      // absolut positions can be wrong if we
    sal_Int32 nCutPos;         // this character doesn't fit
    sal_Int32 nBreakStart;     // start index of word containing line break
    sal_Int32 nBreakPos;       // start index of break position
    sal_Int32 nFieldDiff;      // absolut positions can be wrong if we
                                // a field in the text has been expanded
    KSHORT nBreakWidth;         // width of the broken portion
public:
@@ -49,15 +49,15 @@ public:
    // true, if current portion still fits to current line
    sal_Bool Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf,
                    const KSHORT nHeight );
    bool AlternativeSpelling( const SwTxtFormatInfo &rInf, const xub_StrLen nPos );
    bool AlternativeSpelling( const SwTxtFormatInfo &rInf, const sal_Int32 nPos );

    inline SwHangingPortion* GetHangingPortion() const { return pHanging; }
    inline void ClearHangingPortion() { pHanging = NULL; }
    inline KSHORT BreakWidth() const { return nBreakWidth; }
    inline xub_StrLen CutPos() const { return nCutPos; }
    inline xub_StrLen BreakStart() const { return nBreakStart; }
    inline xub_StrLen BreakPos() const {return nBreakPos; }
    inline xub_StrLen FieldDiff() const {return nFieldDiff; }
    inline sal_Int32 CutPos() const { return nCutPos; }
    inline sal_Int32 BreakStart() const { return nBreakStart; }
    inline sal_Int32 BreakPos() const {return nBreakPos; }
    inline sal_Int32 FieldDiff() const {return nFieldDiff; }
    inline ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XHyphenatedWord > HyphWord() const
        { return xHyphWord; }
};
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 599a09f..d362cff 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -226,7 +226,7 @@ SwTxtSizeInfo::SwTxtSizeInfo( const SwTxtSizeInfo &rNew )
}

void SwTxtSizeInfo::CtorInitTxtSizeInfo( SwTxtFrm *pFrame, SwFont *pNewFnt,
                   const xub_StrLen nNewIdx, const xub_StrLen nNewLen )
                   const sal_Int32 nNewIdx, const sal_Int32 nNewLen )
{
    m_pKanaComp = NULL;
    m_nKanaIdx = 0;
@@ -303,7 +303,7 @@ void SwTxtSizeInfo::CtorInitTxtSizeInfo( SwTxtFrm *pFrame, SwFont *pNewFnt,
}

SwTxtSizeInfo::SwTxtSizeInfo( const SwTxtSizeInfo &rNew, const OUString* pTxt,
                              const sal_Int32 nIndex, const xub_StrLen nLength )
                              const sal_Int32 nIndex, const sal_Int32 nLength )
    : SwTxtInfo( rNew ),
      m_pKanaComp(((SwTxtSizeInfo&)rNew).GetpKanaComp()),
      m_pVsh(((SwTxtSizeInfo&)rNew).GetVsh()),
@@ -359,8 +359,8 @@ void SwTxtSizeInfo::NoteAnimation() const
SwPosSize SwTxtSizeInfo::GetTxtSize( OutputDevice* pOutDev,
                                     const SwScriptInfo* pSI,
                                     const OUString& rTxt,
                                     const xub_StrLen nIndex,
                                     const xub_StrLen nLength,
                                     const sal_Int32 nIndex,
                                     const sal_Int32 nLength,
                                     const sal_uInt16 nComp ) const
{
    SwDrawTextInfo aDrawInf( m_pVsh, *pOutDev, pSI, rTxt, nIndex, nLength );
@@ -392,8 +392,8 @@ SwPosSize SwTxtSizeInfo::GetTxtSize() const
    return m_pFnt->_GetTxtSize( aDrawInf );
}

void SwTxtSizeInfo::GetTxtSize( const SwScriptInfo* pSI, const xub_StrLen nIndex,
                                const xub_StrLen nLength, const sal_uInt16 nComp,
void SwTxtSizeInfo::GetTxtSize( const SwScriptInfo* pSI, const sal_Int32 nIndex,
                                const sal_Int32 nLength, const sal_uInt16 nComp,
                                sal_uInt16& nMinSize, sal_uInt16& nMaxSizeDiff ) const
{
    SwDrawTextInfo aDrawInf( m_pVsh, *m_pOut, pSI, *m_pTxt, nIndex, nLength );
@@ -406,8 +406,8 @@ void SwTxtSizeInfo::GetTxtSize( const SwScriptInfo* pSI, const xub_StrLen nIndex
    nMinSize = aSize.Width();
}

xub_StrLen SwTxtSizeInfo::GetTxtBreak( const long nLineWidth,
                                       const xub_StrLen nMaxLen,
sal_Int32 SwTxtSizeInfo::GetTxtBreak( const long nLineWidth,
                                       const sal_Int32 nMaxLen,
                                       const sal_uInt16 nComp ) const
{
    const SwScriptInfo& rScriptInfo =
@@ -425,10 +425,10 @@ xub_StrLen SwTxtSizeInfo::GetTxtBreak( const long nLineWidth,
    return m_pFnt->GetTxtBreak( aDrawInf, nLineWidth );
}

xub_StrLen SwTxtSizeInfo::GetTxtBreak( const long nLineWidth,
                                       const xub_StrLen nMaxLen,
sal_Int32 SwTxtSizeInfo::GetTxtBreak( const long nLineWidth,
                                       const sal_Int32 nMaxLen,
                                       const sal_uInt16 nComp,
                                       xub_StrLen& rExtraCharPos ) const
                                       sal_Int32& rExtraCharPos ) const
{
    const SwScriptInfo& rScriptInfo =
                     ( (SwParaPortion*)GetParaPortion() )->GetScriptInfo();
@@ -536,7 +536,7 @@ static sal_Bool lcl_IsDarkBackground( const SwTxtPaintInfo& rInf )
 *************************************************************************/

void SwTxtPaintInfo::_DrawText( const OUString &rText, const SwLinePortion &rPor,
                                const xub_StrLen nStart, const xub_StrLen nLength,
                                const sal_Int32 nStart, const sal_Int32 nLength,
                                const sal_Bool bKern, const sal_Bool bWrong,
                                const sal_Bool bSmartTag,
                                const sal_Bool bGrammarCheck )  // SMARTTAGS
@@ -1314,7 +1314,7 @@ sal_Bool SwTxtFormatInfo::InitHyph( const sal_Bool bAutoHyphen )
    sal_Bool bAuto = bAutoHyphen || rAttr.IsHyphen();
    if( bAuto || bInterHyph )
    {
        nHyphStart = nHyphWrdStart = STRING_LEN;
        nHyphStart = nHyphWrdStart = COMPLETE_STRING;
        nHyphWrdLen = 0;

        const sal_Int16 nMinimalLeading  = std::max(rAttr.GetMinLead(), sal_uInt8(2));
@@ -1425,7 +1425,7 @@ void SwTxtFormatInfo::Init()
    nWidth = nRealWidth;
    nForcedLeftMargin = 0;
    nSoftHyphPos = 0;
    nUnderScorePos = STRING_LEN;
    nUnderScorePos = COMPLETE_STRING;
    cHookChar = 0;
    SetIdx(0);
    SetLen( GetTxt().getLength() );
@@ -1454,7 +1454,7 @@ SwTxtFormatInfo::SwTxtFormatInfo( const SwTxtFormatInfo& rInf,
    pLastTab = NULL;

    nSoftHyphPos = 0;
    nUnderScorePos = STRING_LEN;
    nUnderScorePos = COMPLETE_STRING;
    nHyphStart = 0;
    nHyphWrdStart = 0;
    nHyphWrdLen = 0;
@@ -1515,11 +1515,11 @@ sal_Bool SwTxtFormatInfo::_CheckFtnPortion( SwLineLayout* pCurr )
    return bRet;
}

xub_StrLen SwTxtFormatInfo::ScanPortionEnd( const xub_StrLen nStart,
                                            const xub_StrLen nEnd )
sal_Int32 SwTxtFormatInfo::ScanPortionEnd( const sal_Int32 nStart,
                                            const sal_Int32 nEnd )
{
    cHookChar = 0;
    xub_StrLen i = nStart;
    sal_Int32 i = nStart;

    //
    // Used for decimal tab handling:
@@ -1554,7 +1554,7 @@ xub_StrLen SwTxtFormatInfo::ScanPortionEnd( const xub_StrLen nStart,
            return i;

        case CHAR_UNDERSCORE:
            if ( STRING_LEN == nUnderScorePos )
            if ( COMPLETE_STRING == nUnderScorePos )
                nUnderScorePos = i;
            break;

@@ -1772,7 +1772,7 @@ SwFontSave::~SwFontSave()
        if( pIter )
        {
            pIter->SetFnt( pFnt );
            pIter->nPos = STRING_LEN;
            pIter->nPos = COMPLETE_STRING;
        }
    }
}
diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx
index c429690..222cb04 100644
--- a/sw/source/core/text/inftxt.hxx
+++ b/sw/source/core/text/inftxt.hxx
@@ -131,7 +131,7 @@ class SwTxtInfo
    // Implementation in txthyph.cxx
    friend void SetParaPortion( SwTxtInfo *pInf, SwParaPortion *pRoot );
    SwParaPortion *pPara;
    xub_StrLen nTxtStart;                 // TxtOfst for Follows
    sal_Int32 nTxtStart;                 // TxtOfst for Follows

protected:
    inline SwTxtInfo() : pPara(0) {}
@@ -141,7 +141,7 @@ public:
    inline SwTxtInfo( SwTxtFrm *pFrm ) { CtorInitTxtInfo( pFrm ); }
    inline SwParaPortion *GetParaPortion() { return pPara; }
    inline const SwParaPortion *GetParaPortion() const { return pPara; }
    inline xub_StrLen GetTxtStart() const { return nTxtStart; }
    inline sal_Int32 GetTxtStart() const { return nTxtStart; }

    friend SvStream &operator<<( SvStream &rOS, const SwTxtInfo &rInf );
};
@@ -196,18 +196,18 @@ protected:

protected:
    void CtorInitTxtSizeInfo( SwTxtFrm *pFrm, SwFont *pFnt = 0,
                   const xub_StrLen nIdx = 0,
                   const xub_StrLen nLen = STRING_LEN );
                   const sal_Int32 nIdx = 0,
                   const sal_Int32 nLen = COMPLETE_STRING );
    SwTxtSizeInfo() : m_pKanaComp(0), m_pVsh(0), m_pOut(0), m_pRef(0), m_pFnt(0), m_pUnderFnt(0), m_pFrm(0), m_pOpt(0), m_pTxt(0) {}
public:
    SwTxtSizeInfo( const SwTxtSizeInfo &rInf );
    SwTxtSizeInfo( const SwTxtSizeInfo &rInf, const OUString* pTxt,
                   const sal_Int32 nIdx = 0,
                   const xub_StrLen nLen = STRING_LEN );
                   const sal_Int32 nLen = COMPLETE_STRING );

    SwTxtSizeInfo( SwTxtFrm *pTxtFrm, SwFont *pTxtFnt = 0,
                   const sal_Int32 nIndex = 0,
                   const xub_StrLen nLength = STRING_LEN )
                   const sal_Int32 nLength = COMPLETE_STRING )
        : m_bOnWin(false)
    {
        CtorInitTxtSizeInfo( pTxtFrm, pTxtFnt, nIndex, nLength );
@@ -216,7 +216,7 @@ public:
    // GetMultiAttr returns the text attribute of the multiportion,
    // if rPos is inside any multi-line part.
    // rPos will set to the end of the multi-line part.
    SwMultiCreator* GetMultiCreator( xub_StrLen &rPos, SwMultiPortion* pM ) const;
    SwMultiCreator* GetMultiCreator( sal_Int32 &rPos, SwMultiPortion* pM ) const;

    inline bool OnWin() const { return m_bOnWin; }
    inline void SetOnWin( const bool bNew ) { m_bOnWin = bNew; }
@@ -276,26 +276,26 @@ public:
    // GetTxtSize
    //
    SwPosSize GetTxtSize( OutputDevice* pOut, const SwScriptInfo* pSI,
                          const OUString& rTxt, const xub_StrLen nIdx,
                          const xub_StrLen nLen, const sal_uInt16 nComp ) const;
                          const OUString& rTxt, const sal_Int32 nIdx,
                          const sal_Int32 nLen, const sal_uInt16 nComp ) const;
    SwPosSize GetTxtSize() const;
    void GetTxtSize( const SwScriptInfo* pSI, const xub_StrLen nIdx,
                      const xub_StrLen nLen, const sal_uInt16 nComp,
    void GetTxtSize( const SwScriptInfo* pSI, const sal_Int32 nIdx,
                      const sal_Int32 nLen, const sal_uInt16 nComp,
                      sal_uInt16& nMinSize, sal_uInt16& nMaxSizeDiff ) const;
    inline SwPosSize GetTxtSize( const SwScriptInfo* pSI, const xub_StrLen nIdx,
                                 const xub_StrLen nLen, const sal_uInt16 nComp ) const;
    inline SwPosSize GetTxtSize( const SwScriptInfo* pSI, const sal_Int32 nIdx,
                                 const sal_Int32 nLen, const sal_uInt16 nComp ) const;
    inline SwPosSize GetTxtSize( const OUString &rTxt ) const;

    //
    // GetTxtBreak
    //
    xub_StrLen GetTxtBreak( const long nLineWidth,
                                           const xub_StrLen nMaxLen,
    sal_Int32 GetTxtBreak( const long nLineWidth,
                                           const sal_Int32 nMaxLen,
                                           const sal_uInt16 nComp ) const;
    xub_StrLen GetTxtBreak( const long nLineWidth,
                                           const xub_StrLen nMaxLen,
    sal_Int32 GetTxtBreak( const long nLineWidth,
                                           const sal_Int32 nMaxLen,
                                           const sal_uInt16 nComp,
                                           xub_StrLen& rExtraCharPos ) const;
                                           sal_Int32& rExtraCharPos ) const;

    KSHORT GetAscent() const;

@@ -317,9 +317,9 @@ public:
    inline SwTxtFrm *GetTxtFrm() { return m_pFrm; }
    inline const SwTxtFrm *GetTxtFrm() const { return m_pFrm; }

    inline sal_Bool HasHint( xub_StrLen nPos ) const
    inline sal_Bool HasHint( sal_Int32 nPos ) const
        { return _HasHint( m_pFrm->GetTxtNode(), nPos ); }
    static sal_Bool _HasHint( const SwTxtNode* pTxtNode, xub_StrLen nPos );
    static sal_Bool _HasHint( const SwTxtNode* pTxtNode, sal_Int32 nPos );

    // If Kana Compression is enabled, a minimum and maximum portion width
    // is calculated. We format lines with minimal size and share remaining
@@ -384,7 +384,7 @@ class SwTxtPaintInfo : public SwTxtSizeInfo

    MSHORT nSpaceIdx;
    void _DrawText( const OUString &rText, const SwLinePortion &rPor,
                   const xub_StrLen nIdx, const xub_StrLen nLen,
                   const sal_Int32 nIdx, const sal_Int32 nLen,
                   const sal_Bool bKern, const sal_Bool bWrong = sal_False,
                   const sal_Bool bSmartTag = sal_False,
                   const sal_Bool bGrammarCheck = sal_False );  // SMARTTAGS
@@ -422,12 +422,12 @@ public:
    inline SwTxtFly *GetTxtFly() { return &aTxtFly; }
    inline const SwTxtFly *GetTxtFly() const { return &aTxtFly; }
    inline void DrawText( const OUString &rText, const SwLinePortion &rPor,
                          const xub_StrLen nIdx = 0,
                          const xub_StrLen nLen = STRING_LEN,
                          const sal_Int32 nIdx = 0,
                          const sal_Int32 nLen = COMPLETE_STRING,
                          const sal_Bool bKern = sal_False) const;
    inline void DrawText( const SwLinePortion &rPor, const xub_StrLen nLen,
    inline void DrawText( const SwLinePortion &rPor, const sal_Int32 nLen,
                          const sal_Bool bKern = sal_False ) const;
    inline void DrawMarkedText( const SwLinePortion &rPor, const xub_StrLen nLen,
    inline void DrawMarkedText( const SwLinePortion &rPor, const sal_Int32 nLen,
                                const sal_Bool bKern,
                                const sal_Bool bWrong,
                                const sal_Bool bSmartTags,
@@ -521,12 +521,12 @@ class SwTxtFormatInfo : public SwTxtPaintInfo

    SwTabPortion    *pLastTab;     // The _last_ TabPortion

    xub_StrLen nSoftHyphPos;    // SoftHyphPos forr Hyphenation
    xub_StrLen nHyphStart;      // TxtPos at which the interactive hyphen is at the moment
    xub_StrLen nHyphWrdStart;   // Position of the found word
    xub_StrLen nHyphWrdLen;     // Length of the found word
    xub_StrLen nLineStart;      // Current line start in rTxt
    xub_StrLen nUnderScorePos;  // enlarge repaint if underscore has been found
    sal_Int32 nSoftHyphPos;    // SoftHyphPos forr Hyphenation
    sal_Int32 nHyphStart;      // TxtPos at which the interactive hyphen is at the moment
    sal_Int32 nHyphWrdStart;   // Position of the found word
    sal_Int32 nHyphWrdLen;     // Length of the found word
    sal_Int32 nLineStart;      // Current line start in rTxt
    sal_Int32 nUnderScorePos;  // enlarge repaint if underscore has been found
    // #i34348# Changed type from sal_uInt16 to SwTwips
    SwTwips nLeft;              // Left margin
    SwTwips nRight;             // Right margin
@@ -588,7 +588,7 @@ public:
           void Init();

    // Returns the first changed position of the paragraph
    inline xub_StrLen GetReformatStart() const;
    inline sal_Int32 GetReformatStart() const;

    // Margins
    inline SwTwips Left() const { return nLeft; }
@@ -642,8 +642,8 @@ public:
    inline sal_Bool IsQuick() const { return bQuick; }
    inline sal_Bool IsTest() const { return bTestFormat; }

    inline xub_StrLen GetLineStart() const { return nLineStart; }
    inline void SetLineStart( const xub_StrLen nNew ) { nLineStart = nNew; }
    inline sal_Int32 GetLineStart() const { return nLineStart; }
    inline void SetLineStart( const sal_Int32 nNew ) { nLineStart = nNew; }

    // these are used during fly calculation
    inline KSHORT GetLineHeight() const { return nLineHeight; }
@@ -655,8 +655,8 @@ public:
    inline SwLinePortion *GetUnderFlow() { return pUnderFlow; }
    inline void SetUnderFlow( SwLinePortion *pNew )
           { pUnderFlow = pNew; bUnderFlow = sal_True; }
    inline xub_StrLen GetSoftHyphPos() const { return nSoftHyphPos; }
    inline void SetSoftHyphPos( const xub_StrLen nNew ) { nSoftHyphPos = nNew; }
    inline sal_Int32 GetSoftHyphPos() const { return nSoftHyphPos; }
    inline void SetSoftHyphPos( const sal_Int32 nNew ) { nSoftHyphPos = nNew; }

    inline void SetParaFtn();

@@ -691,19 +691,19 @@ public:
    inline void SetArrowDone( const sal_Bool bNew ) { bArrowDone = bNew; }

    // For SwTxtPortion::Hyphenate
    inline sal_Bool IsSoftHyph( const xub_StrLen nPos ) const;
    inline sal_Bool IsSoftHyph( const sal_Int32 nPos ) const;
    sal_Bool ChgHyph( const sal_Bool bNew );

    // Should the hyphenate helper be discarded?
    sal_Bool IsHyphenate() const;
    inline void SetHyphStart( const xub_StrLen nNew ) { nHyphStart = nNew; }
    inline xub_StrLen GetHyphStart() const { return nHyphStart; }
    inline void SetHyphWrdStart( const xub_StrLen nNew ) { nHyphWrdStart = nNew; }
    inline xub_StrLen GetHyphWrdStart() const { return nHyphWrdStart; }
    inline void SetHyphWrdLen( const xub_StrLen nNew ) { nHyphWrdLen = nNew; }
    inline xub_StrLen GetHyphWrdLen() const { return nHyphWrdLen; }
    inline xub_StrLen GetUnderScorePos() const { return nUnderScorePos; }
    inline void SetUnderScorePos( xub_StrLen nNew ) { nUnderScorePos = nNew; }
    inline void SetHyphStart( const sal_Int32 nNew ) { nHyphStart = nNew; }
    inline sal_Int32 GetHyphStart() const { return nHyphStart; }
    inline void SetHyphWrdStart( const sal_Int32 nNew ) { nHyphWrdStart = nNew; }
    inline sal_Int32 GetHyphWrdStart() const { return nHyphWrdStart; }
    inline void SetHyphWrdLen( const sal_Int32 nNew ) { nHyphWrdLen = nNew; }
    inline sal_Int32 GetHyphWrdLen() const { return nHyphWrdLen; }
    inline sal_Int32 GetUnderScorePos() const { return nUnderScorePos; }
    inline void SetUnderScorePos( sal_Int32 nNew ) { nUnderScorePos = nNew; }

    // Calls HyphenateWord() of Hyphenator
    ::com::sun::star::uno::Reference<
@@ -726,7 +726,7 @@ public:

    // Looks for tabs, TabDec, TXTATR and BRK from nIdx until nEnd.
    // Return: Position; sets cHookChar if necessary
    xub_StrLen ScanPortionEnd( const xub_StrLen nStart, const xub_StrLen nEnd );
    sal_Int32 ScanPortionEnd( const sal_Int32 nStart, const sal_Int32 nEnd );

    friend SvStream &operator<<( SvStream &rOS, const SwTxtFormatInfo &rInf );

@@ -815,8 +815,8 @@ inline SwPosSize SwTxtSizeInfo::GetTxtSize( const OUString &rTxt ) const
}

inline SwPosSize SwTxtSizeInfo::GetTxtSize( const SwScriptInfo* pSI,
                                            const xub_StrLen nNewIdx,
                                            const xub_StrLen nNewLen,
                                            const sal_Int32 nNewIdx,
                                            const sal_Int32 nNewLen,
                                            const sal_uInt16 nCompress ) const
{
    return GetTxtSize( m_pOut, pSI, *m_pTxt, nNewIdx, nNewLen, nCompress );
@@ -839,20 +839,20 @@ inline void SwTxtPaintInfo::SetPaintOfst( const SwTwips nNew )

inline void SwTxtPaintInfo::DrawText( const OUString &rText,
                            const SwLinePortion &rPor,
                            const xub_StrLen nStart, const xub_StrLen nLength,
                            const sal_Int32 nStart, const sal_Int32 nLength,
                            const sal_Bool bKern ) const
{
    ((SwTxtPaintInfo*)this)->_DrawText( rText, rPor, nStart, nLength, bKern );
}

inline void SwTxtPaintInfo::DrawText( const SwLinePortion &rPor,
        const xub_StrLen nLength, const sal_Bool bKern ) const
        const sal_Int32 nLength, const sal_Bool bKern ) const
{
    ((SwTxtPaintInfo*)this)->_DrawText( *m_pTxt, rPor, m_nIdx, nLength, bKern );
}

inline void SwTxtPaintInfo::DrawMarkedText( const SwLinePortion &rPor,
                                            const xub_StrLen nLength,
                                            const sal_Int32 nLength,
                                            const sal_Bool bKern,
                                            const sal_Bool bWrong,
                                            const sal_Bool bSmartTags,
@@ -865,7 +865,7 @@ inline void SwTxtPaintInfo::DrawMarkedText( const SwLinePortion &rPor,
 * Inline implementations of SwTxtFormatInfo
 *************************************************************************/

inline xub_StrLen SwTxtFormatInfo::GetReformatStart() const
inline sal_Int32 SwTxtFormatInfo::GetReformatStart() const
{
    return GetParaPortion()->GetReformat()->Start();
}
@@ -880,13 +880,11 @@ inline void SwTxtFormatInfo::SetParaFtn()
    GetTxtFrm()->SetFtn( sal_True );
}

inline sal_Bool SwTxtFormatInfo::IsSoftHyph( const xub_StrLen nPos ) const
inline sal_Bool SwTxtFormatInfo::IsSoftHyph( const sal_Int32 nPos ) const
{
    return CHAR_SOFTHYPHEN == GetTxtFrm()->GetTxtNode()->GetTxt()[nPos];
}



#endif

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/text/itradj.cxx b/sw/source/core/text/itradj.cxx
index 7c9fb85..b81064a 100644
--- a/sw/source/core/text/itradj.cxx
+++ b/sw/source/core/text/itradj.cxx
@@ -106,7 +106,7 @@ void SwTxtAdjuster::FormatBlock( )
        }
    }

    const xub_StrLen nOldIdx = GetInfo().GetIdx();
    const sal_Int32 nOldIdx = GetInfo().GetIdx();
    GetInfo().SetIdx( nStart );
    CalcNewBlock( pCurr, pFly );
    GetInfo().SetIdx( nOldIdx );
@@ -117,11 +117,11 @@ void SwTxtAdjuster::FormatBlock( )
 * lcl_CheckKashidaPositions()
 *************************************************************************/
static bool lcl_CheckKashidaPositions( SwScriptInfo& rSI, SwTxtSizeInfo& rInf, SwTxtIter& rItr,
                                sal_Int32& rKashidas, xub_StrLen& nGluePortion )
                                sal_Int32& rKashidas, sal_Int32& nGluePortion )
{
    // i60594 validate Kashida justification
    xub_StrLen nIdx = rItr.GetStart();
    xub_StrLen nEnd = rItr.GetEnd();
    sal_Int32 nIdx = rItr.GetStart();
    sal_Int32 nEnd = rItr.GetEnd();

    // Note on calling KashidaJustify():
    // Kashida positions may be marked as invalid. Therefore KashidaJustify may return the clean
@@ -142,15 +142,15 @@ static bool lcl_CheckKashidaPositions( SwScriptInfo& rSI, SwTxtSizeInfo& rInf, S
    while ( rKashidas && nIdx < nEnd )
    {
        rItr.SeekAndChgAttrIter( nIdx, rInf.GetOut() );
        xub_StrLen nNext = rItr.GetNextAttr();
        sal_Int32 nNext = rItr.GetNextAttr();

        // is there also a script change before?
        // if there is, nNext should point to the script change
        xub_StrLen nNextScript = rSI.NextScriptChg( nIdx );
        sal_Int32 nNextScript = rSI.NextScriptChg( nIdx );
        if( nNextScript < nNext )
            nNext = nNextScript;

        if ( nNext == STRING_LEN || nNext > nEnd )
        if ( nNext == COMPLETE_STRING || nNext > nEnd )
            nNext = nEnd;
        sal_Int32 nKashidasInAttr = rSI.KashidaJustify ( 0, 0, nIdx, nNext - nIdx );
        if (nKashidasInAttr > 0)
@@ -199,7 +199,7 @@ static bool lcl_CheckKashidaPositions( SwScriptInfo& rSI, SwTxtSizeInfo& rInf, S
 * lcl_CheckKashidaWidth()
 *************************************************************************/
static bool lcl_CheckKashidaWidth ( SwScriptInfo& rSI, SwTxtSizeInfo& rInf, SwTxtIter& rItr, sal_Int32& rKashidas,
                             xub_StrLen& nGluePortion, const long nGluePortionWidth, long& nSpaceAdd )
                             sal_Int32& nGluePortion, const long nGluePortionWidth, long& nSpaceAdd )
{
    // check kashida width
    // if width is smaller than minimal kashida width allowed by fonts in the current line
@@ -208,20 +208,20 @@ static bool lcl_CheckKashidaWidth ( SwScriptInfo& rSI, SwTxtSizeInfo& rInf, SwTx
    while (rKashidas)
    {
        bAddSpaceChanged = false;
        xub_StrLen nIdx = rItr.GetStart();
        xub_StrLen nEnd = rItr.GetEnd();
        sal_Int32 nIdx = rItr.GetStart();
        sal_Int32 nEnd = rItr.GetEnd();
        while ( nIdx < nEnd )
        {
            rItr.SeekAndChgAttrIter( nIdx, rInf.GetOut() );
            xub_StrLen nNext = rItr.GetNextAttr();
            sal_Int32 nNext = rItr.GetNextAttr();

            // is there also a script change before?
            // if there is, nNext should point to the script change
            xub_StrLen nNextScript = rSI.NextScriptChg( nIdx );
            sal_Int32 nNextScript = rSI.NextScriptChg( nIdx );
            if( nNextScript < nNext )
               nNext = nNextScript;

            if ( nNext == STRING_LEN || nNext > nEnd )
            if ( nNext == COMPLETE_STRING || nNext > nEnd )
                nNext = nEnd;
            sal_Int32 nKashidasInAttr = rSI.KashidaJustify ( 0, 0, nIdx, nNext - nIdx );

@@ -271,7 +271,7 @@ void SwTxtAdjuster::CalcNewBlock( SwLineLayout *pCurrent,
    OSL_ENSURE( pCurrent->Height(), "SwTxtAdjuster::CalcBlockAdjust: missing CalcLine()" );

    pCurrent->InitSpaceAdd();
    xub_StrLen nGluePortion = 0;
    sal_Int32 nGluePortion = 0;
    sal_Int32 nCharCnt = 0;
    MSHORT nSpaceIdx = 0;

@@ -627,7 +627,7 @@ void SwTxtAdjuster::CalcFlyAdjust( SwLineLayout *pCurrent )
    CalcRightMargin( pCurrent );

    SwLinePortion *pPos = pLeft->GetPortion();
    xub_StrLen nLen = 0;
    sal_Int32 nLen = 0;

    // If we only have one line, the text portion is consecutive and we center, then ...
    sal_Bool bComplete = 0 == nStart;
diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index 1da43a0..739c882 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -111,7 +111,7 @@ SwAttrIter::~SwAttrIter()
 * GetAttr() das entartete Attribut.
 *************************************************************************/

SwTxtAttr *SwAttrIter::GetAttr( const xub_StrLen nPosition ) const
SwTxtAttr *SwAttrIter::GetAttr( const sal_Int32 nPosition ) const
{
    return (m_pTxtNode) ? m_pTxtNode->GetTxtAttrForCharAt(nPosition) : 0;
}
@@ -120,7 +120,7 @@ SwTxtAttr *SwAttrIter::GetAttr( const xub_StrLen nPosition ) const
 *                        SwAttrIter::SeekAndChg()
 *************************************************************************/

sal_Bool SwAttrIter::SeekAndChgAttrIter( const xub_StrLen nNewPos, OutputDevice* pOut )
sal_Bool SwAttrIter::SeekAndChgAttrIter( const sal_Int32 nNewPos, OutputDevice* pOut )
{
    sal_Bool bChg = nStartIndex && nNewPos == nPos ? pFnt->IsFntChg() : Seek( nNewPos );
    if ( pLastOut != pOut )
@@ -142,7 +142,7 @@ sal_Bool SwAttrIter::SeekAndChgAttrIter( const xub_StrLen nNewPos, OutputDevice*
    return bChg;
}

sal_Bool SwAttrIter::IsSymbol( const xub_StrLen nNewPos )
sal_Bool SwAttrIter::IsSymbol( const sal_Int32 nNewPos )
{
    Seek( nNewPos );
    if ( !nChgCnt && !nPropFont )
@@ -171,7 +171,7 @@ sal_Bool SwAttrIter::SeekStartAndChgAttrIter( OutputDevice* pOut, const sal_Bool
    {
        pRedln->Clear( pFnt );
        if( !bParaFont )
            nChgCnt = nChgCnt + pRedln->Seek( *pFnt, 0, STRING_LEN );
            nChgCnt = nChgCnt + pRedln->Seek( *pFnt, 0, MSHRT_MAX );
        else
            pRedln->Reset();
    }
@@ -215,7 +215,7 @@ sal_Bool SwAttrIter::SeekStartAndChgAttrIter( OutputDevice* pOut, const sal_Bool

// AMA: Neuer AttrIter Nov 94

void SwAttrIter::SeekFwd( const xub_StrLen nNewPos )
void SwAttrIter::SeekFwd( const sal_Int32 nNewPos )
{
    SwTxtAttr *pTxtAttr;

@@ -259,7 +259,7 @@ void SwAttrIter::SeekFwd( const xub_StrLen nNewPos )
 *                       SwAttrIter::Seek()
 *************************************************************************/

sal_Bool SwAttrIter::Seek( const xub_StrLen nNewPos )
sal_Bool SwAttrIter::Seek( const sal_Int32 nNewPos )
{
    if ( pRedln && pRedln->ExtOn() )
        pRedln->LeaveExtend( *pFnt, nNewPos );
@@ -308,9 +308,9 @@ sal_Bool SwAttrIter::Seek( const xub_StrLen nNewPos )
 *                      SwAttrIter::GetNextAttr()
 *************************************************************************/

xub_StrLen SwAttrIter::GetNextAttr( ) const
sal_Int32 SwAttrIter::GetNextAttr( ) const
{
    xub_StrLen nNext = STRING_LEN;
    sal_Int32 nNext = COMPLETE_STRING;
    if( pHints )
    {
        // are there attribute starts left?
@@ -329,7 +329,7 @@ xub_StrLen SwAttrIter::GetNextAttr( ) const
            SwTxtAttr *const pAttr(pHints->GetEnd(i));
            if (!pAttr->IsFormatIgnoreEnd())
            {
                xub_StrLen const nNextEnd = *pAttr->GetAnyEnd();
                sal_Int32 const nNextEnd = *pAttr->GetAnyEnd();
                nNext = std::min(nNext, nNextEnd); // pick nearest one
                break;
            }
@@ -338,7 +338,7 @@ xub_StrLen SwAttrIter::GetNextAttr( ) const
    if (m_pTxtNode!=NULL) {
        //TODO maybe use hints like FieldHints for this instead of looking at the text...
        const sal_Int32 l = nNext<m_pTxtNode->Len() ? nNext : m_pTxtNode->Len();
        xub_StrLen p=nPos;
        sal_Int32 p=nPos;
        while (p<l && m_pTxtNode->GetTxt()[p] != CH_TXT_ATR_FIELDSTART
                   && m_pTxtNode->GetTxt()[p] != CH_TXT_ATR_FIELDEND
                   && m_pTxtNode->GetTxt()[p] != CH_TXT_ATR_FORMELEMENT)
@@ -366,21 +366,21 @@ public:
    long nRowWidth;
    long nWordWidth;
    long nWordAdd;
    xub_StrLen nNoLineBreak;
    sal_Int32 nNoLineBreak;
    SwMinMaxArgs( OutputDevice* pOutI, SwViewShell* pShI, sal_uLong& rMinI, sal_uLong &rMaxI, sal_uLong &rAbsI )
        : pOut( pOutI ), pSh( pShI ), rMin( rMinI ), rMax( rMaxI ), rAbsMin( rAbsI )
        { nRowWidth = nWordWidth = nWordAdd = 0; nNoLineBreak = STRING_LEN; }
        { nRowWidth = nWordWidth = nWordAdd = 0; nNoLineBreak = COMPLETE_STRING; }
    void Minimum( long nNew ) const { if( (long)rMin < nNew ) rMin = nNew; }
    void NewWord() { nWordAdd = nWordWidth = 0; }
};

static sal_Bool lcl_MinMaxString( SwMinMaxArgs& rArg, SwFont* pFnt, const OUString &rTxt,
    xub_StrLen nIdx, xub_StrLen nEnd )
    sal_Int32 nIdx, sal_Int32 nEnd )
{
    sal_Bool bRet = sal_False;
    while( nIdx < nEnd )
    {
        xub_StrLen nStop = nIdx;
        sal_Int32 nStop = nIdx;
        sal_Bool bClear;
        LanguageType eLang = pFnt->GetLanguage();
        if( g_pBreakIt->GetBreakIter().is() )
@@ -389,7 +389,7 @@ static sal_Bool lcl_MinMaxString( SwMinMaxArgs& rArg, SwFont* pFnt, const OUStri
            Boundary aBndry( g_pBreakIt->GetBreakIter()->getWordBoundary( rTxt, nIdx,
                             g_pBreakIt->GetLocale( eLang ),
                             WordType::DICTIONARY_WORD, sal_True ) );
            nStop = (xub_StrLen)aBndry.endPos;
            nStop = aBndry.endPos;
            if( nIdx <= aBndry.startPos && nIdx && nIdx-1 != rArg.nNoLineBreak )
                rArg.NewWord();
            if( nStop == nIdx )
@@ -641,7 +641,7 @@ void SwTxtNode::GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rMa

    SwScriptInfo aScriptInfo;
    SwAttrIter aIter( *(SwTxtNode*)this, aScriptInfo );
    xub_StrLen nIdx = 0;
    sal_Int32 nIdx = 0;
    aIter.SeekAndChgAttrIter( nIdx, pOut );
    sal_Int32 nLen = m_Text.getLength();
    long nAktWidth = 0;
@@ -649,8 +649,8 @@ void SwTxtNode::GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rMa
    SwMinMaxArgs aArg( pOut, pSh, rMin, rMax, rAbsMin );
    while( nIdx < nLen )
    {
        xub_StrLen nNextChg = aIter.GetNextAttr();
        xub_StrLen nStop = aScriptInfo.NextScriptChg( nIdx );
        sal_Int32 nNextChg = aIter.GetNextAttr();
        sal_Int32 nStop = aScriptInfo.NextScriptChg( nIdx );
        if( nNextChg > nStop )
            nNextChg = nStop;
        SwTxtAttr *pHint = NULL;
diff --git a/sw/source/core/text/itratr.hxx b/sw/source/core/text/itratr.hxx
index d550e43..c76c10e 100644
--- a/sw/source/core/text/itratr.hxx
+++ b/sw/source/core/text/itratr.hxx
@@ -55,20 +55,20 @@ private:
    OutputDevice *pLastOut;
    MSHORT nChgCnt;
    SwRedlineItr *pRedln;
    xub_StrLen nStartIndex, nEndIndex, nPos;
    sal_Int32 nStartIndex, nEndIndex, nPos;
    sal_uInt8 nPropFont;
    const void* aMagicNo[ SW_SCRIPTS ];
    MSHORT aFntIdx[ SW_SCRIPTS ];
    const SwTxtNode* m_pTxtNode;

    void SeekFwd( const xub_StrLen nPos );
    inline void SetFnt( SwFont* pNew ) { pFnt = pNew; }
    void SeekFwd( const sal_Int32 nPos );
    void SetFnt( SwFont* pNew ) { pFnt = pNew; }

protected:
    void Chg( SwTxtAttr *pHt );
    void Rst( SwTxtAttr *pHt );
    void CtorInitAttrIter( SwTxtNode& rTxtNode, SwScriptInfo& rScrInf, SwTxtFrm* pFrm = 0 );
    inline SwAttrIter(SwTxtNode* pTxtNode)
    SwAttrIter(SwTxtNode* pTxtNode)
        : pShell(0), pFnt(0), pHints(0), pAttrSet(0), pScriptInfo(0), pLastOut(0), nChgCnt(0), pRedln(0), nPropFont(0), m_pTxtNode(pTxtNode)
        {
            aMagicNo[SW_LATIN] = aMagicNo[SW_CJK] = aMagicNo[SW_CTL] = NULL;
@@ -76,45 +76,45 @@ protected:

public:
    // Constructor, destructor
    inline SwAttrIter( SwTxtNode& rTxtNode, SwScriptInfo& rScrInf )
    SwAttrIter( SwTxtNode& rTxtNode, SwScriptInfo& rScrInf )
        : pShell(0), pFnt(0), pHints(0), pScriptInfo(0), pLastOut(0), nChgCnt(0), pRedln(0),nPropFont(0), m_pTxtNode(&rTxtNode)
        { CtorInitAttrIter( rTxtNode, rScrInf ); }

    virtual ~SwAttrIter();

    inline SwRedlineItr *GetRedln() { return pRedln; }
    SwRedlineItr *GetRedln() { return pRedln; }
    // The parameter returns the position of the next change before or at the
    // char position.
    xub_StrLen GetNextAttr( ) const;
    sal_Int32 GetNextAttr( ) const;
    /// Enables the attributes used at char pos nPos in the logical font
    sal_Bool Seek( const xub_StrLen nPos );
    sal_Bool Seek( const sal_Int32 nPos );
    // Creates the font at the specified position via Seek() and checks
    // if it's a symbol font.
    sal_Bool IsSymbol( const xub_StrLen nPos );
    sal_Bool IsSymbol( const sal_Int32 nPos );

    /** Executes ChgPhysFnt if Seek() returns sal_True
     *  and change font to merge character border with neighbours.
    **/
    sal_Bool SeekAndChgAttrIter( const xub_StrLen nPos, OutputDevice* pOut );
    sal_Bool SeekAndChgAttrIter( const sal_Int32 nPos, OutputDevice* pOut );
    sal_Bool SeekStartAndChgAttrIter( OutputDevice* pOut, const sal_Bool bParaFont = sal_False );

    // Do we have an attribute change at all?
    inline sal_Bool HasHints() const { return 0 != pHints; }
    sal_Bool HasHints() const { return 0 != pHints; }

    // Returns the attribute for a position
    SwTxtAttr *GetAttr( const xub_StrLen nPos ) const;
    SwTxtAttr *GetAttr( const sal_Int32 nPos ) const;

    inline const SwAttrSet* GetAttrSet() const { return pAttrSet; }
    const SwAttrSet* GetAttrSet() const { return pAttrSet; }

    inline const SwpHints *GetHints() const { return pHints; }
    const SwpHints *GetHints() const { return pHints; }

    inline SwFont *GetFnt() { return pFnt; }
    inline const SwFont *GetFnt() const { return pFnt; }
    SwFont *GetFnt() { return pFnt; }
    const SwFont *GetFnt() const { return pFnt; }

    inline sal_uInt8 GetPropFont() const { return nPropFont; }
    inline void SetPropFont( const sal_uInt8 nNew ) { nPropFont = nNew; }
    sal_uInt8 GetPropFont() const { return nPropFont; }
    void SetPropFont( const sal_uInt8 nNew ) { nPropFont = nNew; }

    inline SwAttrHandler& GetAttrHandler() { return aAttrHandler; }
    SwAttrHandler& GetAttrHandler() { return aAttrHandler; }
};

#endif
diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index 6317f388..1bc04e4 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -418,7 +418,7 @@ void SwTxtCursor::CtorInitTxtCursor( SwTxtFrm *pNewFrm, SwTxtSizeInfo *pNewInf )

// 1170: Ancient bug: Shift-End forgets the last character ...

sal_Bool SwTxtCursor::GetEndCharRect( SwRect* pOrig, const xub_StrLen nOfst,
sal_Bool SwTxtCursor::GetEndCharRect( SwRect* pOrig, const sal_Int32 nOfst,
                                  SwCrsrMoveState* pCMS, const long nMax )
{
    // 1170: Ambiguity of document positions
@@ -496,7 +496,7 @@ sal_Bool SwTxtCursor::GetEndCharRect( SwRect* pOrig, const xub_StrLen nOfst,
 * value = real height of (shortened) cursor
 *************************************************************************/

void SwTxtCursor::_GetCharRect( SwRect* pOrig, const xub_StrLen nOfst,
void SwTxtCursor::_GetCharRect( SwRect* pOrig, const sal_Int32 nOfst,
    SwCrsrMoveState* pCMS )
{
    const OUString aText = GetInfo().GetTxt();
@@ -735,7 +735,7 @@ void SwTxtCursor::_GetCharRect( SwRect* pOrig, const xub_StrLen nOfst,
                        // In a multi-portion we use GetCharRect()-function
                        // recursively and must add the x-position
                        // of the multi-portion.
                        xub_StrLen nOldStart = nStart;
                        sal_Int32 nOldStart = nStart;
                        SwTwips nOldY = nY;
                        sal_uInt8 nOldProp = GetPropFont();
                        nStart = aInf.GetIdx();
@@ -905,7 +905,7 @@ void SwTxtCursor::_GetCharRect( SwRect* pOrig, const xub_StrLen nOfst,
                    }
                    if ( pPor->PrtWidth() )
                    {
                        xub_StrLen nOldLen = pPor->GetLen();
                        sal_Int32 nOldLen = pPor->GetLen();
                        pPor->SetLen( nOfst - aInf.GetIdx() );
                        aInf.SetLen( pPor->GetLen() );
                        if( nX || !pPor->InNumberGrp() )
@@ -1099,7 +1099,7 @@ void SwTxtCursor::_GetCharRect( SwRect* pOrig, const xub_StrLen nOfst,
                    else
                    {
                        const bool bOldOnWin = aInf.OnWin();
                        xub_StrLen nOldLen = pPor->GetLen();
                        sal_Int32 nOldLen = pPor->GetLen();
                        pPor->SetLen( 1 );
                        aInf.SetLen( pPor->GetLen() );
                        SeekAndChg( aInf );
@@ -1198,7 +1198,7 @@ void SwTxtCursor::_GetCharRect( SwRect* pOrig, const xub_StrLen nOfst,
 *                      SwTxtCursor::GetCharRect()
 *************************************************************************/

sal_Bool SwTxtCursor::GetCharRect( SwRect* pOrig, const xub_StrLen nOfst,
sal_Bool SwTxtCursor::GetCharRect( SwRect* pOrig, const sal_Int32 nOfst,
                               SwCrsrMoveState* pCMS, const long nMax )
{
    CharCrsrToLine(nOfst);
@@ -1206,7 +1206,7 @@ sal_Bool SwTxtCursor::GetCharRect( SwRect* pOrig, const xub_StrLen nOfst,
    // Indicates that a position inside a special portion (field, number portion)
    // is requested.
    const sal_Bool bSpecialPos = pCMS && pCMS->pSpecialPos;
    xub_StrLen nFindOfst = nOfst;
    sal_Int32 nFindOfst = nOfst;

    if ( bSpecialPos )
    {
@@ -1291,14 +1291,14 @@ sal_Bool SwTxtCursor::GetCharRect( SwRect* pOrig, const xub_StrLen nOfst,
 *
 * Return: Offset in String
 *************************************************************************/
xub_StrLen SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint,
sal_Int32 SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint,
                     const MSHORT nChgNode, SwCrsrMoveState* pCMS ) const
{
    // If necessary, as catch up, do the adjustment
    GetAdjusted();

    const OUString &rText = GetInfo().GetTxt();
    xub_StrLen nOffset = 0;
    sal_Int32 nOffset = 0;

    // x is the horizontal offset within the line.
    SwTwips x = rPoint.X();
@@ -1324,12 +1324,12 @@ xub_StrLen SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint,
    // If there are attribut changes in the line, search for the paragraph,
    // in which nX is situated.
    SwLinePortion *pPor = pCurr->GetFirstPortion();
    xub_StrLen nCurrStart  = nStart;
    sal_Int32 nCurrStart  = nStart;
    sal_Bool bHolePortion = sal_False;
    sal_Bool bLastHyph = sal_False;

    std::deque<sal_uInt16> *pKanaComp = pCurr->GetpKanaComp();
    xub_StrLen nOldIdx = GetInfo().GetIdx();
    sal_Int32 nOldIdx = GetInfo().GetIdx();
    MSHORT nSpaceIdx = 0;
    size_t nKanaIdx = 0;
    long nSpaceAdd = pCurr->IsSpaceAdd() ? pCurr->GetLLSpaceAdd( 0 ) : 0;
@@ -1440,7 +1440,7 @@ xub_StrLen SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint,

    ((SwTxtSizeInfo&)GetInfo()).SetIdx( nOldIdx );

    xub_StrLen nLength = pPor->GetLen();
    sal_Int32 nLength = pPor->GetLen();

    sal_Bool bFieldInfo = pCMS && pCMS->bFieldInfo;

@@ -1692,7 +1692,7 @@ xub_StrLen SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint,
                }

                if ( pPor->InFldGrp() && pCMS && pCMS->pSpecialPos )
                    aDrawInf.SetLen( STRING_LEN ); // SMARTTAGS
                    aDrawInf.SetLen( COMPLETE_STRING ); // SMARTTAGS

                aDrawInf.SetSpace( nSpaceAdd );
                aDrawInf.SetFont( aSizeInf.GetFont() );
@@ -1733,7 +1733,7 @@ xub_StrLen SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint,
                && !( (SwFlyCntPortion*)pPor )->IsDraw() )
            {
                // JP 24.11.94: if the Position is not in Fly, then
                //              we many not return with STRING_LEN as value!
                //              we many not return with COMPLETE_STRING as value!
                //              (BugId: 9692 + Change in feshview)
                SwFlyInCntFrm *pTmp = ( (SwFlyCntPortion*)pPor )->GetFlyFrm();
                sal_Bool bChgNode = 1 < nChgNode;
@@ -1762,8 +1762,8 @@ xub_StrLen SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint,
                    ((SwTxtSizeInfo*)pInf)->SelectFont();

                    // 6776: The pIter->GetCrsrOfst is returning here
                    // from a nesting with STRING_LEN.
                    return STRING_LEN;
                    // from a nesting with COMPLETE_STRING.
                    return COMPLETE_STRING;
                }
            }
            else
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 12c58e4..399d92c 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -75,7 +75,7 @@ namespace {
                                    const sal_Int32 nOldLineEnd,
                                    const std::vector<long> &rFlyStarts );
    //! Determine if we need to build hidden portions
    static bool lcl_BuildHiddenPortion( const SwTxtSizeInfo& rInf, xub_StrLen &rPos );
    static bool lcl_BuildHiddenPortion( const SwTxtSizeInfo& rInf, sal_Int32 &rPos );

    // Check whether the two font has the same border
    static bool lcl_HasSameBorder(const SwFont& rFirst, const SwFont& rSecond);
@@ -104,7 +104,7 @@ void SwTxtFormatter::CtorInitTxtFormatter( SwTxtFrm *pNewFrm, SwTxtFormatInfo *p
    bTruncLines = sal_False;
    nCntEndHyph = 0;
    nCntMidHyph = 0;
    nLeftScanIdx = STRING_LEN;
    nLeftScanIdx = COMPLETE_STRING;
    nRightScanIdx = 0;
    m_nHintEndIndex = 0;
    m_pFirstOfBorderMerge = 0;
@@ -379,7 +379,7 @@ void SwTxtFormatter::InsertPortion( SwTxtFormatInfo &rInf,

void SwTxtFormatter::BuildPortions( SwTxtFormatInfo &rInf )
{
    OSL_ENSURE( rInf.GetTxt().getLength() < STRING_LEN,
    OSL_ENSURE( rInf.GetTxt().getLength() < COMPLETE_STRING,
            "SwTxtFormatter::BuildPortions: bad text length in info" );

    rInf.ChkNoHyph( CntEndHyph(), CntMidHyph() );
@@ -431,7 +431,7 @@ void SwTxtFormatter::BuildPortions( SwTxtFormatInfo &rInf )

    while( pPor && !rInf.IsStop() )
    {
        OSL_ENSURE( rInf.GetLen() < STRING_LEN &&
        OSL_ENSURE( rInf.GetLen() < COMPLETE_STRING &&
                rInf.GetIdx() <= rInf.GetTxt().getLength(),
                "SwTxtFormatter::BuildPortions: bad length in info" );

@@ -630,7 +630,7 @@ void SwTxtFormatter::BuildPortions( SwTxtFormatInfo &rInf )
            {
                // The distance between two different scripts is set
                // to 20% of the fontheight.
                xub_StrLen nTmp = rInf.GetIdx() + pPor->GetLen();
                sal_Int32 nTmp = rInf.GetIdx() + pPor->GetLen();
                if( nTmp == pScriptInfo->NextScriptChg( nTmp - 1 ) &&
                    nTmp != rInf.GetTxt().getLength() )
                {
@@ -657,7 +657,7 @@ void SwTxtFormatter::BuildPortions( SwTxtFormatInfo &rInf )

        if ( bHasGrid && pPor != pGridKernPortion && ! pMulti )
        {
            xub_StrLen nTmp = rInf.GetIdx() + pPor->GetLen();
            sal_Int32 nTmp = rInf.GetIdx() + pPor->GetLen();
            const SwTwips nRestWidth = rInf.Width() - rInf.X() - pPor->Width();

            const sal_uInt8 nCurrScript = pFnt->GetActual(); // pScriptInfo->ScriptType( rInf.GetIdx() );
@@ -1243,7 +1243,7 @@ SwLinePortion *SwTxtFormatter::NewPortion( SwTxtFormatInfo &rInf )
    // Check for Hidden Portion:
    if ( !pPor )
    {
        xub_StrLen nEnd = rInf.GetIdx();
        sal_Int32 nEnd = rInf.GetIdx();
        if ( ::lcl_BuildHiddenPortion( rInf, nEnd ) )
            pPor = new SwHiddenTextPortion( nEnd - rInf.GetIdx() );
    }
@@ -1257,7 +1257,7 @@ SwLinePortion *SwTxtFormatter::NewPortion( SwTxtFormatInfo &rInf )
        {
            // We open a multiportion part, if we enter a multi-line part
            // of the paragraph.
            xub_StrLen nEnd = rInf.GetIdx();
            sal_Int32 nEnd = rInf.GetIdx();
            SwMultiCreator* pCreate = rInf.GetMultiCreator( nEnd, pMulti );
            if( pCreate )
            {
@@ -1495,7 +1495,7 @@ SwLinePortion *SwTxtFormatter::NewPortion( SwTxtFormatInfo &rInf )
 *                      SwTxtFormatter::FormatLine()
 *************************************************************************/

xub_StrLen SwTxtFormatter::FormatLine( const xub_StrLen nStartPos )
sal_Int32 SwTxtFormatter::FormatLine(const sal_Int32 nStartPos)
{
    OSL_ENSURE( ! pFrm->IsVertical() || pFrm->IsSwapped(),
            "SwTxtFormatter::FormatLine( nStartPos ) with unswapped frame" );
@@ -1529,7 +1529,7 @@ xub_StrLen SwTxtFormatter::FormatLine( const xub_StrLen nStartPos )
    // for an optimal repaint rectangle, we want to compare fly portions
    // before and after the BuildPortions call
    const sal_Bool bOptimizeRepaint = AllowRepaintOpt();
    const xub_StrLen nOldLineEnd = nStartPos + pCurr->GetLen();
    const sal_Int32 nOldLineEnd = nStartPos + pCurr->GetLen();
    std::vector<long> flyStarts;

    // these are the conditions for a fly position comparison
@@ -1671,7 +1671,7 @@ xub_StrLen SwTxtFormatter::FormatLine( const xub_StrLen nStartPos )
    // delete master copy of rest portion
    xSaveFld.reset();

    xub_StrLen nNewStart = nStartPos + pCurr->GetLen();
    sal_Int32 nNewStart = nStartPos + pCurr->GetLen();

    // adjust text if kana compression is enabled
    if ( GetInfo().CompressLine() )
@@ -2034,8 +2034,8 @@ sal_Bool SwTxtFormatter::AllowRepaintOpt() const
    }

    // Schon wieder ein Sonderfall: unsichtbare SoftHyphs
    const xub_StrLen nReformat = GetInfo().GetReformatStart();
    if( bOptimizeRepaint && STRING_LEN != nReformat )
    const sal_Int32 nReformat = GetInfo().GetReformatStart();
    if( bOptimizeRepaint && COMPLETE_STRING != nReformat )
    {
        const sal_Unicode cCh = nReformat >= GetInfo().GetTxt().getLength() ? 0 : GetInfo().GetTxt()[ nReformat ];
        bOptimizeRepaint = ( CH_TXTATR_BREAKWORD != cCh && CH_TXTATR_INWORD != cCh )
@@ -2059,7 +2059,7 @@ void SwTxtFormatter::CalcUnclipped( SwTwips& rTop, SwTwips& rBottom )


void SwTxtFormatter::UpdatePos( SwLineLayout *pCurrent, Point aStart,
    xub_StrLen nStartIdx, sal_Bool bAlways ) const
    sal_Int32 nStartIdx, sal_Bool bAlways ) const
{
    OSL_ENSURE( ! pFrm->IsVertical() || pFrm->IsSwapped(),
            "SwTxtFormatter::UpdatePos with unswapped frame" );
@@ -2165,7 +2165,7 @@ void SwTxtFormatter::UpdatePos( SwLineLayout *pCurrent, Point aStart,
                // jump to end of the bidi portion
                aSt.X() += pLay->Width();

            xub_StrLen nStIdx = aTmpInf.GetIdx();
            sal_Int32 nStIdx = aTmpInf.GetIdx();
            do
            {
                UpdatePos( pLay, aSt, nStIdx, bAlways );
@@ -2772,17 +2772,17 @@ namespace {
            // step back six(!) more characters for complex scripts
            // this is required e.g., for Khmer (thank you, Javier!)
            const SwScriptInfo& rSI = txtFmtInfo.GetParaPortion()->GetScriptInfo();
            xub_StrLen nMaxContext = 0;
            sal_Int32 nMaxContext = 0;
            if( ::i18n::ScriptType::COMPLEX == rSI.ScriptType( nReformat ) )
                nMaxContext = 6;
    #else
            // Some Graphite fonts need context for scripts not marked as complex
            static const xub_StrLen nMaxContext = 10;
            static const sal_Int32 nMaxContext = 10;
    #endif
    #else
            // some fonts like Quartz's Zapfino need more context
            // TODO: query FontInfo for maximum unicode context
            static const xub_StrLen nMaxContext = 8;
            static const sal_Int32 nMaxContext = 8;
    #endif
            if( nMaxContext > 0 )
            {
@@ -2850,7 +2850,7 @@ namespace {
    }

    // Determine if we need to build hidden portions
    bool lcl_BuildHiddenPortion( const SwTxtSizeInfo& rInf, xub_StrLen &rPos )
    bool lcl_BuildHiddenPortion( const SwTxtSizeInfo& rInf, sal_Int32 &rPos )
    {
        // Only if hidden text should not be shown:
    //    if ( rInf.GetVsh() && rInf.GetVsh()->GetWin() && rInf.GetOpt().IsShowHiddenChar() )
@@ -2860,8 +2860,8 @@ namespace {
            return false;

        const SwScriptInfo& rSI = rInf.GetParaPortion()->GetScriptInfo();
        xub_StrLen nHiddenStart;
        xub_StrLen nHiddenEnd;
        sal_Int32 nHiddenStart;
        sal_Int32 nHiddenEnd;
        rSI.GetBoundsOfHiddenRange( rPos, nHiddenStart, nHiddenEnd );
        if ( nHiddenEnd )
        {
diff --git a/sw/source/core/text/itrform2.hxx b/sw/source/core/text/itrform2.hxx
index bbaead1..d75ad38 100644
--- a/sw/source/core/text/itrform2.hxx
+++ b/sw/source/core/text/itrform2.hxx
@@ -38,8 +38,8 @@ class SwTxtFormatter : public SwTxtPainter
    SwMultiPortion* pMulti; // during formatting a multi-portion
    sal_uInt8 nCntEndHyph;  // Counts consecutive hyphens at the line end
    sal_uInt8 nCntMidHyph;  // Counts consecutive hyphens before flies
    xub_StrLen nLeftScanIdx; // for increasing performance during
    xub_StrLen nRightScanIdx; // scanning for portion ends
    sal_Int32 nLeftScanIdx; // for increasing performance during
    sal_Int32 nRightScanIdx; // scanning for portion ends
    sal_Bool bOnceMore : 1; // Another round?
    sal_Bool bFlyInCntBase : 1; // Base reference that sets a character-bound frame
    sal_Bool bChanges : 1; // Flag for calculating the repaint rectangle
@@ -113,7 +113,7 @@ class SwTxtFormatter : public SwTxtPainter
        for example after adjustment change (right alignment, justified, etc.)
        Mainly to correct the X position.
     */
    void UpdatePos( SwLineLayout *pCurr, Point aStart, xub_StrLen nStartIdx,
    void UpdatePos( SwLineLayout *pCurr, Point aStart, sal_Int32 nStartIdx,
            sal_Bool bAlways = sal_False ) const;

    /**
@@ -153,11 +153,11 @@ public:
    sal_Bool CalcOnceMore();

    void CtorInitTxtFormatter( SwTxtFrm *pFrm, SwTxtFormatInfo *pInf );
    inline SwTxtFormatter( SwTxtFrm *pTxtFrm, SwTxtFormatInfo *pTxtFmtInf ) : SwTxtPainter(pTxtFrm!=NULL?pTxtFrm->GetTxtNode():NULL)
    SwTxtFormatter( SwTxtFrm *pTxtFrm, SwTxtFormatInfo *pTxtFmtInf ) : SwTxtPainter(pTxtFrm!=NULL?pTxtFrm->GetTxtNode():NULL)
           { CtorInitTxtFormatter( pTxtFrm, pTxtFmtInf ); }
    ~SwTxtFormatter();

    xub_StrLen FormatLine( const xub_StrLen nStart );
    sal_Int32 FormatLine( const sal_Int32 nStart );

    void RecalcRealHeight();

@@ -167,16 +167,16 @@ public:
    // A special method for QuoVadis texts:
    // nErgo is the page number of the ErgoSum Ftn
    // At 0 it's still unclear
    xub_StrLen FormatQuoVadis( const xub_StrLen nStart );
    sal_Int32 FormatQuoVadis( const sal_Int32 nStart );

    // The emergency break: Cancel formatting, discard line
    inline sal_Bool IsStop() const { return GetInfo().IsStop(); }
    sal_Bool IsStop() const { return GetInfo().IsStop(); }

    // The counterpart: Continue formatting at all costs
    inline sal_Bool IsNewLine() const { return GetInfo().IsNewLine(); }
    sal_Bool IsNewLine() const { return GetInfo().IsNewLine(); }

    // FormatQuick(); Refresh formatting information
    inline sal_Bool IsQuick() const { return GetInfo().IsQuick(); }
    sal_Bool IsQuick() const { return GetInfo().IsQuick(); }

    // Create a SwLineLayout if needed, which avoids Ftn/Fly to oscillate
    void MakeDummyLine();
@@ -190,38 +190,38 @@ public:
    // How wide would you be without any bounds (Flys etc.)?
    SwTwips _CalcFitToContent( );

    SwLinePortion* MakeRestPortion(const SwLineLayout* pLine, xub_StrLen nPos);
    SwLinePortion* MakeRestPortion(const SwLineLayout* pLine, sal_Int32 nPos);

    inline const SwFmtDrop *GetDropFmt() const { return pDropFmt; }
    inline void ClearDropFmt() { pDropFmt = 0; }
    const SwFmtDrop *GetDropFmt() const { return pDropFmt; }
    void ClearDropFmt() { pDropFmt = 0; }

    inline SwMultiPortion *GetMulti() const { return pMulti; }
    SwMultiPortion *GetMulti() const { return pMulti; }

    inline sal_Bool IsOnceMore() const { return bOnceMore; }
    inline void       SetOnceMore( sal_Bool bNew ) { bOnceMore = bNew; }
    sal_Bool IsOnceMore() const { return bOnceMore; }
    void       SetOnceMore( sal_Bool bNew ) { bOnceMore = bNew; }

    inline sal_Bool HasChanges() const { return bChanges; }
    inline void       SetChanges()       { bChanges = sal_True; }
    sal_Bool HasChanges() const { return bChanges; }
    void       SetChanges()       { bChanges = sal_True; }

    inline sal_Bool HasTruncLines() const { return bTruncLines; }
    inline void       SetTruncLines( sal_Bool bNew ) { bTruncLines = bNew; }
    sal_Bool HasTruncLines() const { return bTruncLines; }
    void       SetTruncLines( sal_Bool bNew ) { bTruncLines = bNew; }

    inline sal_Bool IsUnclipped() const { return bUnclipped; }
    inline void       SetUnclipped( sal_Bool bNew ) { bUnclipped = bNew; }
    sal_Bool IsUnclipped() const { return bUnclipped; }
    void       SetUnclipped( sal_Bool bNew ) { bUnclipped = bNew; }

    inline sal_Bool IsFlyInCntBase() const { return bFlyInCntBase; }
    inline void  SetFlyInCntBase( sal_Bool bNew = sal_True ){ bFlyInCntBase = bNew; }
    sal_Bool IsFlyInCntBase() const { return bFlyInCntBase; }
    void  SetFlyInCntBase( sal_Bool bNew = sal_True ){ bFlyInCntBase = bNew; }

    inline SwTxtFormatInfo &GetInfo()
    SwTxtFormatInfo &GetInfo()
        { return (SwTxtFormatInfo&)SwTxtIter::GetInfo(); }
    inline const SwTxtFormatInfo &GetInfo() const
    const SwTxtFormatInfo &GetInfo() const
        { return (const SwTxtFormatInfo&)SwTxtIter::GetInfo(); }

    inline void InitCntHyph() { CntHyphens( nCntEndHyph, nCntMidHyph ); }
    inline const sal_uInt8 &CntEndHyph() const { return nCntEndHyph; }
    inline const sal_uInt8 &CntMidHyph() const { return nCntMidHyph; }
    inline sal_uInt8 &CntEndHyph() { return nCntEndHyph; }
    inline sal_uInt8 &CntMidHyph() { return nCntMidHyph; }
    void InitCntHyph() { CntHyphens( nCntEndHyph, nCntMidHyph ); }
    const sal_uInt8 &CntEndHyph() const { return nCntEndHyph; }
    const sal_uInt8 &CntMidHyph() const { return nCntMidHyph; }
    sal_uInt8 &CntEndHyph() { return nCntEndHyph; }
    sal_uInt8 &CntMidHyph() { return nCntMidHyph; }

    /**
     * Merge border of the drop portion with modifying the font of
diff --git a/sw/source/core/text/itrtxt.cxx b/sw/source/core/text/itrtxt.cxx
index 00de231..72d3127 100644
--- a/sw/source/core/text/itrtxt.cxx
+++ b/sw/source/core/text/itrtxt.cxx
@@ -242,7 +242,7 @@ void SwTxtIter::Bottom()
 *                      SwTxtIter::CharToLine()
 *************************************************************************/

void SwTxtIter::CharToLine(const xub_StrLen nChar)
void SwTxtIter::CharToLine(const sal_Int32 nChar)
{
    while( nStart + pCurr->GetLen() <= nChar && Next() )
        ;
@@ -255,7 +255,7 @@ void SwTxtIter::CharToLine(const xub_StrLen nChar)
 *************************************************************************/

// 1170: beruecksichtigt Mehrdeutigkeiten:
const SwLineLayout *SwTxtCursor::CharCrsrToLine( const xub_StrLen nPosition )
const SwLineLayout *SwTxtCursor::CharCrsrToLine( const sal_Int32 nPosition )
{
    CharToLine( nPosition );
    if( nPosition != nStart )
@@ -389,7 +389,7 @@ static sal_Bool lcl_NeedsFieldRest( const SwLineLayout* pCurr )
void SwTxtIter::TruncLines( bool bNoteFollow )
{
    SwLineLayout *pDel = pCurr->GetNext();
    const xub_StrLen nEnd = nStart + pCurr->GetLen();
    const sal_Int32 nEnd = nStart + pCurr->GetLen();

    if( pDel )
    {
@@ -404,7 +404,7 @@ void SwTxtIter::TruncLines( bool bNoteFollow )
            if ( pFollow && ! pFollow->IsLocked() &&
                 nEnd == pFollow->GetOfst() )
            {
                xub_StrLen nRangeEnd = nEnd;
                sal_Int32 nRangeEnd = nEnd;
                SwLineLayout* pLine = pDel;

                // determine range to be searched for flys anchored as characters
diff --git a/sw/source/core/text/itrtxt.hxx b/sw/source/core/text/itrtxt.hxx
index d1e0042..591d42c 100644
--- a/sw/source/core/text/itrtxt.hxx
+++ b/sw/source/core/text/itrtxt.hxx
@@ -43,7 +43,7 @@ protected:
    SwTwips nFrameStart;
    SwTwips nY;
    SwTwips nRegStart;          // The register's start position (Y)
    xub_StrLen nStart;          // Start in the text string, end = pCurr->GetLen()
    sal_Int32 nStart;          // Start in the text string, end = pCurr->GetLen()
    KSHORT nRegDiff;            // Register's line distance
    MSHORT nLineNr;             // Line number
    sal_Bool bPrev          : 1;
@@ -70,10 +70,10 @@ public:
    inline const SwLineLayout *GetCurr() const { return pCurr; } // NEVER 0!
    inline const SwLineLayout *GetNext() const { return pCurr->GetNext(); }
           const SwLineLayout *GetPrev();
    inline xub_StrLen GetLength() const { return pCurr->GetLen(); }
    inline sal_Int32 GetLength() const { return pCurr->GetLen(); }
    inline MSHORT GetLineNr() const { return nLineNr; }
    inline xub_StrLen GetStart() const { return nStart; }
    inline xub_StrLen GetEnd() const { return GetStart() + GetLength(); }
    inline sal_Int32 GetStart() const { return nStart; }
    inline sal_Int32 GetEnd() const { return GetStart() + GetLength(); }
    inline SwTwips Y() const { return nY; }

    inline SwTwips RegStart() const { return nRegStart; }
@@ -94,7 +94,7 @@ public:
    const SwLineLayout *GetNextLine() const;
    const SwLineLayout *GetPrevLine();

    void CharToLine( const xub_StrLen );
    void CharToLine( const sal_Int32 );
    const SwLineLayout *TwipsToLine(const SwTwips);

    // Truncates all after pCurr
@@ -188,8 +188,8 @@ public:

    // Returns the TxtPos for start and end of the current line without whitespace
    // Implemented in frminf.cxx
    xub_StrLen GetTxtStart() const;
    xub_StrLen GetTxtEnd() const;
    sal_Int32 GetTxtStart() const;
    sal_Int32 GetTxtEnd() const;

    inline SwTxtSizeInfo &GetInfo()
        { return (SwTxtSizeInfo&)SwTxtIter::GetInfo(); }
@@ -255,21 +255,21 @@ class SwTxtCursor : public SwTxtAdjuster

    // Ambiguities
    static sal_Bool bRightMargin;
    void _GetCharRect(SwRect *, const xub_StrLen, SwCrsrMoveState* );
    void _GetCharRect(SwRect *, const sal_Int32, SwCrsrMoveState* );
protected:
    void CtorInitTxtCursor( SwTxtFrm *pFrm, SwTxtSizeInfo *pInf );
    inline SwTxtCursor(SwTxtNode* pTxtNode) : SwTxtAdjuster(pTxtNode) { }
public:
    inline SwTxtCursor( SwTxtFrm *pTxtFrm, SwTxtSizeInfo *pTxtSizeInf ) : SwTxtAdjuster(pTxtFrm!=NULL?pTxtFrm->GetTxtNode():NULL)
           { CtorInitTxtCursor( pTxtFrm, pTxtSizeInf ); }
    sal_Bool GetCharRect(SwRect *, const xub_StrLen, SwCrsrMoveState* = 0,
    sal_Bool GetCharRect(SwRect *, const sal_Int32, SwCrsrMoveState* = 0,
        const long nMax = 0 );
    sal_Bool GetEndCharRect(SwRect *, const xub_StrLen, SwCrsrMoveState* = 0,
    sal_Bool GetEndCharRect(SwRect *, const sal_Int32, SwCrsrMoveState* = 0,
        const long nMax = 0 );
    xub_StrLen GetCrsrOfst( SwPosition *pPos, const Point &rPoint,
    sal_Int32 GetCrsrOfst( SwPosition *pPos, const Point &rPoint,
                const MSHORT nChgNode, SwCrsrMoveState* = 0 ) const;
    // Respects ambiguities: For the implementation see below
    const SwLineLayout *CharCrsrToLine( const xub_StrLen nPos );
    const SwLineLayout *CharCrsrToLine( const sal_Int32 nPos );

    // calculates baseline for portion rPor
    // bAutoToCentered indicates, if AUTOMATIC mode means CENTERED or BASELINE
diff --git a/sw/source/core/text/pordrop.hxx b/sw/source/core/text/pordrop.hxx
index 3ba9795..ea5c972 100644
--- a/sw/source/core/text/pordrop.hxx
+++ b/sw/source/core/text/pordrop.hxx
@@ -40,20 +40,20 @@ class SwDropPortionPart
{
    SwDropPortionPart* pFollow;
    SwFont* pFnt;
    xub_StrLen nLen;
    sal_Int32 nLen;
    sal_uInt16 nWidth;
    bool m_bJoinBorderWithNext;
    bool m_bJoinBorderWithPrev;

public:
    SwDropPortionPart( SwFont& rFont, const xub_StrLen nL )
    SwDropPortionPart( SwFont& rFont, const sal_Int32 nL )
            : pFollow( 0 ), pFnt( &rFont ), nLen( nL ), nWidth( 0 ), m_bJoinBorderWithNext(false), m_bJoinBorderWithPrev(false) {};
    ~SwDropPortionPart();

    inline SwDropPortionPart* GetFollow() const { return pFollow; };
    inline void SetFollow( SwDropPortionPart* pNew ) { pFollow = pNew; };
    inline SwFont& GetFont() const { return *pFnt; }
    inline xub_StrLen GetLen() const { return nLen; }
    inline sal_Int32 GetLen() const { return nLen; }
    inline sal_uInt16 GetWidth() const { return nWidth; }
    inline void SetWidth( sal_uInt16 nNew )  { nWidth = nNew; }

@@ -94,7 +94,7 @@ public:
            void PaintDrop( const SwTxtPaintInfo &rInf ) const;
    virtual sal_Bool Format( SwTxtFormatInfo &rInf );
    virtual SwPosSize GetTxtSize( const SwTxtSizeInfo &rInfo ) const;
    virtual xub_StrLen GetCrsrOfst( const MSHORT nOfst ) const;
    virtual sal_Int32 GetCrsrOfst( const MSHORT nOfst ) const;

    inline MSHORT GetLines() const { return nLines; }
    inline KSHORT GetDistance() const { return nDistance; }
diff --git a/sw/source/core/text/porexp.cxx b/sw/source/core/text/porexp.cxx
index 8c7a2b1..66be8a5 100644
--- a/sw/source/core/text/porexp.cxx
+++ b/sw/source/core/text/porexp.cxx
@@ -26,7 +26,7 @@
 *                      class SwExpandPortion
 *************************************************************************/

xub_StrLen SwExpandPortion::GetCrsrOfst( const MSHORT nOfst ) const
sal_Int32 SwExpandPortion::GetCrsrOfst( const MSHORT nOfst ) const
{ return SwLinePortion::GetCrsrOfst( nOfst ); }

/*************************************************************************
@@ -70,7 +70,7 @@ SwPosSize SwExpandPortion::GetTxtSize( const SwTxtSizeInfo &rInf ) const
sal_Bool SwExpandPortion::Format( SwTxtFormatInfo &rInf )
{
    SwTxtSlot aDiffTxt( &rInf, this, true, false );
    const xub_StrLen nFullLen = rInf.GetLen();
    const sal_Int32 nFullLen = rInf.GetLen();

    // So komisch es aussieht, die Abfrage auf GetLen() muss wegen der
    // ExpandPortions _hinter_ aDiffTxt (vgl. SoftHyphs)
@@ -137,7 +137,7 @@ SwLinePortion *SwBlankPortion::Compress() { return this; }
// Komplikationen bei Flys...

MSHORT SwBlankPortion::MayUnderFlow( const SwTxtFormatInfo &rInf,
    xub_StrLen nIdx, sal_Bool bUnderFlow ) const
    sal_Int32 nIdx, sal_Bool bUnderFlow ) const
{
    if( rInf.StopUnderFlow() )
        return 0;
@@ -161,7 +161,7 @@ MSHORT SwBlankPortion::MayUnderFlow( const SwTxtFormatInfo &rInf,
        //Hier wird ueberprueft, ob es in dieser Zeile noch sinnvolle Umbrueche
        //gibt, Blanks oder Felder etc., wenn nicht, kein Underflow.
        //Wenn Flys im Spiel sind, lassen wir das Underflow trotzdem zu.
            xub_StrLen nBlank = nIdx;
            sal_Int32 nBlank = nIdx;
            while( --nBlank > rInf.GetLineStart() )
            {
                const sal_Unicode cCh = rInf.GetChar( nBlank );
diff --git a/sw/source/core/text/porexp.hxx b/sw/source/core/text/porexp.hxx
index 77ece8a..59c8fa2 100644
--- a/sw/source/core/text/porexp.hxx
+++ b/sw/source/core/text/porexp.hxx
@@ -31,7 +31,7 @@ class SwExpandPortion : public SwTxtPortion
public:
    inline  SwExpandPortion() { SetWhichPor( POR_EXP ); }
    virtual sal_Bool Format( SwTxtFormatInfo &rInf );
    virtual xub_StrLen GetCrsrOfst( const MSHORT nOfst ) const;
    virtual sal_Int32 GetCrsrOfst( const MSHORT nOfst ) const;
    virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, OUString &rTxt ) const;
    virtual SwPosSize GetTxtSize( const SwTxtSizeInfo &rInfo ) const;
    virtual void Paint( const SwTxtPaintInfo &rInf ) const;
@@ -64,7 +64,7 @@ public:
    virtual void FormatEOL( SwTxtFormatInfo &rInf );
    virtual sal_Bool Format( SwTxtFormatInfo &rInf );
    virtual void Paint( const SwTxtPaintInfo &rInf ) const;
    MSHORT MayUnderFlow( const SwTxtFormatInfo &rInf, xub_StrLen nIdx,
    MSHORT MayUnderFlow( const SwTxtFormatInfo &rInf, sal_Int32 nIdx,
        sal_Bool bUnderFlow ) const;

    // Accessibility: pass information about this portion to the PortionHandler
diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index 55ce597..efbef16 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -76,7 +76,7 @@ void SwFldPortion::TakeNextOffset( const SwFldPortion* pFld )
}

SwFldPortion::SwFldPortion( const OUString &rExpand, SwFont *pFont, bool bPlaceHold )
    : aExpand(rExpand), pFnt(pFont), nNextOffset(0), nNextScriptChg(STRING_LEN), nViewWidth(0),
    : aExpand(rExpand), pFnt(pFont), nNextOffset(0), nNextScriptChg(COMPLETE_STRING), nViewWidth(0),
      bFollow( sal_False ), bHasFollow( sal_False ), bPlaceHolder( bPlaceHold )
    , m_bNoLength( sal_False )
{
@@ -200,10 +200,10 @@ void SwFldPortion::CheckScript( const SwTxtSizeInfo &rInf )
        sal_uInt16 nScript;
        {
            nScript = g_pBreakIt->GetBreakIter()->getScriptType( aTxt, 0 );
            xub_StrLen nChg = 0;
            sal_Int32 nChg = 0;
            if( i18n::ScriptType::WEAK == nScript )
            {
                nChg =(xub_StrLen)g_pBreakIt->GetBreakIter()->endOfScript(aTxt,0,nScript);
                nChg = g_pBreakIt->GetBreakIter()->endOfScript(aTxt,0,nScript);
                if( nChg < aTxt.getLength() )
                    nScript = g_pBreakIt->GetBreakIter()->getScriptType( aTxt, nChg );
            }
@@ -212,7 +212,7 @@ void SwFldPortion::CheckScript( const SwTxtSizeInfo &rInf )
            // nNextScriptChg will be evaluated during SwFldPortion::Format()
            //
            if ( nChg < aTxt.getLength() )
                nNextScriptChg = (xub_StrLen)g_pBreakIt->GetBreakIter()->endOfScript( aTxt, nChg, nScript );
                nNextScriptChg = g_pBreakIt->GetBreakIter()->endOfScript( aTxt, nChg, nScript );
            else
                nNextScriptChg = aTxt.getLength();

@@ -242,7 +242,7 @@ void SwFldPortion::CheckScript( const SwTxtSizeInfo &rInf )
            UBiDiLevel nCurrDir;
            ubidi_getLogicalRun( pBidi, 0, &nEnd, &nCurrDir );
            ubidi_close( pBidi );
            const xub_StrLen nNextDirChg = (xub_StrLen)nEnd;
            const sal_Int32 nNextDirChg = nEnd;
            nNextScriptChg = std::min( nNextScriptChg, nNextDirChg );

            // #i89825# change the script type also to CTL
@@ -295,7 +295,7 @@ void SwFldPortion::CheckScript( const SwTxtSizeInfo &rInf )
sal_Bool SwFldPortion::Format( SwTxtFormatInfo &rInf )
{
    // Scope wegen aDiffTxt::DTOR!
    xub_StrLen nRest;
    sal_Int32 nRest;
    sal_Bool bFull;
    bool bEOL = false;
    long nTxtRest = rInf.GetTxt().getLength() - rInf.GetIdx();
@@ -307,8 +307,8 @@ sal_Bool SwFldPortion::Format( SwTxtFormatInfo &rInf )
        // Field portion has to be split in several parts if
        // 1. There are script/direction changes inside the field
        // 2. There are portion breaks (tab, break) inside the field:
        const xub_StrLen nOldFullLen = rInf.GetLen();
        xub_StrLen nFullLen = rInf.ScanPortionEnd( rInf.GetIdx(), rInf.GetIdx() + nOldFullLen ) - rInf.GetIdx();
        const sal_Int32 nOldFullLen = rInf.GetLen();
        sal_Int32 nFullLen = rInf.ScanPortionEnd( rInf.GetIdx(), rInf.GetIdx() + nOldFullLen ) - rInf.GetIdx();
        if ( nNextScriptChg < nFullLen )
        {
            nFullLen = nNextScriptChg;
@@ -316,7 +316,7 @@ sal_Bool SwFldPortion::Format( SwTxtFormatInfo &rInf )
        }
        rInf.SetLen( nFullLen );

        if ( STRING_LEN != rInf.GetUnderScorePos() &&
        if ( COMPLETE_STRING != rInf.GetUnderScorePos() &&
             rInf.GetUnderScorePos() > rInf.GetIdx() )
             rInf.SetUnderScorePos( rInf.GetIdx() );

@@ -342,7 +342,7 @@ sal_Bool SwFldPortion::Format( SwTxtFormatInfo &rInf )
        }
        else
        {
            xub_StrLen nOldLineStart = rInf.GetLineStart();
            sal_Int32 nOldLineStart = rInf.GetLineStart();
            if( IsFollow() )
                rInf.SetLineStart( 0 );
            rInf.SetNotEOL( nFullLen == nOldFullLen && nTxtRest > nFollow );
@@ -358,7 +358,7 @@ sal_Bool SwFldPortion::Format( SwTxtFormatInfo &rInf )
            rInf.SetNotEOL( false );
            rInf.SetLineStart( nOldLineStart );
        }
        xub_StrLen nTmpLen = GetLen();
        sal_Int32 nTmpLen = GetLen();
        bEOL = !nTmpLen && nFollow && bFull;
        nRest = nOldFullLen - nTmpLen;

@@ -543,7 +543,7 @@ SwNumberPortion::SwNumberPortion( const OUString &rExpand,
    SetCenter( bCntr );
}

xub_StrLen SwNumberPortion::GetCrsrOfst( const MSHORT ) const
sal_Int32 SwNumberPortion::GetCrsrOfst( const MSHORT ) const
{
    return 0;
}
diff --git a/sw/source/core/text/porfld.hxx b/sw/source/core/text/porfld.hxx
index 2169689..0770edf 100644
--- a/sw/source/core/text/porfld.hxx
+++ b/sw/source/core/text/porfld.hxx
@@ -38,8 +38,8 @@ class SwFldPortion : public SwExpandPortion
protected:
    OUString  aExpand;              // The expanded field
    SwFont  *pFnt;                  // For multi-line fields
    xub_StrLen nNextOffset;         // Offset of the follow in the original string
    xub_StrLen nNextScriptChg;
    sal_Int32 nNextOffset;         // Offset of the follow in the original string
    sal_Int32 nNextScriptChg;
    KSHORT  nViewWidth;             // Screen width for empty fields
    sal_Bool bFollow : 1;           // 2nd or later part of a field
    sal_Bool bLeft : 1;             // Used by SwNumberPortion
@@ -93,11 +93,11 @@ public:
    inline sal_Bool HasFollow() const { return bHasFollow; }
    inline void SetHasFollow( sal_Bool bNew ) { bHasFollow = bNew; }

    inline xub_StrLen GetNextOffset() const { return nNextOffset; }
    inline void SetNextOffset( xub_StrLen nNew ) { nNextOffset = nNew; }
    inline sal_Int32 GetNextOffset() const { return nNextOffset; }
    inline void SetNextOffset( sal_Int32 nNew ) { nNextOffset = nNew; }

    inline xub_StrLen GetNextScriptChg() const { return nNextScriptChg; }
    inline void SetNextScriptChg( xub_StrLen nNew ) { nNextScriptChg = nNew; }
    inline sal_Int32 GetNextScriptChg() const { return nNextScriptChg; }
    inline void SetNextScriptChg( sal_Int32 nNew ) { nNextScriptChg = nNew; }

    // Field cloner for SplitGlue
    virtual SwFldPortion *Clone( const OUString &rExpand ) const;
@@ -149,7 +149,7 @@ public:
                     const KSHORT nMinDst,
                     const bool bLabelAlignmentPosAndSpaceModeActive );
    virtual void Paint( const SwTxtPaintInfo &rInf ) const;
    virtual xub_StrLen GetCrsrOfst( const MSHORT nOfst ) const;
    virtual sal_Int32 GetCrsrOfst( const MSHORT nOfst ) const;
    virtual sal_Bool Format( SwTxtFormatInfo &rInf );

    // Field cloner for SplitGlue
diff --git a/sw/source/core/text/porfly.cxx b/sw/source/core/text/porfly.cxx
index 7d07630..b306a43 100644
--- a/sw/source/core/text/porfly.cxx
+++ b/sw/source/core/text/porfly.cxx
@@ -143,7 +143,7 @@ sal_Bool SwFlyCntPortion::Format( SwTxtFormatInfo &rInf )
 * @param nStart
 * @param nEnd
 */
void SwTxtFrm::MoveFlyInCnt( SwTxtFrm *pNew, xub_StrLen nStart, xub_StrLen nEnd )
void SwTxtFrm::MoveFlyInCnt( SwTxtFrm *pNew, sal_Int32 nStart, sal_Int32 nEnd )
{
    SwSortedObjs *pObjs = 0L;
    if ( 0 != (pObjs = GetDrawObjs()) )
@@ -178,12 +178,12 @@ void SwTxtFrm::MoveFlyInCnt( SwTxtFrm *pNew, xub_StrLen nStart, xub_StrLen nEnd 
    }
}

xub_StrLen SwTxtFrm::CalcFlyPos( SwFrmFmt* pSearch )
sal_Int32 SwTxtFrm::CalcFlyPos( SwFrmFmt* pSearch )
{
    SwpHints* pHints = GetTxtNode()->GetpSwpHints();
    OSL_ENSURE( pHints, "CalcFlyPos: Why me?" );
    if( !pHints )
        return STRING_LEN;
        return COMPLETE_STRING;
    SwTxtAttr* pFound = NULL;
    for ( sal_uInt16 i = 0; i < pHints->Count(); i++)
    {
@@ -197,7 +197,7 @@ xub_StrLen SwTxtFrm::CalcFlyPos( SwFrmFmt* pSearch )
    }
    OSL_ENSURE( pHints, "CalcFlyPos: Not Found!" );
    if( !pFound )
        return STRING_LEN;
        return COMPLETE_STRING;
    return *pFound->GetStart();
}

@@ -380,7 +380,7 @@ void SwFlyCntPortion::SetBase( const SwTxtFrm& rFrm, const Point &rBase,
    }
}

xub_StrLen SwFlyCntPortion::GetFlyCrsrOfst( const KSHORT nOfst,
sal_Int32 SwFlyCntPortion::GetFlyCrsrOfst( const KSHORT nOfst,
    const Point &rPoint, SwPosition *pPos, SwCrsrMoveState* pCMS ) const
{
    // Da die FlyCnt nicht an der Seite haengen, wird ihr
@@ -394,7 +394,7 @@ xub_StrLen SwFlyCntPortion::GetFlyCrsrOfst( const KSHORT nOfst,
        return 0;
}

xub_StrLen SwFlyCntPortion::GetCrsrOfst( const KSHORT nOfst ) const
sal_Int32 SwFlyCntPortion::GetCrsrOfst( const KSHORT nOfst ) const
{
    // OSL_ENSURE( !this, "SwFlyCntPortion::GetCrsrOfst: use GetFlyCrsrOfst()" );
    return SwLinePortion::GetCrsrOfst( nOfst );
diff --git a/sw/source/core/text/porfly.hxx b/sw/source/core/text/porfly.hxx
index 34a4dfe..80ef418 100644
--- a/sw/source/core/text/porfly.hxx
+++ b/sw/source/core/text/porfly.hxx
@@ -57,7 +57,7 @@ class SwFlyCntPortion : public SwLinePortion
    sal_Bool bDraw : 1;  // DrawContact?
    sal_Bool bMax : 1;   // Line adjustment and height == line height
    sal_uInt8 nAlign : 3; // Line adjustment? No, above, middle, bottom
    virtual xub_StrLen GetCrsrOfst( const KSHORT nOfst ) const;
    virtual sal_Int32 GetCrsrOfst( const KSHORT nOfst ) const;

public:
    // OD 29.07.2003 #110978# - use new datatype for parameter <nFlags>
@@ -87,7 +87,7 @@ public:
                  long nLnAscent, long nLnDescent,
                  long nFlyAscent, long nFlyDescent,
                  objectpositioning::AsCharFlags nFlags );
    xub_StrLen GetFlyCrsrOfst( const KSHORT nOfst, const Point &rPoint,
    sal_Int32 GetFlyCrsrOfst( const KSHORT nOfst, const Point &rPoint,
                        SwPosition *pPos, SwCrsrMoveState* pCMS ) const;
    virtual sal_Bool Format( SwTxtFormatInfo &rInf );
    virtual void Paint( const SwTxtPaintInfo &rInf ) const;
diff --git a/sw/source/core/text/porftn.hxx b/sw/source/core/text/porftn.hxx
index 48c5b7e..ec05631 100644
--- a/sw/source/core/text/porftn.hxx
+++ b/sw/source/core/text/porftn.hxx
@@ -100,7 +100,7 @@ class SwErgoSumPortion : public SwFldPortion
{
public:
    SwErgoSumPortion( const OUString &rExp, const OUString& rStr );
    virtual xub_StrLen GetCrsrOfst( const KSHORT nOfst ) const;
    virtual sal_Int32 GetCrsrOfst( const KSHORT nOfst ) const;
    virtual sal_Bool Format( SwTxtFormatInfo &rInf );

    // Field cloner for SplitGlue
diff --git a/sw/source/core/text/porglue.cxx b/sw/source/core/text/porglue.cxx
index 19fa51e..aea370b 100644
--- a/sw/source/core/text/porglue.cxx
+++ b/sw/source/core/text/porglue.cxx
@@ -42,7 +42,7 @@ SwGluePortion::SwGluePortion( const KSHORT nInitFixWidth )
 *                virtual SwGluePortion::GetCrsrOfst()
 *************************************************************************/

xub_StrLen SwGluePortion::GetCrsrOfst( const KSHORT nOfst ) const
sal_Int32 SwGluePortion::GetCrsrOfst( const KSHORT nOfst ) const
{
    if( !GetLen() || nOfst > GetLen() || !Width() )
        return SwLinePortion::GetCrsrOfst( nOfst );
diff --git a/sw/source/core/text/porglue.hxx b/sw/source/core/text/porglue.hxx
index 0496a8a..1c6ef74 100644
--- a/sw/source/core/text/porglue.hxx
+++ b/sw/source/core/text/porglue.hxx
@@ -45,7 +45,7 @@ public:
    inline void MoveHalfGlue( SwGluePortion *pTarget );
    inline void AdjFixWidth();
    virtual void Paint( const SwTxtPaintInfo &rInf ) const;
    virtual xub_StrLen GetCrsrOfst( const KSHORT nOfst ) const;
    virtual sal_Int32 GetCrsrOfst( const KSHORT nOfst ) const;
    virtual SwPosSize GetTxtSize( const SwTxtSizeInfo &rInfo ) const;
    virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, OUString &rTxt ) const;

diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 8b234b10..1d59791 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -353,7 +353,7 @@ void SwLineLayout::CalcLine( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf )
                    continue;
                }

                const xub_StrLen nPorSttIdx = rInf.GetLineStart() + nLineLength;
                const sal_Int32 nPorSttIdx = rInf.GetLineStart() + nLineLength;
                nLineLength = nLineLength + pPos->GetLen();
                AddPrtWidth( pPos->Width() );

@@ -624,9 +624,9 @@ SwCharRange &SwCharRange::operator+=(const SwCharRange &rRange)
    return *this;
}

SwScriptInfo::SwScriptInfo() :
    nInvalidityPos( 0 ),
    nDefaultDir( 0 )
SwScriptInfo::SwScriptInfo()
    : nInvalidityPos(0)
    , nDefaultDir(0)
{
};

@@ -641,7 +641,7 @@ SwScriptInfo::~SwScriptInfo()
 * Sw Script Types (SW_LATIN, SW_CJK, SW_CTL), used to identify the font
*************************************************************************/

sal_uInt8 SwScriptInfo::WhichFont( xub_StrLen nIdx, const OUString* pTxt, const SwScriptInfo* pSI )
sal_uInt8 SwScriptInfo::WhichFont( sal_Int32 nIdx, const OUString* pTxt, const SwScriptInfo* pSI )
{
    SAL_WARN_IF( !pTxt && !pSI, "sw.core", "How should I determine the script type?" );
    sal_uInt16 nScript;
@@ -693,8 +693,8 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
    for( i = 0; i < aHiddenMulti.GetRangeCount(); ++i )
    {
        const Range& rRange = aHiddenMulti.GetRange( i );
        const xub_StrLen nStart = (xub_StrLen)rRange.Min();
        const xub_StrLen nEnd = (xub_StrLen)rRange.Max() + 1;
        const sal_Int32 nStart = rRange.Min();
        const sal_Int32 nEnd = rRange.Max() + 1;

        aHiddenChg.push_back( nStart );
        aHiddenChg.push_back( nEnd );
@@ -704,10 +704,10 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
    // SCRIPT AND SCRIPT RELATED INFORMATION
    //

    xub_StrLen nChg = nInvalidityPos;
    sal_Int32 nChg = nInvalidityPos;

    // STRING_LEN means the data structure is up to date
    nInvalidityPos = STRING_LEN;
    // COMPLETE_STRING means the data structure is up to date
    nInvalidityPos = COMPLETE_STRING;

    // this is the default direction
    nDefaultDir = static_cast<sal_uInt8>(bRTL ? UBIDI_RTL : UBIDI_LTR);
@@ -779,7 +779,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
    if ( nChg )
        --nChg;

    const xub_StrLen nGrpStart = nCnt ? GetScriptChg( nCnt - 1 ) : 0;
    const sal_Int32 nGrpStart = nCnt ? GetScriptChg( nCnt - 1 ) : 0;

    // we go back in our group until we reach the first character of
    // type nScript
@@ -800,7 +800,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
    aScriptChanges.erase( aScriptChanges.begin() + nCnt, aScriptChanges.end() );

    // get the start of the last compression group
    sal_uInt16 nLastCompression = nChg;
    sal_Int32 nLastCompression = nChg;
    if( nCntComp )
    {
        --nCntComp;
@@ -816,7 +816,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
    aCompressionChanges.erase(aCompressionChanges.begin() + nCntComp, aCompressionChanges.end() );

    // get the start of the last kashida group
    sal_uInt16 nLastKashida = nChg;
    sal_Int32 nLastKashida = nChg;
    if( nCntKash && i18n::ScriptType::COMPLEX == nScript )
    {
        --nCntKash;
@@ -837,8 +837,8 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
        // all of the characters in this grounp are weak. We have to assign
        // the scripts to these characters depending on the fonts which are
        // set for these characters to display them.
        xub_StrLen nEnd =
                (xub_StrLen)g_pBreakIt->GetBreakIter()->endOfScript( rTxt, nChg, WEAK );
        sal_Int32 nEnd =
                g_pBreakIt->GetBreakIter()->endOfScript( rTxt, nChg, WEAK );

        if( nEnd > rTxt.getLength() )
            nEnd = rTxt.getLength();
@@ -874,8 +874,8 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
                "sw.core", "Inserting WEAK into SwScriptInfo structure" );
        SAL_WARN_IF( STRING_LEN == nChg, "sw.core", "65K? Strange length of script section" );

        xub_StrLen nSearchStt = nChg;
        nChg = (xub_StrLen)g_pBreakIt->GetBreakIter()->endOfScript( rTxt, nSearchStt, nScript );
        sal_Int32 nSearchStt = nChg;
        nChg = g_pBreakIt->GetBreakIter()->endOfScript( rTxt, nSearchStt, nScript );

        if ( nChg > rTxt.getLength() )
            nChg = rTxt.getLength();
@@ -886,11 +886,11 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
        if( i18n::ScriptType::COMPLEX == nScript )
        {
            const short nScriptType = ScriptTypeDetector::getCTLScriptType( rTxt, nSearchStt );
            xub_StrLen nNextCTLScriptStart = nSearchStt;
            sal_Int32 nNextCTLScriptStart = nSearchStt;
            short nCurrentScriptType = nScriptType;
            while( com::sun::star::i18n::CTLScriptType::CTL_UNKNOWN == nCurrentScriptType || nScriptType == nCurrentScriptType )
            {
                nNextCTLScriptStart = (xub_StrLen)ScriptTypeDetector::endOfCTLScriptType( rTxt, nNextCTLScriptStart );
                nNextCTLScriptStart = ScriptTypeDetector::endOfCTLScriptType( rTxt, nNextCTLScriptStart );
                if( nNextCTLScriptStart < rTxt.getLength() && nNextCTLScriptStart < nChg )
                    nCurrentScriptType = ScriptTypeDetector::getCTLScriptType( rTxt, nNextCTLScriptStart );
                else
@@ -928,7 +928,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
        {
            sal_uInt8 ePrevState = NONE;
            sal_uInt8 eState;
            sal_uInt16 nPrevChg = nLastCompression;
            sal_Int32 nPrevChg = nLastCompression;

            while ( nLastCompression < nChg )
            {
@@ -1203,9 +1203,9 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
        {
            const sal_uInt8 nCurrDirType = GetDirType( nDirIdx );
                // nStart ist start of RTL run:
                const xub_StrLen nStart = nDirIdx > 0 ? GetDirChg( nDirIdx - 1 ) : 0;
                const sal_Int32 nStart = nDirIdx > 0 ? GetDirChg( nDirIdx - 1 ) : 0;
                // nEnd is end of RTL run:
                const xub_StrLen nEnd = GetDirChg( nDirIdx );
                const sal_Int32 nEnd = GetDirChg( nDirIdx );

            if ( nCurrDirType % 2 == UBIDI_RTL  || // text in RTL run
                ( nCurrDirType > UBIDI_LTR && !lcl_HasStrongLTR( rTxt, nStart, nEnd ) ) ) // non-strong text in embedded LTR run
@@ -1220,7 +1220,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
                while ( GetScriptChg( nScriptIdx ) <= nStart )
                    ++nScriptIdx;

                const xub_StrLen nStartPosOfGroup = nScriptIdx ? GetScriptChg( nScriptIdx - 1 ) : 0;
                const sal_Int32 nStartPosOfGroup = nScriptIdx ? GetScriptChg( nScriptIdx - 1 ) : 0;
                const sal_uInt8 nScriptTypeOfGroup = GetScriptType( nScriptIdx );

                SAL_WARN_IF( nStartPosOfGroup > nStart || GetScriptChg( nScriptIdx ) <= nStart,
@@ -1250,7 +1250,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
                // Check that ScriptChangeInfos are in increasing order of
                // position and that we don't have "empty" changes.
                sal_uInt8 nLastTyp = i18n::ScriptType::WEAK;
                xub_StrLen nLastPos = 0;
                sal_Int32 nLastPos = 0;
                for (std::vector<ScriptChangeInfo>::const_iterator i2 = aScriptChanges.begin(); i2 != aScriptChanges.end(); ++i2)
                {
                    SAL_WARN_IF( nLastTyp == i2->type ||
@@ -1279,11 +1279,11 @@ void SwScriptInfo::UpdateBidiInfo( const OUString& rTxt )
    ubidi_setPara( pBidi, reinterpret_cast<const UChar *>(rTxt.getStr()), rTxt.getLength(),    // UChar != sal_Unicode in MinGW
                   nDefaultDir, NULL, &nError );
    nError = U_ZERO_ERROR;
    long nCount = ubidi_countRuns( pBidi, &nError );
    int nCount = ubidi_countRuns( pBidi, &nError );
    int32_t nStart = 0;
    int32_t nEnd;
    UBiDiLevel nCurrDir;
    for ( sal_uInt16 nIdx = 0; nIdx < nCount; ++nIdx )
    for ( int nIdx = 0; nIdx < nCount; ++nIdx )
    {
        ubidi_getLogicalRun( pBidi, nStart, &nEnd, &nCurrDir );
        aDirectionChanges.push_back( DirectionChangeInfo(nEnd, nCurrDir) );
@@ -1299,13 +1299,13 @@ void SwScriptInfo::UpdateBidiInfo( const OUString& rTxt )
 * returns the position of the next character which belongs to another script
 * than the character of the actual (input) position.
 * If there's no script change until the end of the paragraph, it will return
 * STRING_LEN.
 * COMPLETE_STRING.
 * Scripts are Asian (Chinese, Japanese, Korean),
 *             Latin ( English etc.)
 *         and Complex ( Hebrew, Arabian )
 *************************************************************************/

xub_StrLen SwScriptInfo::NextScriptChg( const xub_StrLen nPos )  const
sal_Int32 SwScriptInfo::NextScriptChg(const sal_Int32 nPos)  const
{
    sal_uInt16 nEnd = CountScriptChg();
    for( sal_uInt16 nX = 0; nX < nEnd; ++nX )
@@ -1314,7 +1314,7 @@ xub_StrLen SwScriptInfo::NextScriptChg( const xub_StrLen nPos )  const
            return GetScriptChg( nX );
    }

    return STRING_LEN;
    return COMPLETE_STRING;
}

/*************************************************************************
@@ -1322,7 +1322,7 @@ xub_StrLen SwScriptInfo::NextScriptChg( const xub_StrLen nPos )  const
 * returns the script of the character at the input position
 *************************************************************************/

sal_uInt8 SwScriptInfo::ScriptType( const xub_StrLen nPos ) const
sal_uInt8 SwScriptInfo::ScriptType(const sal_Int32 nPos) const
{
    sal_uInt16 nEnd = CountScriptChg();
    for( sal_uInt16 nX = 0; nX < nEnd; ++nX )
@@ -1335,7 +1335,7 @@ sal_uInt8 SwScriptInfo::ScriptType( const xub_StrLen nPos ) const
    return (sal_uInt8)GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() );
}

xub_StrLen SwScriptInfo::NextDirChg( const xub_StrLen nPos,
sal_Int32 SwScriptInfo::NextDirChg( const sal_Int32 nPos,
                                     const sal_uInt8* pLevel )  const
{
    sal_uInt8 nCurrDir = pLevel ? *pLevel : 62;
@@ -1347,10 +1347,10 @@ xub_StrLen SwScriptInfo::NextDirChg( const xub_StrLen nPos,
            return GetDirChg( nX );
    }

    return STRING_LEN;
    return COMPLETE_STRING;
}

sal_uInt8 SwScriptInfo::DirType( const xub_StrLen nPos ) const
sal_uInt8 SwScriptInfo::DirType(const sal_Int32 nPos) const
{
    sal_uInt16 nEnd = CountDirChg();
    for( sal_uInt16 nX = 0; nX < nEnd; ++nX )
@@ -1367,15 +1367,15 @@ sal_uInt8 SwScriptInfo::DirType( const xub_StrLen nPos ) const
 * Takes a string and replaced the hidden ranges with cChar.
 **************************************************************************/

sal_uInt16 SwScriptInfo::MaskHiddenRanges( const SwTxtNode& rNode, OUStringBuffer & rText,
                                       const xub_StrLen nStt, const xub_StrLen nEnd,
sal_Int32 SwScriptInfo::MaskHiddenRanges( const SwTxtNode& rNode, OUStringBuffer & rText,
                                       const sal_Int32 nStt, const sal_Int32 nEnd,
                                       const sal_Unicode cChar )
{
    assert(rNode.GetTxt().getLength() == rText.getLength());

    PositionList aList;
    xub_StrLen nHiddenStart;
    xub_StrLen nHiddenEnd;
    sal_Int32 nHiddenStart;
    sal_Int32 nHiddenEnd;
    sal_uInt16 nNumOfHiddenChars = 0;
    GetBoundsOfHiddenRange( rNode, 0, nHiddenStart, nHiddenEnd, &aList );
    PositionList::const_reverse_iterator rFirst( aList.end() );
@@ -1410,8 +1410,8 @@ sal_uInt16 SwScriptInfo::MaskHiddenRanges( const SwTxtNode& rNode, OUStringBuffe
void SwScriptInfo::DeleteHiddenRanges( SwTxtNode& rNode )
{
    PositionList aList;
    xub_StrLen nHiddenStart;
    xub_StrLen nHiddenEnd;
    sal_Int32 nHiddenStart;
    sal_Int32 nHiddenEnd;
    GetBoundsOfHiddenRange( rNode, 0, nHiddenStart, nHiddenEnd, &aList );
    PositionList::const_reverse_iterator rFirst( aList.end() );
    PositionList::const_reverse_iterator rLast( aList.begin() );
@@ -1430,11 +1430,11 @@ void SwScriptInfo::DeleteHiddenRanges( SwTxtNode& rNode )
 * static version
 **************************************************************************/

bool SwScriptInfo::GetBoundsOfHiddenRange( const SwTxtNode& rNode, xub_StrLen nPos,
                                           xub_StrLen& rnStartPos, xub_StrLen& rnEndPos,
bool SwScriptInfo::GetBoundsOfHiddenRange( const SwTxtNode& rNode, sal_Int32 nPos,
                                           sal_Int32& rnStartPos, sal_Int32& rnEndPos,
                                           PositionList* pList )
{
    rnStartPos = STRING_LEN;
    rnStartPos = COMPLETE_STRING;
    rnEndPos = 0;

    bool bNewContainsHiddenChars = false;
@@ -1487,8 +1487,8 @@ bool SwScriptInfo::GetBoundsOfHiddenRange( const SwTxtNode& rNode, xub_StrLen nP
        for( sal_uInt16 i = 0; i < aHiddenMulti.GetRangeCount(); ++i )
        {
            const Range& rRange = aHiddenMulti.GetRange( i );
            const xub_StrLen nHiddenStart = (xub_StrLen)rRange.Min();
            const xub_StrLen nHiddenEnd = (xub_StrLen)rRange.Max() + 1;
            const sal_Int32 nHiddenStart = rRange.Min();
            const sal_Int32 nHiddenEnd = rRange.Max() + 1;

            if ( nHiddenStart > nPos )
                break;
@@ -1506,8 +1506,8 @@ bool SwScriptInfo::GetBoundsOfHiddenRange( const SwTxtNode& rNode, xub_StrLen nP
            for( sal_uInt16 i = 0; i < aHiddenMulti.GetRangeCount(); ++i )
            {
                const Range& rRange = aHiddenMulti.GetRange( i );
                pList->push_back( (xub_StrLen)rRange.Min() );
                pList->push_back( (xub_StrLen)rRange.Max() + 1 );
                pList->push_back( rRange.Min() );
                pList->push_back( rRange.Max() + 1 );
            }
        }

@@ -1522,17 +1522,17 @@ bool SwScriptInfo::GetBoundsOfHiddenRange( const SwTxtNode& rNode, xub_StrLen nP
 * non-static version
 **************************************************************************/

bool SwScriptInfo::GetBoundsOfHiddenRange( xub_StrLen nPos, xub_StrLen& rnStartPos,
                                           xub_StrLen& rnEndPos, PositionList* pList ) const
bool SwScriptInfo::GetBoundsOfHiddenRange( sal_Int32 nPos, sal_Int32& rnStartPos,
                                           sal_Int32& rnEndPos, PositionList* pList ) const
{
    rnStartPos = STRING_LEN;
    rnStartPos = COMPLETE_STRING;
    rnEndPos = 0;

    sal_uInt16 nEnd = CountHiddenChg();
    for( sal_uInt16 nX = 0; nX < nEnd; ++nX )
    {
        const xub_StrLen nHiddenStart = GetHiddenChg( nX++ );
        const xub_StrLen nHiddenEnd = GetHiddenChg( nX );
        const sal_Int32 nHiddenStart = GetHiddenChg( nX++ );
        const sal_Int32 nHiddenEnd = GetHiddenChg( nX );

        if ( nHiddenStart > nPos )
            break;
@@ -1556,12 +1556,12 @@ bool SwScriptInfo::GetBoundsOfHiddenRange( xub_StrLen nPos, xub_StrLen& rnStartP
    return CountHiddenChg() > 0;
}

bool SwScriptInfo::IsInHiddenRange( const SwTxtNode& rNode, xub_StrLen nPos )
bool SwScriptInfo::IsInHiddenRange( const SwTxtNode& rNode, sal_Int32 nPos )
{
    xub_StrLen nStartPos;
    xub_StrLen nEndPos;
    sal_Int32 nStartPos;
    sal_Int32 nEndPos;
    SwScriptInfo::GetBoundsOfHiddenRange( rNode, nPos, nStartPos, nEndPos );
    return nStartPos != STRING_LEN;
    return nStartPos != COMPLETE_STRING;
}


@@ -1571,12 +1571,12 @@ bool SwScriptInfo::IsInHiddenRange( const SwTxtNode& rNode, xub_StrLen nPos )
 * returns the type of the compressed character
 *************************************************************************/

sal_uInt8 SwScriptInfo::CompType( const xub_StrLen nPos ) const
sal_uInt8 SwScriptInfo::CompType( const sal_Int32 nPos ) const
{
    sal_uInt16 nEnd = CountCompChg();
    for( sal_uInt16 nX = 0; nX < nEnd; ++nX )
    {
        xub_StrLen nChg = GetCompStart( nX );
        sal_Int32 nChg = GetCompStart( nX );

        if ( nPos < nChg )
            return NONE;
@@ -1594,15 +1594,15 @@ sal_uInt8 SwScriptInfo::CompType( const xub_StrLen nPos ) const
 * between nStart and nEnd
 *************************************************************************/

sal_uInt16 SwScriptInfo::HasKana( xub_StrLen nStart, const xub_StrLen nLen ) const
sal_uInt16 SwScriptInfo::HasKana( sal_Int32 nStart, const sal_Int32 nLen ) const
{
    sal_uInt16 nCnt = CountCompChg();
    xub_StrLen nEnd = nStart + nLen;
    sal_Int32 nEnd = nStart + nLen;

    for( sal_uInt16 nX = 0; nX < nCnt; ++nX )
    {
        xub_StrLen nKanaStart  = GetCompStart( nX );
        xub_StrLen nKanaEnd = nKanaStart + GetCompLen( nX );
        sal_Int32 nKanaStart  = GetCompStart( nX );
        sal_Int32 nKanaEnd = nKanaStart + GetCompLen( nX );

        if ( nKanaStart >= nEnd )
            return USHRT_MAX;
@@ -1614,7 +1614,7 @@ sal_uInt16 SwScriptInfo::HasKana( xub_StrLen nStart, const xub_StrLen nLen ) con
    return USHRT_MAX;
}

long SwScriptInfo::Compress( sal_Int32* pKernArray, xub_StrLen nIdx, xub_StrLen nLen,
long SwScriptInfo::Compress( sal_Int32* pKernArray, sal_Int32 nIdx, sal_Int32 nLen,
                             const sal_uInt16 nCompress, const sal_uInt16 nFontHeight,
                             Point* pPoint ) const
{
@@ -1632,8 +1632,8 @@ long SwScriptInfo::Compress( sal_Int32* pKernArray, xub_StrLen nIdx, xub_StrLen 
    if ( USHRT_MAX == nCompIdx )
        return 0;

    xub_StrLen nChg = GetCompStart( nCompIdx );
    xub_StrLen nCompLen = GetCompLen( nCompIdx );
    sal_Int32 nChg = GetCompStart( nCompIdx );
    sal_Int32 nCompLen = GetCompLen( nCompIdx );
    sal_uInt16 nI = 0;
    nLen = nLen + nIdx;

@@ -1703,7 +1703,7 @@ long SwScriptInfo::Compress( sal_Int32* pKernArray, xub_StrLen nIdx, xub_StrLen 

        if( nIdx < nLen )
        {
            xub_StrLen nTmpChg;
            sal_Int32 nTmpChg;
            if( ++nCompIdx < nCompCount )
            {
                nTmpChg = GetCompStart( nCompIdx );
@@ -1837,7 +1837,7 @@ bool SwScriptInfo::IsArabicText( const OUString& rTxt, sal_Int32 nStt, sal_Int32
    const CharClass& rCC = GetAppCharClass();
    sal_Int32 nIdx = nStt;
    const sal_Int32 nEnd = nStt + nLen;
    while ( nIdx < nEnd && !rCC.isLetterNumeric( rTxt, (xub_StrLen)nIdx ) )
    while ( nIdx < nEnd && !rCC.isLetterNumeric( rTxt, nIdx ) )
    {
        ++nIdx;
    }
@@ -1846,7 +1846,7 @@ bool SwScriptInfo::IsArabicText( const OUString& rTxt, sal_Int32 nStt, sal_Int32
    {
        // no regular character found in this portion. Go backward:
        --nIdx;
        while ( nIdx >= 0 && !rCC.isLetterNumeric( rTxt, (xub_StrLen)nIdx ) )
        while ( nIdx >= 0 && !rCC.isLetterNumeric( rTxt, nIdx ) )
        {
            --nIdx;
        }
@@ -2088,7 +2088,7 @@ SwScriptInfo* SwScriptInfo::GetScriptInfo( const SwTxtNode& rTNd,
            pScriptInfo = (SwScriptInfo*)pLast->GetScriptInfo();
            if ( pScriptInfo )
            {
                if ( !bAllowInvalid && STRING_LEN != pScriptInfo->GetInvalidity() )
                if ( !bAllowInvalid && COMPLETE_STRING != pScriptInfo->GetInvalidityA() )
                    pScriptInfo = 0;
                else break;
            }
@@ -2108,9 +2108,9 @@ SwParaPortion::~SwParaPortion()
{
}

xub_StrLen SwParaPortion::GetParLen() const
sal_Int32 SwParaPortion::GetParLen() const
{
    xub_StrLen nLen = 0;
    sal_Int32 nLen = 0;
    const SwLineLayout *pLay = this;
    while( pLay )
    {
@@ -2222,8 +2222,8 @@ void SwScriptInfo::selectHiddenTextProperty(const SwTxtNode& rNode, MultiSelecti
                static_cast<const SvxCharHiddenItem*>( CharFmt::GetItem( *pTxtAttr, RES_CHRATR_HIDDEN ) );
            if( pHiddenItem )
            {
                const xub_StrLen nSt = *pTxtAttr->GetStart();
                const xub_StrLen nEnd = *pTxtAttr->End();
                const sal_Int32 nSt = *pTxtAttr->GetStart();
                const sal_Int32 nEnd = *pTxtAttr->End();
                if( nEnd > nSt )
                {
                    Range aTmp( nSt, nEnd - 1 );
@@ -2251,8 +2251,8 @@ void SwScriptInfo::selectRedLineDeleted(const SwTxtNode& rNode, MultiSelection &
            if ( pRed->Start()->nNode > rNode.GetIndex() )
                break;

            xub_StrLen nRedlStart;
            xub_StrLen nRedlnEnd;
            sal_Int32 nRedlStart;
            sal_Int32 nRedlnEnd;
            pRed->CalcStartEnd( rNode.GetIndex(), nRedlStart, nRedlnEnd );
            //clip it if the redline extends past the end of the nodes text
            nRedlnEnd = std::min<sal_Int32>(nRedlnEnd, rNode.GetTxt().getLength());
@@ -2287,8 +2287,8 @@ void SwScriptInfo::CalcHiddenRanges( const SwTxtNode& rNode, MultiSelection& rHi
    if ( bNewContainsHiddenChars )
    {
        const Range& rRange = rHiddenMulti.GetRange( 0 );
        const xub_StrLen nHiddenStart = (xub_StrLen)rRange.Min();
        const xub_StrLen nHiddenEnd = (xub_StrLen)rRange.Max() + 1;
        const sal_Int32 nHiddenStart = rRange.Min();
        const sal_Int32 nHiddenEnd = rRange.Max() + 1;
        bNewHiddenCharsHidePara =
            (nHiddenStart == 0 && nHiddenEnd >= rNode.GetTxt().getLength());
    }
diff --git a/sw/source/core/text/porlay.hxx b/sw/source/core/text/porlay.hxx
index 869cb54..667f13d 100644
--- a/sw/source/core/text/porlay.hxx
+++ b/sw/source/core/text/porlay.hxx
@@ -41,18 +41,18 @@ class SwTxtFormatter;

class SwCharRange
{
    xub_StrLen nStart, nLen;
    sal_Int32 nStart, nLen;
public:
    inline SwCharRange( const xub_StrLen nInitStart = 0,
        const xub_StrLen nInitLen = 0): nStart( nInitStart ), nLen(nInitLen) {}
    inline xub_StrLen &Start() { return nStart; }
    inline const xub_StrLen &Start() const { return nStart; }
    inline void LeftMove( xub_StrLen nNew )
    inline SwCharRange( const sal_Int32 nInitStart = 0,
        const sal_Int32 nInitLen = 0): nStart( nInitStart ), nLen(nInitLen) {}
    inline sal_Int32 &Start() { return nStart; }
    inline const sal_Int32 &Start() const { return nStart; }
    inline void LeftMove( sal_Int32 nNew )
            { if ( nNew < nStart ) { nLen += nStart-nNew; nStart = nNew; } }
    inline xub_StrLen End() const
    inline sal_Int32 End() const
                { return nStart + nLen; }
    inline xub_StrLen &Len() { return nLen; }
    inline const xub_StrLen &Len() const { return nLen; }
    inline sal_Int32 &Len() { return nLen; }
    inline const sal_Int32 &Len() const { return nLen; }
    inline bool operator<(const SwCharRange &rRange) const
                { return nStart < rRange.nStart; }
    inline bool operator>(const SwCharRange &rRange) const
@@ -302,7 +302,7 @@ public:
    inline const SwScriptInfo& GetScriptInfo() const { return aScriptInfo; }

    // For SwTxtFrm::Format: returns the paragraph's current length
    xub_StrLen GetParLen() const;
    sal_Int32 GetParLen() const;

    // For Prepare()
    sal_Bool UpdateQuoVadis( const OUString &rQuo );
@@ -388,7 +388,7 @@ inline void SwParaPortion::ResetPreps()
inline void SwParaPortion::FormatReset()
{
    nDelta = 0;
    aReformat = SwCharRange( 0, STRING_LEN );
    aReformat = SwCharRange(0, COMPLETE_STRING);
    // bFlys needs to be retained in SwTxtFrm::_Format() so that empty
    // paragraphs that needed to avoid Frames with no flow, reformat
    // when the Frame disappears from the Area
diff --git a/sw/source/core/text/porlin.cxx b/sw/source/core/text/porlin.cxx
index de3124b..f299df4 100644
--- a/sw/source/core/text/porlin.cxx
+++ b/sw/source/core/text/porlin.cxx
@@ -264,7 +264,7 @@ SwLinePortion *SwLinePortion::FindPrevPortion( const SwLinePortion *pRoot )
 *                virtual SwLinePortion::GetCrsrOfst()
 *************************************************************************/

xub_StrLen SwLinePortion::GetCrsrOfst( const KSHORT nOfst ) const
sal_Int32 SwLinePortion::GetCrsrOfst( const KSHORT nOfst ) const
{
    if( nOfst > ( PrtWidth() / 2 ) )
        return GetLen();
diff --git a/sw/source/core/text/porlin.hxx b/sw/source/core/text/porlin.hxx
index 429d865..e6d3e56 100644
--- a/sw/source/core/text/porlin.hxx
+++ b/sw/source/core/text/porlin.hxx
@@ -64,7 +64,7 @@ protected:
    // Here we have areas with different attributes
    SwLinePortion *pPortion;
    // Count of chars and spaces on the line
    xub_StrLen nLineLength;
    sal_Int32 nLineLength;
    KSHORT nAscent;      // Maximum ascender

    SwLinePortion();
@@ -83,8 +83,8 @@ public:
    inline SwLinePortion *GetPortion() const { return( pPortion ); }
    inline SwLinePortion &operator=(const SwLinePortion &rPortion);
    inline bool operator==( const SwLinePortion &rPortion ) const;
    inline xub_StrLen GetLen() const { return nLineLength; }
    inline void SetLen( const xub_StrLen nLen ) { nLineLength = nLen; }
    inline sal_Int32 GetLen() const { return nLineLength; }
    inline void SetLen( const sal_Int32 nLen ) { nLineLength = nLen; }
    inline void SetPortion( SwLinePortion *pNew ){ pPortion = pNew; }
    inline KSHORT &GetAscent() { return nAscent; }
    inline KSHORT GetAscent() const { return nAscent; }
@@ -161,7 +161,7 @@ public:
    SwLinePortion *FindPrevPortion( const SwLinePortion *pRoot );
    SwLinePortion *FindLastPortion();

    virtual xub_StrLen GetCrsrOfst( const KSHORT nOfst ) const;
    virtual sal_Int32 GetCrsrOfst( const KSHORT nOfst ) const;
    virtual SwPosSize GetTxtSize( const SwTxtSizeInfo &rInfo ) const;
    void CalcTxtSize( const SwTxtSizeInfo &rInfo );

diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx
index ec356ed..1862eb5 100644
--- a/sw/source/core/text/pormulti.cxx
+++ b/sw/source/core/text/pormulti.cxx
@@ -171,7 +171,7 @@ void SwMultiPortion::ActualizeTabulator()
 * --------------------------------------------------*/

SwRotatedPortion::SwRotatedPortion( const SwMultiCreator& rCreate,
    xub_StrLen nEnd, sal_Bool bRTL ) : SwMultiPortion( nEnd )
    sal_Int32 nEnd, sal_Bool bRTL ) : SwMultiPortion( nEnd )
{
    const SvxCharRotateItem* pRot = (SvxCharRotateItem*)rCreate.pItem;
    if( !pRot )
@@ -200,7 +200,7 @@ SwRotatedPortion::SwRotatedPortion( const SwMultiCreator& rCreate,
 * SwBidiPortion::SwBidiPortion(..)
 * --------------------------------------------------*/

SwBidiPortion::SwBidiPortion( xub_StrLen nEnd, sal_uInt8 nLv )
SwBidiPortion::SwBidiPortion( sal_Int32 nEnd, sal_uInt8 nLv )
    : SwMultiPortion( nEnd ), nLevel( nLv )
{
    SetBidi();
@@ -230,11 +230,11 @@ sal_Bool SwBidiPortion::ChgSpaceAdd( SwLineLayout* pCurr, long nSpaceAdd ) const
    return bRet;
}

xub_StrLen SwBidiPortion::GetSpaceCnt( const SwTxtSizeInfo &rInf ) const
sal_Int32 SwBidiPortion::GetSpaceCnt( const SwTxtSizeInfo &rInf ) const
{
    // Calculate number of blanks for justified alignment
    SwLinePortion* pPor = GetRoot().GetFirstPortion();
    xub_StrLen nTmpStart = rInf.GetIdx();
    sal_Int32 nTmpStart = rInf.GetIdx();
    sal_Int32 nNull = 0;
    sal_Int32 nBlanks;

@@ -261,7 +261,7 @@ xub_StrLen SwBidiPortion::GetSpaceCnt( const SwTxtSizeInfo &rInf ) const
 * --------------------------------------------------*/

SwDoubleLinePortion::SwDoubleLinePortion( SwDoubleLinePortion& rDouble,
                                          xub_StrLen nEnd ) :
                                          sal_Int32 nEnd ) :
    SwMultiPortion( nEnd ),
    pBracket( 0 )
{
@@ -289,7 +289,7 @@ SwDoubleLinePortion::SwDoubleLinePortion( SwDoubleLinePortion& rDouble,
 * --------------------------------------------------*/

SwDoubleLinePortion::SwDoubleLinePortion( const SwMultiCreator& rCreate,
    xub_StrLen nEnd ) : SwMultiPortion( nEnd ), pBracket( new SwBracket() )
    sal_Int32 nEnd ) : SwMultiPortion( nEnd ), pBracket( new SwBracket() )
{
    SetDouble();
    const SvxTwoLinesItem* pTwo = (SvxTwoLinesItem*)rCreate.pItem;
@@ -544,8 +544,8 @@ sal_Bool SwDoubleLinePortion::ChgSpaceAdd( SwLineLayout* pCurr,
        }
        else
        {
            xub_StrLen nMyBlank = GetSmallerSpaceCnt();
            xub_StrLen nOther = GetSpaceCnt();
            sal_Int32 nMyBlank = GetSmallerSpaceCnt();
            sal_Int32 nOther = GetSpaceCnt();
            SwTwips nMultiSpace = pCurr->GetLLSpaceAdd( 0 ) * nMyBlank + nOther * nSpaceAdd;

            if( nMyBlank )
@@ -588,7 +588,7 @@ SwDoubleLinePortion::~SwDoubleLinePortion()
 * --------------------------------------------------*/


SwRubyPortion::SwRubyPortion( const SwRubyPortion& rRuby, xub_StrLen nEnd ) :
SwRubyPortion::SwRubyPortion( const SwRubyPortion& rRuby, sal_Int32 nEnd ) :
    SwMultiPortion( nEnd ),
    nRubyOffset( rRuby.GetRubyOffset() ),
    nAdjustment( rRuby.GetAdjustment() )
@@ -606,7 +606,7 @@ SwRubyPortion::SwRubyPortion( const SwRubyPortion& rRuby, xub_StrLen nEnd ) :

SwRubyPortion::SwRubyPortion( const SwMultiCreator& rCreate, const SwFont& rFnt,
                              const IDocumentSettingAccess& rIDocumentSettingAccess,
                              xub_StrLen nEnd, xub_StrLen nOffs,
                              sal_Int32 nEnd, sal_Int32 nOffs,
                              const sal_Bool* pForceRubyPos )
     : SwMultiPortion( nEnd )
{
@@ -681,7 +681,7 @@ SwRubyPortion::SwRubyPortion( const SwMultiCreator& rCreate, const SwFont& rFnt,
void SwRubyPortion::_Adjust( SwTxtFormatInfo &rInf )
{
    SwTwips nLineDiff = GetRoot().Width() - GetRoot().GetNext()->Width();
    xub_StrLen nOldIdx = rInf.GetIdx();
    sal_Int32 nOldIdx = rInf.GetIdx();
    if( !nLineDiff )
        return;
    SwLineLayout *pCurr;
@@ -791,7 +791,7 @@ void SwRubyPortion::CalcRubyOffset()
        if( pFld->HasFollow() )
            nRubyOffset = pFld->GetNextOffset();
        else
            nRubyOffset = STRING_LEN;
            nRubyOffset = COMPLETE_STRING;
    }
}

@@ -866,7 +866,7 @@ static bool lcl_HasRotation( const SwTxtAttr& rAttr,
    return false;
}

SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos,
SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( sal_Int32 &rPos,
                                                SwMultiPortion* pMulti ) const
{
    SwScriptInfo& rSI = ((SwParaPortion*)GetParaPortion())->GetScriptInfo();
@@ -897,7 +897,7 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos,
    if ( GetTxt().getLength() != rPos && nNextLevel > nCurrLevel )
    {
        rPos = bFldBidi ? rPos + 1 : rSI.NextDirChg( rPos, &nCurrLevel );
        if ( STRING_LEN == rPos )
        if ( COMPLETE_STRING == rPos )
            return NULL;
        SwMultiCreator *pRet = new SwMultiCreator;
        pRet->pItem = NULL;
@@ -944,7 +944,7 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos,
    for( i = 0; i < nCount; ++i )
    {
        const SwTxtAttr *pTmp = (*pHints)[i];
        xub_StrLen nStart = *pTmp->GetStart();
        sal_Int32 nStart = *pTmp->GetStart();
        if( rPos < nStart )
            break;
        if( *pTmp->GetAnyEnd() > rPos )
@@ -986,7 +986,7 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos,
        SwMultiCreator *pRet = new SwMultiCreator;

        // We note the endpositions of the 2-line attributes in aEnd as stack
        std::deque< xub_StrLen > aEnd;
        std::deque< sal_Int32 > aEnd;

        // The bOn flag signs the state of the last 2-line attribute in the
        // aEnd-stack, it is compatible with the winner-attribute or
@@ -1103,7 +1103,7 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos,
        pRet->nId = SW_MC_ROTATE;

        // We note the endpositions of the 2-line attributes in aEnd as stack
        std::deque< xub_StrLen > aEnd;
        std::deque< sal_Int32 > aEnd;

        // The bOn flag signs the state of the last 2-line attribute in the
        // aEnd-stack, which could interrupts the winning rotation attribute.
@@ -1112,7 +1112,7 @@ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos,
        // n2Lines is the index of the last 2-line-attribute, which contains
        // the actual position.
        i = 0;
        xub_StrLen n2Start = rPos;
        sal_Int32 n2Start = rPos;
        while( i < nCount )
        {
            const SwTxtAttr *pTmp = (*pHints)[i++];
@@ -1392,10 +1392,10 @@ void SwTxtPainter::PaintMultiPortion( const SwRect &rPaint,
        rMulti.GetPortion()->PrePaint( GetInfo(), &rMulti );

    // old values must be saved and restored at the end
    xub_StrLen nOldLen = GetInfo().GetLen();
    sal_Int32 nOldLen = GetInfo().GetLen();
    KSHORT nOldX = KSHORT(GetInfo().X());
    long nOldY = GetInfo().Y();
    xub_StrLen nOldIdx = GetInfo().GetIdx();
    sal_Int32 nOldIdx = GetInfo().GetIdx();

    SwSpaceManipulator aManip( GetInfo(), rMulti );

@@ -1420,7 +1420,7 @@ void SwTxtPainter::PaintMultiPortion( const SwRect &rPaint,

    if( rMulti.HasBrackets() )
    {
        xub_StrLen nTmpOldIdx = GetInfo().GetIdx();
        sal_Int32 nTmpOldIdx = GetInfo().GetIdx();
        GetInfo().SetIdx(((SwDoubleLinePortion&)rMulti).GetBrackets()->nStart);
        SeekAndChg( GetInfo() );
        ((SwDoubleLinePortion&)rMulti).PaintBracket( GetInfo(), 0, sal_True );
@@ -1645,7 +1645,7 @@ void SwTxtPainter::PaintMultiPortion( const SwRect &rPaint,

    if( rMulti.HasBrackets() )
    {
        xub_StrLen nTmpOldIdx = GetInfo().GetIdx();
        sal_Int32 nTmpOldIdx = GetInfo().GetIdx();
        GetInfo().SetIdx(((SwDoubleLinePortion&)rMulti).GetBrackets()->nStart);
        SeekAndChg( GetInfo() );
        GetInfo().X( nOldX );
@@ -1693,7 +1693,7 @@ static bool lcl_ExtractFieldFollow( SwLineLayout* pLine, SwLinePortion* &rpFld )
 * --------------------------------------------------*/

static void lcl_TruncateMultiPortion( SwMultiPortion& rMulti, SwTxtFormatInfo& rInf,
                               xub_StrLen nStartIdx )
                               sal_Int32 nStartIdx )
{
    rMulti.GetRoot().Truncate();
    rMulti.GetRoot().SetLen(0);
@@ -1725,7 +1725,7 @@ sal_Bool SwTxtFormatter::BuildMultiPortion( SwTxtFormatInfo &rInf,

    if( rMulti.HasBrackets() )
    {
        xub_StrLen nOldIdx = rInf.GetIdx();
        sal_Int32 nOldIdx = rInf.GetIdx();
        rInf.SetIdx( ((SwDoubleLinePortion&)rMulti).GetBrackets()->nStart );
        SeekAndChg( rInf );
        nOldX = KSHORT(GetInfo().X());
@@ -1797,11 +1797,11 @@ sal_Bool SwTxtFormatter::BuildMultiPortion( SwTxtFormatInfo &rInf,

    pMulti = &rMulti;
    SwLineLayout *pOldCurr = pCurr;
    xub_StrLen nOldStart = GetStart();
    sal_Int32 nOldStart = GetStart();
    SwTwips nMinWidth = nTmpX + 1;
    SwTwips nActWidth = nMaxWidth;
    const xub_StrLen nStartIdx = rInf.GetIdx();
    xub_StrLen nMultiLen = rMulti.GetLen();
    const sal_Int32 nStartIdx = rInf.GetIdx();
    sal_Int32 nMultiLen = rMulti.GetLen();

    SwLinePortion *pFirstRest;
    SwLinePortion *pSecondRest;
@@ -1900,7 +1900,7 @@ sal_Bool SwTxtFormatter::BuildMultiPortion( SwTxtFormatInfo &rInf,
        // second line has to be formatted
        else if( pCurr->GetLen()<nMultiLen || rMulti.IsRuby() || aInf.GetRest())
        {
            xub_StrLen nFirstLen = pCurr->GetLen();
            sal_Int32 nFirstLen = pCurr->GetLen();
            delete pCurr->GetNext();
            pCurr->SetNext( new SwLineLayout() );
            pCurr = pCurr->GetNext();
@@ -2178,11 +2178,11 @@ sal_Bool SwTxtFormatter::BuildMultiPortion( SwTxtFormatInfo &rInf,
 * --------------------------------------------------*/

SwLinePortion* SwTxtFormatter::MakeRestPortion( const SwLineLayout* pLine,
    xub_StrLen nPosition )
    sal_Int32 nPosition )
{
    if( !nPosition )
        return NULL;
    xub_StrLen nMultiPos = nPosition - pLine->GetLen();
    sal_Int32 nMultiPos = nPosition - pLine->GetLen();
    const SwMultiPortion *pTmpMulti = NULL;
    const SwMultiPortion *pHelpMulti = NULL;
    const SwLinePortion* pPor = pLine->GetFirstPortion();
@@ -2277,7 +2277,7 @@ SwLinePortion* SwTxtFormatter::MakeRestPortion( const SwLineLayout* pLine,
        return pRest;

    if( pRest || nMultiPos > nPosition || ( pHelpMulti->IsRuby() &&
        ((SwRubyPortion*)pHelpMulti)->GetRubyOffset() < STRING_LEN ) )
        ((SwRubyPortion*)pHelpMulti)->GetRubyOffset() < COMPLETE_STRING ) )
    {
        SwMultiPortion* pTmp;
        if( pHelpMulti->IsDouble() )
@@ -2341,7 +2341,7 @@ SwTxtCursorSave::SwTxtCursorSave( SwTxtCursor* pTxtCursor,
                                  SwMultiPortion* pMulti,
                                  SwTwips nY,
                                  sal_uInt16& nX,
                                  xub_StrLen nCurrStart,
                                  sal_Int32 nCurrStart,
                                  long nSpaceAdd )
{
    pTxtCrsr = pTxtCursor;
@@ -2367,7 +2367,7 @@ SwTxtCursorSave::SwTxtCursorSave( SwTxtCursor* pTxtCursor,
        }
        else
        {
            const xub_StrLen nOldIdx = pTxtCursor->GetInfo().GetIdx();
            const sal_Int32 nOldIdx = pTxtCursor->GetInfo().GetIdx();
            pTxtCursor->GetInfo().SetIdx ( nCurrStart );
            nSpaceCnt = ((SwBidiPortion*)pMulti)->GetSpaceCnt(pTxtCursor->GetInfo());
            pTxtCursor->GetInfo().SetIdx ( nOldIdx );
diff --git a/sw/source/core/text/pormulti.hxx b/sw/source/core/text/pormulti.hxx
index 46ca418..86c64e5 100644
--- a/sw/source/core/text/pormulti.hxx
+++ b/sw/source/core/text/pormulti.hxx
@@ -59,7 +59,7 @@ struct SwMultiCreator

struct SwBracket
{
    xub_StrLen nStart;      // Start of text attribute determins the font
    sal_Int32 nStart;      // Start of text attribute determins the font
    KSHORT nAscent;         // Ascent of the brackets
    KSHORT nHeight;         // Height of them
    KSHORT nPreWidth;       // Width of the opening bracket
@@ -94,7 +94,7 @@ class SwMultiPortion : public SwLinePortion
    sal_uInt8 nDirection:2; // Direction (0/90/180/270 degrees)
    sal_Bool bFlyInCntnt:1; // Fly as character inside
protected:
    SwMultiPortion( xub_StrLen nEnd ) : pFldRest( 0 ), bTab1( sal_False ),
    SwMultiPortion( sal_Int32 nEnd ) : pFldRest( 0 ), bTab1( sal_False ),
        bTab2( sal_False ), bDouble( sal_False ), bRuby( false ),
        bBidi( sal_False ), bFormatted( sal_False ), bFollowFld( sal_False ),
        nDirection( 0 ), bFlyInCntnt( sal_False )
@@ -152,11 +152,11 @@ class SwDoubleLinePortion : public SwMultiPortion
{
    SwBracket* pBracket;    // Surrounding brackets
    SwTwips nLineDiff;      // Difference of the width of the both lines
    xub_StrLen nBlank1;     // Number of blanks in the first line
    xub_StrLen nBlank2;     // Number of blanks in the second line
    sal_Int32 nBlank1;     // Number of blanks in the first line
    sal_Int32 nBlank2;     // Number of blanks in the second line
public:
    SwDoubleLinePortion( SwDoubleLinePortion& rDouble, xub_StrLen nEnd );
    SwDoubleLinePortion( const SwMultiCreator& rCreate, xub_StrLen nEnd );
    SwDoubleLinePortion( SwDoubleLinePortion& rDouble, sal_Int32 nEnd );
    SwDoubleLinePortion( const SwMultiCreator& rCreate, sal_Int32 nEnd );
    ~SwDoubleLinePortion();

    inline SwBracket* GetBrackets() const { return pBracket; }
@@ -172,12 +172,12 @@ public:
    void CalcBlanks( SwTxtFormatInfo &rInf );
    static void ResetSpaceAdd( SwLineLayout* pCurr );
    inline SwTwips GetLineDiff() const { return nLineDiff; }
    inline xub_StrLen GetSpaceCnt() const
    inline sal_Int32 GetSpaceCnt() const
        { return ( nLineDiff < 0 ) ? nBlank2 : nBlank1; }
    inline xub_StrLen GetSmallerSpaceCnt() const
    inline sal_Int32 GetSmallerSpaceCnt() const
        { return ( nLineDiff < 0 ) ? nBlank1 : nBlank2; }
    inline xub_StrLen GetBlank1() const { return nBlank1; }
    inline xub_StrLen GetBlank2() const { return nBlank2; }
    inline sal_Int32 GetBlank1() const { return nBlank1; }
    inline sal_Int32 GetBlank2() const { return nBlank2; }

    virtual long CalcSpacing( long nSpaceAdd, const SwTxtSizeInfo &rInf ) const;
    virtual sal_Bool ChgSpaceAdd( SwLineLayout* pCurr, long nSpaceAdd ) const;
@@ -185,30 +185,30 @@ public:

class SwRubyPortion : public SwMultiPortion
{
    xub_StrLen nRubyOffset;
    sal_Int32 nRubyOffset;
    sal_uInt16 nAdjustment;
    void _Adjust( SwTxtFormatInfo &rInf);
public:
    SwRubyPortion( const SwRubyPortion& rRuby, xub_StrLen nEnd );
    SwRubyPortion( const SwRubyPortion& rRuby, sal_Int32 nEnd );

    SwRubyPortion( const SwMultiCreator& rCreate, const SwFont& rFnt,
                   const IDocumentSettingAccess& rIDocumentSettingAccess,
                   xub_StrLen nEnd, xub_StrLen nOffs,
                   sal_Int32 nEnd, sal_Int32 nOffs,
                   const sal_Bool* pForceRubyPos );

    void CalcRubyOffset();
    inline void Adjust( SwTxtFormatInfo &rInf )
        { if(nAdjustment && GetRoot().GetNext()) _Adjust(rInf); }
    inline sal_uInt16 GetAdjustment() const { return nAdjustment; }
    inline xub_StrLen GetRubyOffset() const { return nRubyOffset; }
    inline sal_Int32 GetRubyOffset() const { return nRubyOffset; }
};

class SwRotatedPortion : public SwMultiPortion
{
public:
    SwRotatedPortion( xub_StrLen nEnd, sal_uInt8 nDir = 1 )
    SwRotatedPortion( sal_Int32 nEnd, sal_uInt8 nDir = 1 )
        : SwMultiPortion( nEnd ) { SetDirection( nDir ); }
    SwRotatedPortion( const SwMultiCreator& rCreate, xub_StrLen nEnd,
    SwRotatedPortion( const SwMultiCreator& rCreate, sal_Int32 nEnd,
                      sal_Bool bRTL );
};

@@ -217,11 +217,11 @@ class SwBidiPortion : public SwMultiPortion
    sal_uInt8 nLevel;

public:
    SwBidiPortion( xub_StrLen nEnd, sal_uInt8 nLv );
    SwBidiPortion( sal_Int32 nEnd, sal_uInt8 nLv );

    inline sal_uInt8 GetLevel() const { return nLevel; }
    // Get number of blanks for justified alignment
    xub_StrLen GetSpaceCnt( const SwTxtSizeInfo &rInf ) const;
    sal_Int32 GetSpaceCnt( const SwTxtSizeInfo &rInf ) const;
    // Calculates extra spacing based on number of blanks
    virtual long CalcSpacing( long nSpaceAdd, const SwTxtSizeInfo &rInf ) const;
    // Manipulate the spacing array at pCurr
@@ -235,12 +235,12 @@ class SwTxtCursorSave
    SwTxtCursor* pTxtCrsr;
    SwLineLayout* pCurr;
    SwTwips nWidth;
    xub_StrLen nStart;
    sal_Int32 nStart;
    sal_uInt8 nOldProp;
    sal_Bool bSpaceChg;
public:
    SwTxtCursorSave( SwTxtCursor* pTxtCursor, SwMultiPortion* pMulti,
        SwTwips nY, sal_uInt16& nX, xub_StrLen nCurrStart, long nSpaceAdd );
        SwTwips nY, sal_uInt16& nX, sal_Int32 nCurrStart, long nSpaceAdd );
    ~SwTxtCursorSave();
};

diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx
index fd3b40d..72a175f 100644
--- a/sw/source/core/text/porrst.cxx
+++ b/sw/source/core/text/porrst.cxx
@@ -85,7 +85,7 @@ SwBreakPortion::SwBreakPortion( const SwLinePortion &rPortion )
    SetWhichPor( POR_BRK );
}

xub_StrLen SwBreakPortion::GetCrsrOfst( const KSHORT ) const
sal_Int32 SwBreakPortion::GetCrsrOfst( const KSHORT ) const
{ return 0; }

KSHORT SwBreakPortion::GetViewWidth( const SwTxtSizeInfo & ) const
diff --git a/sw/source/core/text/porrst.hxx b/sw/source/core/text/porrst.hxx
index 574be56..de5f2fd 100644
--- a/sw/source/core/text/porrst.hxx
+++ b/sw/source/core/text/porrst.hxx
@@ -51,7 +51,7 @@ public:
    virtual void Paint( const SwTxtPaintInfo &rInf ) const;
    virtual sal_Bool Format( SwTxtFormatInfo &rInf );
    virtual KSHORT GetViewWidth( const SwTxtSizeInfo &rInf ) const;
    virtual xub_StrLen GetCrsrOfst( const MSHORT nOfst ) const;
    virtual sal_Int32 GetCrsrOfst( const MSHORT nOfst ) const;

    // Accessibility: pass information about this portion to the PortionHandler
    virtual void HandlePortion( SwPortionHandler& rPH ) const;
@@ -133,7 +133,7 @@ public:
class SwHiddenTextPortion : public SwLinePortion
{
public:
    inline SwHiddenTextPortion( xub_StrLen nLen )
    inline SwHiddenTextPortion( sal_Int32 nLen )
        { SetWhichPor( POR_HIDDEN_TXT );  SetLen( nLen ); }

    virtual void Paint( const SwTxtPaintInfo &rInf ) const;
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index 0d9d851..50767f1 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -232,7 +232,7 @@ void SwTxtPortion::BreakCut( SwTxtFormatInfo &rInf, const SwTxtGuess &rGuess )
    // Special case 1: The word is larger than the line
    // We truncate ...
    const KSHORT nLineWidth = (KSHORT)(rInf.Width() - rInf.X());
    xub_StrLen nLen = rGuess.CutPos() - rInf.GetIdx();
    sal_Int32 nLen = rGuess.CutPos() - rInf.GetIdx();
    if( nLen )
    {
        // special case: guess does not always provide the correct
@@ -363,7 +363,7 @@ sal_Bool SwTxtPortion::_Format( SwTxtFormatInfo &rInf )
        aGuess.ClearHangingPortion();
    }
    // breakPos >= index
    else if ( aGuess.BreakPos() >= rInf.GetIdx() && aGuess.BreakPos() != STRING_LEN )
    else if ( aGuess.BreakPos() >= rInf.GetIdx() && aGuess.BreakPos() != COMPLETE_STRING )
    {
        // case B1
        if( aGuess.HyphWord().is() && aGuess.BreakPos() > rInf.GetLineStart()
@@ -421,7 +421,7 @@ sal_Bool SwTxtPortion::_Format( SwTxtFormatInfo &rInf )

            OSL_ENSURE( aGuess.BreakStart() >= aGuess.FieldDiff(),
                    "Trouble with expanded field portions during line break" );
            const xub_StrLen nRealStart = aGuess.BreakStart() - aGuess.FieldDiff();
            const sal_Int32 nRealStart = aGuess.BreakStart() - aGuess.FieldDiff();
            if( aGuess.BreakPos() < nRealStart && !InExpGrp() )
            {
                SwHolePortion *pNew = new SwHolePortion( *this );
@@ -436,7 +436,7 @@ sal_Bool SwTxtPortion::_Format( SwTxtFormatInfo &rInf )
    else
    {
        bool bFirstPor = rInf.GetLineStart() == rInf.GetIdx();
        if( aGuess.BreakPos() != STRING_LEN &&
        if( aGuess.BreakPos() != COMPLETE_STRING &&
            aGuess.BreakPos() != rInf.GetLineStart() &&
            ( !bFirstPor || rInf.GetFly() || rInf.GetLast()->IsFlyPortion() ||
              rInf.IsFirstMulti() ) &&
@@ -500,7 +500,7 @@ void SwTxtPortion::FormatEOL( SwTxtFormatInfo &rInf )
        && !rInf.GetLast()->IsHolePortion() )
    {
        // calculate number of blanks
        xub_StrLen nX = rInf.GetIdx() - 1;
        sal_Int32 nX = rInf.GetIdx() - 1;
        sal_uInt16 nHoleLen = 1;
        while( nX && nHoleLen < GetLen() && CH_BLANK == rInf.GetChar( --nX ) )
            nHoleLen++;
@@ -525,7 +525,7 @@ void SwTxtPortion::FormatEOL( SwTxtFormatInfo &rInf )
/*************************************************************************
 *               virtual SwTxtPortion::GetCrsrOfst()
 *************************************************************************/
xub_StrLen SwTxtPortion::GetCrsrOfst( const KSHORT nOfst ) const
sal_Int32 SwTxtPortion::GetCrsrOfst( const KSHORT nOfst ) const
{
    OSL_ENSURE( !this, "SwTxtPortion::GetCrsrOfst: don't use this method!" );
    return SwLinePortion::GetCrsrOfst( nOfst );
@@ -605,7 +605,7 @@ sal_Bool SwTxtPortion::GetExpTxt( const SwTxtSizeInfo &, OUString & ) const
}

/*************************************************************************
 *        xub_StrLen SwTxtPortion::GetSpaceCnt()
 *        sal_Int32 SwTxtPortion::GetSpaceCnt()
 *              long SwTxtPortion::CalcSpacing()
 * Are responsible for the justified paragraph. They calculate the blank
 * count and the resulting added space.
@@ -644,7 +644,7 @@ sal_Int32 SwTxtPortion::GetSpaceCnt( const SwTxtSizeInfo &rInf,

long SwTxtPortion::CalcSpacing( long nSpaceAdd, const SwTxtSizeInfo &rInf ) const
{
    xub_StrLen nCnt = 0;
    sal_Int32 nCnt = 0;

    if ( InExpGrp() )
    {
diff --git a/sw/source/core/text/portxt.hxx b/sw/source/core/text/portxt.hxx
index 71e6de5..e45f1ac 100644
--- a/sw/source/core/text/portxt.hxx
+++ b/sw/source/core/text/portxt.hxx
@@ -42,7 +42,7 @@ public:
    virtual void Paint( const SwTxtPaintInfo &rInf ) const;
    virtual sal_Bool Format( SwTxtFormatInfo &rInf );
    virtual void FormatEOL( SwTxtFormatInfo &rInf );
    virtual xub_StrLen GetCrsrOfst( const KSHORT nOfst ) const;
    virtual sal_Int32 GetCrsrOfst( const KSHORT nOfst ) const;
    virtual SwPosSize GetTxtSize( const SwTxtSizeInfo &rInfo ) const;
    virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, OUString &rTxt ) const;
    virtual long CalcSpacing( long nSpaceAdd, const SwTxtSizeInfo &rInf ) const;
diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx
index e95cd18..8b6338f 100644
--- a/sw/source/core/text/redlnitr.cxx
+++ b/sw/source/core/text/redlnitr.cxx
@@ -88,14 +88,14 @@ void SwAttrIter::CtorInitAttrIter( SwTxtNode& rTxtNode, SwScriptInfo& rScrInf, S

    // determine script changes if not already done for current paragraph
    OSL_ENSURE( pScriptInfo, "No script info available");
    if ( pScriptInfo->GetInvalidity() != STRING_LEN )
    if ( pScriptInfo->GetInvalidityA() != COMPLETE_STRING )
         pScriptInfo->InitScriptInfo( rTxtNode, bRTL );

    if ( g_pBreakIt->GetBreakIter().is() )
    {
        pFnt->SetActual( SwScriptInfo::WhichFont( 0, 0, pScriptInfo ) );

        xub_StrLen nChg = 0;
        sal_Int32 nChg = 0;
        sal_uInt16 nCnt = 0;

        do
@@ -133,8 +133,8 @@ void SwAttrIter::CtorInitAttrIter( SwTxtNode& rTxtNode, SwScriptInfo& rScrInf, S
    const bool bShow = IDocumentRedlineAccess::IsShowChanges( pIDRA->GetRedlineMode() );
    if( pExtInp || bShow )
    {
        MSHORT nRedlPos = pIDRA->GetRedlinePos( rTxtNode, USHRT_MAX );
        if( pExtInp || MSHRT_MAX != nRedlPos )
        sal_uInt16 nRedlPos = pIDRA->GetRedlinePos( rTxtNode, USHRT_MAX );
        if( pExtInp || USHRT_MAX != nRedlPos )
        {
            const std::vector<sal_uInt16> *pArr = 0;
            sal_Int32 nInputStt = 0;
@@ -167,23 +167,23 @@ void SwAttrIter::CtorInitAttrIter( SwTxtNode& rTxtNode, SwScriptInfo& rScrInf, S
 *
 * Wenn bOn gesetzt ist, ist der Font entsprechend manipuliert worden.
 *
 * Wenn nAct auf MSHRT_MAX gesetzt wurde ( durch Reset() ), so ist zur Zeit
 * Wenn nAct auf COMPLETE_STRING gesetzt wurde ( durch Reset() ), so ist zur Zeit
 * kein Redline aktiv, nStart und nEnd sind invalid.
 *************************************************************************/

SwRedlineItr::SwRedlineItr( const SwTxtNode& rTxtNd, SwFont& rFnt,
                            SwAttrHandler& rAH, MSHORT nRed, sal_Bool bShw,
                            SwAttrHandler& rAH, sal_Int32 nRed, sal_Bool bShw,
                            const std::vector<sal_uInt16> *pArr,
                            xub_StrLen nExtStart )
                            sal_Int32 nExtStart )
    : rDoc( *rTxtNd.GetDoc() ), rAttrHandler( rAH ), pSet( 0 ),
      nNdIdx( rTxtNd.GetIndex() ), nFirst( nRed ),
      nAct( MSHRT_MAX ), bOn( sal_False ), bShow( bShw )
      nAct( COMPLETE_STRING ), bOn( sal_False ), bShow( bShw )
{
    if( pArr )
        pExt = new SwExtend( *pArr, nExtStart );
    else
        pExt = NULL;
    Seek( rFnt, 0, STRING_LEN );
    Seek (rFnt, 0, COMPLETE_STRING);
}

SwRedlineItr::~SwRedlineItr()
@@ -196,7 +196,7 @@ SwRedlineItr::~SwRedlineItr()
// Der Return-Wert von SwRedlineItr::Seek gibt an, ob der aktuelle Font
// veraendert wurde durch Verlassen (-1) oder Betreten eines Bereichs (+1)

short SwRedlineItr::_Seek( SwFont& rFnt, xub_StrLen nNew, xub_StrLen nOld )
short SwRedlineItr::_Seek(SwFont& rFnt, sal_Int32 nNew, sal_Int32 nOld)
{
    short nRet = 0;
    if( ExtOn() )
@@ -224,13 +224,13 @@ short SwRedlineItr::_Seek( SwFont& rFnt, xub_StrLen nNew, xub_StrLen nOld )
            else
                return nRet + EnterExtend( rFnt, nNew ); // Wir sind im gleichen Bereich geblieben.
        }
        if( MSHRT_MAX == nAct || nOld > nNew )
        if( COMPLETE_STRING == nAct || nOld > nNew )
            nAct = nFirst;

        nStart = STRING_LEN;
        nEnd = STRING_LEN;
        nStart = COMPLETE_STRING;
        nEnd = COMPLETE_STRING;

        for( ; nAct < rDoc.GetRedlineTbl().size() ; ++nAct )
        for( ; nAct < (sal_Int32)rDoc.GetRedlineTbl().size() ; ++nAct )
        {
            rDoc.GetRedlineTbl()[ nAct ]->CalcStartEnd( nNdIdx, nStart, nEnd );

@@ -278,8 +278,8 @@ short SwRedlineItr::_Seek( SwFont& rFnt, xub_StrLen nNew, xub_StrLen nOld )
                }
                break;
            }
            nStart = STRING_LEN;
            nEnd = STRING_LEN;
            nStart = COMPLETE_STRING;
            nEnd = COMPLETE_STRING;
        }
    }
    return nRet + EnterExtend( rFnt, nNew );
@@ -343,12 +343,12 @@ void SwRedlineItr::_Clear( SwFont* pFnt )
        pFnt->SetNoCol( sal_False );
}

xub_StrLen SwRedlineItr::_GetNextRedln( xub_StrLen nNext )
sal_Int32 SwRedlineItr::_GetNextRedln( sal_Int32 nNext )
{
    nNext = NextExtend( nNext );
    if( !bShow || MSHRT_MAX == nFirst )
    if( !bShow || COMPLETE_STRING == nFirst )
        return nNext;
    if( MSHRT_MAX == nAct )
    if( COMPLETE_STRING == nAct )
    {
        nAct = nFirst;
        rDoc.GetRedlineTbl()[ nAct ]->CalcStartEnd( nNdIdx, nStart, nEnd );
@@ -368,7 +368,7 @@ sal_Bool SwRedlineItr::_ChkSpecialUnderline() const
    // Wenn die Unterstreichung oder das Escapement vom Redling kommt,
    // wenden wir immer das SpecialUnderlining, d.h. die Unterstreichung
    // unter der Grundlinie an.
    for (MSHORT i = 0; i < m_Hints.size(); ++i)
    for (size_t i = 0; i < m_Hints.size(); ++i)
    {
        MSHORT nWhich = m_Hints[i]->Which();
        if( RES_CHRATR_UNDERLINE == nWhich ||
@@ -378,23 +378,23 @@ sal_Bool SwRedlineItr::_ChkSpecialUnderline() const
    return sal_False;
}

sal_Bool SwRedlineItr::CheckLine( xub_StrLen nChkStart, xub_StrLen nChkEnd )
sal_Bool SwRedlineItr::CheckLine( sal_Int32 nChkStart, sal_Int32 nChkEnd )
{
    if( nFirst == MSHRT_MAX )
    if( nFirst == COMPLETE_STRING )
        return sal_False;
    if( nChkEnd == nChkStart ) // Leerzeilen gucken ein Zeichen weiter.
        ++nChkEnd;
    xub_StrLen nOldStart = nStart;
    xub_StrLen nOldEnd = nEnd;
    xub_StrLen nOldAct = nAct;
    sal_Int32 nOldStart = nStart;
    sal_Int32 nOldEnd = nEnd;
    sal_Int32 nOldAct = nAct;
    sal_Bool bRet = sal_False;

    for( nAct = nFirst; nAct < rDoc.GetRedlineTbl().size() ; ++nAct )
    for( nAct = nFirst; nAct < (sal_Int32)rDoc.GetRedlineTbl().size() ; ++nAct )
    {
        rDoc.GetRedlineTbl()[ nAct ]->CalcStartEnd( nNdIdx, nStart, nEnd );
        if( nChkEnd < nStart )
            break;
        if( nChkStart <= nEnd && ( nChkEnd > nStart || STRING_LEN == nEnd ) )
        if( nChkStart <= nEnd && ( nChkEnd > nStart || COMPLETE_STRING == nEnd ) )
        {
            bRet = sal_True;
            break;
@@ -407,7 +407,7 @@ sal_Bool SwRedlineItr::CheckLine( xub_StrLen nChkStart, xub_StrLen nChkEnd )
    return bRet;
}

void SwExtend::ActualizeFont( SwFont &rFnt, MSHORT nAttr )
void SwExtend::ActualizeFont( SwFont &rFnt, sal_uInt16 nAttr )
{
    if ( nAttr & EXTTEXTINPUT_ATTR_UNDERLINE )
        rFnt.SetUnderline( UNDERLINE_SINGLE );
@@ -431,7 +431,7 @@ void SwExtend::ActualizeFont( SwFont &rFnt, MSHORT nAttr )
        rFnt.SetGreyWave( sal_True );
}

short SwExtend::Enter( SwFont& rFnt, xub_StrLen nNew )
short SwExtend::Enter(SwFont& rFnt, sal_Int32 nNew)
{
    OSL_ENSURE( !Inside(), "SwExtend: Enter without Leave" );
    OSL_ENSURE( !pFnt, "SwExtend: Enter with Font" );
@@ -445,7 +445,7 @@ short SwExtend::Enter( SwFont& rFnt, xub_StrLen nNew )
    return 0;
}

sal_Bool SwExtend::_Leave( SwFont& rFnt, xub_StrLen nNew )
sal_Bool SwExtend::_Leave(SwFont& rFnt, sal_Int32 nNew)
{
    OSL_ENSURE( Inside(), "SwExtend: Leave without Enter" );
    MSHORT nOldAttr = rArr[ nPos - nStart ];
@@ -469,7 +469,7 @@ sal_Bool SwExtend::_Leave( SwFont& rFnt, xub_StrLen nNew )
    return sal_False;
}

xub_StrLen SwExtend::Next( xub_StrLen nNext )
sal_Int32 SwExtend::Next( sal_Int32 nNext )
{
    if( nPos < nStart )
    {
@@ -478,9 +478,9 @@ xub_StrLen SwExtend::Next( xub_StrLen nNext )
    }
    else if( nPos < nEnd )
    {
        MSHORT nIdx = nPos - nStart;
        sal_Int32 nIdx = nPos - nStart;
        MSHORT nAttr = rArr[ nIdx ];
        while( ++nIdx < rArr.size() && nAttr == rArr[ nIdx ] )
        while( ++nIdx < (sal_Int32)rArr.size() && nAttr == rArr[ nIdx ] )
            ; //nothing
        nIdx = nIdx + nStart;
        if( nNext > nIdx )
diff --git a/sw/source/core/text/redlnitr.hxx b/sw/source/core/text/redlnitr.hxx
index ff7a3b9..2eddc05 100644
--- a/sw/source/core/text/redlnitr.hxx
+++ b/sw/source/core/text/redlnitr.hxx
@@ -34,23 +34,23 @@ class SwAttrHandler;
class SwExtend
{
    SwFont *pFnt;
    const std::vector<sal_uInt16> &rArr;    // XAMA: Array of xub_StrLen
    xub_StrLen nStart;
    xub_StrLen nPos;
    xub_StrLen nEnd;
    sal_Bool _Leave( SwFont& rFnt, xub_StrLen nNew );
    const std::vector<sal_uInt16> &rArr;    // XAMA: Array of sal_uInt16
    sal_Int32 nStart;
    sal_Int32 nPos;
    sal_Int32 nEnd;
    sal_Bool _Leave( SwFont& rFnt, sal_Int32 nNew );
    bool Inside() const { return ( nPos >= nStart && nPos < nEnd ); }
    void ActualizeFont( SwFont &rFnt, xub_StrLen nAttr );
    void ActualizeFont( SwFont &rFnt, sal_uInt16 nAttr );
public:
    SwExtend( const std::vector<sal_uInt16> &rA, xub_StrLen nSt ) : pFnt(0), rArr( rA ),
        nStart( nSt ), nPos( STRING_LEN ), nEnd( nStart + rA.size() ) {}
    SwExtend( const std::vector<sal_uInt16> &rA, sal_Int32 nSt ) : pFnt(0), rArr( rA ),
        nStart( nSt ), nPos( COMPLETE_STRING ), nEnd( nStart + rA.size() ) {}
    ~SwExtend() { delete pFnt; }
    bool IsOn() const { return pFnt != 0; }
    void Reset() { if( pFnt ) { delete pFnt; pFnt = NULL; } nPos = STRING_LEN; }
    sal_Bool Leave( SwFont& rFnt, xub_StrLen nNew )
    void Reset() { if( pFnt ) { delete pFnt; pFnt = NULL; } nPos = COMPLETE_STRING; }
    sal_Bool Leave( SwFont& rFnt, sal_Int32 nNew )
        { if( pFnt ) return _Leave( rFnt, nNew ); return sal_False; }
    short Enter( SwFont& rFnt, xub_StrLen nNew );
    xub_StrLen Next( xub_StrLen nNext );
    short Enter( SwFont& rFnt, sal_Int32 nNew );
    sal_Int32 Next( sal_Int32 nNext );
    SwFont* GetFont()  { return pFnt; }
    void UpdateFont( SwFont &rFnt ) { ActualizeFont( rFnt, rArr[ nPos - nStart ] ); }
};
@@ -63,40 +63,40 @@ class SwRedlineItr
    SfxItemSet *pSet;
    SwExtend *pExt;
    sal_uLong nNdIdx;
    xub_StrLen nFirst;
    xub_StrLen nAct;
    xub_StrLen nStart;
    xub_StrLen nEnd;
    sal_Int32 nFirst;
    sal_Int32 nAct;
    sal_Int32 nStart;
    sal_Int32 nEnd;
    sal_Bool bOn;
    sal_Bool bShow;

    void _Clear( SwFont* pFnt );
    sal_Bool _ChkSpecialUnderline() const;
    void FillHints( MSHORT nAuthor, RedlineType_t eType );
    short _Seek( SwFont& rFnt, xub_StrLen nNew, xub_StrLen nOld );
    xub_StrLen _GetNextRedln( xub_StrLen nNext );
    inline short EnterExtend( SwFont& rFnt, xub_StrLen nNew )
    short _Seek( SwFont& rFnt, sal_Int32 nNew, sal_Int32 nOld );
    sal_Int32 _GetNextRedln( sal_Int32 nNext );
    short EnterExtend( SwFont& rFnt, sal_Int32 nNew )
        { if( pExt ) return pExt->Enter( rFnt, nNew ); return 0; }
    inline xub_StrLen NextExtend( xub_StrLen nNext )
    sal_Int32 NextExtend( sal_Int32 nNext )
        { if( pExt ) return pExt->Next( nNext ); return nNext; }
public:
    SwRedlineItr( const SwTxtNode& rTxtNd, SwFont& rFnt, SwAttrHandler& rAH,
        xub_StrLen nRedlPos, sal_Bool bShw, const std::vector<sal_uInt16> *pArr = 0,
        xub_StrLen nStart = STRING_LEN );
        sal_Int32 nRedlPos, sal_Bool bShw, const std::vector<sal_uInt16> *pArr = 0,
        sal_Int32 nExtStart = COMPLETE_STRING );
    ~SwRedlineItr();
    inline bool IsOn() const { return bOn || ( pExt && pExt->IsOn() ); }
    inline void Clear( SwFont* pFnt ) { if( bOn ) _Clear( pFnt ); }
    void ChangeTxtAttr( SwFont* pFnt, SwTxtAttr &rHt, sal_Bool bChg );
    inline short Seek( SwFont& rFnt, xub_StrLen nNew, xub_StrLen nOld )
    inline short Seek( SwFont& rFnt, sal_Int32 nNew, sal_Int32 nOld )
        { if( bShow || pExt ) return _Seek( rFnt, nNew, nOld ); return 0; }
    inline void Reset() { if( nAct != nFirst ) nAct = STRING_LEN;
    inline void Reset() { if( nAct != nFirst ) nAct = COMPLETE_STRING;
                          if( pExt ) pExt->Reset(); }
    inline xub_StrLen GetNextRedln( xub_StrLen nNext )
    inline sal_Int32 GetNextRedln( sal_Int32 nNext )
        { if( bShow || pExt ) return _GetNextRedln( nNext ); return nNext; }
    inline sal_Bool ChkSpecialUnderline() const
        { if ( IsOn() ) return _ChkSpecialUnderline(); return sal_False; }
    sal_Bool CheckLine( xub_StrLen nChkStart, xub_StrLen nChkEnd );
    inline sal_Bool LeaveExtend( SwFont& rFnt, xub_StrLen nNew )
    sal_Bool CheckLine( sal_Int32 nChkStart, sal_Int32 nChkEnd );
    inline sal_Bool LeaveExtend( SwFont& rFnt, sal_Int32 nNew )
        { return pExt->Leave(rFnt, nNew ); }
    inline bool ExtOn() { if( pExt ) return pExt->IsOn(); return false; }
    inline void UpdateExtFont( SwFont &rFnt ) {
diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx
index f4af8af..23738a6 100644
--- a/sw/source/core/text/txtdrop.cxx
+++ b/sw/source/core/text/txtdrop.cxx
@@ -73,8 +73,8 @@ static sal_Bool lcl_IsDropFlyInter( const SwTxtFormatInfo &rInf,
class SwDropSave
{
    SwTxtPaintInfo* pInf;
    xub_StrLen nIdx;
    xub_StrLen nLen;
    sal_Int32 nIdx;
    sal_Int32 nLen;
    long nX;
    long nY;

@@ -133,7 +133,7 @@ SwDropPortion::~SwDropPortion()
        pBlink->Delete( this );
}

sal_Bool SwTxtSizeInfo::_HasHint( const SwTxtNode* pTxtNode, xub_StrLen nPos )
sal_Bool SwTxtSizeInfo::_HasHint( const SwTxtNode* pTxtNode, sal_Int32 nPos )
{
    return 0 != pTxtNode->GetTxtAttrForCharAt(nPos);
}
@@ -175,10 +175,10 @@ MSHORT SwTxtNode::GetDropLen( MSHORT nWishLen ) const
            g_pBreakIt->GetBreakIter()->getWordBoundary( GetTxt(), 0,
            g_pBreakIt->GetLocale( eLanguage ), WordType::DICTIONARY_WORD, sal_True );

        nEnd = (xub_StrLen)aBound.endPos;
        nEnd = aBound.endPos;
    }

    xub_StrLen i = 0;
    sal_Int32 i = 0;
    for( ; i < nEnd; ++i )
    {
        sal_Unicode const cChar = GetTxt()[i];
@@ -276,7 +276,7 @@ void SwDropPortion::PaintTxt( const SwTxtPaintInfo &rInf ) const
    OSL_ENSURE( nDropHeight && pPart && nLines != 1, "Drop Portion painted twice" );

    const SwDropPortionPart* pCurrPart = GetPart();
    const xub_StrLen nOldLen = GetLen();
    const sal_Int32 nOldLen = GetLen();
    const KSHORT nOldWidth = Width();
    const KSHORT nOldAscent = GetAscent();

@@ -408,8 +408,8 @@ void SwDropPortion::Paint( const SwTxtPaintInfo &rInf ) const

sal_Bool SwDropPortion::FormatTxt( SwTxtFormatInfo &rInf )
{
    const xub_StrLen nOldLen = GetLen();
    const xub_StrLen nOldInfLen = rInf.GetLen();
    const sal_Int32 nOldLen = GetLen();
    const sal_Int32 nOldInfLen = rInf.GetLen();
    const sal_Bool bFull = SwTxtPortion::Format( rInf );
    if( bFull )
    {
@@ -430,7 +430,7 @@ sal_Bool SwDropPortion::FormatTxt( SwTxtFormatInfo &rInf )
SwPosSize SwDropPortion::GetTxtSize( const SwTxtSizeInfo &rInf ) const
{
    sal_uInt16 nMyX = 0;
    xub_StrLen nIdx = 0;
    sal_Int32 nIdx = 0;

    const SwDropPortionPart* pCurrPart = GetPart();

@@ -442,8 +442,8 @@ SwPosSize SwDropPortion::GetTxtSize( const SwTxtSizeInfo &rInf ) const
        pCurrPart = pCurrPart->GetFollow();
    }

    xub_StrLen nOldIdx = rInf.GetIdx();
    xub_StrLen nOldLen = rInf.GetLen();
    sal_Int32 nOldIdx = rInf.GetIdx();
    sal_Int32 nOldLen = rInf.GetLen();

    ((SwTxtSizeInfo&)rInf).SetIdx( nIdx );
    ((SwTxtSizeInfo&)rInf).SetLen( rInf.GetLen() - nIdx );
@@ -474,7 +474,7 @@ SwPosSize SwDropPortion::GetTxtSize( const SwTxtSizeInfo &rInf ) const
 *                virtual GetCrsrOfst()
 *************************************************************************/

xub_StrLen SwDropPortion::GetCrsrOfst( const KSHORT ) const
sal_Int32 SwDropPortion::GetCrsrOfst( const KSHORT ) const
{
    return 0;
}
@@ -575,7 +575,7 @@ SwDropPortion *SwTxtFormatter::NewDropPortion( SwTxtFormatInfo &rInf )
    if( !pDropFmt )
        return 0;

    xub_StrLen nPorLen = pDropFmt->GetWholeWord() ? 0 : pDropFmt->GetChars();
    sal_Int32 nPorLen = pDropFmt->GetWholeWord() ? 0 : pDropFmt->GetChars();
    nPorLen = pFrm->GetTxtNode()->GetDropLen( nPorLen );
    if( !nPorLen )
    {
@@ -615,7 +615,7 @@ SwDropPortion *SwTxtFormatter::NewDropPortion( SwTxtFormatInfo &rInf )

    // build DropPortionParts:
    OSL_ENSURE( ! rInf.GetIdx(), "Drop Portion not at 0 position!" );
    xub_StrLen nNextChg = 0;
    sal_Int32 nNextChg = 0;
    const SwCharFmt* pFmt = pDropFmt->GetCharFmt();
    SwDropPortionPart* pCurrPart = 0;

@@ -636,7 +636,7 @@ SwDropPortion *SwTxtFormatter::NewDropPortion( SwTxtFormatInfo &rInf )
        pTmpFnt->SetVertical( 0, rInf.GetTxtFrm()->IsVertical() );

        // find next attribute change / script change
        const xub_StrLen nTmpIdx = nNextChg;
        const sal_Int32 nTmpIdx = nNextChg;
        sal_Int32 nNextAttr = std::min( static_cast<sal_Int32>(GetNextAttr()), rInf.GetTxt().getLength() );
        nNextChg = pScriptInfo->NextScriptChg( nTmpIdx );
        if( nNextChg > nNextAttr )
@@ -759,7 +759,7 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTxtFormatInfo &rInf )

    SwDropPortionPart* pCurrPart = pDrop->GetPart();
    const bool bUseCache = ! pCurrPart->GetFollow() && !pCurrPart->GetFont().HasBorder();
    xub_StrLen nIdx = rInf.GetIdx();
    sal_Int32 nIdx = rInf.GetIdx();
    OUString aStr(rInf.GetTxt().copy(nIdx, pCurrPart->GetLen()));

    long nAscent = 0;
diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx
index 6e1c310..928ee0b 100644
--- a/sw/source/core/text/txtfly.cxx
+++ b/sw/source/core/text/txtfly.cxx
@@ -482,12 +482,12 @@ sal_Bool SwTxtFly::DrawTextOpaque( SwDrawTextInfo &rInf )
    SwRect aRect( rInf.GetPos(), rInf.GetSize() );
    if( rInf.GetSpace() )
    {
        xub_StrLen nTmpLen = STRING_LEN == rInf.GetLen() ? rInf.GetText().getLength() :
        sal_Int32 nTmpLen = COMPLETE_STRING == rInf.GetLen() ? rInf.GetText().getLength() :
                                                      rInf.GetLen();
        if( rInf.GetSpace() > 0 )
        {
            sal_Int32 nSpaceCnt = 0;
            const xub_StrLen nEndPos = rInf.GetIdx() + nTmpLen;
            const sal_Int32 nEndPos = rInf.GetIdx() + nTmpLen;
            for( sal_Int32 nPos = rInf.GetIdx(); nPos < nEndPos; ++nPos )
            {
                if( CH_BLANK == rInf.GetText()[ nPos ] )
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index a445ad3..9bc457a 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -447,7 +447,7 @@ void SwTxtFrm::HideHidden()
    OSL_ENSURE( !GetFollow() && IsHiddenNow(),
            "HideHidden on visible frame of hidden frame has follow" );

    const xub_StrLen nEnd = STRING_LEN;
    const sal_Int32 nEnd = COMPLETE_STRING;
    HideFootnotes( GetOfst(), nEnd );
    // OD 2004-01-15 #110582#
    HideAndShowObjects();
@@ -459,7 +459,7 @@ void SwTxtFrm::HideHidden()
/*************************************************************************
 *                        SwTxtFrm::HideFootnotes()
 *************************************************************************/
void SwTxtFrm::HideFootnotes( xub_StrLen nStart, xub_StrLen nEnd )
void SwTxtFrm::HideFootnotes( sal_Int32 nStart, sal_Int32 nEnd )
{
    const SwpHints *pHints = GetTxtNode()->GetpSwpHints();
    if( pHints )
@@ -471,7 +471,7 @@ void SwTxtFrm::HideFootnotes( xub_StrLen nStart, xub_StrLen nEnd )
            const SwTxtAttr *pHt = (*pHints)[i];
            if ( pHt->Which() == RES_TXTATR_FTN )
            {
                const xub_StrLen nIdx = *pHt->GetStart();
                const sal_Int32 nIdx = *pHt->GetStart();
                if ( nEnd < nIdx )
                    break;
                if( nStart <= nIdx )
@@ -604,13 +604,13 @@ void SwTxtFrm::HideAndShowObjects()
                else if ((eAnchorType == FLY_AT_CHAR) ||
                         (eAnchorType == FLY_AS_CHAR))
                {
                    xub_StrLen nHiddenStart;
                    xub_StrLen nHiddenEnd;
                    sal_Int32 nHiddenStart;
                    sal_Int32 nHiddenEnd;
                    const sal_Int32 nObjAnchorPos = pContact->GetCntntAnchorIndex().GetIndex();
                    SwScriptInfo::GetBoundsOfHiddenRange( rNode, nObjAnchorPos, nHiddenStart, nHiddenEnd, 0 );
                    // #120729# - hotfix
                    // under certain conditions
                    if ( nHiddenStart != STRING_LEN && bShouldBeHidden &&
                    if ( nHiddenStart != COMPLETE_STRING && bShouldBeHidden &&
                         sw_HideObj( *this, eAnchorType, nObjAnchorPos, (*GetDrawObjs())[i] ) )
                        pContact->MoveObjToInvisibleLayer( pObj );
                    else
@@ -642,7 +642,7 @@ void SwTxtFrm::HideAndShowObjects()
 * nFound ist <= nEndLine.
 *************************************************************************/

xub_StrLen SwTxtFrm::FindBrk( const OUString &rTxt,
sal_Int32 SwTxtFrm::FindBrk( const OUString &rTxt,
                              const sal_Int32 nStart,
                              const sal_Int32 nEnd ) const
{
@@ -664,16 +664,14 @@ xub_StrLen SwTxtFrm::FindBrk( const OUString &rTxt,
        nFound++;
    }

    return nFound <= STRING_LEN
           ? static_cast<xub_StrLen>(nFound)
           : STRING_LEN;
    return nFound;
}

/*************************************************************************
 *                      SwTxtFrm::IsIdxInside()
 *************************************************************************/

sal_Bool SwTxtFrm::IsIdxInside( const xub_StrLen nPos, const xub_StrLen nLen ) const
sal_Bool SwTxtFrm::IsIdxInside( const sal_Int32 nPos, const sal_Int32 nLen ) const
{
    if( GetOfst() > nPos + nLen ) // d.h., der Bereich liegt komplett vor uns.
        return sal_False;
@@ -681,7 +679,7 @@ sal_Bool SwTxtFrm::IsIdxInside( const xub_StrLen nPos, const xub_StrLen nLen ) c
    if( !GetFollow() )         // der Bereich liegt nicht komplett vor uns,
        return sal_True;           // nach uns kommt niemand mehr.

    const xub_StrLen nMax = GetFollow()->GetOfst();
    const sal_Int32 nMax = GetFollow()->GetOfst();

    // der Bereich liegt nicht komplett hinter uns bzw.
    // unser Text ist geloescht worden.
@@ -728,7 +726,7 @@ void SwTxtFrm::_InvalidateRange( const SwCharRange &aRange, const long nD)
    }
    SwCharRange &rReformat = *(pPara->GetReformat());
    if(aRange != rReformat) {
        if( STRING_LEN == rReformat.Len() )
        if( COMPLETE_STRING == rReformat.Len() )
            rReformat = aRange;
        else
            rReformat += aRange;
@@ -879,10 +877,10 @@ static void lcl_SetWrong( SwTxtFrm& rFrm, sal_Int32 nPos, sal_Int32 nCnt, bool b
static void lcl_SetScriptInval( SwTxtFrm& rFrm, sal_Int32 nPos )
{
    if( rFrm.GetPara() )
        rFrm.GetPara()->GetScriptInfo().SetInvalidity( nPos );
        rFrm.GetPara()->GetScriptInfo().SetInvalidityA( nPos );
}

static void lcl_ModifyOfst( SwTxtFrm* pFrm, xub_StrLen nPos, sal_Int32 nLen )
static void lcl_ModifyOfst( SwTxtFrm* pFrm, sal_Int32 nPos, sal_Int32 nLen )
{
    while( pFrm && pFrm->GetOfst() <= nPos )
        pFrm = pFrm->GetFollow();
@@ -918,7 +916,7 @@ void SwTxtFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew )
            // Collection hat sich geaendert
            Prepare( PREP_CLEAR );
            _InvalidatePrt();
            lcl_SetWrong( *this, 0, STRING_LEN, false );
            lcl_SetWrong( *this, 0, COMPLETE_STRING, false );
            SetDerivedR2L( sal_False );
            CheckDirChange();
            // OD 09.12.2002 #105576# - Force complete paint due to existing
@@ -979,7 +977,7 @@ void SwTxtFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew )
            lcl_SetScriptInval( *this, nPos );
            bSetFldsDirty = bRecalcFtnFlag = true;
            if( HasFollow() )
                lcl_ModifyOfst( this, nPos, STRING_LEN );
                lcl_ModifyOfst( this, nPos, COMPLETE_STRING );
        }
        break;
        case RES_DEL_TXT:
@@ -1206,7 +1204,7 @@ void SwTxtFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew )
            if ( SFX_ITEM_SET ==
                 rNewSet.GetItemState( RES_TXTATR_CHARFMT, sal_False ) )
            {
                lcl_SetWrong( *this, 0, STRING_LEN, false );
                lcl_SetWrong( *this, 0, COMPLETE_STRING, false );
                lcl_SetScriptInval( *this, 0 );
            }
            else if ( SFX_ITEM_SET ==
@@ -1215,7 +1213,7 @@ void SwTxtFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew )
                      rNewSet.GetItemState( RES_CHRATR_CJK_LANGUAGE, sal_False ) ||
                      SFX_ITEM_SET ==
                      rNewSet.GetItemState( RES_CHRATR_CTL_LANGUAGE, sal_False ) )
                lcl_SetWrong( *this, 0, STRING_LEN, false );
                lcl_SetWrong( *this, 0, COMPLETE_STRING, false );
            else if ( SFX_ITEM_SET ==
                      rNewSet.GetItemState( RES_CHRATR_FONT, sal_False ) ||
                      SFX_ITEM_SET ==
@@ -1386,7 +1384,7 @@ void SwTxtFrm::PrepWidows( const MSHORT nNeed, sal_Bool bNotify )
    SwTxtSizeInfo aInf( this );
    SwTxtMargin aLine( this, &aInf );
    aLine.Bottom();
    xub_StrLen nTmpLen = aLine.GetCurr()->GetLen();
    sal_Int32 nTmpLen = aLine.GetCurr()->GetLen();
    while( nHave && aLine.PrevLine() )
    {
        if( nTmpLen )
@@ -1429,7 +1427,7 @@ void SwTxtFrm::PrepWidows( const MSHORT nNeed, sal_Bool bNotify )
 *                      SwTxtFrm::Prepare
 *************************************************************************/

static bool lcl_ErgoVadis( SwTxtFrm* pFrm, xub_StrLen &rPos, const PrepareHint ePrep )
static bool lcl_ErgoVadis( SwTxtFrm* pFrm, sal_Int32 &rPos, const PrepareHint ePrep )
{
    const SwFtnInfo &rFtnInfo = pFrm->GetNode()->GetDoc()->GetFtnInfo();
    if( ePrep == PREP_ERGOSUM )
@@ -1573,7 +1571,7 @@ void SwTxtFrm::Prepare( const PrepareHint ePrep, const void* pVoid,
                    const SwFtnInfo &rFtnInfo = GetNode()->GetDoc()->GetFtnInfo();
                    if( !pPara->UpdateQuoVadis( rFtnInfo.aQuoVadis ) )
                    {
                        xub_StrLen nPos = pPara->GetParLen();
                        sal_Int32 nPos = pPara->GetParLen();
                        if( nPos )
                            --nPos;
                        InvalidateRange( SwCharRange( nPos, 1 ), 1);
@@ -1583,7 +1581,7 @@ void SwTxtFrm::Prepare( const PrepareHint ePrep, const void* pVoid,
            else
            {
                // Wir sind also der TxtFrm _mit_ der Fussnote
                const xub_StrLen nPos = *pFtn->GetStart();
                const sal_Int32 nPos = *pFtn->GetStart();
                InvalidateRange( SwCharRange( nPos, 1 ), 1);
            }
            break;
@@ -1596,19 +1594,19 @@ void SwTxtFrm::Prepare( const PrepareHint ePrep, const void* pVoid,
                sal_Bool bOld = IsVertical();
                SetInvalidVert( sal_True );
                if( bOld != IsVertical() )
                    InvalidateRange( SwCharRange( GetOfst(), STRING_LEN ) );
                    InvalidateRange( SwCharRange( GetOfst(), COMPLETE_STRING ) );
            }

            if( HasFollow() )
            {
                xub_StrLen nNxtOfst = GetFollow()->GetOfst();
                sal_Int32 nNxtOfst = GetFollow()->GetOfst();
                if( nNxtOfst )
                    --nNxtOfst;
                InvalidateRange( SwCharRange( nNxtOfst, 1 ), 1);
            }
            if( IsInFtn() )
            {
                xub_StrLen nPos;
                sal_Int32 nPos;
                if( lcl_ErgoVadis( this, nPos, PREP_QUOVADIS ) )
                    InvalidateRange( SwCharRange( nPos, 1 ), 0 );
                if( lcl_ErgoVadis( this, nPos, PREP_ERGOSUM ) )
@@ -1620,12 +1618,12 @@ void SwTxtFrm::Prepare( const PrepareHint ePrep, const void* pVoid,
            if( pHints )
            {
                const sal_uInt16 nSize = pHints->Count();
                const xub_StrLen nEnd = GetFollow() ?
                                    GetFollow()->GetOfst() : STRING_LEN;
                const sal_Int32 nEnd = GetFollow() ?
                                    GetFollow()->GetOfst() : COMPLETE_STRING;
                for ( sal_uInt16 i = 0; i < nSize; ++i )
                {
                    const SwTxtAttr *pHt = (*pHints)[i];
                    const xub_StrLen nStart = *pHt->GetStart();
                    const sal_Int32 nStart = *pHt->GetStart();
                    if( nStart >= GetOfst() )
                    {
                        if( nStart >= nEnd )
@@ -1757,7 +1755,7 @@ void SwTxtFrm::Prepare( const PrepareHint ePrep, const void* pVoid,
                // hochrutschen kann, die extra auf die naechste Seite gerutscht war, um mit
                // der Fussnote zusammen zu sein, insbesondere bei spaltigen Bereichen.
                OSL_ENSURE( GetFollow(), "PREP_FTN_GONE darf nur vom Follow gerufen werden" );
                xub_StrLen nPos = GetFollow()->GetOfst();
                sal_Int32 nPos = GetFollow()->GetOfst();
                if( IsFollow() && GetOfst() == nPos )       // falls wir gar keine Textmasse besitzen,
                    FindMaster()->Prepare( PREP_FTN_GONE ); // rufen wir das Prepare unseres Masters
                if( nPos )
@@ -1768,7 +1766,7 @@ void SwTxtFrm::Prepare( const PrepareHint ePrep, const void* pVoid,
        case PREP_ERGOSUM:
        case PREP_QUOVADIS:
            {
                xub_StrLen nPos;
                sal_Int32 nPos;
                if( lcl_ErgoVadis( this, nPos, ePrep ) )
                    InvalidateRange( SwCharRange( nPos, 1 ), 0 );
            }
@@ -1777,8 +1775,8 @@ void SwTxtFrm::Prepare( const PrepareHint ePrep, const void* pVoid,
        {
            if( pVoid )
            {
                xub_StrLen nWhere = CalcFlyPos( (SwFrmFmt*)pVoid );
                OSL_ENSURE( STRING_LEN != nWhere, "Prepare: Why me?" );
                sal_Int32 nWhere = CalcFlyPos( (SwFrmFmt*)pVoid );
                OSL_ENSURE( COMPLETE_STRING != nWhere, "Prepare: Why me?" );
                InvalidateRange( SwCharRange( nWhere, 1 ) );
                return;
            }
@@ -1791,8 +1789,8 @@ void SwTxtFrm::Prepare( const PrepareHint ePrep, const void* pVoid,
            {
                if( PREP_FLY_ARRIVE == ePrep || PREP_FLY_LEAVE == ePrep )
                {
                    xub_StrLen nLen = ( GetFollow() ? GetFollow()->GetOfst() :
                                      STRING_LEN ) - GetOfst();
                    sal_Int32 nLen = ( GetFollow() ? GetFollow()->GetOfst() :
                                      COMPLETE_STRING ) - GetOfst();
                    InvalidateRange( SwCharRange( GetOfst(), nLen ), 0 );
                }
            }
@@ -2438,7 +2436,7 @@ KSHORT SwTxtFrm::FirstLineHeight() const
    return pPara->Height();
}

MSHORT SwTxtFrm::GetLineCount( xub_StrLen nPos )
MSHORT SwTxtFrm::GetLineCount( sal_Int32 nPos )
{
    MSHORT nRet = 0;
    SwTxtFrm *pFrm = this;
@@ -2449,7 +2447,7 @@ MSHORT SwTxtFrm::GetLineCount( xub_StrLen nPos )
            break;
        SwTxtSizeInfo aInf( pFrm );
        SwTxtMargin aLine( pFrm, &aInf );
        if( STRING_LEN == nPos )
        if( COMPLETE_STRING == nPos )
            aLine.Bottom();
        else
            aLine.CharToLine( nPos );
diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx
index e9476da..1da0f8a 100644
--- a/sw/source/core/text/txtftn.cxx
+++ b/sw/source/core/text/txtftn.cxx
@@ -92,7 +92,7 @@ SwTxtFrm *SwTxtFrm::FindFtnRef( const SwTxtFtn *pFtn )
 *************************************************************************/

#ifdef DBG_UTIL
void SwTxtFrm::CalcFtnFlag( xub_StrLen nStop )//For testing the SplitFrm
void SwTxtFrm::CalcFtnFlag( sal_Int32 nStop )//For testing the SplitFrm
#else
void SwTxtFrm::CalcFtnFlag()
#endif
@@ -106,10 +106,10 @@ void SwTxtFrm::CalcFtnFlag()
    const sal_uInt16 nSize = pHints->Count();

#ifdef DBG_UTIL
    const xub_StrLen nEnd = nStop != STRING_LEN ? nStop
                        : GetFollow() ? GetFollow()->GetOfst() : STRING_LEN;
    const sal_Int32 nEnd = nStop != COMPLETE_STRING ? nStop
                        : GetFollow() ? GetFollow()->GetOfst() : COMPLETE_STRING;
#else
    const xub_StrLen nEnd = GetFollow() ? GetFollow()->GetOfst() : STRING_LEN;
    const sal_Int32 nEnd = GetFollow() ? GetFollow()->GetOfst() : COMPLETE_STRING;
#endif

    for ( sal_uInt16 i = 0; i < nSize; ++i )
@@ -117,7 +117,7 @@ void SwTxtFrm::CalcFtnFlag()
        const SwTxtAttr *pHt = (*pHints)[i];
        if ( pHt->Which() == RES_TXTATR_FTN )
        {
            const xub_StrLen nIdx = *pHt->GetStart();
            const sal_Int32 nIdx = *pHt->GetStart();
            if ( nEnd < nIdx )
                break;
            if( GetOfst() <= nIdx )
@@ -300,7 +300,7 @@ SwTwips SwTxtFrm::GetFtnLine( const SwTxtFtn *pFtn ) const

    SwTxtInfo aInf( pThis );
    SwTxtIter aLine( pThis, &aInf );
    const xub_StrLen nPos = *pFtn->GetStart();
    const sal_Int32 nPos = *pFtn->GetStart();
    aLine.CharToLine( nPos );

    SwTwips nRet = aLine.Y() + SwTwips(aLine.GetLineHeight());
@@ -427,7 +427,7 @@ SwTxtFrm *SwTxtFrm::FindQuoVadisFrm()
 *                      SwTxtFrm::RemoveFtn()
 *************************************************************************/

void SwTxtFrm::RemoveFtn( const xub_StrLen nStart, const xub_StrLen nLen )
void SwTxtFrm::RemoveFtn( const sal_Int32 nStart, const sal_Int32 nLen )
{
    if ( !IsFtnAllowed() )
        return;
@@ -436,9 +436,9 @@ void SwTxtFrm::RemoveFtn( const xub_StrLen nStart, const xub_StrLen nLen )
    if( !pHints )
        return;

    bool bRollBack = nLen != STRING_LEN;
    bool bRollBack = nLen != COMPLETE_STRING;
    sal_uInt16 nSize = pHints->Count();
    xub_StrLen nEnd;
    sal_Int32 nEnd;
    SwTxtFrm* pSource;
    if( bRollBack )
    {
@@ -449,7 +449,7 @@ void SwTxtFrm::RemoveFtn( const xub_StrLen nStart, const xub_StrLen nLen )
    }
    else
    {
        nEnd = STRING_LEN;
        nEnd = COMPLETE_STRING;
        pSource = this;
    }

@@ -467,7 +467,7 @@ void SwTxtFrm::RemoveFtn( const xub_StrLen nStart, const xub_StrLen nLen )
            if ( RES_TXTATR_FTN != pHt->Which() )
                continue;

            const xub_StrLen nIdx = *pHt->GetStart();
            const sal_Int32 nIdx = *pHt->GetStart();
            if( nStart > nIdx )
                break;

@@ -592,14 +592,14 @@ void SwTxtFrm::RemoveFtn( const xub_StrLen nStart, const xub_StrLen nLen )
    // des Follows ist aber veraltet, er wird demnaechst gesetzt. CalcFntFlag ist
    // auf einen richtigen Follow-Offset angewiesen. Deshalb wird hier kurzfristig
    // der Follow-Offset manipuliert.
    xub_StrLen nOldOfst = STRING_LEN;
    sal_Int32 nOldOfst = COMPLETE_STRING;
    if( HasFollow() && nStart > GetOfst() )
    {
        nOldOfst = GetFollow()->GetOfst();
        GetFollow()->ManipOfst( nStart + ( bRollBack ? nLen : 0 ) );
    }
    pSource->CalcFtnFlag();
    if( nOldOfst < STRING_LEN )
    if( nOldOfst < COMPLETE_STRING )
        GetFollow()->ManipOfst( nOldOfst );
}

@@ -1080,7 +1080,7 @@ SwErgoSumPortion *SwTxtFormatter::NewErgoSumPortion( SwTxtFormatInfo &rInf ) con
 *                  SwTxtFormatter::FormatQuoVadis()
 *************************************************************************/

xub_StrLen SwTxtFormatter::FormatQuoVadis( const xub_StrLen nOffset )
sal_Int32 SwTxtFormatter::FormatQuoVadis( const sal_Int32 nOffset )
{
    OSL_ENSURE( ! pFrm->IsVertical() || ! pFrm->IsSwapped(),
            "SwTxtFormatter::FormatQuoVadis with swapped frame" );
@@ -1172,7 +1172,7 @@ xub_StrLen SwTxtFormatter::FormatQuoVadis( const xub_StrLen nOffset )

    SWAP_IF_NOT_SWAPPED( pFrm )

    const xub_StrLen nRet = FormatLine( nStart );
    const sal_Int32 nRet = FormatLine( nStart );

    UNDO_SWAP( pFrm )

@@ -1588,7 +1588,7 @@ SwErgoSumPortion::SwErgoSumPortion(const OUString &rExp, const OUString& rStr)
    SetWhichPor( POR_ERGOSUM );
}

xub_StrLen SwErgoSumPortion::GetCrsrOfst( const KSHORT ) const
sal_Int32 SwErgoSumPortion::GetCrsrOfst( const KSHORT ) const
{
    return 0;
}
diff --git a/sw/source/core/text/wrong.cxx b/sw/source/core/text/wrong.cxx
index d4e6c6e..d28bc58 100644
--- a/sw/source/core/text/wrong.cxx
+++ b/sw/source/core/text/wrong.cxx
@@ -48,8 +48,8 @@ SwWrongArea::SwWrongArea( const rtl::OUString& rType,

SwWrongList::SwWrongList( WrongListType eType ) :
    meType       (eType),
    nBeginInvalid(STRING_LEN),  // everything correct... (the invalid area starts beyond the string)
    nEndInvalid  (STRING_LEN)
    nBeginInvalid(COMPLETE_STRING),  // everything correct... (the invalid area starts beyond the string)
    nEndInvalid  (COMPLETE_STRING)
{
    maList.reserve( 5 );
}
@@ -154,11 +154,11 @@ sal_Bool SwWrongList::Check( sal_Int32 &rChk, sal_Int32 &rLn ) const

    @param[in] rChk starting position of the word to check

    @return starting position of incorrectly selected area, <STRING_LEN> otherwise
    @return starting position of incorrectly selected area, <COMPLETE_STRING> otherwise
 */
sal_Int32 SwWrongList::NextWrong( sal_Int32 nChk ) const
{
    sal_Int32 nRet = STRING_LEN;
    sal_Int32 nRet = COMPLETE_STRING;
    sal_uInt16 nPos = GetWrongPos( nChk );
    if( nPos < Count() )
    {
@@ -168,7 +168,7 @@ sal_Int32 SwWrongList::NextWrong( sal_Int32 nChk ) const
            if( ++nPos < Count() )
                nRet = Pos( nPos );
            else
                nRet = STRING_LEN;
                nRet = COMPLETE_STRING;
        }
    }
    if( nRet > GetBeginInv() && nChk < GetEndInv() )
@@ -296,7 +296,7 @@ void SwWrongList::Move( sal_Int32 nPos, sal_Int32 nDiff )

        if ( bJump )
            ++i;
        if( STRING_LEN == GetBeginInv() )
        if( COMPLETE_STRING == GetBeginInv() )
            SetInvalid( nPos ? nPos - 1 : nPos, nPos + 1 );
        else
        {
@@ -308,7 +308,7 @@ void SwWrongList::Move( sal_Int32 nPos, sal_Int32 nDiff )
    else
    {
        const sal_Int32 nEnd = nPos + nDiff;
        if( STRING_LEN != GetBeginInv() )
        if( COMPLETE_STRING != GetBeginInv() )
        {
            if( nBeginInvalid > nPos )
                nBeginInvalid += nDiff;
@@ -419,7 +419,7 @@ sal_Bool SwWrongList::Fresh( sal_Int32 &rStart, sal_Int32 &rEnd, sal_Int32 nPos,

void SwWrongList::Invalidate( sal_Int32 nBegin, sal_Int32 nEnd )
{
    if (STRING_LEN == GetBeginInv())
    if (COMPLETE_STRING == GetBeginInv())
        SetInvalid( nBegin, nEnd );
    else
        _Invalidate( nBegin, nEnd );
@@ -465,7 +465,7 @@ SwWrongList* SwWrongList::SplitList( sal_Int32 nSplitPos )
        pRet->_Invalidate( nSplitPos ? nSplitPos - 1 : nSplitPos, nSplitPos );
        Remove( 0, nLst );
    }
    if( STRING_LEN == GetBeginInv() )
    if( COMPLETE_STRING == GetBeginInv() )
        SetInvalid( 0, 1 );
    else
    {
diff --git a/sw/source/core/txtnode/SwGrammarContact.cxx b/sw/source/core/txtnode/SwGrammarContact.cxx
index eb34d04..9138b02 100644
--- a/sw/source/core/txtnode/SwGrammarContact.cxx
+++ b/sw/source/core/txtnode/SwGrammarContact.cxx
@@ -124,7 +124,7 @@ SwGrammarMarkUp* SwGrammarContact::getGrammarCheck( SwTxtNode& rTxtNode, bool bC
                else
                {
                    mpProxyList = new SwGrammarMarkUp();
                    mpProxyList->SetInvalid( 0, STRING_LEN );
                    mpProxyList->SetInvalid( 0, COMPLETE_STRING );
                }
            }
           mbFinished = false;
@@ -137,7 +137,7 @@ SwGrammarMarkUp* SwGrammarContact::getGrammarCheck( SwTxtNode& rTxtNode, bool bC
        if( bCreate && !pRet ) // do you want to create a list?
        {
            pRet = new SwGrammarMarkUp();
            pRet->SetInvalid( 0, STRING_LEN );
            pRet->SetInvalid( 0, COMPLETE_STRING );
            rTxtNode.SetGrammarCheck( pRet );
            rTxtNode.SetGrammarCheckDirty( true );
        }
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 9f3c991..28391ba 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -183,7 +183,7 @@ struct CalcLinePosData
{
    SwDrawTextInfo& rInf;
    Font& rFont;
    xub_StrLen nCnt;
    sal_Int32 nCnt;
    const sal_Bool bSwitchH2V;
    const sal_Bool bSwitchL2R;
    long nHalfSpace;
@@ -191,7 +191,7 @@ struct CalcLinePosData
    const sal_Bool bBidiPor;

    CalcLinePosData( SwDrawTextInfo& _rInf, Font& _rFont,
                      xub_StrLen _nCnt, const sal_Bool _bSwitchH2V, const sal_Bool _bSwitchL2R,
                      sal_Int32 _nCnt, const sal_Bool _bSwitchH2V, const sal_Bool _bSwitchL2R,
                      long _nHalfSpace, sal_Int32* _pKernArray, const sal_Bool _bBidiPor) :
        rInf( _rInf ),
        rFont( _rFont ),
@@ -212,10 +212,10 @@ struct CalcLinePosData
*/

static void lcl_calcLinePos( const CalcLinePosData &rData,
    Point &rStart, Point &rEnd, xub_StrLen nStart, xub_StrLen nWrLen )
    Point &rStart, Point &rEnd, sal_Int32 nStart, sal_Int32 nWrLen )
{
   long nBlank = 0;
   const xub_StrLen nEnd = nStart + nWrLen;
   const sal_Int32 nEnd = nStart + nWrLen;
   const long nTmpSpaceAdd = rData.rInf.GetSpace() / SPACING_PRECISION_FACTOR;

   if ( nEnd < rData.nCnt
@@ -970,7 +970,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
    if ( bChgColor )
        pTmpFont->SetColor( aOldColor );

    if ( STRING_LEN == rInf.GetLen() )
    if ( COMPLETE_STRING == rInf.GetLen() )
        rInf.SetLen( rInf.GetText().getLength() );


@@ -1170,8 +1170,8 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
                    else
                    {
                        Point aTmpPos( aPos );
                        xub_StrLen i;
                        xub_StrLen j = 0;
                        sal_Int32 i;
                        sal_Int32 j = 0;
                        long nSpaceSum = 0;
                        for( i = 0; i < rInf.GetLen(); i++ )
                        {
@@ -1238,7 +1238,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )

            if( bStretch )
            {
                xub_StrLen nZwi = rInf.GetLen() - 1;
                sal_Int32 nZwi = rInf.GetLen() - 1;
                long nDiff = rInf.GetWidth() - pKernArray[ nZwi ]
                             - rInf.GetLen() * rInf.GetKern();
                long nRest = nDiff % nZwi;
@@ -1380,8 +1380,8 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
            else
            {
                Point aTmpPos( aPos );
                xub_StrLen j = 0;
                xub_StrLen i;
                sal_Int32 j = 0;
                sal_Int32 i;
                for( i = 0; i < rInf.GetLen(); i++ )
                {
                    if( CH_BLANK == rInf.GetText()[ rInf.GetIdx()+i ] )
@@ -1556,11 +1556,11 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
            // !!! HACK !!!
            // The Arabic layout engine requires some context of the string
            // which should be painted.
            xub_StrLen nCopyStart = rInf.GetIdx();
            sal_Int32 nCopyStart = rInf.GetIdx();
            if ( nCopyStart )
                --nCopyStart;

            xub_StrLen nCopyLen = rInf.GetLen();
            sal_Int32 nCopyLen = rInf.GetLen();
            if ( nCopyStart + nCopyLen < rInf.GetText().getLength() )
                ++nCopyLen;

@@ -1785,8 +1785,8 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
                }
            }

            xub_StrLen nOffs = 0;
            xub_StrLen nLen = rInf.GetLen();
            sal_Int32 nOffs = 0;
            sal_Int32 nLen = rInf.GetLen();

            if( nOffs < nLen )
            {
@@ -1794,7 +1794,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
                // the paragraph string. For the layout engine, the copy
                // of the string has to be an environment of the range which
                // is painted
                xub_StrLen nTmpIdx = bBullet ?
                sal_Int32 nTmpIdx = bBullet ?
                                              ( rInf.GetIdx() ? 1 : 0 ) :
                                              rInf.GetIdx();

@@ -1816,7 +1816,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf )
{
    Size aTxtSize;
    const xub_StrLen nLn = ( STRING_LEN != rInf.GetLen() ) ? rInf.GetLen() :
    const sal_Int32 nLn = ( COMPLETE_STRING != rInf.GetLen() ) ? rInf.GetLen() :
                           rInf.GetText().getLength();

    // be sure to have the correct layout mode at the printer
@@ -2022,7 +2022,7 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf )
}


xub_StrLen SwFntObj::GetCrsrOfst( SwDrawTextInfo &rInf )
sal_Int32 SwFntObj::GetCrsrOfst( SwDrawTextInfo &rInf )
{
    long nSpaceAdd =       rInf.GetSpace() / SPACING_PRECISION_FACTOR;
    const long nSperren = -rInf.GetSperren() / SPACING_PRECISION_FACTOR;
@@ -2111,7 +2111,7 @@ xub_StrLen SwFntObj::GetCrsrOfst( SwDrawTextInfo &rInf )

    long nLeft = 0;
    long nRight = 0;
    xub_StrLen nCnt = 0;
    sal_Int32 nCnt = 0;
    long nSpaceSum = 0;
    long nKernSum = 0;

@@ -2176,9 +2176,9 @@ xub_StrLen SwFntObj::GetCrsrOfst( SwDrawTextInfo &rInf )
    sal_Int32 nDone = 0;
    LanguageType aLang = LANGUAGE_NONE;
    bool bSkipCharacterCells = false;
    xub_StrLen nIdx = rInf.GetIdx();
    xub_StrLen nLastIdx = nIdx;
    const xub_StrLen nEnd = rInf.GetIdx() + rInf.GetLen();
    sal_Int32 nIdx = rInf.GetIdx();
    sal_Int32 nLastIdx = nIdx;
    const sal_Int32 nEnd = rInf.GetIdx() + rInf.GetLen();

    // #i105901#
    // skip character cells for all script types
@@ -2198,7 +2198,7 @@ xub_StrLen SwFntObj::GetCrsrOfst( SwDrawTextInfo &rInf )

        if ( bSkipCharacterCells )
        {
            nIdx = (xub_StrLen)g_pBreakIt->GetBreakIter()->nextCharacters( rInf.GetText(),
            nIdx = g_pBreakIt->GetBreakIter()->nextCharacters( rInf.GetText(),
                        nIdx, g_pBreakIt->GetLocale( aLang ), nItrMode, 1, nDone );
            if ( nIdx <= nLastIdx )
                break;
@@ -2347,13 +2347,13 @@ SwCacheObj *SwFntAccess::NewObj( )
    return new SwFntObj( *(SwSubFont *)pOwner, ++pMagicNo, pShell );
}

extern xub_StrLen sw_CalcCaseMap( const SwFont& rFnt,
extern sal_Int32 sw_CalcCaseMap( const SwFont& rFnt,
                                   const OUString& rOrigString,
                                   xub_StrLen nOfst,
                                   xub_StrLen nLen,
                                   xub_StrLen nIdx );
                                   sal_Int32 nOfst,
                                   sal_Int32 nLen,
                                   sal_Int32 nIdx );

xub_StrLen SwFont::GetTxtBreak( SwDrawTextInfo& rInf, long nTextWidth )
sal_Int32 SwFont::GetTxtBreak( SwDrawTextInfo& rInf, long nTextWidth )
{
    ChgFnt( rInf.GetShell(), rInf.GetOut() );

@@ -2369,7 +2369,7 @@ xub_StrLen SwFont::GetTxtBreak( SwDrawTextInfo& rInf, long nTextWidth )
    sal_Int32 nTxtBreak = 0;
    long nKern = 0;

    sal_uInt16 nLn = ( rInf.GetLen() == STRING_LEN ? rInf.GetText().getLength()
    sal_uInt16 nLn = ( rInf.GetLen() == COMPLETE_STRING ? rInf.GetText().getLength()
                                               : rInf.GetLen() );

    if ( rInf.GetFrm() && nLn && rInf.SnapToGrid() &&
@@ -2447,8 +2447,8 @@ xub_StrLen SwFont::GetTxtBreak( SwDrawTextInfo& rInf, long nTextWidth )

        const OUString* pTmpText;
        OUString aTmpText;
        xub_StrLen nTmpIdx;
        xub_StrLen nTmpLen;
        sal_Int32 nTmpIdx;
        sal_Int32 nTmpLen;
        bool bTextReplaced = false;

        if ( !aSub[nActual].IsCaseMap() )
@@ -2491,8 +2491,7 @@ xub_StrLen SwFont::GetTxtBreak( SwDrawTextInfo& rInf, long nTextWidth )
            nTxtBreak = rInf.GetOut().GetTextBreak( *pTmpText, nTextWidth,
                             static_cast<sal_Unicode>('-'), nHyphPos,
                             nTmpIdx, nTmpLen, nKern );
            *rInf.GetHyphPos() = (nHyphPos == -1)
                ? STRING_LEN : static_cast<xub_StrLen>(nHyphPos);
            *rInf.GetHyphPos() = (nHyphPos == -1) ? COMPLETE_STRING : nHyphPos;
        }
        else
            nTxtBreak = rInf.GetOut().GetTextBreak( *pTmpText, nTextWidth,
@@ -2508,7 +2507,7 @@ xub_StrLen SwFont::GetTxtBreak( SwDrawTextInfo& rInf, long nTextWidth )
        }
    }

    xub_StrLen nTxtBreak2 = nTxtBreak == -1 ? STRING_LEN : nTxtBreak;
    sal_Int32 nTxtBreak2 = nTxtBreak == -1 ? COMPLETE_STRING : nTxtBreak;

    if ( ! bCompress )
        return nTxtBreak2;
@@ -2528,7 +2527,7 @@ xub_StrLen SwFont::GetTxtBreak( SwDrawTextInfo& rInf, long nTextWidth )
                            rInf.GetKanaComp(), (sal_uInt16)GetHeight( nActual ) ) )
        {
            long nKernAdd = nKern;
            xub_StrLen nTmpBreak = nTxtBreak2;
            sal_Int32 nTmpBreak = nTxtBreak2;
            if( nKern && nTxtBreak2 )
                nKern *= nTxtBreak2 - 1;
            while( nTxtBreak2<nLn && nTextWidth >= pKernArray[nTxtBreak2] +nKern )
diff --git a/sw/source/core/txtnode/fntcap.cxx b/sw/source/core/txtnode/fntcap.cxx
index 075ad73..6355531 100644
--- a/sw/source/core/txtnode/fntcap.cxx
+++ b/sw/source/core/txtnode/fntcap.cxx
@@ -49,12 +49,12 @@ public:
    explicit SwCapitalInfo( const OUString& rOrigText ) :
        rString( rOrigText ), nIdx( 0 ), nLen( 0 ) {};
    const OUString& rString;
    xub_StrLen nIdx;
    xub_StrLen nLen;
    sal_Int32 nIdx;
    sal_Int32 nLen;
};

/*************************************************************************
 *                      xub_StrLen sw_CalcCaseMap()
 *                      sal_Int32 sw_CalcCaseMap()
 *
 * rFnt: required for CalcCaseMap
 * rOrigString: The original string
@@ -64,14 +64,14 @@ public:
 *       to a position in rOrigString
 *************************************************************************/

xub_StrLen sw_CalcCaseMap( const SwFont& rFnt,
sal_Int32 sw_CalcCaseMap( const SwFont& rFnt,
                            const OUString& rOrigString,
                            xub_StrLen nOfst,
                            xub_StrLen nLen,
                            xub_StrLen nIdx )
                            sal_Int32 nOfst,
                            sal_Int32 nLen,
                            sal_Int32 nIdx )
{
    int j = 0;
    const xub_StrLen nEnd = nOfst + nLen;
    const sal_Int32 nEnd = nOfst + nLen;
    OSL_ENSURE( nEnd <= rOrigString.getLength(), "sw_CalcCaseMap: Wrong parameters" );

    // special case for title case:
@@ -207,7 +207,7 @@ void SwDoGetCapitalBreak::Do()
            nTxtWidth -= rInf.GetSize().Width();
        else
        {
            xub_StrLen nEnd = rInf.GetEnd();
            sal_Int32 nEnd = rInf.GetEnd();
            m_nBreak = GetOut().GetTextBreak( rInf.GetText(), nTxtWidth,
                               rInf.GetIdx(), rInf.GetLen(), rInf.GetKern() );

@@ -238,7 +238,7 @@ void SwDoGetCapitalBreak::Do()

sal_Int32 SwFont::GetCapitalBreak( SwViewShell* pSh, const OutputDevice* pOut,
    const SwScriptInfo* pScript, const OUString& rTxt, long const nTextWidth,
    const xub_StrLen nIdx, const xub_StrLen nLen )
    const sal_Int32 nIdx, const sal_Int32 nLen )
{
    // Start:
    Point aPos( 0, 0 );
@@ -363,7 +363,7 @@ class SwDoCapitalCrsrOfst : public SwDoCapitals
protected:
    SwFntObj *pUpperFnt;
    SwFntObj *pLowerFnt;
    xub_StrLen nCrsr;
    sal_Int32 nCrsr;
    sal_uInt16 nOfst;
public:
    SwDoCapitalCrsrOfst( SwDrawTextInfo &rInfo, const sal_uInt16 nOfs ) :
@@ -374,7 +374,7 @@ public:
    virtual void Do();

    void DrawSpace( const Point &rPos );
    inline xub_StrLen GetCrsr(){ return nCrsr; }
    inline sal_Int32 GetCrsr(){ return nCrsr; }
};

void SwDoCapitalCrsrOfst::Init( SwFntObj *pUpperFont, SwFntObj *pLowerFont )
@@ -424,7 +424,7 @@ void SwDoCapitalCrsrOfst::Do()
 *                    SwSubFont::GetCapitalCrsrOfst()
 *************************************************************************/

xub_StrLen SwSubFont::GetCapitalCrsrOfst( SwDrawTextInfo& rInf )
sal_Int32 SwSubFont::GetCapitalCrsrOfst( SwDrawTextInfo& rInf )
{
    const long nOldKern = rInf.GetKern();
    rInf.SetKern( CheckKerning() );
@@ -443,7 +443,7 @@ xub_StrLen SwSubFont::GetCapitalCrsrOfst( SwDrawTextInfo& rInf )

class SwDoDrawStretchCapital : public SwDoDrawCapital
{
    const xub_StrLen nStrLen;
    const sal_Int32 nStrLen;
    const sal_uInt16 nCapWidth;
    const sal_uInt16 nOrgWidth;
public:
@@ -513,7 +513,7 @@ void SwSubFont::DrawStretchCapital( SwDrawTextInfo &rInf )
    // Es wird vorausgesetzt, dass rPos bereits kalkuliert ist!
    // hochgezogen in SwFont: const Point aPos( CalcPos(rPos) );

    if( rInf.GetLen() == STRING_LEN )
    if( rInf.GetLen() == COMPLETE_STRING )
        rInf.SetLen( rInf.GetText().getLength() );

    const Point& rOldPos = rInf.GetPos();
@@ -537,14 +537,14 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )

    long nKana = 0;
    const OUString aTxt( CalcCaseMap( rDo.GetInf().GetText() ) );
    xub_StrLen nMaxPos = std::min( sal_uInt16(rDo.GetInf().GetText().getLength() - rDo.GetInf().GetIdx()),
    sal_Int32 nMaxPos = std::min( rDo.GetInf().GetText().getLength() - rDo.GetInf().GetIdx(),
                             rDo.GetInf().GetLen() );
    rDo.GetInf().SetLen( nMaxPos );

    const OUString oldText = rDo.GetInf().GetText();
    rDo.GetInf().SetText( aTxt );
    xub_StrLen nPos = rDo.GetInf().GetIdx();
    xub_StrLen nOldPos = nPos;
    sal_Int32 nPos = rDo.GetInf().GetIdx();
    sal_Int32 nOldPos = nPos;
    nMaxPos = nMaxPos + nPos;

    // #107816#
@@ -623,10 +623,10 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )

    if( nPos < nMaxPos )
    {
        nPos = (xub_StrLen)g_pBreakIt->GetBreakIter()->endOfCharBlock(
        nPos = g_pBreakIt->GetBreakIter()->endOfCharBlock(
                        oldText, nPos,
            g_pBreakIt->GetLocale( eLng ), CharType::LOWERCASE_LETTER);
        if( nPos == STRING_LEN )
        if( nPos == COMPLETE_STRING )
            nPos = nOldPos;
        else if( nPos > nMaxPos )
            nPos = nMaxPos;
@@ -673,10 +673,10 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
            rDo.Do();
            nOldPos = nPos;
        }
        nPos = (xub_StrLen)g_pBreakIt->GetBreakIter()->nextCharBlock(
        nPos = g_pBreakIt->GetBreakIter()->nextCharBlock(
                            oldText, nPos,
               g_pBreakIt->GetLocale( eLng ), CharType::LOWERCASE_LETTER);
        if( nPos == STRING_LEN || nPos > nMaxPos )
        if( nPos == COMPLETE_STRING || nPos > nMaxPos )
            nPos = nMaxPos;
        OSL_ENSURE( nPos, "nextCharBlock not implemented?" );
#if OSL_DEBUG_LEVEL > 1
@@ -693,7 +693,7 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
                rDo.GetInf().SetUpper( sal_True );
                pLastFont = pBigFont;
                pLastFont->SetDevFont( rDo.GetInf().GetShell(), rDo.GetOut() );
                xub_StrLen nTmp;
                sal_Int32 nTmp;
                if( bWordWise )
                {
                    nTmp = nOldPos;
@@ -790,10 +790,10 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
                }
            } while( nOldPos != nPos );
        }
        nPos = (xub_StrLen)g_pBreakIt->GetBreakIter()->endOfCharBlock(
        nPos = g_pBreakIt->GetBreakIter()->endOfCharBlock(
                            oldText, nPos,
               g_pBreakIt->GetLocale( eLng ), CharType::LOWERCASE_LETTER);
        if( nPos == STRING_LEN || nPos > nMaxPos )
        if( nPos == COMPLETE_STRING || nPos > nMaxPos )
            nPos = nMaxPos;
        OSL_ENSURE( nPos, "endOfCharBlock not implemented?" );
#if OSL_DEBUG_LEVEL > 1
diff --git a/sw/source/core/txtnode/ndhints.cxx b/sw/source/core/txtnode/ndhints.cxx
index d637a2d..4809b15 100644
--- a/sw/source/core/txtnode/ndhints.cxx
+++ b/sw/source/core/txtnode/ndhints.cxx
@@ -42,8 +42,8 @@ static bool lcl_IsLessStart( const SwTxtAttr &rHt1, const SwTxtAttr &rHt2 )
{
    if ( *rHt1.GetStart() == *rHt2.GetStart() )
    {
        const xub_StrLen nHt1 = *rHt1.GetAnyEnd();
        const xub_StrLen nHt2 = *rHt2.GetAnyEnd();
        const sal_Int32 nHt1 = *rHt1.GetAnyEnd();
        const sal_Int32 nHt2 = *rHt2.GetAnyEnd();
        if ( nHt1 == nHt2 )
        {
            const sal_uInt16 nWhich1 = rHt1.Which();
@@ -75,8 +75,8 @@ static bool lcl_IsLessStart( const SwTxtAttr &rHt1, const SwTxtAttr &rHt2 )
// Zuerst nach Ende danach nach Ptr
static bool lcl_IsLessEnd( const SwTxtAttr &rHt1, const SwTxtAttr &rHt2 )
{
    const xub_StrLen nHt1 = *rHt1.GetAnyEnd();
    const xub_StrLen nHt2 = *rHt2.GetAnyEnd();
    const sal_Int32 nHt1 = *rHt1.GetAnyEnd();
    const sal_Int32 nHt2 = *rHt2.GetAnyEnd();
    if ( nHt1 == nHt2 )
    {
        if ( *rHt1.GetStart() == *rHt2.GetStart() )
@@ -178,8 +178,8 @@ bool SwpHintsArray::Check(bool bPortionsMerged) const
    // 1) gleiche Anzahl in beiden Arrays
    CHECK_ERR( m_HintStarts.size() == m_HintEnds.size(),
        "HintsCheck: wrong sizes" );
    xub_StrLen nLastStart = 0;
    xub_StrLen nLastEnd   = 0;
    sal_Int32 nLastStart = 0;
    sal_Int32 nLastEnd   = 0;

    const SwTxtAttr *pLastStart = 0;
    const SwTxtAttr *pLastEnd = 0;
@@ -210,7 +210,7 @@ bool SwpHintsArray::Check(bool bPortionsMerged) const
        CHECK_ERR( 0xFF != *(unsigned char*)pHt, "HintsCheck: start ptr was deleted" );

        // 3a) Stimmt die Start-Sortierung?
        xub_StrLen nIdx = *pHt->GetStart();
        sal_Int32 nIdx = *pHt->GetStart();
        CHECK_ERR( nIdx >= nLastStart, "HintsCheck: starts are unsorted" );

        // 4a) IsLessStart-Konsistenz
@@ -242,15 +242,15 @@ bool SwpHintsArray::Check(bool bPortionsMerged) const

        // 5) gleiche Pointer in beiden Arrays
        if (m_HintStarts.find(const_cast<SwTxtAttr*>(pHt)) == m_HintStarts.end())
            nIdx = STRING_LEN;
            nIdx = COMPLETE_STRING;

        CHECK_ERR( STRING_LEN != nIdx, "HintsCheck: no GetStartOf" );
        CHECK_ERR( COMPLETE_STRING != nIdx, "HintsCheck: no GetStartOf" );

        // 6) gleiche Pointer in beiden Arrays
        if (m_HintEnds.find(const_cast<SwTxtAttr*>(pHt)) == m_HintEnds.end())
            nIdx = STRING_LEN;
            nIdx = COMPLETE_STRING;

        CHECK_ERR( STRING_LEN != nIdx, "HintsCheck: no GetEndOf" );
        CHECK_ERR( COMPLETE_STRING != nIdx, "HintsCheck: no GetEndOf" );

        // 7a) character attributes in array?
        sal_uInt16 nWhich = pHt->Which();
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 3a2a174..afe6dc3 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -4250,8 +4250,8 @@ OUString SwTxtNode::GetLabelFollowedBy() const

void SwTxtNode::CalcHiddenCharFlags() const
{
    xub_StrLen nStartPos;
    xub_StrLen nEndPos;
    sal_Int32 nStartPos;
    sal_Int32 nEndPos;
    // Update of the flags is done inside GetBoundsOfHiddenRange()
    SwScriptInfo::GetBoundsOfHiddenRange( *this, 0, nStartPos, nEndPos );
}
diff --git a/sw/source/core/txtnode/swfont.cxx b/sw/source/core/txtnode/swfont.cxx
index 2269f24..7fdb145 100644
--- a/sw/source/core/txtnode/swfont.cxx
+++ b/sw/source/core/txtnode/swfont.cxx
@@ -1083,7 +1083,7 @@ Size SwSubFont::_GetTxtSize( SwDrawTextInfo& rInf )
    SwDigitModeModifier aDigitModeModifier( rInf.GetOut(), rInf.GetFont()->GetLanguage() );

    Size aTxtSize;
    xub_StrLen nLn = ( rInf.GetLen() == STRING_LEN ? rInf.GetText().getLength()
    sal_Int32 nLn = ( rInf.GetLen() == COMPLETE_STRING ? rInf.GetText().getLength()
                                                   : rInf.GetLen() );
    rInf.SetLen( nLn );
    if( IsCapital() && nLn )
@@ -1108,8 +1108,8 @@ Size SwSubFont::_GetTxtSize( SwDrawTextInfo& rInf )
                // If the length of the original string and the CaseMapped one
                // are different, it is necessary to handle the given text part as
                // a single snippet since its size may differ, too.
                xub_StrLen nOldIdx(rInf.GetIdx());
                xub_StrLen nOldLen(rInf.GetLen());
                sal_Int32 nOldIdx(rInf.GetIdx());
                sal_Int32 nOldLen(rInf.GetLen());
                const OUString aSnippet(oldStr.copy(nOldIdx, nOldLen));
                OUString aNewText(CalcCaseMap(aSnippet));

@@ -1145,8 +1145,8 @@ Size SwSubFont::_GetTxtSize( SwDrawTextInfo& rInf )

    if (1==rInf.GetLen() && CH_TXT_ATR_FIELDSTART==rInf.GetText()[rInf.GetIdx()])
    {
        xub_StrLen nOldIdx(rInf.GetIdx());
        xub_StrLen nOldLen(rInf.GetLen());
        sal_Int32 nOldIdx(rInf.GetIdx());
        sal_Int32 nOldLen(rInf.GetLen());
        OUString aNewText(CH_TXT_ATR_SUBST_FIELDSTART);
        rInf.SetText( aNewText );
        rInf.SetIdx( 0 );
@@ -1157,8 +1157,8 @@ Size SwSubFont::_GetTxtSize( SwDrawTextInfo& rInf )
    }
    else if (1==rInf.GetLen() && CH_TXT_ATR_FIELDEND==rInf.GetText()[ rInf.GetIdx() ])
    {
        xub_StrLen nOldIdx(rInf.GetIdx());
        xub_StrLen nOldLen(rInf.GetLen());
        sal_Int32 nOldIdx(rInf.GetIdx());
        sal_Int32 nOldLen(rInf.GetLen());
        OUString aNewText(CH_TXT_ATR_SUBST_FIELDEND);
        rInf.SetText( aNewText );
        rInf.SetIdx( 0 );
@@ -1177,7 +1177,7 @@ void SwSubFont::_DrawText( SwDrawTextInfo &rInf, const sal_Bool bGrey )
    sal_Int32 nLn = rInf.GetText().getLength();
    if( !rInf.GetLen() || !nLn )
        return;
    if( STRING_LEN == rInf.GetLen() )
    if( COMPLETE_STRING == rInf.GetLen() )
        rInf.SetLen( nLn );

    FontUnderline nOldUnder = UNDERLINE_NONE;
@@ -1223,8 +1223,8 @@ void SwSubFont::_DrawText( SwDrawTextInfo &rInf, const sal_Bool bGrey )
                // If the length of the original string and the CaseMapped one
                // are different, it is necessary to handle the given text part as
                // a single snippet since its size may differ, too.
                xub_StrLen nOldIdx(rInf.GetIdx());
                xub_StrLen nOldLen(rInf.GetLen());
                sal_Int32 nOldIdx(rInf.GetIdx());
                sal_Int32 nOldLen(rInf.GetLen());
                const OUString aSnippet(oldStr.copy(nOldIdx, nOldLen));
                OUString aNewText = CalcCaseMap(aSnippet);

@@ -1253,12 +1253,12 @@ void SwSubFont::_DrawText( SwDrawTextInfo &rInf, const sal_Bool bGrey )
        const OUString oldStr = rInf.GetText();
        OUString aStr("  ");

        xub_StrLen nOldIdx = rInf.GetIdx();
        xub_StrLen nOldLen = rInf.GetLen();
        sal_Int32 nOldIdx = rInf.GetIdx();
        sal_Int32 nOldLen = rInf.GetLen();
        long nSpace = 0;
        if( rInf.GetSpace() )
        {
            xub_StrLen nTmpEnd = nOldIdx + nOldLen;
            sal_Int32 nTmpEnd = nOldIdx + nOldLen;
            if (nTmpEnd > oldStr.getLength())
                nTmpEnd = oldStr.getLength();

@@ -1363,8 +1363,8 @@ void SwSubFont::_DrawStretchText( SwDrawTextInfo &rInf )
    {
        const OUString oldStr = rInf.GetText();
        OUString aStr("  ");
        xub_StrLen nOldIdx = rInf.GetIdx();
        xub_StrLen nOldLen = rInf.GetLen();
        sal_Int32 nOldIdx = rInf.GetIdx();
        sal_Int32 nOldLen = rInf.GetLen();
        rInf.SetText( aStr );
        rInf.SetIdx( 0 );
        rInf.SetLen( 2 );
@@ -1385,17 +1385,17 @@ void SwSubFont::_DrawStretchText( SwDrawTextInfo &rInf )
    rInf.SetPos( rOld );
}

xub_StrLen SwSubFont::_GetCrsrOfst( SwDrawTextInfo& rInf )
sal_Int32 SwSubFont::_GetCrsrOfst( SwDrawTextInfo& rInf )
{
    if ( !pLastFont || pLastFont->GetOwner()!=pMagic )
        ChgFnt( rInf.GetShell(), rInf.GetOut() );

    SwDigitModeModifier aDigitModeModifier( rInf.GetOut(), rInf.GetFont()->GetLanguage() );

    xub_StrLen nLn = rInf.GetLen() == STRING_LEN ? rInf.GetText().getLength()
    sal_Int32 nLn = rInf.GetLen() == COMPLETE_STRING ? rInf.GetText().getLength()
                                                 : rInf.GetLen();
    rInf.SetLen( nLn );
    xub_StrLen nCrsr = 0;
    sal_Int32 nCrsr = 0;
    if( IsCapital() && nLn )
        nCrsr = GetCapitalCrsrOfst( rInf );
    else
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index 6fc28bc..f4477e1 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -109,8 +109,8 @@ struct TxtAttrDeleter

struct TxtAttrContains
{
    xub_StrLen m_nPos;
    TxtAttrContains( const xub_StrLen nPos ) : m_nPos( nPos ) { }
    sal_Int32 m_nPos;
    TxtAttrContains( const sal_Int32 nPos ) : m_nPos( nPos ) { }
    bool operator() (SwTxtAttrEnd * const pAttr)
    {
        return (*pAttr->GetStart() < m_nPos) && (m_nPos < *pAttr->End());
@@ -134,8 +134,8 @@ struct TxtAttrContains
//                  |---| => valid: b after a
// ===> 2 invalid overlap cases
static
bool isOverlap(const xub_StrLen nStart1, const xub_StrLen nEnd1,
               const xub_StrLen nStart2, const xub_StrLen nEnd2)
bool isOverlap(const sal_Int32 nStart1, const sal_Int32 nEnd1,
               const sal_Int32 nStart2, const sal_Int32 nEnd2)
{
    return
        ((nStart1 > nStart2) && (nStart1 < nEnd2) && (nEnd1 > nEnd2))  // (1)
@@ -144,8 +144,8 @@ bool isOverlap(const xub_StrLen nStart1, const xub_StrLen nEnd1,

/// #i106930#: now asymmetric: empty hint1 is _not_ nested, but empty hint2 is
static
bool isNestedAny(const xub_StrLen nStart1, const xub_StrLen nEnd1,
                 const xub_StrLen nStart2, const xub_StrLen nEnd2)
bool isNestedAny(const sal_Int32 nStart1, const sal_Int32 nEnd1,
                 const sal_Int32 nStart2, const sal_Int32 nEnd2)
{
    return ((nStart1 == nStart2) || (nEnd1 == nEnd2))
        // same start/end: nested except if hint1 empty and hint2 not empty
@@ -225,7 +225,7 @@ void SwTxtRuby::InitRuby(SwTxtNode & rNode)
 */
static SwTxtAttrNesting *
MakeTxtAttrNesting(SwTxtNode & rNode, SwTxtAttrNesting & rNesting,
        const xub_StrLen nStart, const xub_StrLen nEnd)
        const sal_Int32 nStart, const sal_Int32 nEnd)
{
    SwTxtAttr * const pNew( MakeTxtAttr(
            *rNode.GetDoc(), rNesting.GetAttr(), nStart, nEnd ) );
@@ -252,18 +252,18 @@ typedef ::std::vector<SwTxtAttrNesting *> NestList_t;

static void
lcl_DoSplitNew(NestList_t & rSplits, SwTxtNode & rNode,
    const xub_StrLen nNewStart,
    const xub_StrLen nOtherStart, const xub_StrLen nOtherEnd, bool bOtherDummy)
    const sal_Int32 nNewStart,
    const sal_Int32 nOtherStart, const sal_Int32 nOtherEnd, bool bOtherDummy)
{
    const bool bSplitAtStart(nNewStart < nOtherStart);
    const xub_StrLen nSplitPos( (bSplitAtStart) ? nOtherStart : nOtherEnd );
    const sal_Int32 nSplitPos( (bSplitAtStart) ? nOtherStart : nOtherEnd );
    // first find the portion that is split (not necessarily the last one!)
    NestList_t::iterator const iter(
        ::std::find_if( rSplits.begin(), rSplits.end(),
            TxtAttrContains(nSplitPos) ) );
    if (iter != rSplits.end()) // already split here?
    {
        const xub_StrLen nStartPos( // skip other's dummy character!
        const sal_Int32 nStartPos( // skip other's dummy character!
            (bSplitAtStart && bOtherDummy) ? nSplitPos + 1 : nSplitPos );
        SwTxtAttrNesting * const pNew( MakeTxtAttrNesting(
                rNode, **iter, nStartPos, *(*iter)->GetEnd() ) );
@@ -354,8 +354,8 @@ SwpHints::TryInsertNesting( SwTxtNode & rNode, SwTxtAttrNesting & rNewHint )
{
//    INVARIANT:  the nestable hints in the array are properly nested
    const sal_uInt16 nNewWhich( rNewHint.Which() );
    const xub_StrLen nNewStart( *rNewHint.GetStart() );
    const xub_StrLen nNewEnd  ( *rNewHint.GetEnd()   );
    const sal_Int32 nNewStart( *rNewHint.GetStart() );
    const sal_Int32 nNewEnd  ( *rNewHint.GetEnd()   );
    const bool bNewSelfNestable( isSelfNestable(nNewWhich) );

    OSL_ENSURE( (RES_TXTATR_INETFMT   == nNewWhich) ||
@@ -379,8 +379,8 @@ SwpHints::TryInsertNesting( SwTxtNode & rNode, SwTxtAttrNesting & rNewHint )
        if (pOther->IsNesting())
        {
            const sal_uInt16 nOtherWhich( pOther->Which() );
            const xub_StrLen nOtherStart( *(pOther)->GetStart() );
            const xub_StrLen nOtherEnd  ( *(pOther)->GetEnd()   );
            const sal_Int32 nOtherStart( *(pOther)->GetStart() );
            const sal_Int32 nOtherEnd  ( *(pOther)->GetEnd()   );
            if (isOverlap(nNewStart, nNewEnd, nOtherStart, nOtherEnd ))
            {
                switch (splitPolicy(nNewWhich, nOtherWhich))
@@ -446,14 +446,14 @@ SwpHints::TryInsertNesting( SwTxtNode & rNode, SwTxtAttrNesting & rNewHint )
    for (NestList_t::iterator itOther = OverlappingExisting.begin();
            itOther != OverlappingExisting.end(); ++itOther)
    {
        const xub_StrLen nOtherStart( *(*itOther)->GetStart() );
        const xub_StrLen nOtherEnd  ( *(*itOther)->GetEnd()   );
        const sal_Int32 nOtherStart( *(*itOther)->GetStart() );
        const sal_Int32 nOtherEnd  ( *(*itOther)->GetEnd()   );

        for (NestList_t::iterator itNew = SplitNew.begin();
                itNew != SplitNew.end(); ++itNew)
        {
            const xub_StrLen nSplitNewStart( *(*itNew)->GetStart() );
            const xub_StrLen nSplitNewEnd  ( *(*itNew)->GetEnd()   );
            const sal_Int32 nSplitNewStart( *(*itNew)->GetStart() );
            const sal_Int32 nSplitNewEnd  ( *(*itNew)->GetEnd()   );
            // 4 cases: within, around, overlap l, overlap r, (OTHER: no action)
            const bool bRemoveOverlap(
                !bNewSelfNestable && (nNewWhich == (*itOther)->Which()) );
@@ -536,8 +536,8 @@ SwpHints::TryInsertNesting( SwTxtNode & rNode, SwTxtAttrNesting & rNewHint )
    for (NestList_t::iterator itOther = OverwrittenExisting.begin();
            itOther != OverwrittenExisting.end(); ++itOther)
    {
        const xub_StrLen nOtherStart( *(*itOther)->GetStart() );
        const xub_StrLen nOtherEnd  ( *(*itOther)->GetEnd()   );
        const sal_Int32 nOtherStart( *(*itOther)->GetStart() );
        const sal_Int32 nOtherEnd  ( *(*itOther)->GetEnd()   );

        // overwritten portion is given by start/end of inserted hint
        if ((nNewStart <= nOtherStart) && (nOtherEnd <= nNewEnd))
@@ -2053,7 +2053,7 @@ struct SwPoolItemEndPair
{
public:
    const SfxPoolItem* mpItem;
    xub_StrLen mnEndPos;
    sal_Int32 mnEndPos;

    SwPoolItemEndPair() : mpItem( 0 ), mnEndPos( 0 ) {};
};
@@ -2687,7 +2687,7 @@ bool SwpHints::MergePortions( SwTxtNode& rNode )
    typedef std::multimap< int, std::pair<SwTxtAttr*, bool> > PortionMap;
    PortionMap aPortionMap;
    std::map<int, bool> RsidOnlyAutoFmtFlagMap;
    xub_StrLen nLastPorStart = STRING_LEN;
    sal_Int32 nLastPorStart = COMPLETE_STRING;
    sal_uInt16 i = 0;
    int nKey = 0;

@@ -2737,7 +2737,7 @@ bool SwpHints::MergePortions( SwTxtNode& rNode )
            continue;
        }

        const xub_StrLen nPorStart = *pHt->GetStart();
        const sal_Int32 nPorStart = *pHt->GetStart();
        if (nPorStart != nLastPorStart)
            ++nKey;
        nLastPorStart = nPorStart;
@@ -2876,7 +2876,7 @@ bool SwpHints::MergePortions( SwTxtNode& rNode )
            // important: delete second range so any IgnoreStart on the first
            // range is still valid
            // erase all elements with key i + 1
            xub_StrLen nNewPortionEnd = 0;
            sal_Int32 nNewPortionEnd = 0;
            for ( aIter2 = aRange2.first; aIter2 != aRange2.second; ++aIter2 )
            {
                SwTxtAttr *const p2 = aIter2->second.first;
@@ -2950,22 +2950,22 @@ bool SwpHints::MergePortions( SwTxtNode& rNode )
// check if there is already a character format and adjust the sort numbers
static void lcl_CheckSortNumber( const SwpHints& rHints, SwTxtCharFmt& rNewCharFmt )
{
    const xub_StrLen nHtStart = *rNewCharFmt.GetStart();
    const xub_StrLen nHtEnd   = *rNewCharFmt.GetEnd();
    const sal_Int32 nHtStart = *rNewCharFmt.GetStart();
    const sal_Int32 nHtEnd   = *rNewCharFmt.GetEnd();
    sal_uInt16 nSortNumber = 0;

    for ( sal_uInt16 i = 0; i < rHints.Count(); ++i )
    {
        const SwTxtAttr* pOtherHt = rHints[i];

        const xub_StrLen nOtherStart = *pOtherHt->GetStart();
        const sal_Int32 nOtherStart = *pOtherHt->GetStart();

        if ( nOtherStart > nHtStart )
            break;

        if ( RES_TXTATR_CHARFMT == pOtherHt->Which() )
        {
            const xub_StrLen nOtherEnd = *pOtherHt->End();
            const sal_Int32 nOtherEnd = *pOtherHt->End();

            if ( nOtherStart == nHtStart && nOtherEnd == nHtEnd )
            {
diff --git a/sw/source/core/txtnode/txatritr.cxx b/sw/source/core/txtnode/txatritr.cxx
index b29df9f..f67fafbd 100644
--- a/sw/source/core/txtnode/txatritr.cxx
+++ b/sw/source/core/txtnode/txatritr.cxx
@@ -30,7 +30,7 @@ using namespace ::com::sun::star;


SwScriptIterator::SwScriptIterator(
            const OUString& rStr, xub_StrLen nStt, bool const bFrwrd)
            const OUString& rStr, sal_Int32 nStt, bool const bFrwrd)
    : m_rText(rStr)
    , m_nChgPos(rStr.getLength())
    , nCurScript(i18n::ScriptType::WEAK)
@@ -41,13 +41,13 @@ SwScriptIterator::SwScriptIterator(
        if ( ! bFrwrd && nStt )
            --nStt;

        xub_StrLen nPos = nStt;
        sal_Int32 nPos = nStt;
        nCurScript = g_pBreakIt->GetBreakIter()->getScriptType(m_rText, nPos);
        if( i18n::ScriptType::WEAK == nCurScript )
        {
            if( nPos )
            {
                nPos = (xub_StrLen)g_pBreakIt->GetBreakIter()->beginOfScript(
                nPos = g_pBreakIt->GetBreakIter()->beginOfScript(
                                                m_rText, nPos, nCurScript);
                if (nPos && nPos < m_rText.getLength())
                {
@@ -97,7 +97,7 @@ bool SwScriptIterator::Next()
// --------------------------------------------------------------------

SwTxtAttrIterator::SwTxtAttrIterator( const SwTxtNode& rTNd, sal_uInt16 nWhchId,
                                        xub_StrLen nStt,
                                        sal_Int32 nStt,
                                        bool bUseGetWhichOfScript )
    : aSIter( rTNd.GetTxt(), nStt ), rTxtNd( rTNd ),
    pParaItem( 0 ), nChgPos( nStt ), nAttrPos( 0 ), nWhichId( nWhchId ),
@@ -187,7 +187,7 @@ void SwTxtAttrIterator::SearchNextChg()
        pParaItem = &rTxtNd.GetSwAttrSet().Get( nWh );
    }

    xub_StrLen nStt = nChgPos;
    sal_Int32 nStt = nChgPos;
    nChgPos = aSIter.GetScriptChgPos();
    pCurItem = pParaItem;

diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index b26e6ad7..b06b5e1 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -114,8 +114,8 @@ lcl_MaskRedlines( const SwTxtNode& rNode, OUStringBuffer& rText,

        if( nsRedlineType_t::REDLINE_DELETE == pRed->GetType() )
        {
            xub_StrLen nRedlineEnd;
            xub_StrLen nRedlineStart;
            sal_Int32 nRedlineEnd;
            sal_Int32 nRedlineStart;

            pRed->CalcStartEnd( rNode.GetIndex(), nRedlineStart, nRedlineEnd );

@@ -1109,8 +1109,8 @@ sal_uInt16 SwTxtNode::Convert( SwConversionArgs &rArgs )
    }

    bool    bFound  = false;
    xub_StrLen  nBegin  = nTextBegin;
    xub_StrLen  nLen = 0;
    sal_Int32  nBegin  = nTextBegin;
    sal_Int32  nLen = 0;
    LanguageType nLangFound = LANGUAGE_NONE;
    if (m_Text.isEmpty())
    {
@@ -1132,7 +1132,7 @@ sal_uInt16 SwTxtNode::Convert( SwConversionArgs &rArgs )
        // Implicit changes require setting new attributes, which in turn destroys
        // the attribute sequence on that aIter iterates. We store the necessary
        // coordinates and apply those changes after iterating through the text.
        typedef std::pair<xub_StrLen, xub_StrLen> ImplicitChangesRange;
        typedef std::pair<sal_Int32, sal_Int32> ImplicitChangesRange;
        std::vector<ImplicitChangesRange> aImplicitChanges;

        // find non zero length text portion of appropriate language
@@ -1142,11 +1142,11 @@ sal_uInt16 SwTxtNode::Convert( SwConversionArgs &rArgs )
                                (editeng::HangulHanjaConversion::IsChinese( nLangFound ) &&
                                 editeng::HangulHanjaConversion::IsChinese( rArgs.nConvSrcLang ));

            xub_StrLen nChPos = aIter.GetChgPos();
            // the position at the end of the paragraph returns -1
            // that becomes 65535 when converted to xub_StrLen,
            // and thus must be cut to the end of the actual string.
            if (nChPos == (xub_StrLen) -1)
            sal_Int32 nChPos = aIter.GetChgPos();
            // the position at the end of the paragraph is COMPLETE_STRING and
            // thus must be cut to the end of the actual string.
            assert(nChPos != -1);
            if (nChPos == -1 || nChPos == COMPLETE_STRING)
            {
                nChPos = m_Text.getLength();
            }
@@ -1220,7 +1220,7 @@ sal_uInt16 SwTxtNode::Convert( SwConversionArgs &rArgs )

// Die Aehnlichkeiten zu SwTxtNode::Spell sind beabsichtigt ...
// ACHTUNG: Ev. Bugs in beiden Routinen fixen!
SwRect SwTxtFrm::_AutoSpell( const SwCntntNode* pActNode, const SwViewOption& rViewOpt, xub_StrLen nActPos )
SwRect SwTxtFrm::_AutoSpell( const SwCntntNode* pActNode, const SwViewOption& rViewOpt, sal_Int32 nActPos )
{
    SwRect aRect;
#if OSL_DEBUG_LEVEL > 1
@@ -1232,7 +1232,7 @@ SwRect SwTxtFrm::_AutoSpell( const SwCntntNode* pActNode, const SwViewOption& rV
    // ACHTUNG: Ev. Bugs in beiden Routinen fixen!
    SwTxtNode *pNode = GetTxtNode();
    if( pNode != pActNode || !nActPos )
        nActPos = STRING_LEN;
        nActPos = COMPLETE_STRING;

    SwAutoCompleteWord& rACW = SwDoc::GetAutoCompleteWords();

@@ -1252,9 +1252,9 @@ SwRect SwTxtFrm::_AutoSpell( const SwCntntNode* pActNode, const SwViewOption& rV
    sal_Int32 nBegin = 0;
    sal_Int32 nEnd = pNode->GetTxt().getLength();
    sal_Int32 nInsertPos = 0;
    sal_Int32 nChgStart = STRING_LEN;
    sal_Int32 nChgStart = COMPLETE_STRING;
    sal_Int32 nChgEnd = 0;
    sal_Int32 nInvStart = STRING_LEN;
    sal_Int32 nInvStart = COMPLETE_STRING;
    sal_Int32 nInvEnd = 0;

    const bool bAddAutoCmpl = pNode->IsAutoCompleteWordDirty() &&
@@ -1263,13 +1263,13 @@ SwRect SwTxtFrm::_AutoSpell( const SwCntntNode* pActNode, const SwViewOption& rV
    if( pNode->GetWrong() )
    {
        nBegin = pNode->GetWrong()->GetBeginInv();
        if( STRING_LEN != nBegin )
        if( COMPLETE_STRING != nBegin )
        {
            nEnd = std::max(pNode->GetWrong()->GetEndInv(), pNode->GetTxt().getLength());
        }

        // get word around nBegin, we start at nBegin - 1
        if ( STRING_LEN != nBegin )
        if ( COMPLETE_STRING != nBegin )
        {
            if ( nBegin )
                --nBegin;
@@ -1312,7 +1312,7 @@ SwRect SwTxtFrm::_AutoSpell( const SwCntntNode* pActNode, const SwViewOption& rV
        {
            const OUString& rWord = aScanner.GetWord();
            nBegin = aScanner.GetBegin();
            xub_StrLen nLen = aScanner.GetLen();
            sal_Int32 nLen = aScanner.GetLen();

            // get next language for next word, consider language attributes
            // within the word
@@ -1380,7 +1380,7 @@ SwRect SwTxtFrm::_AutoSpell( const SwCntntNode* pActNode, const SwViewOption& rV
        }

        pNode->GetWrong()->SetInvalid( nInvStart, nInvEnd );
        pNode->SetWrongDirty( STRING_LEN != pNode->GetWrong()->GetBeginInv() );
        pNode->SetWrongDirty( COMPLETE_STRING != pNode->GetWrong()->GetBeginInv() );
        if( !pNode->GetWrong()->Count() && ! pNode->IsWrongDirty() )
            pNode->SetWrong( NULL );
    }
@@ -1404,7 +1404,7 @@ SwRect SwTxtFrm::_AutoSpell( const SwCntntNode* pActNode, const SwViewOption& rV
    @param nActPos ???
    @return SwRect Repaint area
*/
SwRect SwTxtFrm::SmartTagScan( SwCntntNode* /*pActNode*/, xub_StrLen /*nActPos*/ )
SwRect SwTxtFrm::SmartTagScan( SwCntntNode* /*pActNode*/, sal_Int32 /*nActPos*/ )
{
    SwRect aRet;
    SwTxtNode *pNode = GetTxtNode();
@@ -1420,7 +1420,7 @@ SwRect SwTxtFrm::SmartTagScan( SwCntntNode* /*pActNode*/, xub_StrLen /*nActPos*/

    if ( pSmartTagList )
    {
        if ( pSmartTagList->GetBeginInv() != STRING_LEN )
        if ( pSmartTagList->GetBeginInv() != COMPLETE_STRING )
        {
            nBegin = pSmartTagList->GetBeginInv();
            nEnd = std::min( pSmartTagList->GetEndInv(), rText.getLength() );
@@ -1442,10 +1442,10 @@ SwRect SwTxtFrm::SmartTagScan( SwCntntNode* /*pActNode*/, xub_StrLen /*nActPos*/
    // clear smart tag list between nBegin and nEnd:
    if ( 0 != nNumberOfEntries )
    {
        sal_Int32 nChgStart = STRING_LEN;
        sal_Int32 nChgStart = COMPLETE_STRING;
        sal_Int32 nChgEnd = 0;
        const sal_uInt16 nCurrentIndex = pSmartTagList->GetWrongPos( nBegin );
        pSmartTagList->Fresh( nChgStart, nChgEnd, nBegin, nEnd - nBegin, nCurrentIndex, STRING_LEN );
        pSmartTagList->Fresh( nChgStart, nChgEnd, nBegin, nEnd - nBegin, nCurrentIndex, COMPLETE_STRING );
        nNumberOfRemovedEntries = nNumberOfEntries - pSmartTagList->Count();
    }

@@ -1498,8 +1498,8 @@ SwRect SwTxtFrm::SmartTagScan( SwCntntNode* /*pActNode*/, xub_StrLen /*nActPos*/
    if( pSmartTagList )
    {
        // Update WrongList stuff
        pSmartTagList->SetInvalid( STRING_LEN, 0 );
        pNode->SetSmartTagDirty( STRING_LEN != pSmartTagList->GetBeginInv() );
        pSmartTagList->SetInvalid( COMPLETE_STRING, 0 );
        pNode->SetSmartTagDirty( COMPLETE_STRING != pSmartTagList->GetBeginInv() );

        if( !pSmartTagList->Count() && !pNode->IsSmartTagDirty() )
            pNode->SetSmartTags( NULL );
@@ -1522,11 +1522,11 @@ SwRect SwTxtFrm::SmartTagScan( SwCntntNode* /*pActNode*/, xub_StrLen /*nActPos*/
}

// Wird vom CollectAutoCmplWords gerufen
void SwTxtFrm::CollectAutoCmplWrds( SwCntntNode* pActNode, xub_StrLen nActPos )
void SwTxtFrm::CollectAutoCmplWrds( SwCntntNode* pActNode, sal_Int32 nActPos )
{
    SwTxtNode *pNode = GetTxtNode();
    if( pNode != pActNode || !nActPos )
        nActPos = STRING_LEN;
        nActPos = COMPLETE_STRING;

    SwDoc* pDoc = pNode->GetDoc();
    SwAutoCompleteWord& rACW = SwDoc::GetAutoCompleteWords();
diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx
index 9e32059..a4d535c 100644
--- a/sw/source/core/undo/rolbck.cxx
+++ b/sw/source/core/undo/rolbck.cxx
@@ -394,7 +394,7 @@ int SwHistorySetTOXMark::IsEqual( const SwTOXMark& rCmp ) const
}

SwHistoryResetTxt::SwHistoryResetTxt( sal_uInt16 nWhich,
            xub_StrLen nAttrStart, xub_StrLen nAttrEnd, sal_uLong nNodePos )
            sal_Int32 nAttrStart, sal_Int32 nAttrEnd, sal_uLong nNodePos )
    : SwHistoryHint( HSTRY_RESETTXTHNT )
    , m_nNodeIndex( nNodePos ), m_nStart( nAttrStart ), m_nEnd( nAttrEnd )
    , m_nAttr( nWhich )
@@ -781,7 +781,7 @@ void SwHistorySetAttrSet::SetInDoc( SwDoc* pDoc, bool )
}

SwHistoryResetAttrSet::SwHistoryResetAttrSet( const SfxItemSet& rSet,
                    sal_uLong nNodePos, xub_StrLen nAttrStt, xub_StrLen nAttrEnd )
                    sal_uLong nNodePos, sal_Int32 nAttrStt, sal_Int32 nAttrEnd )
    : SwHistoryHint( HSTRY_RESETATTRSET )
    , m_nNodeIndex( nNodePos ), m_nStart( nAttrStt ), m_nEnd( nAttrEnd )
    , m_Array( (sal_uInt8)rSet.Count() )
@@ -871,7 +871,7 @@ SwHistoryChangeFlyAnchor::SwHistoryChangeFlyAnchor( SwFrmFmt& rFmt )
    , m_nOldNodeIndex( rFmt.GetAnchor().GetCntntAnchor()->nNode.GetIndex() )
    , m_nOldContentIndex( (FLY_AT_CHAR == rFmt.GetAnchor().GetAnchorId())
            ?   rFmt.GetAnchor().GetCntntAnchor()->nContent.GetIndex()
            :   STRING_MAXLEN )
            :   COMPLETE_STRING )
{
}

@@ -888,7 +888,7 @@ void SwHistoryChangeFlyAnchor::SetInDoc( SwDoc* pDoc, bool )
        SwNode* pNd = pDoc->GetNodes()[ m_nOldNodeIndex ];
        SwCntntNode* pCNd = pNd->GetCntntNode();
        SwPosition aPos( *pNd );
        if ( STRING_MAXLEN != m_nOldContentIndex )
        if ( COMPLETE_STRING != m_nOldContentIndex )
        {
            OSL_ENSURE(pCNd, "SwHistoryChangeFlyAnchor: no ContentNode");
            if (pCNd)
@@ -1219,8 +1219,8 @@ void SwHistory::CopyFmtAttr( const SfxItemSet& rSet, sal_uLong nNodeIdx )
void SwHistory::CopyAttr(
    SwpHints* pHts,
    const sal_uLong nNodeIdx,
    const xub_StrLen nStart,
    const xub_StrLen nEnd,
    const sal_Int32 nStart,
    const sal_Int32 nEnd,
    const bool bCopyFields )
{
    if( !pHts  )
@@ -1342,7 +1342,7 @@ void SwRegHistory::AddHint( SwTxtAttr* pHt, const bool bNew )
}

bool SwRegHistory::InsertItems( const SfxItemSet& rSet,
    xub_StrLen const nStart, xub_StrLen const nEnd, SetAttrMode const nFlags )
    sal_Int32 const nStart, sal_Int32 const nEnd, SetAttrMode const nFlags )
{
    if( !rSet.Count() )
        return false;
diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx
index 5a5df29..c5f1076 100644
--- a/sw/source/core/undo/unattr.cxx
+++ b/sw/source/core/undo/unattr.cxx
@@ -415,7 +415,7 @@ void SwUndoFmtAttr::SaveFlyAnchor( bool bSvDrwPt )
    if( !rAnchor.GetCntntAnchor() )
        return;

    xub_StrLen nCntnt = 0;
    sal_Int32 nCntnt = 0;
    switch( rAnchor.GetAnchorId() )
    {
    case FLY_AS_CHAR:
@@ -897,7 +897,7 @@ void SwUndoAttr::RemoveIdx( SwDoc& rDoc )
    SwNodes& rNds = rDoc.GetNodes();
    for ( sal_uInt16 n = 0; n < m_pHistory->Count(); ++n )
    {
        xub_StrLen nCntnt = 0;
        sal_Int32 nCntnt = 0;
        sal_uLong nNode = 0;
        pHstHnt = (*m_pHistory)[ n ];
        switch ( pHstHnt->Which() )
@@ -919,7 +919,7 @@ void SwUndoAttr::RemoveIdx( SwDoc& rDoc )
                    SwHistoryResetAttrSet * pHistoryHint
                        = static_cast<SwHistoryResetAttrSet*>(pHstHnt);
                    nCntnt = pHistoryHint->GetCntnt();
                    if ( STRING_MAXLEN != nCntnt )
                    if ( COMPLETE_STRING != nCntnt )
                    {
                        const std::vector<sal_uInt16>& rArr = pHistoryHint->GetArr();
                        for ( sal_uInt16 i = rArr.size(); i; )
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index 12bd392..31fd89b 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -80,7 +80,7 @@ void SwUndRng::SetValues( const SwPaM& rPam )
    }
    else
        // no selection !!
        nEndNode = 0, nEndCntnt = STRING_MAXLEN;
        nEndNode = 0, nEndCntnt = COMPLETE_STRING;

    nSttNode = pStt->nNode.GetIndex();
    nSttCntnt = pStt->nContent.GetIndex();
@@ -98,7 +98,7 @@ void SwUndRng::SetPaM( SwPaM & rPam, sal_Bool bCorrToCntnt ) const
    else
        rPam.GetPoint()->nContent.Assign( 0, 0 );

    if( !nEndNode && STRING_MAXLEN == nEndCntnt )       // no selection
    if( !nEndNode && COMPLETE_STRING == nEndCntnt )       // no selection
        return ;

    rPam.SetMark();
@@ -321,7 +321,7 @@ SwUndoSaveCntnt::~SwUndoSaveCntnt()
// If pEndNdIdx is given, Undo/Redo calls -Ins/DelFly. In that case the whole
// section should be moved.
void SwUndoSaveCntnt::MoveToUndoNds( SwPaM& rPaM, SwNodeIndex* pNodeIdx,
                    sal_uLong* pEndNdIdx, xub_StrLen* pEndCntIdx )
                    sal_uLong* pEndNdIdx, sal_Int32* pEndCntIdx )
{
    SwDoc& rDoc = *rPaM.GetDoc();
    ::sw::UndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo());
@@ -362,7 +362,7 @@ void SwUndoSaveCntnt::MoveToUndoNds( SwPaM& rPaM, SwNodeIndex* pNodeIdx,

void SwUndoSaveCntnt::MoveFromUndoNds( SwDoc& rDoc, sal_uLong nNodeIdx,
                            SwPosition& rInsPos,
                            sal_uLong* pEndNdIdx, xub_StrLen* pEndCntIdx )
                            sal_uLong* pEndNdIdx, sal_Int32* pEndCntIdx )
{
    // here comes the recovery
    SwNodes & rNds = rDoc.GetUndoManager().GetUndoNodes();
@@ -1115,7 +1115,7 @@ sal_Bool SwUndo::CanRedlineGroup( SwRedlineSaveDatas& rCurr,
}

// #111827#
OUString ShortenString(const OUString & rStr, xub_StrLen nLength, const OUString & rFillStr)
OUString ShortenString(const OUString & rStr, sal_Int32 nLength, const OUString & rFillStr)
{
    assert(nLength - rFillStr.getLength() >= 2);

@@ -1125,14 +1125,14 @@ OUString ShortenString(const OUString & rStr, xub_StrLen nLength, const OUString
        aResult = rStr;
    else
    {
        long nTmpLength = nLength - rFillStr.getLength();
        sal_Int32 nTmpLength = nLength - rFillStr.getLength();
        if ( nTmpLength < 2 )
            nTmpLength = 2;

        nLength = static_cast<xub_StrLen>(nTmpLength);
        nLength = nTmpLength;

        const xub_StrLen nFrontLen = nLength - nLength / 2;
        const xub_StrLen nBackLen = nLength - nFrontLen;
        const sal_Int32 nFrontLen = nLength - nLength / 2;
        const sal_Int32 nBackLen = nLength - nFrontLen;

        aResult += rStr.copy(0, nFrontLen);
        aResult += rFillStr;
diff --git a/sw/source/core/undo/undobj1.cxx b/sw/source/core/undo/undobj1.cxx
index 9a18d6f..69e1f0d 100644
--- a/sw/source/core/undo/undobj1.cxx
+++ b/sw/source/core/undo/undobj1.cxx
@@ -219,7 +219,7 @@ void SwUndoFlyBase::DelFly( SwDoc* pDoc )
    rFlyFmts.erase( std::find( rFlyFmts.begin(), rFlyFmts.end(), pFrmFmt ));
}

SwUndoInsLayFmt::SwUndoInsLayFmt( SwFrmFmt* pFormat, sal_uLong nNodeIdx, xub_StrLen nCntIdx )
SwUndoInsLayFmt::SwUndoInsLayFmt( SwFrmFmt* pFormat, sal_uLong nNodeIdx, sal_Int32 nCntIdx )
    : SwUndoFlyBase( pFormat, RES_DRAWFRMFMT == pFormat->Which() ?
                                            UNDO_INSDRAWFMT : UNDO_INSLAYFMT ),
    mnCrsrSaveIndexPara( nNodeIdx ), mnCrsrSaveIndexPos( nCntIdx )
@@ -482,7 +482,7 @@ void SwUndoSetFlyFmt::DeRegisterFromFormat( SwFmt& rFmt )
}

void SwUndoSetFlyFmt::GetAnchor( SwFmtAnchor& rAnchor,
                                sal_uLong nNode, xub_StrLen nCntnt )
                                sal_uLong nNode, sal_Int32 nCntnt )
{
    RndStdIds nAnchorTyp = rAnchor.GetAnchorId();
    if (FLY_AT_PAGE != nAnchorTyp)
diff --git a/sw/source/core/undo/unmove.cxx b/sw/source/core/undo/unmove.cxx
index f89ebf5..29b53c0 100644
--- a/sw/source/core/undo/unmove.cxx
+++ b/sw/source/core/undo/unmove.cxx
@@ -94,7 +94,7 @@ SwUndoMove::SwUndoMove( SwDoc* pDoc, const SwNodeRange& rRg,
    bMoveRange = sal_True;
    bJoinNext = bJoinPrev = sal_False;

    nSttCntnt = nEndCntnt = nMvDestCntnt = STRING_MAXLEN;
    nSttCntnt = nEndCntnt = nMvDestCntnt = COMPLETE_STRING;

    nSttNode = rRg.aStart.GetIndex();
    nEndNode = rRg.aEnd.GetIndex();
@@ -166,7 +166,7 @@ void SwUndoMove::SetDestRange( const SwNodeIndex& rStt,
    }
    nInsPosNode  = rInsPos.GetIndex();

    nDestSttCntnt = nDestEndCntnt = nInsPosCntnt = STRING_MAXLEN;
    nDestSttCntnt = nDestEndCntnt = nInsPosCntnt = COMPLETE_STRING;
}

void SwUndoMove::UndoImpl(::sw::UndoRedoContext & rContext)
diff --git a/sw/source/core/undo/unsect.cxx b/sw/source/core/undo/unsect.cxx
index da33bf6..86c488a 100644
--- a/sw/source/core/undo/unsect.cxx
+++ b/sw/source/core/undo/unsect.cxx
@@ -126,7 +126,7 @@ void SwUndoInsSection::UndoImpl(::sw::UndoRedoContext & rContext)

    // no selection?
    SwNodeIndex aIdx( *pNd );
    if( ( !nEndNode && STRING_MAXLEN == nEndCntnt ) ||
    if( ( !nEndNode && COMPLETE_STRING == nEndCntnt ) ||
        ( nSttNode == nEndNode && nSttCntnt == nEndCntnt ))
        // delete simply all nodes
        rDoc.GetNodes().Delete( aIdx, pNd->EndOfSectionIndex() -
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
index df3caa0..1d3a5ec 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -267,7 +267,7 @@ void GetSelectableFromAny(uno::Reference<uno::XInterface> const& xIfc,
}

uno::Reference<text::XTextContent>
GetNestedTextContent(SwTxtNode & rTextNode, xub_StrLen const nIndex,
GetNestedTextContent(SwTxtNode & rTextNode, sal_Int32 const nIndex,
        bool const bParent)
{
    // these should be unambiguous because of the dummy character
@@ -1124,7 +1124,7 @@ bool DocInsertStringSplitCR(
    // grouping done in InsertString is intended for typing, not API calls
    ::sw::GroupUndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo());
    OUString aTxt;
    xub_StrLen nStartIdx = 0;
    sal_Int32 nStartIdx = 0;
    SwTxtNode* const pTxtNd =
        rNewCursor.GetPoint()->nNode.GetNode().GetTxtNode();
    if (!pTxtNd)
@@ -1132,9 +1132,9 @@ bool DocInsertStringSplitCR(
        SAL_INFO("sw.uno", "DocInsertStringSplitCR: need a text node");
        return false;
    }
    const xub_StrLen nMaxLength = ( pTxtNd )
        ? STRING_LEN - pTxtNd->GetTxt().getLength()
        : STRING_LEN;
    const sal_Int32 nMaxLength = ( pTxtNd )
        ? COMPLETE_STRING - pTxtNd->GetTxt().getLength()
        : COMPLETE_STRING;
    sal_Int32 nIdx = rText.indexOf( '\r', nStartIdx );
    if( ( nIdx == -1 && nMaxLength < rText.getLength() ) ||
        ( nIdx != -1 && nMaxLength < nIdx ) )
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index 8875524..1bb47aa 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -2320,8 +2320,8 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
                    sal_Bool bHidden = rTxtNode.IsHidden();
                    if ( !bHidden )
                    {
                        xub_StrLen nHiddenStart;
                        xub_StrLen nHiddenEnd;
                        sal_Int32 nHiddenStart;
                        sal_Int32 nHiddenEnd;

                        SwPosition aPosition( pTxtFld->GetTxtNode() );
                        aPosition.nContent = *pTxtFld->GetStart();
diff --git a/sw/source/core/unocore/unotextmarkup.cxx b/sw/source/core/unocore/unotextmarkup.cxx
index 1a28999..cd4bdad 100644
--- a/sw/source/core/unocore/unotextmarkup.cxx
+++ b/sw/source/core/unocore/unotextmarkup.cxx
@@ -157,7 +157,7 @@ void SAL_CALL SwXTextMarkup::commitStringMarkup(
            }
        }
        bRepaint = pWList == mpTxtNode->GetGrammarCheck();
        if( pWList->GetBeginInv() < STRING_LEN )
        if( pWList->GetBeginInv() < COMPLETE_STRING )
            ((SwGrammarMarkUp*)pWList)->ClearGrammarList();
    }
    else if ( nType == text::TextMarkupType::SMARTTAG )
@@ -422,13 +422,13 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
        {
            mpTxtNode->SetGrammarCheck( new SwGrammarMarkUp() );
            pWList = mpTxtNode->GetGrammarCheck();
            pWList->SetInvalid( 0, STRING_LEN );
            pWList->SetInvalid( 0, COMPLETE_STRING );
        }
    }
    bRepaint = pWList == mpTxtNode->GetGrammarCheck();

    bool bAcceptGrammarError = false;
    if( pWList->GetBeginInv() < STRING_LEN )
    if( pWList->GetBeginInv() < COMPLETE_STRING )
    {
        const ModelToViewHelper::ModelPosition aSentenceEnd =
            maConversionMap.ConvertToModelPosition(
diff --git a/sw/source/filter/ascii/ascatr.cxx b/sw/source/filter/ascii/ascatr.cxx
index df303893..23719cd 100644
--- a/sw/source/filter/ascii/ascatr.cxx
+++ b/sw/source/filter/ascii/ascatr.cxx
@@ -102,13 +102,13 @@ sal_Int32 SwASC_AttrIter::SearchNext( sal_Int32 nStartPos )
            }
            else if ( pHt->HasContent() )
            {
                const xub_StrLen nHintStart = *pHt->GetStart();
                const sal_Int32 nHintStart = *pHt->GetStart();
                if ( nHintStart >= nStartPos && nHintStart <= nMinPos )
                {
                    nMinPos = nHintStart;
                }

                const xub_StrLen nHintEnd = pHt->End() ? *pHt->End() : STRING_MAXLEN;
                const sal_Int32 nHintEnd = pHt->End() ? *pHt->End() : COMPLETE_STRING;
                if ( nHintEnd >= nStartPos && nHintEnd < nMinPos )
                {
                    nMinPos = nHintEnd;
diff --git a/sw/source/filter/html/htmlcss1.cxx b/sw/source/filter/html/htmlcss1.cxx
index ea8ea42..92af2f9 100644
--- a/sw/source/filter/html/htmlcss1.cxx
+++ b/sw/source/filter/html/htmlcss1.cxx
@@ -37,6 +37,7 @@
#include <editeng/frmdiritem.hxx>
#include <svtools/htmltokn.h>
#include <svtools/htmlkywd.hxx>
#include <tools/string.hxx>
#include <fmtpdsc.hxx>
#include <fmtanchr.hxx>
#include <fmtornt.hxx>