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

Matteo Casalin matteo.casalin at yahoo.com
Sat Jun 8 12:59:59 PDT 2013


 sw/inc/pam.hxx                                  |   24 ++++---
 sw/source/core/crsr/crsrsh.cxx                  |    2 
 sw/source/core/crsr/pam.cxx                     |   77 ++++++++++++------------
 sw/source/core/crsr/paminit.cxx                 |    1 
 sw/source/core/crsr/swcrsr.cxx                  |   19 ++---
 sw/source/core/doc/docbm.cxx                    |    2 
 sw/source/core/doc/docedt.cxx                   |    4 -
 sw/source/core/doc/docnum.cxx                   |    2 
 sw/source/core/doc/docredln.cxx                 |    2 
 sw/source/core/doc/swserv.cxx                   |    7 +-
 sw/source/core/docnode/ndcopy.cxx               |    2 
 sw/source/core/docnode/ndsect.cxx               |    8 +-
 sw/source/core/docnode/nodes.cxx                |    7 --
 sw/source/core/frmedt/fefly1.cxx                |    2 
 sw/source/core/inc/pamtyp.hxx                   |   15 ++--
 sw/source/core/unocore/unoidx.cxx               |    2 
 sw/source/core/unocore/unoportenum.cxx          |    4 -
 sw/source/filter/basflt/shellio.cxx             |   30 +++++----
 sw/source/filter/ww1/fltshell.cxx               |    4 -
 sw/source/filter/xml/XMLRedlineImportHelper.cxx |    2 
 sw/source/ui/uno/unotxdoc.cxx                   |    2 
 sw/source/ui/uno/unotxvw.cxx                    |    4 -
 22 files changed, 115 insertions(+), 107 deletions(-)

New commits:
commit 6b379300ad3fdbc5c58901c6e06fe600367f83c0
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sat Jun 8 21:58:18 2013 +0200

    Check pointer before deferenging
    
    Change-Id: I9bf9ad249afc88379d66337059a73297880acd83

diff --git a/sw/source/core/doc/swserv.cxx b/sw/source/core/doc/swserv.cxx
index e2a34af..476767d 100644
--- a/sw/source/core/doc/swserv.cxx
+++ b/sw/source/core/doc/swserv.cxx
@@ -78,12 +78,17 @@ sal_Bool SwServerObject::GetData( uno::Any & rData,
 
         case SECTION_SERVER:
             pPam = new SwPaM( SwPosition( *CNTNT_TYPE.pSectNd ) );
+            if (!pPam)
+            {
+                break;
+            }
             pPam->Move( fnMoveForward );
             pPam->SetMark();
             pPam->GetPoint()->nNode = *CNTNT_TYPE.pSectNd->EndOfSectionNode();
             pPam->Move( fnMoveBackward );
             break;
-        case NONE_SERVER: break;
+        case NONE_SERVER:
+            break;
         }
 
         if( pPam )
diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx
index a17f91d..af77503 100644
--- a/sw/source/filter/basflt/shellio.cxx
+++ b/sw/source/filter/basflt/shellio.cxx
@@ -830,9 +830,12 @@ sal_uLong SwWriter::Write( WriterRef& rxWriter, const String* pRealFileName )
             else
             {
                 pPam = new SwPaM( *pPam );
-                pPam->Move( fnMoveBackward, fnGoDoc );
-                pPam->SetMark();
-                pPam->Move( fnMoveForward, fnGoDoc );
+                if (pPam)
+                {
+                    pPam->Move( fnMoveBackward, fnGoDoc );
+                    pPam->SetMark();
+                    pPam->Move( fnMoveForward, fnGoDoc );
+                }
             }
         }
         // pPam ist immer noch der akt. Cursor !!
@@ -842,16 +845,19 @@ sal_uLong SwWriter::Write( WriterRef& rxWriter, const String* pRealFileName )
         // keine Shell oder alles schreiben -> eigenen Pam erzeugen
         SwDoc* pOutDoc = pDoc ? pDoc : &rDoc;
         pPam = new SwPaM( pOutDoc->GetNodes().GetEndOfContent() );
-        if( pOutDoc->IsClipBoard() )
+        if (pPam)
         {
-            pPam->Move( fnMoveBackward, fnGoDoc );
-            pPam->SetMark();
-            pPam->Move( fnMoveForward, fnGoDoc );
-        }
-        else
-        {
-            pPam->SetMark();
-            pPam->Move( fnMoveBackward, fnGoDoc );
+            if( pOutDoc->IsClipBoard() )
+            {
+                pPam->Move( fnMoveBackward, fnGoDoc );
+                pPam->SetMark();
+                pPam->Move( fnMoveForward, fnGoDoc );
+            }
+            else
+            {
+                pPam->SetMark();
+                pPam->Move( fnMoveBackward, fnGoDoc );
+            }
         }
     }
 
commit 43941d9a5313fcd7fe39a61bd2eace64f7743486
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sat Jun 8 21:56:55 2013 +0200

    sal_Bool to bool and some cleanup
    
    Change-Id: I4b20be1a3558e6b48a224e37e7f50944bb6bd237

