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

Miklos Vajna vmiklos at collabora.co.uk
Sat Sep 21 05:27:24 PDT 2013


 sw/inc/edimp.hxx                 |    2 +-
 sw/source/core/doc/docbm.cxx     |   10 +---------
 sw/source/core/doc/doccorr.cxx   |   11 +----------
 sw/source/core/edit/autofmt.cxx  |    2 +-
 sw/source/core/edit/edatmisc.cxx |    4 ++--
 sw/source/core/edit/edattr.cxx   |    4 ++--
 sw/source/core/edit/eddel.cxx    |    8 ++++----
 sw/source/core/edit/edfcol.cxx   |    2 +-
 sw/source/core/edit/edfld.cxx    |    4 ++--
 sw/source/core/edit/edglss.cxx   |    2 +-
 sw/source/core/edit/editsh.cxx   |   12 ++++++------
 sw/source/core/edit/edredln.cxx  |    2 +-
 sw/source/core/edit/edsect.cxx   |    6 +++---
 sw/source/core/edit/edtab.cxx    |    4 ++--
 sw/source/core/edit/edtox.cxx    |    2 +-
 sw/source/core/fields/fldlst.cxx |    2 +-
 sw/source/core/frmedt/fecopy.cxx |    2 +-
 sw/source/core/frmedt/fedesc.cxx |    2 +-
 sw/source/core/frmedt/fefly1.cxx |    2 +-
 sw/source/core/frmedt/fews.cxx   |    2 +-
 20 files changed, 34 insertions(+), 51 deletions(-)

New commits:
commit 815c6758727abf7adef5d1a962a36fb3d102000c
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Sat Sep 21 13:57:41 2013 +0200

    sw: unify PCURCRSR / FOREACHPAM_START / FOREACHPAM_END macros
    
    Change-Id: I10ab2d0ba10178ba2d37db2632349215341612f4

