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

Matteo Casalin matteo.casalin at yahoo.com
Fri Jun 7 13:16:22 PDT 2013


 sw/inc/pam.hxx                   |   22 +++++++++++-----------
 sw/source/core/crsr/findattr.cxx |   28 ++++++++++++++--------------
 sw/source/core/crsr/findfmt.cxx  |   15 ++++++++-------
 sw/source/core/crsr/findtxt.cxx  |   29 ++++++++++++++---------------
 sw/source/core/crsr/pam.cxx      |    2 +-
 5 files changed, 48 insertions(+), 48 deletions(-)

New commits:
commit 4af491df711510369f423d45565b4d744e637238
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Fri Jun 7 09:15:44 2013 +0200

    sal_Bool to bool
    
    Change-Id: I73bc2cbf3abf8de041302b6342b49275fb3c2ce6

diff --git a/sw/inc/pam.hxx b/sw/inc/pam.hxx
index 73a33f7..29fb082 100644
--- a/sw/inc/pam.hxx
+++ b/sw/inc/pam.hxx
@@ -186,24 +186,24 @@ public:
                     SwGoInDoc fnGo = fnGoCntnt );
 
     /// Search.
-    sal_uInt8 Find( const com::sun::star::util::SearchOptions& rSearchOpt,
-                sal_Bool bSearchInNotes,
+    bool Find(  const com::sun::star::util::SearchOptions& rSearchOpt,
+                bool bSearchInNotes,
                 utl::TextSearch& rSTxt,
                 SwMoveFn fnMove = fnMoveForward,
-                const SwPaM *pPam =0, sal_Bool bInReadOnly = sal_False);
-    sal_Bool Find(  const SwFmt& rFmt,
+                const SwPaM *pPam =0, bool bInReadOnly = false);
+    bool Find(  const SwFmt& rFmt,
                 SwMoveFn fnMove = fnMoveForward,
-                const SwPaM *pPam =0, sal_Bool bInReadOnly = sal_False);
-    sal_Bool Find(  const SfxPoolItem& rAttr, sal_Bool bValue = sal_True,
+                const SwPaM *pPam =0, bool bInReadOnly = false);
+    bool Find(  const SfxPoolItem& rAttr, bool bValue = true,
                 SwMoveFn fnMove = fnMoveForward,
-                const SwPaM *pPam =0, sal_Bool bInReadOnly = sal_False );
-    sal_Bool Find(  const SfxItemSet& rAttr, sal_Bool bNoColls,
+                const SwPaM *pPam =0, bool bInReadOnly = false );
+    bool Find(  const SfxItemSet& rAttr, bool bNoColls,
                 SwMoveFn fnMove,
-                const SwPaM *pPam, sal_Bool bInReadOnly, sal_Bool bMoveFirst );
+                const SwPaM *pPam, bool bInReadOnly, bool bMoveFirst );
 
     bool DoSearch( const com::sun::star::util::SearchOptions& rSearchOpt, utl::TextSearch& rSTxt,
-                    SwMoveFn fnMove, sal_Bool bSrchForward, sal_Bool bRegSearch, sal_Bool bChkEmptyPara, sal_Bool bChkParaEnd,
-                    xub_StrLen &nStart, xub_StrLen &nEnde,xub_StrLen nTxtLen,SwNode* pNode, SwPaM* pPam);
+                   SwMoveFn fnMove, bool bSrchForward, bool bRegSearch, bool bChkEmptyPara, bool bChkParaEnd,
+                   xub_StrLen &nStart, xub_StrLen &nEnde,xub_StrLen nTxtLen,SwNode* pNode, SwPaM* pPam);
 
     inline bool IsInFrontOfLabel() const        { return m_bIsInFrontOfLabel; }
     inline void _SetInFrontOfLabel( bool bNew ) { m_bIsInFrontOfLabel = bNew; }
diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx
index a3ea2bd..ce86579 100644
--- a/sw/source/core/crsr/findattr.cxx
+++ b/sw/source/core/crsr/findattr.cxx
@@ -855,8 +855,8 @@ static int lcl_Search( const SwCntntNode& rCNd, const SfxItemSet& rCmpSet, sal_B
 }
 
 