diff --git a/sw/inc/pam.hxx b/sw/inc/pam.hxx
index 29fb082..54c20b1 100644
--- a/sw/inc/pam.hxx
+++ b/sw/inc/pam.hxx
@@ -139,7 +139,7 @@ typedef SwMoveFnCollection* SwMoveFn;
 SW_DLLPUBLIC extern SwMoveFn fnMoveForward; ///< SwPam::Move()/Find() default argument.
 SW_DLLPUBLIC extern SwMoveFn fnMoveBackward;
 
-typedef sal_Bool (*SwGoInDoc)( SwPaM& rPam, SwMoveFn fnMove );
+typedef bool (*SwGoInDoc)( SwPaM& rPam, SwMoveFn fnMove );
 SW_DLLPUBLIC extern SwGoInDoc fnGoDoc;
 extern SwGoInDoc fnGoSection;
 SW_DLLPUBLIC extern SwGoInDoc fnGoNode;
@@ -182,8 +182,8 @@ public:
     SwPaM& operator=( const SwPaM & );
 
     /// Movement of cursor.
-    sal_Bool Move( SwMoveFn fnMove = fnMoveForward,
-                    SwGoInDoc fnGo = fnGoCntnt );
+    bool Move( SwMoveFn fnMove = fnMoveForward,
+                SwGoInDoc fnGo = fnGoCntnt );
 
     /// Search.
     bool Find(  const com::sun::star::util::SearchOptions& rSearchOpt,
@@ -271,10 +271,10 @@ public:
     /**
        Normalizes PaM, i.e. sort point and mark.
 
-       @param bPointFirst sal_True: If the point is behind the mark then swap.
-                          sal_False: If the mark is behind the point then swap.
+       @param bPointFirst true: If the point is behind the mark then swap.
+                          false: If the mark is behind the point then swap.
     */
-    SwPaM & Normalize(sal_Bool bPointFirst = sal_True);
+    SwPaM & Normalize(bool bPointFirst = true);
 
     /// @return the document (SwDoc) at which the PaM is registered
     SwDoc* GetDoc() const   { return m_pPoint->nNode.GetNode().GetDoc(); }
@@ -285,14 +285,16 @@ public:
                             { return bOne ? m_Bound1 : m_Bound2; }
 
     /// Get number of page which contains cursor.
-    sal_uInt16 GetPageNum( sal_Bool bAtPoint = sal_True, const Point* pLayPos = 0 );
+    sal_uInt16 GetPageNum( bool bAtPoint = true, const Point* pLayPos = 0 );
 
     /** Is in something protected (readonly) or selection contains
        something protected. */
     bool HasReadonlySel( bool bFormView, bool bAnnotationMode = false ) const;
 
-    sal_Bool ContainsPosition(const SwPosition & rPos)
-    { return *Start() <= rPos && rPos <= *End(); }
+    bool ContainsPosition(const SwPosition & rPos)
+    {
+        return *Start() <= rPos && rPos <= *End();
+    }
 
     DECL_FIXEDMEMPOOL_NEWDEL(SwPaM);
 
@@ -301,8 +303,8 @@ public:
 };
 
 