diff --git a/sw/inc/edimp.hxx b/sw/inc/edimp.hxx
index b6ec277..8e251ff 100644
--- a/sw/inc/edimp.hxx
+++ b/sw/inc/edimp.hxx
@@ -31,7 +31,7 @@ class SwNodeIndex;
 
 #define FOREACHPAM_START(pCURSH) \
     {\
-        SwPaM *_pStartCrsr = (pCURSH)->GetCrsr(), *__pStartCrsr = _pStartCrsr; \
+        SwPaM *_pStartCrsr = (pCURSH), *__pStartCrsr = _pStartCrsr; \
         do {
 
 #define FOREACHPAM_END() \
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index ae066c7..c9e7684 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -46,6 +46,7 @@
 #include <swundo.hxx>
 #include <unocrsr.hxx>
 #include <viscrs.hxx>
+#include <edimp.hxx>
 #include <stdio.h>
 
 using namespace ::std;
@@ -874,15 +875,6 @@ namespace sw { namespace mark
 
 }} // namespace ::sw::mark
 
-#define PCURCRSR (_pCurrCrsr)
-#define FOREACHPAM_START(pSttCrsr) \
-    {\
-        SwPaM *_pStartCrsr = pSttCrsr, *_pCurrCrsr = pSttCrsr; \
-        do {
-
-#define FOREACHPAM_END() \
-        } while( (_pCurrCrsr=(SwPaM *)_pCurrCrsr->GetNext()) != _pStartCrsr ); \
-    }
 #define PCURSH ((SwCrsrShell*)_pStartShell)
 #define FOREACHSHELL_START( pEShell ) \
     {\
diff --git a/sw/source/core/doc/doccorr.cxx b/sw/source/core/doc/doccorr.cxx
index d6cf7b0..9c57fd5 100644
--- a/sw/source/core/doc/doccorr.cxx
+++ b/sw/source/core/doc/doccorr.cxx
@@ -30,6 +30,7 @@
 #include <unocrsr.hxx>
 #include <swundo.hxx>
 #include <hints.hxx>
+#include <edimp.hxx>
 
 /*
  * Macros to iterate over all CrsrShells
@@ -47,16 +48,6 @@
         } while((_pStartShell=(ViewShell*)_pStartShell->GetNext())!= pEShell ); \
     }
 
-#define PCURCRSR (_pCurrCrsr)
-#define FOREACHPAM_START(pSttCrsr) \
-    {\
-        SwPaM *_pStartCrsr = pSttCrsr, *_pCurrCrsr = pSttCrsr; \
-        do {
-
-#define FOREACHPAM_END() \
-        } while( (_pCurrCrsr=(SwPaM *)_pCurrCrsr->GetNext()) != _pStartCrsr ); \
-    }
-
 namespace
 {
     /// find the relevant section in which the SwUnoCrsr may wander.
diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index 8d4571a..2ad6483 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -2556,7 +2556,7 @@ void SwEditShell::AutoFormat( const SvxSwAutoFmtFlags* pAFlags )
     // There are more than one or a selection is open
     if( pCrsr->GetNext() != pCrsr || pCrsr->HasMark() )
     {
-        FOREACHPAM_START(this)
+        FOREACHPAM_START(GetCrsr())
             if( PCURCRSR->HasMark() )
             {
                 SwAutoFormat aFmt( this, aAFFlags, &PCURCRSR->Start()->nNode,
diff --git a/sw/source/core/edit/edatmisc.cxx b/sw/source/core/edit/edatmisc.cxx
index 5c3fc19..94218ac 100644
--- a/sw/source/core/edit/edatmisc.cxx
+++ b/sw/source/core/edit/edatmisc.cxx
@@ -56,7 +56,7 @@ void SwEditShell::ResetAttr( const std::set<sal_uInt16> &attrs, SwPaM* pPaM )
 
 void SwEditShell::GCAttr()
 {
-    FOREACHPAM_START(this)
+    FOREACHPAM_START(GetCrsr())
         if ( !PCURCRSR->HasMark() )
         {
             SwTxtNode *const pTxtNode =
@@ -106,7 +106,7 @@ void SwEditShell::SetAttr( const SfxPoolItem& rHint, sal_uInt16 nFlags )
         sal_Bool bIsTblMode = IsTableMode();
         GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_INSATTR, NULL);
 
-        FOREACHPAM_START(this)
+        FOREACHPAM_START(GetCrsr())
             if( PCURCRSR->HasMark() && ( bIsTblMode ||
                 *PCURCRSR->GetPoint() != *PCURCRSR->GetMark() ))
             {
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index 1133863..4306fb5 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -373,7 +373,7 @@ bool SwEditShell::IsMoveLeftMargin( bool bRight, bool bModulus ) const
     if( !nDefDist )
         return false;
 
-    FOREACHPAM_START(this)
+    FOREACHPAM_START(GetCrsr())
 
         sal_uLong nSttNd = PCURCRSR->GetMark()->nNode.GetIndex(),
               nEndNd = PCURCRSR->GetPoint()->nNode.GetIndex();
@@ -523,7 +523,7 @@ sal_uInt16 SwEditShell::GetScriptType() const
     sal_uInt16 nRet = 0;
 
     {
-        FOREACHPAM_START(this)
+        FOREACHPAM_START(GetCrsr())
 
             const SwPosition *pStt = PCURCRSR->Start(),
                              *pEnd = pStt == PCURCRSR->GetMark()
diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx
index 8ea582c..e644b96 100644
--- a/sw/source/core/edit/eddel.cxx
+++ b/sw/source/core/edit/eddel.cxx
@@ -115,7 +115,7 @@ long SwEditShell::Delete()
             GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_DELETE, &aRewriter);
         }
 
-        FOREACHPAM_START(this)
+        FOREACHPAM_START(GetCrsr())
             DeleteSel( *PCURCRSR, &bUndo );
         FOREACHPAM_END()
 
@@ -145,7 +145,7 @@ long SwEditShell::Copy( SwEditShell* pDestShell )
         SwPosition * pPos = 0;
         boost::shared_ptr<SwPosition> pInsertPos;
         sal_uInt16 nMove = 0;
-        FOREACHPAM_START(this)
+        FOREACHPAM_START(GetCrsr())
 
             if( !pPos )
             {
@@ -193,7 +193,7 @@ long SwEditShell::Copy( SwEditShell* pDestShell )
     std::list< boost::shared_ptr<SwPosition> >::iterator pNextInsert = aInsertList.begin();
 
     pDestShell->GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
-    FOREACHPAM_START(this)
+    FOREACHPAM_START(GetCrsr())
 
         if( !pPos )
         {
@@ -297,7 +297,7 @@ sal_Bool SwEditShell::Replace( const String& rNewStr, sal_Bool bRegExpRplc )
         StartAllAction();
         GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
 
-        FOREACHPAM_START(this)
+        FOREACHPAM_START(GetCrsr())
             if( PCURCRSR->HasMark() && *PCURCRSR->GetMark() != *PCURCRSR->GetPoint() )
             {
                 bRet = GetDoc()->ReplaceRange( *PCURCRSR, rNewStr, bRegExpRplc )
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 612fdd5..dd8cd16 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -58,7 +58,7 @@ void SwEditShell::SetTxtFmtColl( SwTxtFmtColl *pFmt,
     aRewriter.AddRule(UndoArg1, pLocal->GetName());
 
     GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_SETFMTCOLL, &aRewriter);
-    FOREACHPAM_START(this)
+    FOREACHPAM_START(GetCrsr())
 
         if( !PCURCRSR->HasReadonlySel(
                     // Formular view
diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx
index 503fa6f..d39bcd9 100644
--- a/sw/source/core/edit/edfld.cxx
+++ b/sw/source/core/edit/edfld.cxx
@@ -199,7 +199,7 @@ void SwEditShell::Insert2(SwField& rFld, const bool bForceExpandHints)
         ? nsSetAttrMode::SETATTR_FORCEHINTEXPAND
         : nsSetAttrMode::SETATTR_DEFAULT;
 
-    FOREACHPAM_START(this) // for each PaM
+    FOREACHPAM_START(GetCrsr()) // for each PaM
         bool bSuccess(GetDoc()->InsertPoolItem(*PCURCRSR, aFld, nInsertFlags));
         OSL_ENSURE( bSuccess, "Doc->Insert(Field) failed");
         (void) bSuccess;
@@ -307,7 +307,7 @@ void SwEditShell::UpdateFlds( SwField &rFld )
         sal_Bool bTblSelBreak = sal_False;
 
         SwMsgPoolItem aHint( RES_TXTATR_FIELD );  // Search-Hint
-        FOREACHPAM_START(this)                    // for each PaM
+        FOREACHPAM_START(GetCrsr())               // for each PaM
             if( PCURCRSR->HasMark() && bOkay )    // ... with selection
             {
                 // copy of the PaM
diff --git a/sw/source/core/edit/edglss.cxx b/sw/source/core/edit/edglss.cxx
index 18ea2fe..1c1ecb1 100644
--- a/sw/source/core/edit/edglss.cxx
+++ b/sw/source/core/edit/edglss.cxx
@@ -212,7 +212,7 @@ sal_Bool SwEditShell::_CopySelToDoc( SwDoc* pInsDoc, SwNodeIndex* pSttNd )
             pInsDoc->SetColumnSelection( true );
         bool bSelectAll = StartsWithTable() && ExtendedSelectedAll();
         {
-        FOREACHPAM_START(this)
+        FOREACHPAM_START(GetCrsr())
 
             if( !PCURCRSR->HasMark() )
             {
diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx
index f292446..5b703be 100644
--- a/sw/source/core/edit/editsh.cxx
+++ b/sw/source/core/edit/editsh.cxx
@@ -63,7 +63,7 @@ using namespace com::sun::star;
 void SwEditShell::Insert( sal_Unicode c, sal_Bool bOnlyCurrCrsr )
 {
     StartAllAction();
-    FOREACHPAM_START(this)
+    FOREACHPAM_START(GetCrsr())
 
         const bool bSuccess = GetDoc()->InsertString(*PCURCRSR, OUString(c));
         OSL_ENSURE( bSuccess, "Doc->Insert() failed." );
@@ -163,7 +163,7 @@ void SwEditShell::Insert2(const String &rStr, const bool bForceExpandHints )
 void SwEditShell::Overwrite(const String &rStr)
 {
     StartAllAction();
-    FOREACHPAM_START(this)
+    FOREACHPAM_START(GetCrsr())
         if( !GetDoc()->Overwrite(*PCURCRSR, rStr ) )
         {
             OSL_FAIL( "Doc->Overwrite(Str) failed." );
@@ -178,7 +178,7 @@ long SwEditShell::SplitNode( sal_Bool bAutoFormat, sal_Bool bCheckTableStart )
     StartAllAction();
     GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
 
-    FOREACHPAM_START(this)
+    FOREACHPAM_START(GetCrsr())
         // Here, a table cell becomes a normal text cell.
         GetDoc()->ClearBoxNumAttrs( PCURCRSR->GetPoint()->nNode );
         GetDoc()->SplitNode( *PCURCRSR->GetPoint(), bCheckTableStart );
@@ -201,7 +201,7 @@ sal_Bool SwEditShell::AppendTxtNode()
     StartAllAction();
     GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
 
-    FOREACHPAM_START(this)
+    FOREACHPAM_START(GetCrsr())
         GetDoc()->ClearBoxNumAttrs( PCURCRSR->GetPoint()->nNode );
         bRet = GetDoc()->AppendTxtNode( *PCURCRSR->GetPoint()) || bRet;
     FOREACHPAM_END()
@@ -1050,7 +1050,7 @@ void SwEditShell::TransliterateText( sal_uInt32 nType )
     if( pCrsr->GetNext() != pCrsr )
     {
         GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
-        FOREACHPAM_START( this )
+        FOREACHPAM_START(GetCrsr())
 
         if( PCURCRSR->HasMark() )
             GetDoc()->TransliterateText( *PCURCRSR, aTrans );
@@ -1066,7 +1066,7 @@ void SwEditShell::TransliterateText( sal_uInt32 nType )
 
 void SwEditShell::CountWords( SwDocStat& rStat ) const
 {
-    FOREACHPAM_START( this )
+    FOREACHPAM_START(GetCrsr())
 
         if( PCURCRSR->HasMark() )
             GetDoc()->CountWords( *PCURCRSR, rStat );
diff --git a/sw/source/core/edit/edredln.cxx b/sw/source/core/edit/edredln.cxx
index 966255b..bc5bffb 100644
--- a/sw/source/core/edit/edredln.cxx
+++ b/sw/source/core/edit/edredln.cxx
@@ -95,7 +95,7 @@ sal_Bool SwEditShell::RejectRedline( sal_uInt16 nPos )
 sal_Bool SwEditShell::SetRedlineComment( const String& rS )
 {
     sal_Bool bRet = sal_False;
-    FOREACHPAM_START(this)
+    FOREACHPAM_START(GetCrsr())
         bRet = bRet || GetDoc()->SetRedlineComment( *PCURCRSR, rS );
     FOREACHPAM_END()
 
diff --git a/sw/source/core/edit/edsect.cxx b/sw/source/core/edit/edsect.cxx
index aef3213..88b0695 100644
--- a/sw/source/core/edit/edsect.cxx
+++ b/sw/source/core/edit/edsect.cxx
@@ -41,7 +41,7 @@ SwEditShell::InsertSection(
         StartAllAction();
         GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_INSSECTION, NULL );
 
-        FOREACHPAM_START(this)
+        FOREACHPAM_START(GetCrsr())
             SwSection const*const pNew =
                 GetDoc()->InsertSwSection( *PCURCRSR, rNewData, 0, pAttr );
             if( !pRet )
@@ -183,7 +183,7 @@ void SwEditShell::SetSectionAttr( const SfxItemSet& rSet,
     {
         // for all section in the selection
 
-        FOREACHPAM_START(this)
+        FOREACHPAM_START(GetCrsr())
 
             const SwPosition* pStt = PCURCRSR->Start(),
                             * pEnd = PCURCRSR->End();
@@ -253,7 +253,7 @@ void SwEditShell::_SetSectionAttr( SwSectionFmt& rSectFmt,
 sal_uInt16 SwEditShell::GetFullSelectedSectionCount() const
 {
     sal_uInt16 nRet = 0;
-    FOREACHPAM_START(this)
+    FOREACHPAM_START(GetCrsr())
 
         const SwPosition* pStt = PCURCRSR->Start(),
                         * pEnd = PCURCRSR->End();
diff --git a/sw/source/core/edit/edtab.cxx b/sw/source/core/edit/edtab.cxx
index a0b5de7..b36ab3f 100644
--- a/sw/source/core/edit/edtab.cxx
+++ b/sw/source/core/edit/edtab.cxx
@@ -124,7 +124,7 @@ sal_Bool SwEditShell::TextToTable( const SwInsertTableOptions& rInsTblOpts,
     SwWait aWait( *GetDoc()->GetDocShell(), sal_True );
     sal_Bool bRet = sal_False;
     StartAllAction();
-    FOREACHPAM_START(this)
+    FOREACHPAM_START(GetCrsr())
         if( PCURCRSR->HasMark() )
             bRet |= 0 != GetDoc()->TextToTable( rInsTblOpts, *PCURCRSR, cCh,
                                                 eAdj, pTAFmt );
@@ -183,7 +183,7 @@ sal_Bool SwEditShell::TableToText( sal_Unicode cCh )
 sal_Bool SwEditShell::IsTextToTableAvailable() const
 {
     sal_Bool bOnlyText = sal_False;
-    FOREACHPAM_START(this)
+    FOREACHPAM_START(GetCrsr())
         if( PCURCRSR->HasMark() && *PCURCRSR->GetPoint() != *PCURCRSR->GetMark() )
         {
             bOnlyText = sal_True;
diff --git a/sw/source/core/edit/edtox.cxx b/sw/source/core/edit/edtox.cxx
index ab7f7ec..f93c8fb 100644
--- a/sw/source/core/edit/edtox.cxx
+++ b/sw/source/core/edit/edtox.cxx
@@ -59,7 +59,7 @@ void SwEditShell::Insert(const SwTOXMark& rMark)
 {
     sal_Bool bInsAtPos = rMark.IsAlternativeText();
     StartAllAction();
-    FOREACHPAM_START(this)
+    FOREACHPAM_START(GetCrsr())
 
         const SwPosition *pStt = PCURCRSR->Start(),
                          *pEnd = PCURCRSR->End();
diff --git a/sw/source/core/fields/fldlst.cxx b/sw/source/core/fields/fldlst.cxx
index c094cd5..fb55ce0 100644
--- a/sw/source/core/fields/fldlst.cxx
+++ b/sw/source/core/fields/fldlst.cxx
@@ -174,7 +174,7 @@ void SwInputFieldList::RemoveUnselectedFlds()
 {
     _SetGetExpFlds* pNewLst = new _SetGetExpFlds();
 
-    FOREACHPAM_START(pSh)
+    FOREACHPAM_START(pSh->GetCrsr())
     {
         for (sal_uInt16 i = 0; i < Count();)
         {
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index a38e0cd..c98e5f2 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -821,7 +821,7 @@ sal_Bool SwFEShell::Paste( SwDoc* pClpDoc, sal_Bool bIncludingPageFrames )
     }
     else
     {
-        FOREACHPAM_START(this)
+        FOREACHPAM_START(GetCrsr())
 
         if( pSrcNd &&
             0 != ( pDestNd = GetDoc()->IsIdxInTbl( PCURCRSR->GetPoint()->nNode )))
diff --git a/sw/source/core/frmedt/fedesc.cxx b/sw/source/core/frmedt/fedesc.cxx
index 3d99e05..65a4e96 100644
--- a/sw/source/core/frmedt/fedesc.cxx
+++ b/sw/source/core/frmedt/fedesc.cxx
@@ -211,7 +211,7 @@ const SwPageDesc* SwFEShell::GetSelectedPageDescs() const
     const SwPageDesc* pFnd, *pRetDesc = (SwPageDesc*)0xffffffff;
     const Point aNulPt;
 
-    FOREACHPAM_START(this)
+    FOREACHPAM_START(GetCrsr())
 
         if( 0 != (pCNd = PCURCRSR->GetCntntNode() ) &&
             0 != ( pPtFrm = pCNd->getLayoutFrm( GetLayout(), &aNulPt, 0, sal_False )) )
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index 72a4932..f5d7668 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -854,7 +854,7 @@ SwFlyFrmFmt* SwFEShell::InsertObject( const svt::EmbeddedObjectRef&  xObj,
     SwFlyFrmFmt* pFmt = 0;
     SET_CURR_SHELL( this );
     StartAllAction();
-        FOREACHPAM_START( this )
+        FOREACHPAM_START(GetCrsr())
             pFmt = GetDoc()->Insert(*PCURCRSR, xObj,
                                     pFlyAttrSet, pGrfAttrSet, pFrmFmt );
             OSL_ENSURE( pFmt, "Doc->Insert(notxt) failed." );
diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx
index 4593b69..a962ba7 100644
--- a/sw/source/core/frmedt/fews.cxx
+++ b/sw/source/core/frmedt/fews.cxx
@@ -571,7 +571,7 @@ sal_Bool SwFEShell::Sort(const SwSortOptions& rOpt)
     else
     {
         // Sort text nothing else
-        FOREACHPAM_START(this)
+        FOREACHPAM_START(GetCrsr())
 
             SwPaM* pPam = PCURCRSR;
 


More information about the Libreoffice-commits mailing list