-sal_Bool SwPaM::Find( const SfxPoolItem& rAttr, sal_Bool bValue, SwMoveFn fnMove,
-                    const SwPaM *pRegion, sal_Bool bInReadOnly )
+bool SwPaM::Find( const SfxPoolItem& rAttr, bool bValue, SwMoveFn fnMove,
+                  const SwPaM *pRegion, bool bInReadOnly )
 {
     // determine which attribute is searched:
     sal_uInt16 nWhich = rAttr.Which();
@@ -864,9 +864,9 @@ sal_Bool SwPaM::Find( const SfxPoolItem& rAttr, sal_Bool bValue, SwMoveFn fnMove
 
     SwPaM* pPam = MakeRegion( fnMove, pRegion );
 
-    sal_Bool bFound = sal_False;
+    bool bFound = false;
     sal_Bool bFirst = sal_True;
-    sal_Bool bSrchForward = fnMove == fnMoveForward;
+    const bool bSrchForward = fnMove == fnMoveForward;
     SwCntntNode * pNode;
     const SfxPoolItem* pItem;
     SwpFmts aFmtArr;
@@ -879,7 +879,7 @@ sal_Bool SwPaM::Find( const SfxPoolItem& rAttr, sal_Bool bValue, SwMoveFn fnMove
         if( !(*fnMove->fnNds)( &pPam->GetPoint()->nNode, sal_False ))
         {
             delete pPam;
-            return sal_False;
+            return false;
         }
         SwCntntNode *pNd = pPam->GetCntntNode();
         xub_StrLen nTmpPos = bSrchForward ? 0 : pNd->Len();
@@ -900,7 +900,7 @@ sal_Bool SwPaM::Find( const SfxPoolItem& rAttr, sal_Bool bValue, SwMoveFn fnMove
                 SetMark();
                 *GetPoint() = *pPam->GetPoint();
                 *GetMark() = *pPam->GetMark();
-                bFound = sal_True;
+                bFound = true;
                 break;
             }
             else if (isTXTATR(nWhich))
@@ -925,7 +925,7 @@ sal_Bool SwPaM::Find( const SfxPoolItem& rAttr, sal_Bool bValue, SwMoveFn fnMove
             *GetPoint() = *pPam->GetPoint();
             SetMark();
             pNode->MakeEndIndex( &GetPoint()->nContent );
-            bFound = sal_True;
+            bFound = true;
             break;
         }
     }
@@ -941,14 +941,14 @@ sal_Bool SwPaM::Find( const SfxPoolItem& rAttr, sal_Bool bValue, SwMoveFn fnMove
 
 typedef int (*FnSearchAttr)( const SwTxtNode&, SwAttrCheckArr&, SwPaM& );
 
-sal_Bool SwPaM::Find( const SfxItemSet& rSet, sal_Bool bNoColls, SwMoveFn fnMove,
-                    const SwPaM *pRegion, sal_Bool bInReadOnly, sal_Bool bMoveFirst )
+bool SwPaM::Find( const SfxItemSet& rSet, bool bNoColls, SwMoveFn fnMove,
+                  const SwPaM *pRegion, bool bInReadOnly, bool bMoveFirst )
 {
     SwPaM* pPam = MakeRegion( fnMove, pRegion );
 
-    sal_Bool bFound = sal_False;
+    bool bFound = false;
     sal_Bool bFirst = sal_True;
-    sal_Bool bSrchForward = fnMove == fnMoveForward;
+    const bool bSrchForward = fnMove == fnMoveForward;
     SwCntntNode * pNode;
     SwpFmts aFmtArr;
 
@@ -971,7 +971,7 @@ sal_Bool SwPaM::Find( const SfxItemSet& rSet, sal_Bool bNoColls, SwMoveFn fnMove
         if( !(*fnMove->fnNds)( &pPam->GetPoint()->nNode, sal_False ))
         {
             delete pPam;
-            return sal_False;
+            return false;
         }
         SwCntntNode *pNd = pPam->GetCntntNode();
         xub_StrLen nTmpPos = bSrchForward ? 0 : pNd->Len();
@@ -994,7 +994,7 @@ sal_Bool SwPaM::Find( const SfxItemSet& rSet, sal_Bool bNoColls, SwMoveFn fnMove
                 SetMark();
                 *GetPoint() = *pPam->GetPoint();
                 *GetMark() = *pPam->GetMark();
-                bFound = sal_True;
+                bFound = true;
                 break;
             }
             continue; // text attribute
@@ -1020,7 +1020,7 @@ sal_Bool SwPaM::Find( const SfxItemSet& rSet, sal_Bool bNoColls, SwMoveFn fnMove
             *GetPoint() = *pPam->GetPoint();
             SetMark();
             pNode->MakeEndIndex( &GetPoint()->nContent );
-            bFound = sal_True;
+            bFound = true;
             break;
         }
     }
diff --git a/sw/source/core/crsr/findfmt.cxx b/sw/source/core/crsr/findfmt.cxx
index fc8396a..e92f71c 100644
--- a/sw/source/core/crsr/findfmt.cxx
+++ b/sw/source/core/crsr/findfmt.cxx
@@ -21,10 +21,10 @@
 #include <pamtyp.hxx>
 
 
-sal_Bool SwPaM::Find( const SwFmt& rFmt, SwMoveFn fnMove,
-                        const SwPaM *pRegion, sal_Bool bInReadOnly  )
+bool SwPaM::Find( const SwFmt& rFmt, SwMoveFn fnMove,
+                  const SwPaM *pRegion, bool bInReadOnly  )
 {
-    sal_Bool bFound = sal_False;
+    bool bFound = false;
     const bool bSrchForward = (fnMove == fnMoveForward);
     SwPaM* pPam = MakeRegion( fnMove, pRegion );
 
@@ -36,7 +36,7 @@ sal_Bool SwPaM::Find( const SwFmt& rFmt, SwMoveFn fnMove,
         if( !(*fnMove->fnNds)( &pPam->GetPoint()->nNode, sal_False ))
         {
             delete pPam;
-            return sal_False;
+            return false;
         }
         SwCntntNode *pNd = pPam->GetPoint()->nNode.GetNode().GetCntntNode();
         xub_StrLen nTmpPos = bSrchForward ? 0 : pNd->Len();
@@ -45,10 +45,9 @@ sal_Bool SwPaM::Find( const SwFmt& rFmt, SwMoveFn fnMove,
 
     sal_Bool bFirst = sal_True;
     SwCntntNode* pNode;
-    while( !bFound &&
-            0 != ( pNode = ::GetNode( *pPam, bFirst, fnMove, bInReadOnly )))
+    while( 0 != ( pNode = ::GetNode( *pPam, bFirst, fnMove, bInReadOnly )))
     {
-        if( 0 != ( bFound = (pNode->GetFmtColl() == &rFmt) ))
+        if ( pNode->GetFmtColl() == &rFmt )
         {
             // if a FormatCollection is found then it is definitely a SwCntntNode
 
@@ -63,6 +62,8 @@ sal_Bool SwPaM::Find( const SwFmt& rFmt, SwMoveFn fnMove,
             // if backward search, switch point and mark
             if( !bSrchForward )
                 Exchange();
+
+            bFound = true;
             break;
         }
     }
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index cb6ec35..92f1249 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -214,15 +214,15 @@ xub_StrLen GetPostIt(xub_StrLen aCount,const SwpHints *pHts)
     return aIndex;
 }
 
-sal_uInt8 SwPaM::Find( const SearchOptions& rSearchOpt, sal_Bool bSearchInNotes , utl::TextSearch& rSTxt,
-                    SwMoveFn fnMove, const SwPaM * pRegion,
-                    sal_Bool bInReadOnly )
+bool SwPaM::Find( const SearchOptions& rSearchOpt, bool bSearchInNotes , utl::TextSearch& rSTxt,
+                  SwMoveFn fnMove, const SwPaM * pRegion,
+                  bool bInReadOnly )
 {
     if( rSearchOpt.searchString.isEmpty() )
-        return sal_False;
+        return false;
 
     SwPaM* pPam = MakeRegion( fnMove, pRegion );
-    sal_Bool bSrchForward = fnMove == fnMoveForward;
+    const bool bSrchForward = fnMove == fnMoveForward;
     SwNodeIndex& rNdIdx = pPam->GetPoint()->nNode;
     SwIndex& rCntntIdx = pPam->GetPoint()->nContent;
 
@@ -235,7 +235,7 @@ sal_uInt8 SwPaM::Find( const SearchOptions& rSearchOpt, sal_Bool bSearchInNotes
         if( !(*fnMove->fnNds)( &rNdIdx, sal_False ))
         {
             delete pPam;
-            return sal_False;
+            return false;
         }
         SwCntntNode *pNd = rNdIdx.GetNode().GetCntntNode();
         xub_StrLen nTmpPos = bSrchForward ? 0 : pNd->Len();
@@ -243,18 +243,18 @@ sal_uInt8 SwPaM::Find( const SearchOptions& rSearchOpt, sal_Bool bSearchInNotes
     }
 
     // If bFound is true then the string was found and is between nStart and nEnd
-    sal_Bool bFound = sal_False;
+    bool bFound = false;
     // start position in text or initial position
     sal_Bool bFirst = sal_True;
     SwCntntNode * pNode;
 
     xub_StrLen nStart, nEnd, nTxtLen;
 
-    sal_Bool bRegSearch = SearchAlgorithms_REGEXP == rSearchOpt.algorithmType;
-    sal_Bool bChkEmptyPara = bRegSearch && 2 == rSearchOpt.searchString.getLength() &&
+    const bool bRegSearch = SearchAlgorithms_REGEXP == rSearchOpt.algorithmType;
+    const bool bChkEmptyPara = bRegSearch && 2 == rSearchOpt.searchString.getLength() &&
                         ( !rSearchOpt.searchString.compareToAscii( "^$" ) ||
                           !rSearchOpt.searchString.compareToAscii( "$^" ) );
-    sal_Bool bChkParaEnd = bRegSearch && 1 == rSearchOpt.searchString.getLength() &&
+    const bool bChkParaEnd = bRegSearch && 1 == rSearchOpt.searchString.getLength() &&
                       !rSearchOpt.searchString.compareToAscii( "$" );
 
     // LanguageType eLastLang = 0;
@@ -404,8 +404,8 @@ sal_uInt8 SwPaM::Find( const SearchOptions& rSearchOpt, sal_Bool bSearchInNotes
 }
 
 bool SwPaM::DoSearch( const SearchOptions& rSearchOpt, utl::TextSearch& rSTxt,
-                      SwMoveFn fnMove, sal_Bool bSrchForward, sal_Bool bRegSearch,
-                      sal_Bool bChkEmptyPara, sal_Bool bChkParaEnd,
+                      SwMoveFn fnMove, bool bSrchForward, bool bRegSearch,
+                      bool bChkEmptyPara, bool bChkParaEnd,
                       xub_StrLen &nStart, xub_StrLen &nEnd, xub_StrLen nTxtLen,
                       SwNode* pNode, SwPaM* pPam)
 {
@@ -514,7 +514,7 @@ bool SwPaM::DoSearch( const SearchOptions& rSearchOpt, utl::TextSearch& rSTxt,
             // if backward search, switch point and mark
             if( !bSrchForward )
                 Exchange();
-            bFound = sal_True;
+            bFound = true;
             break;
         }
         nStart = nEnd;
@@ -574,8 +574,7 @@ int SwFindParaText::Find( SwPaM* pCrsr, SwMoveFn fnMove,
     if( bInReadOnly && bReplace )
         bInReadOnly = sal_False;
 
-    sal_Bool bFnd = (sal_Bool)pCrsr->Find( rSearchOpt, bSearchInNotes, aSTxt, fnMove, pRegion, bInReadOnly );
-
+    const bool bFnd = pCrsr->Find( rSearchOpt, bSearchInNotes, aSTxt, fnMove, pRegion, bInReadOnly );
 
     if( bFnd && bReplace ) // replace string
     {
diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index 182521d..4e8bf0b 100644
--- a/sw/source/core/crsr/pam.cxx
+++ b/sw/source/core/crsr/pam.cxx
@@ -45,7 +45,7 @@
 #include <xmloff/odffields.hxx>
 
 // for the dump "MSC-" compiler
-inline xub_StrLen GetSttOrEnd( sal_Bool bCondition, const SwCntntNode& rNd )
+inline xub_StrLen GetSttOrEnd( bool bCondition, const SwCntntNode& rNd )
 {
     return bCondition ? 0 : rNd.Len();
 }


More information about the Libreoffice-commits mailing list