-sal_Bool CheckNodesRange( const SwNodeIndex&, const SwNodeIndex&, sal_Bool );
-sal_Bool GoInCntnt( SwPaM & rPam, SwMoveFn fnMove );
+bool CheckNodesRange( const SwNodeIndex&, const SwNodeIndex&, bool bChkSection );
+bool GoInCntnt( SwPaM & rPam, SwMoveFn fnMove );
 
 
 #endif  // _PAM_HXX
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index d3f65cf..c8ed632 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -700,7 +700,7 @@ int SwCrsrShell::SetCrsr( const Point &rLPt, sal_Bool bOnlyText, bool bBlock )
     else
     {
         // SSelection over not allowed sections or if in header/footer -> different
-        if( !CheckNodesRange( aPos.nNode, pCrsr->GetMark()->nNode, sal_True )
+        if( !CheckNodesRange( aPos.nNode, pCrsr->GetMark()->nNode, true )
             || ( pFrm && !pFrm->Frm().IsInside( pCrsr->GetMkPos() ) ))
             return bRet;
 
diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index 4e8bf0b..cb89473 100644
--- a/sw/source/core/crsr/pam.cxx
+++ b/sw/source/core/crsr/pam.cxx
@@ -212,14 +212,14 @@ static CHKSECTION lcl_TstIdx( sal_uLong nSttIdx, sal_uLong nEndIdx, const SwNode
 }
 
 
-static sal_Bool lcl_ChkOneRange( CHKSECTION eSec, sal_Bool bChkSections,
+static bool lcl_ChkOneRange( CHKSECTION eSec, bool bChkSections,
                     const SwNode& rBaseEnd, sal_uLong nStt, sal_uLong nEnd )
 {
     if( eSec != Chk_Both )
-        return sal_False;
+        return false;
 
     if( !bChkSections )
-        return sal_True;
+        return true;
 
     // search the surrounding section
     const SwNodes& rNds = rBaseEnd.GetNodes();
@@ -228,11 +228,11 @@ static sal_Bool lcl_ChkOneRange( CHKSECTION eSec, sal_Bool bChkSections,
         pNd = pNd->StartOfSectionNode();
 
     if( pNd == rNds[ nEnd ]->StartOfSectionNode() )
-        return sal_True; // same StartNode, same section
+        return true; // same StartNode, same section
 
     // already on a base node => error
     if( !pNd->StartOfSectionIndex() )
-        return sal_False;
+        return false;
 
     while( ( pTmp = pNd->StartOfSectionNode())->EndOfSectionNode() !=
             &rBaseEnd )
@@ -240,17 +240,18 @@ static sal_Bool lcl_ChkOneRange( CHKSECTION eSec, sal_Bool bChkSections,
 
     sal_uLong nSttIdx = pNd->GetIndex(), nEndIdx = pNd->EndOfSectionIndex();
     return nSttIdx <= nStt && nStt <= nEndIdx &&
-           nSttIdx <= nEnd && nEnd <= nEndIdx ? sal_True : sal_False;
+           nSttIdx <= nEnd && nEnd <= nEndIdx;
 }
 
 
-sal_Bool CheckNodesRange( const SwNodeIndex& rStt,
-                        const SwNodeIndex& rEnd, sal_Bool bChkSection )
+bool CheckNodesRange( const SwNodeIndex& rStt,
+                      const SwNodeIndex& rEnd, bool bChkSection )
 {
     const SwNodes& rNds = rStt.GetNodes();
     sal_uLong nStt = rStt.GetIndex(), nEnd = rEnd.GetIndex();
     CHKSECTION eSec = lcl_TstIdx( nStt, nEnd, rNds.GetEndOfContent() );
-    if( Chk_None != eSec ) return eSec == Chk_Both ? sal_True : sal_False;
+    if( Chk_None != eSec )
+        return eSec == Chk_Both;
 
     eSec = lcl_TstIdx( nStt, nEnd, rNds.GetEndOfAutotext() );
     if( Chk_None != eSec )
@@ -272,7 +273,7 @@ sal_Bool CheckNodesRange( const SwNodeIndex& rStt,
         return lcl_ChkOneRange( eSec, bChkSection,
                             rNds.GetEndOfRedlines(), nStt, nEnd );
 
-    return sal_False; // somewhere in between => error
+    return false; // somewhere in between => error
 }
 
 
@@ -299,7 +300,7 @@ SwCntntNode* GoNextNds( SwNodeIndex* pIdx, sal_Bool bChk )
     if( pNd )
     {
         if( bChk && 1 != aIdx.GetIndex() - pIdx->GetIndex() &&
-            !CheckNodesRange( *pIdx, aIdx, sal_True ) )
+            !CheckNodesRange( *pIdx, aIdx, true ) )
                 pNd = 0;
         else
             *pIdx = aIdx;
@@ -315,7 +316,7 @@ SwCntntNode* GoPreviousNds( SwNodeIndex * pIdx, sal_Bool bChk )
     if( pNd )
     {
         if( bChk && 1 != pIdx->GetIndex() - aIdx.GetIndex() &&
-            !CheckNodesRange( *pIdx, aIdx, sal_True ) )
+            !CheckNodesRange( *pIdx, aIdx, true ) )
                 pNd = 0;
         else
             *pIdx = aIdx;
@@ -494,9 +495,9 @@ void SwPaM::Exchange()
 #endif
 
 /// movement of cursor
-sal_Bool SwPaM::Move( SwMoveFn fnMove, SwGoInDoc fnGo )
+bool SwPaM::Move( SwMoveFn fnMove, SwGoInDoc fnGo )
 {
-    sal_Bool bRet = (*fnGo)( *this, fnMove );
+    const bool bRet = (*fnGo)( *this, fnMove );
 
     m_bIsInFrontOfLabel = false;
 
@@ -537,7 +538,7 @@ SwPaM* SwPaM::MakeRegion( SwMoveFn fnMove, const SwPaM * pOrigRg )
     return pPam;
 }
 
-SwPaM & SwPaM::Normalize(sal_Bool bPointFirst)
+SwPaM & SwPaM::Normalize(bool bPointFirst)
 {
     if (HasMark())
         if ( ( bPointFirst && *m_pPoint > *m_pMark) ||
@@ -550,7 +551,7 @@ SwPaM & SwPaM::Normalize(sal_Bool bPointFirst)
 }
 
 /// return page number at cursor (for reader and page bound frames)
-sal_uInt16 SwPaM::GetPageNum( sal_Bool bAtPoint, const Point* pLayPos )
+sal_uInt16 SwPaM::GetPageNum( bool bAtPoint, const Point* pLayPos )
 {
     const SwCntntFrm* pCFrm;
     const SwPageFrm *pPg;
@@ -592,7 +593,7 @@ static const SwFrm* lcl_FindEditInReadonlyFrm( const SwFrm& rFrm )
 /// is in protected section or selection surrounds something protected
 bool SwPaM::HasReadonlySel( bool bFormView, bool bAnnotationMode ) const
 {
-    bool bRet = sal_False;
+    bool bRet = false;
     Point aTmpPt;
     const SwCntntNode *pNd;
     const SwCntntFrm *pFrm;
@@ -608,13 +609,13 @@ bool SwPaM::HasReadonlySel( bool bFormView, bool bAnnotationMode ) const
 
     if( pFrm && ( pFrm->IsProtected() ||
                   ( bFormView && 0 == ( pSttEIRFrm = lcl_FindEditInReadonlyFrm( *pFrm ) ) ) ) )
-        bRet = sal_True;
+        bRet = true;
     else if( pNd )
     {
         const SwSectionNode* pSNd = pNd->GetSectionNode();
         if( pSNd && ( pSNd->GetSection().IsProtectFlag() ||
                       (bFormView && !pSNd->GetSection().IsEditInReadonlyFlag()) ) )
-            bRet = sal_True;
+            bRet = true;
     }
 
     if( !bRet && HasMark() && GetPoint()->nNode != GetMark()->nNode )
@@ -626,13 +627,13 @@ bool SwPaM::HasReadonlySel( bool bFormView, bool bAnnotationMode ) const
 
         if( pFrm && ( pFrm->IsProtected() ||
                   ( bFormView && 0 == ( pEndEIRFrm = lcl_FindEditInReadonlyFrm( *pFrm ) ) ) ) )
-            bRet = sal_True;
+            bRet = true;
         else if( pNd )
         {
             const SwSectionNode* pSNd = pNd->GetSectionNode();
             if( pSNd && ( pSNd->GetSection().IsProtectFlag() ||
                           (bFormView && !pSNd->GetSection().IsEditInReadonlyFlag()) ) )
-                bRet = sal_True;
+                bRet = true;
         }
 
         if ( !bRet && bFormView )
@@ -640,7 +641,7 @@ bool SwPaM::HasReadonlySel( bool bFormView, bool bAnnotationMode ) const
            // Check if start and end frame are inside the _same_
            // edit-in-readonly-environment. Otherwise we better return 'true'
            if ( pSttEIRFrm != pEndEIRFrm )
-                bRet = sal_True;
+                bRet = true;
         }
 
         // protected section in selection
@@ -672,7 +673,7 @@ bool SwPaM::HasReadonlySel( bool bFormView, bool bAnnotationMode ) const
                         if( nSttIdx <= nIdx && nEndIdx >= nIdx &&
                             rCntnt.GetCntntIdx()->GetNode().GetNodes().IsDocNodes() )
                         {
-                            bRet = sal_True;
+                            bRet = true;
                             break;
                         }
                     }
@@ -713,7 +714,7 @@ bool SwPaM::HasReadonlySel( bool bFormView, bool bAnnotationMode ) const
     {
         // Unhandled fieldmarks case shouldn't be edited manually to avoid breaking anything
         if ( ( pA == pB ) && bUnhandledMark )
-            bRet = sal_True;
+            bRet = true;
         // Allow editing of commented ranges.
         else if (!bCommentrangeMark)
         {
@@ -877,59 +878,59 @@ void GoEndSection( SwPosition * pPos )
 
 
 
-sal_Bool GoInDoc( SwPaM & rPam, SwMoveFn fnMove )
+bool GoInDoc( SwPaM & rPam, SwMoveFn fnMove )
 {
     (*fnMove->fnDoc)( rPam.GetPoint() );
-    return sal_True;
+    return true;
 }
 
 
-sal_Bool GoInSection( SwPaM & rPam, SwMoveFn fnMove )
+bool GoInSection( SwPaM & rPam, SwMoveFn fnMove )
 {
     (*fnMove->fnSections)( (SwPosition*)rPam.GetPoint() );
-    return sal_True;
+    return true;
 }
 
 
-sal_Bool GoInNode( SwPaM & rPam, SwMoveFn fnMove )
+bool GoInNode( SwPaM & rPam, SwMoveFn fnMove )
 {
     SwCntntNode *pNd = (*fnMove->fnNds)( &rPam.GetPoint()->nNode, sal_True );
     if( pNd )
         rPam.GetPoint()->nContent.Assign( pNd,
                         ::GetSttOrEnd( fnMove == fnMoveForward, *pNd ) );
-    return 0 != pNd;
+    return pNd;
 }
 
 
-sal_Bool GoInCntnt( SwPaM & rPam, SwMoveFn fnMove )
+bool GoInCntnt( SwPaM & rPam, SwMoveFn fnMove )
 {
     if( (*fnMove->fnNd)( &rPam.GetPoint()->nNode.GetNode(),
                         &rPam.GetPoint()->nContent, CRSR_SKIP_CHARS ))
-        return sal_True;
+        return true;
     return GoInNode( rPam, fnMove );
 }
 
-sal_Bool GoInCntntCells( SwPaM & rPam, SwMoveFn fnMove )
+bool GoInCntntCells( SwPaM & rPam, SwMoveFn fnMove )
 {
     if( (*fnMove->fnNd)( &rPam.GetPoint()->nNode.GetNode(),
                          &rPam.GetPoint()->nContent, CRSR_SKIP_CELLS ))
-        return sal_True;
+        return true;
     return GoInNode( rPam, fnMove );
 }
 
-sal_Bool GoInCntntSkipHidden( SwPaM & rPam, SwMoveFn fnMove )
+bool GoInCntntSkipHidden( SwPaM & rPam, SwMoveFn fnMove )
 {
     if( (*fnMove->fnNd)( &rPam.GetPoint()->nNode.GetNode(),
                         &rPam.GetPoint()->nContent, CRSR_SKIP_CHARS | CRSR_SKIP_HIDDEN ) )
-        return sal_True;
+        return true;
     return GoInNode( rPam, fnMove );
 }
 
-sal_Bool GoInCntntCellsSkipHidden( SwPaM & rPam, SwMoveFn fnMove )
+bool GoInCntntCellsSkipHidden( SwPaM & rPam, SwMoveFn fnMove )
 {
     if( (*fnMove->fnNd)( &rPam.GetPoint()->nNode.GetNode(),
                          &rPam.GetPoint()->nContent, CRSR_SKIP_CELLS | CRSR_SKIP_HIDDEN ) )
-        return sal_True;
+        return true;
     return GoInNode( rPam, fnMove );
 }
 
diff --git a/sw/source/core/crsr/paminit.cxx b/sw/source/core/crsr/paminit.cxx
index 2093c3e..17fe0e0 100644
--- a/sw/source/core/crsr/paminit.cxx
+++ b/sw/source/core/crsr/paminit.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <pam.hxx>
 #include <pamtyp.hxx>
 
 
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index 73a9edd..af9dd90 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -200,7 +200,7 @@ bool SwTableCursor::IsSelOvrCheck(int eFlags)
         && HasMark() )
     {
         SwNodeIndex aOldPos( rNds, GetSavePos()->nNode );
-        if( !CheckNodesRange( aOldPos, GetPoint()->nNode, sal_True ))
+        if( !CheckNodesRange( aOldPos, GetPoint()->nNode, true ))
         {
             GetPoint()->nNode = aOldPos;
             GetPoint()->nContent.Assign( GetCntntNode(), GetSavePos()->nCntnt );
@@ -256,8 +256,8 @@ sal_Bool SwCursor::IsSelOvr( int eFlags )
             }
 
             int bIsValidPos = 0 != pCNd;
-            sal_Bool bValidNodesRange = bIsValidPos &&
-                                    ::CheckNodesRange( rPtIdx, aIdx, sal_True );
+            const bool bValidNodesRange = bIsValidPos &&
+                                    ::CheckNodesRange( rPtIdx, aIdx, true );
             if( !bValidNodesRange )
             {
                 rPtIdx = pSavePos->nNode;
@@ -385,7 +385,7 @@ sal_Bool SwCursor::IsSelOvr( int eFlags )
         return sal_False;
 
     // check for invalid sections
-    if( !::CheckNodesRange( GetMark()->nNode, GetPoint()->nNode, sal_True ))
+    if( !::CheckNodesRange( GetMark()->nNode, GetPoint()->nNode, true ))
     {
         DeleteMark();
         RestoreSavePos();
@@ -454,7 +454,7 @@ sal_Bool SwCursor::IsSelOvr( int eFlags )
                 // we permit these
                 if( pMyNd->IsCntntNode() &&
                     ::CheckNodesRange( GetMark()->nNode,
-                                       GetPoint()->nNode, sal_True ))
+                                       GetPoint()->nNode, true ))
                 {
                     // table in table
                     const SwTableNode* pOuterTableNd = pMyNd->FindTableNode();
@@ -1604,8 +1604,7 @@ sal_Bool SwCursor::LeftRight( sal_Bool bLeft, sal_uInt16 nCnt, sal_uInt16 nMode,
     {
         SwNodeIndex aOldNodeIdx( GetPoint()->nNode );
 
-        bool bSuccess = Move( fnMove, fnGo );
-        if ( !bSuccess )
+        if ( !Move( fnMove, fnGo ) )
             break;
 
         // If we were located inside a covered cell but our position has been
@@ -1643,8 +1642,7 @@ sal_Bool SwCursor::LeftRight( sal_Bool bLeft, sal_uInt16 nCnt, sal_uInt16 nMode,
                         GetPoint()->nContent.Assign( pCntntNode, nTmpPos );
 
                         // Redo the move:
-                        bSuccess = Move( fnMove, fnGo );
-                        if ( !bSuccess )
+                        if ( !Move( fnMove, fnGo ) )
                             break;
                     }
                 }
@@ -1779,8 +1777,7 @@ sal_Bool SwCursor::UpDown( sal_Bool bUp, sal_uInt16 nCnt,
         }
 
         // It is allowed to move footnotes in other footnotes but not sections
-        const sal_Bool bChkRange = pFrm->IsInFtn() && !HasMark()
-                                    ? sal_False : sal_True;
+        const bool bChkRange = pFrm->IsInFtn() && !HasMark();
         const SwPosition aOldPos( *GetPoint() );
         sal_Bool bInReadOnly = IsReadOnlyAvailable();
 
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index ab83199..d7f74ef 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -1135,7 +1135,7 @@ void SaveBookmark::SetInDoc(
     }
 
     if(!aPam.HasMark()
-        || CheckNodesRange(aPam.GetPoint()->nNode, aPam.GetMark()->nNode, sal_True))
+        || CheckNodesRange(aPam.GetPoint()->nNode, aPam.GetMark()->nNode, true))
     {
         ::sw::mark::IBookmark* const pBookmark = dynamic_cast< ::sw::mark::IBookmark* >(pDoc->getIDocumentMarkAccess()->makeMark(aPam, m_aName, m_eOrigBkmType));
         if(pBookmark)
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index f169ae5..c3ebae4 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -924,7 +924,7 @@ bool SwDoc::MoveRange( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
     // the manipulated range.
     // If there's no content anymore, set it to the StartNode (that's
     // always there).
-    sal_Bool bNullCntnt = !aSavePam.Move( fnMoveBackward, fnGoCntnt );
+    const bool bNullCntnt = !aSavePam.Move( fnMoveBackward, fnGoCntnt );
     if( bNullCntnt )
     {
         aSavePam.GetPoint()->nNode--;
@@ -2168,7 +2168,7 @@ bool SwDoc::ReplaceRange( SwPaM& rPam, const String& rStr,
     ::std::vector<xub_StrLen> Breaks;
 
     SwPaM aPam( *rPam.GetMark(), *rPam.GetPoint() );
-    aPam.Normalize(sal_False);
+    aPam.Normalize(false);
     if (aPam.GetPoint()->nNode != aPam.GetMark()->nNode)
     {
         aPam.Move(fnMoveBackward);
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 038f01e..2be80a9 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -1935,7 +1935,7 @@ bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, bool bIsOutlMv )
                 /* aInsPos points to the non-content node. Move it to
                    the previous content node. */
                 SwPaM aInsPam(aInsPos);
-                sal_Bool bMoved = aInsPam.Move(fnMoveBackward);
+                const bool bMoved = aInsPam.Move(fnMoveBackward);
                 OSL_ENSURE(bMoved, "No content node found!");
 
                 if (bMoved)
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index a6a92a1..11e6c6b 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -3825,7 +3825,7 @@ bool SwDoc::IsInRedlines(const SwNode & rNode) const
     SwPaM aPam(SwPosition(*rEndOfRedlines.StartOfSectionNode()),
                SwPosition(rEndOfRedlines));
 
-    return aPam.ContainsPosition(aPos) ? true : false;
+    return aPam.ContainsPosition(aPos);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx
index deefc12..7df0ae4 100644
--- a/sw/source/core/docnode/ndcopy.cxx
+++ b/sw/source/core/docnode/ndcopy.cxx
@@ -884,7 +884,7 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos,
     // Move the PaM one node back from the insert position, so that
     // the position doesn't get moved
     pCopyPam->SetMark();
-    sal_Bool bCanMoveBack = pCopyPam->Move(fnMoveBackward, fnGoCntnt);
+    bool bCanMoveBack = pCopyPam->Move(fnMoveBackward, fnGoCntnt);
     // If the position was shifted from more than one node, an end node has been skipped
     bool bAfterTable = false;
     if ((rPos.nNode.GetIndex() - pCopyPam->GetPoint()->nNode.GetIndex()) > 1)
diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx
index 9c389f1..a071de5 100644
--- a/sw/source/core/docnode/ndsect.cxx
+++ b/sw/source/core/docnode/ndsect.cxx
@@ -131,13 +131,13 @@ static void lcl_CheckEmptyLayFrm( SwNodes& rNds, SwSectionData& rSectionData,
 {
     SwNodeIndex aIdx( rStt );
     if( !rNds.GoPrevSection( &aIdx, sal_True, sal_False ) ||
-        !CheckNodesRange( rStt, aIdx, sal_True ) ||
+        !CheckNodesRange( rStt, aIdx, true ) ||
         // #i21457#
         !lcl_IsInSameTblBox( rNds, rStt, true ))
     {
         aIdx = rEnd;
         if( !rNds.GoNextSection( &aIdx, sal_True, sal_False ) ||
-            !CheckNodesRange( rEnd, aIdx, sal_True ) ||
+            !CheckNodesRange( rEnd, aIdx, true ) ||
             // #i21457#
             !lcl_IsInSameTblBox( rNds, rEnd, false ))
         {
@@ -1206,13 +1206,13 @@ void SwSectionNode::DelFrms()
     {
         SwNodeIndex aIdx( *this );
         if( !rNds.GoPrevSection( &aIdx, sal_True, sal_False ) ||
-            !CheckNodesRange( *this, aIdx, sal_True ) ||
+            !CheckNodesRange( *this, aIdx, true ) ||
             // #i21457#
             !lcl_IsInSameTblBox( rNds, *this, true ))
         {
             aIdx = *EndOfSectionNode();
             if( !rNds.GoNextSection( &aIdx, sal_True, sal_False ) ||
-                !CheckNodesRange( *EndOfSectionNode(), aIdx, sal_True ) ||
+                !CheckNodesRange( *EndOfSectionNode(), aIdx, true ) ||
                 // #i21457#
                 !lcl_IsInSameTblBox( rNds, *EndOfSectionNode(), false ))
             {
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 543aa24..61c3098 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -42,9 +42,6 @@
 #include <docsh.hxx>
 #include <svl/smplhint.hxx>
 
-extern sal_Bool CheckNodesRange( const SwNodeIndex& rStt,
-                            const SwNodeIndex& rEnd, sal_Bool bChkSection );
-
 typedef std::vector<SwStartNode*> SwSttNdPtrs;
 
 
@@ -2230,7 +2227,7 @@ SwNode* SwNodes::FindPrvNxtFrmNode( SwNodeIndex& rFrmIdx,
 
                 // suche nach vorne/hinten nach einem Content Node
             else if( 0 != ( pFrmNd = GoPrevSection( &aIdx, sal_True, sal_False )) &&
-                    ::CheckNodesRange( aIdx, rFrmIdx, sal_True ) &&
+                    ::CheckNodesRange( aIdx, rFrmIdx, true ) &&
                     // nach vorne nie aus der Tabelle hinaus!
                     pFrmNd->FindTableNode() == pTableNd &&
                     // Bug 37652: nach hinten nie aus der Tabellenzelle hinaus!
@@ -2252,7 +2249,7 @@ SwNode* SwNodes::FindPrvNxtFrmNode( SwNodeIndex& rFrmIdx,
                 // JP 19.09.93: aber nie die Section dafuer verlassen !!
                 if( ( pEnd && ( pFrmNd = &aIdx.GetNode())->IsCntntNode() ) ||
                     ( 0 != ( pFrmNd = GoNextSection( &aIdx, sal_True, sal_False )) &&
-                    ::CheckNodesRange( aIdx, rFrmIdx, sal_True ) &&
+                    ::CheckNodesRange( aIdx, rFrmIdx, true ) &&
                     ( pFrmNd->FindTableNode() == pTableNd &&
                         // Bug 37652: nach hinten nie aus der Tabellenzelle hinaus!
                         (!pFrmNd->FindTableNode() || pFrmNd->FindTableBoxStartNode()
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index 7fc3756..f8cebfe 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -807,7 +807,7 @@ void SwFEShell::Insert( const String& rGrfName, const String& rFltName,
                     if( !pAnchor->GetPageNum() )
                     {
                         pAnchor->SetPageNum( pCursor->GetPageNum(
-                                sal_True, &pCursor->GetPtPos() ) );
+                                true, &pCursor->GetPtPos() ) );
                     }
                     break;
                 default :
diff --git a/sw/source/core/inc/pamtyp.hxx b/sw/source/core/inc/pamtyp.hxx
index 5796c33..b20c4e9 100644
--- a/sw/source/core/inc/pamtyp.hxx
+++ b/sw/source/core/inc/pamtyp.hxx
@@ -21,7 +21,6 @@
 #define _PAMTYP_HXX
 
 #include <unotools/textsearch.hxx>
-#include <pam.hxx>
 #include <node.hxx>
 #include <tools/string.hxx>
 
@@ -36,13 +35,13 @@ void GoStartDoc( SwPosition*);
 void GoEndDoc( SwPosition*);
 void GoStartSection( SwPosition*);
 void GoEndSection( SwPosition*);
-sal_Bool GoInDoc( SwPaM&, SwMoveFn);
-sal_Bool GoInSection( SwPaM&, SwMoveFn);
-sal_Bool GoInNode( SwPaM&, SwMoveFn);
-sal_Bool GoInCntnt( SwPaM&, SwMoveFn);
-sal_Bool GoInCntntCells( SwPaM&, SwMoveFn);
-sal_Bool GoInCntntSkipHidden( SwPaM&, SwMoveFn);
-sal_Bool GoInCntntCellsSkipHidden( SwPaM&, SwMoveFn);
+bool GoInDoc( SwPaM&, SwMoveFn);
+bool GoInSection( SwPaM&, SwMoveFn);
+bool GoInNode( SwPaM&, SwMoveFn);
+bool GoInCntnt( SwPaM&, SwMoveFn);
+bool GoInCntntCells( SwPaM&, SwMoveFn);
+bool GoInCntntSkipHidden( SwPaM&, SwMoveFn);
+bool GoInCntntCellsSkipHidden( SwPaM&, SwMoveFn);
 const SwTxtAttr* GetFrwrdTxtHint( const SwpHints&, sal_uInt16&, xub_StrLen );
 const SwTxtAttr* GetBkwrdTxtHint( const SwpHints&, sal_uInt16&, xub_StrLen );
 
diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx
index 4dcb59b..cda70a1 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -1917,7 +1917,7 @@ void SwXDocumentIndexMark::Impl::InsertTOXMark(
     // n.b.: toxmarks must have either alternative text or an extent
     if (bMark && rMark.GetAlternativeText().Len())
     {
-        rPam.Normalize(sal_True);
+        rPam.Normalize(true);
         rPam.DeleteMark();
         bMark = false;
     }
diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx
index 5bfac66..a7a0dec 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -785,7 +785,7 @@ lcl_ExportHints(
                                 xParent, pUnoCrsr, *pAttr, false);
                         if (bIsPoint) // consume CH_TXTATR!
                         {
-                            pUnoCrsr->Normalize(sal_False);
+                            pUnoCrsr->Normalize(false);
                             pUnoCrsr->DeleteMark();
                             xRef = xTmp;
                         }
@@ -1091,7 +1091,7 @@ lcl_CreatePortions(
     {
         if (pUnoCrsr->HasMark())
         {
-            pUnoCrsr->Normalize(sal_False);
+            pUnoCrsr->Normalize(false);
             pUnoCrsr->DeleteMark();
         }
 
diff --git a/sw/source/filter/ww1/fltshell.cxx b/sw/source/filter/ww1/fltshell.cxx
index 634d4bc..c78c0a4 100644
--- a/sw/source/filter/ww1/fltshell.cxx
+++ b/sw/source/filter/ww1/fltshell.cxx
@@ -140,11 +140,11 @@ bool SwFltStackEntry::MakeRegion(SwDoc* pDoc, SwPaM& rRegion, bool bCheck,
     }
     rRegion.GetPoint()->nContent.Assign(pCNd, rPtPos.m_nCntnt);
     OSL_ENSURE( CheckNodesRange( rRegion.Start()->nNode,
-                             rRegion.End()->nNode, sal_True ),
+                             rRegion.End()->nNode, true ),
              "atttribute or similar crosses section-boundaries" );
     if( bCheck )
         return CheckNodesRange( rRegion.Start()->nNode,
-                                rRegion.End()->nNode, sal_True );
+                                rRegion.End()->nNode, true );
     else
         return true;
 }
diff --git a/sw/source/filter/xml/XMLRedlineImportHelper.cxx b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
index b4f85a5..e1118e0 100644
--- a/sw/source/filter/xml/XMLRedlineImportHelper.cxx
+++ b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
@@ -647,7 +647,7 @@ void XMLRedlineImportHelper::InsertIntoDocument(RedlineInfo* pRedlineInfo)
     else if ( bIgnoreRedlines ||
          !CheckNodesRange( aPaM.GetPoint()->nNode,
                            aPaM.GetMark()->nNode,
-                           sal_True ) )
+                           true ) )
     {
         // ignore redline (e.g. file loaded in insert mode):
         // delete 'deleted' redlines and forget about the whole thing
diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx
index 84e2930..5dd2943 100644
--- a/sw/source/ui/uno/unotxdoc.cxx
+++ b/sw/source/ui/uno/unotxdoc.cxx
@@ -176,7 +176,7 @@ static SwPrintUIOptions * lcl_GetPrintUIOptions(
     if (pSh)
     {
         SwPaM* pShellCrsr = pSh->GetCrsr();
-        nCurrentPage = pShellCrsr->GetPageNum(sal_True, 0);
+        nCurrentPage = pShellCrsr->GetPageNum(true, 0);
     }
     else if (!bSwSrcView)
     {
diff --git a/sw/source/ui/uno/unotxvw.cxx b/sw/source/ui/uno/unotxvw.cxx
index cefcc8b..98adb3a 100644
--- a/sw/source/ui/uno/unotxvw.cxx
+++ b/sw/source/ui/uno/unotxvw.cxx
@@ -1307,12 +1307,12 @@ sal_Bool SwXTextViewCursor::jumpToStartOfPage(void) throw( uno::RuntimeException
 sal_Int16 SwXTextViewCursor::getPage(void) throw( uno::RuntimeException )
 {
     SolarMutexGuard aGuard;
-    short nRet = 0;
+    sal_Int16 nRet = 0;
     if(m_pView)
     {
         SwWrtShell& rSh = m_pView->GetWrtShell();
         SwPaM* pShellCrsr = rSh.GetCrsr();
-        nRet = (short)pShellCrsr->GetPageNum( sal_True, 0 );
+        nRet = static_cast<sal_Int16>(pShellCrsr->GetPageNum( true, 0 ));
     }
     else
         throw uno::RuntimeException();


More information about the Libreoffice-commits mailing list