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

Bjoern Michaelsen bjoern.michaelsen at canonical.com
Mon Mar 16 05:58:59 PDT 2015


 sw/inc/calbck.hxx                   |    4 -
 sw/source/core/access/accmap.cxx    |    6 -
 sw/source/core/doc/doc.cxx          |   48 +++++---------
 sw/source/core/doc/docdraw.cxx      |    6 -
 sw/source/core/doc/docfly.cxx       |    2 
 sw/source/core/doc/htmltbl.cxx      |    2 
 sw/source/core/doc/tblrwcl.cxx      |    4 -
 sw/source/core/docnode/section.cxx  |  103 +++++++++++++++---------------
 sw/source/core/docnode/swbaslnk.cxx |   21 ++----
 sw/source/core/edit/edfld.cxx       |    8 +-
 sw/source/core/fields/ddefld.cxx    |  121 +++++++++++++++++-------------------
 sw/source/core/layout/atrfrm.cxx    |   11 +--
 12 files changed, 155 insertions(+), 181 deletions(-)

New commits:
commit f87a47a04a9eaae5d85a9f081536aa0b8dddf95d
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Sat Mar 14 20:42:14 2015 +0100

    core/doc: dont use 'shortcut' that is longer than the original
    
    Change-Id: Ib2d19c1b6af7676910208d0d07627f41379fcb4a

diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx
index 10e2e62..3dbc5f7 100644
--- a/sw/source/core/doc/docdraw.cxx
+++ b/sw/source/core/doc/docdraw.cxx
@@ -491,14 +491,14 @@ _ZSortFly::_ZSortFly( const SwFrmFmt* pFrmFmt, const SwFmtAnchor* pFlyAn,
         if( pFmt->getIDocumentLayoutAccess()->GetCurrentViewShell() )
         {
             // See if there is an SdrObject for it
-            SwFlyFrm* pFly = SwIterator<SwFlyFrm,SwFmt>::FirstElement( *pFrmFmt );
+            SwFlyFrm* pFly = SwIterator<SwFlyFrm,SwFmt>( *pFrmFmt ).First();
             if( pFly )
                 nOrdNum = pFly->GetVirtDrawObj()->GetOrdNum();
         }
         else
         {
             // See if there is an SdrObject for it
-            SwFlyDrawContact* pContact = SwIterator<SwFlyDrawContact,SwFmt>::FirstElement( *pFrmFmt );
+            SwFlyDrawContact* pContact = SwIterator<SwFlyDrawContact,SwFmt>( *pFrmFmt ).First();
             if( pContact )
                 nOrdNum = pContact->GetMaster()->GetOrdNum();
         }
@@ -506,7 +506,7 @@ _ZSortFly::_ZSortFly( const SwFrmFmt* pFrmFmt, const SwFmtAnchor* pFlyAn,
     else if( RES_DRAWFRMFMT == pFmt->Which() )
     {
         // See if there is an SdrObject for it
-        SwDrawContact* pContact = SwIterator<SwDrawContact,SwFmt>::FirstElement( *pFrmFmt );
+        SwDrawContact* pContact = SwIterator<SwDrawContact,SwFmt>( *pFrmFmt ).First();
         if( pContact )
             nOrdNum = pContact->GetMaster()->GetOrdNum();
     }
diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx
index 701dea3..428e758 100644
--- a/sw/source/core/doc/docfly.cxx
+++ b/sw/source/core/doc/docfly.cxx
@@ -1056,7 +1056,7 @@ SwChainRet SwDoc::Chain( SwFrmFmt &rSource, const SwFrmFmt &rDest )
         SwFmtFrmSize aSize( rSource.GetFrmSize() );
         if ( aSize.GetHeightSizeType() != ATT_FIX_SIZE )
         {
-            SwFlyFrm *pFly = SwIterator<SwFlyFrm,SwFmt>::FirstElement( rSource );
+            SwFlyFrm *pFly = SwIterator<SwFlyFrm,SwFmt>( rSource ).First();
             if ( pFly )
                 aSize.SetHeight( pFly->Frm().Height() );
             aSize.SetHeightSizeType( ATT_FIX_SIZE );
diff --git a/sw/source/core/doc/htmltbl.cxx b/sw/source/core/doc/htmltbl.cxx
index 5aa4d67..1520adb 100644
--- a/sw/source/core/doc/htmltbl.cxx
+++ b/sw/source/core/doc/htmltbl.cxx
@@ -407,7 +407,7 @@ sal_uInt16 SwHTMLTableLayout::GetBrowseWidthByTabFrm(
 sal_uInt16 SwHTMLTableLayout::GetBrowseWidthByTable( const SwDoc& rDoc ) const
 {
     sal_uInt16 nBrowseWidth = 0;
-    SwTabFrm* pFrm = SwIterator<SwTabFrm,SwFmt>::FirstElement( *pSwTable->GetFrmFmt() );
+    SwTabFrm* pFrm = SwIterator<SwTabFrm,SwFmt>( *pSwTable->GetFrmFmt() ).First();
     if( pFrm )
     {
         nBrowseWidth = GetBrowseWidthByTabFrm( *pFrm );
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index 9dbbec0..d0bdb86 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -586,7 +586,7 @@ bool SwTable::_InsertRow( SwDoc* pDoc, const SwSelBoxes& rBoxes,
 
     // Find Lines for the layout update
     const bool bLayout = !IsNewModel() &&
-        0 != SwIterator<SwTabFrm,SwFmt>::FirstElement( *GetFrmFmt() );
+        0 != SwIterator<SwTabFrm,SwFmt>( *GetFrmFmt() ).First();
 
     if ( bLayout )
     {
@@ -3552,7 +3552,7 @@ bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType,
                     if( GetFrmFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) &&
                         !rSz.GetWidthPercent() )
                     {
-                        SwTabFrm* pTabFrm = SwIterator<SwTabFrm,SwFmt>::FirstElement( *GetFrmFmt() );
+                        SwTabFrm* pTabFrm = SwIterator<SwTabFrm,SwFmt>( *GetFrmFmt() ).First();
                         if( pTabFrm &&
                             pTabFrm->Prt().Width() != rSz.GetWidth() )
                         {
commit f2993962fdac764026ec60239ad7229cbc1cbe85
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Sun Mar 15 04:48:25 2015 +0100

    use SwIterator<>
    
    Change-Id: I87c0385bba8de804c63dd5d908d9efb6959016c9

diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx
index 37289e4..b101800 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -951,58 +951,14 @@ void SwSectionFmt::UpdateParent()
     const SwFmtEditInReadonly* pEditInReadonly = 0;
     bool bIsHidden = false;
 
-    SwClientIter aIter( *this );    // TODO
-    ::SwClient * pLast = aIter.GoStart();
-    if( pLast ) // Could we jump to the beginning?
-        do {
-            if( pLast->IsA( TYPE(SwSectionFmt) ) )
-            {
-                if( !pSection )
-                {
-                    pSection = GetSection();
-                    if( GetRegisteredIn() )
-                    {
-                        const SwSection* pPS = GetParentSection();
-                        pProtect = &pPS->GetFmt()->GetProtect();
-                        // edit in readonly sections
-                        pEditInReadonly = &pPS->GetFmt()->GetEditInReadonly();
-                        bIsHidden = pPS->IsHiddenFlag();
-                    }
-                    else
-                    {
-                        pProtect = &GetProtect();
-                        // edit in readonly sections
-                        pEditInReadonly = &GetEditInReadonly();
-                        bIsHidden = pSection->IsHidden();
-                    }
-                }
-                if (!pProtect->IsCntntProtected() !=
-                    !pSection->IsProtectFlag())
-                {
-                    pLast->ModifyNotification( (SfxPoolItem*)pProtect,
-                                    (SfxPoolItem*)pProtect );
-                }
-
-                // edit in readonly sections
-                if (!pEditInReadonly->GetValue() !=
-                    !pSection->IsEditInReadonlyFlag())
-                {
-                    pLast->ModifyNotification( (SfxPoolItem*)pEditInReadonly,
-                                    (SfxPoolItem*)pEditInReadonly );
-                }
-
-                if( bIsHidden == pSection->IsHiddenFlag() )
-                {
-                    SwMsgPoolItem aMsgItem( static_cast<sal_uInt16>(bIsHidden
-                                ? RES_SECTION_HIDDEN
-                                : RES_SECTION_NOT_HIDDEN ) );
-                    pLast->ModifyNotification( &aMsgItem, &aMsgItem );
-                }
-            }
-            else if( !pSection &&
-                    pLast->IsA( TYPE(SwSection) ) )
+    SwIterator<SwClient,SwSectionFmt> aIter(*this);
+    for(SwClient* pLast = aIter.First(); pLast; pLast = aIter.Next())
+    {
+        if( pLast->IsA( TYPE(SwSectionFmt) ) )
+        {
+            if( !pSection )
             {
-                pSection = static_cast<SwSection*>(pLast);
+                pSection = GetSection();
                 if( GetRegisteredIn() )
                 {
                     const SwSection* pPS = GetParentSection();
@@ -1019,7 +975,50 @@ void SwSectionFmt::UpdateParent()
                     bIsHidden = pSection->IsHidden();
                 }
             }
-        } while( 0 != ( pLast = ++aIter ));
+            if (!pProtect->IsCntntProtected() !=
+                !pSection->IsProtectFlag())
+            {
+                pLast->ModifyNotification( (SfxPoolItem*)pProtect,
+                                (SfxPoolItem*)pProtect );
+            }
+
+            // edit in readonly sections
+            if (!pEditInReadonly->GetValue() !=
+                !pSection->IsEditInReadonlyFlag())
+            {
+                pLast->ModifyNotification( (SfxPoolItem*)pEditInReadonly,
+                                (SfxPoolItem*)pEditInReadonly );
+            }
+
+            if( bIsHidden == pSection->IsHiddenFlag() )
+            {
+                SwMsgPoolItem aMsgItem( static_cast<sal_uInt16>(bIsHidden
+                            ? RES_SECTION_HIDDEN
+                            : RES_SECTION_NOT_HIDDEN ) );
+                pLast->ModifyNotification( &aMsgItem, &aMsgItem );
+            }
+        }
+        else if( !pSection &&
+                pLast->IsA( TYPE(SwSection) ) )
+        {
+            pSection = static_cast<SwSection*>(pLast);
+            if( GetRegisteredIn() )
+            {
+                const SwSection* pPS = GetParentSection();
+                pProtect = &pPS->GetFmt()->GetProtect();
+                // edit in readonly sections
+                pEditInReadonly = &pPS->GetFmt()->GetEditInReadonly();
+                bIsHidden = pPS->IsHiddenFlag();
+            }
+            else
+            {
+                pProtect = &GetProtect();
+                // edit in readonly sections
+                pEditInReadonly = &GetEditInReadonly();
+                bIsHidden = pSection->IsHidden();
+            }
+        }
+    }
 }
 
 SwSectionNode* SwSectionFmt::GetSectionNode(bool const bAlways)
commit 2c93ae21a3883bf23b867c7bbc0cbb742de183bf
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Sun Mar 15 04:48:05 2015 +0100

    use SwIterator<>
    
    Change-Id: Ia0a432019dc856c6c12996a898e8137789cbc76b

diff --git a/sw/source/core/docnode/swbaslnk.cxx b/sw/source/core/docnode/swbaslnk.cxx
index de6f3dd..c391d49 100644
--- a/sw/source/core/docnode/swbaslnk.cxx
+++ b/sw/source/core/docnode/swbaslnk.cxx
@@ -50,6 +50,7 @@
 #include <tabfrm.hxx>
 #include <cntfrm.hxx>
 #include <htmltbl.hxx>
+#include <switerator.hxx>
 
 using namespace com::sun::star;
 
@@ -64,18 +65,16 @@ static void lcl_CallModify( SwGrfNode& rGrfNd, SfxPoolItem& rItem )
     //              after a Paint will be swapped out! So all other "behind"
     //              them havent't a loaded Graphic.
     rGrfNd.LockModify();
-
-    SwClientIter aIter( rGrfNd );   // TODO
-    for( int n = 0; n < 2; ++n )
     {
-        SwClient * pLast = aIter.GoStart();
-        if( pLast )     // Were we able to jump to the beginning?
-        {
-            do {
-                if( (0 == n) != pLast->ISA( SwCntntFrm ) )
-                    pLast->ModifyNotification( &rItem, &rItem );
-            } while( 0 != ( pLast = ++aIter ));
-        }
+        SwIterator<SwClient,SwGrfNode> aIter(rGrfNd);
+        for(SwClient* pLast = aIter.First(); pLast; pLast = aIter.Next())
+            if(!pLast->ISA(SwCntntFrm))
+                pLast->ModifyNotification(&rItem, &rItem);
+    }
+    {
+        SwIterator<SwCntntFrm,SwGrfNode> aIter(rGrfNd);
+        for(SwClient* pLast = aIter.First(); pLast; pLast = aIter.Next())
+            pLast->ModifyNotification(&rItem, &rItem);
     }
     rGrfNd.UnlockModify();
 }
commit 8b41d4292b7c72643602cdfd89358972d14faf27
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Sun Mar 15 04:47:36 2015 +0100

    use SwIterator<>
    
    Change-Id: Ic24eaa5b0fd4c1c06a4a43c77418cb44e53e0f7b

diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx
index 6e05a4a..3cccf44 100644
--- a/sw/source/core/edit/edfld.cxx
+++ b/sw/source/core/edit/edfld.cxx
@@ -179,14 +179,14 @@ void SwEditShell::FieldToText( SwFieldType* pType )
     StartUndo( UNDO_DELETE );
     Push();
     SwPaM* pPaM = GetCrsr();
-
+    // TODO: this is really hackish
     SwFieldHint aHint( pPaM );
-    SwClientIter aIter( *pType );
-    for ( SwClient* pClient = aIter.GoStart(); pClient; pClient = ++aIter )
+    SwIterator<SwClient,SwFieldType> aIter(*pType);
+    for( SwClient* pClient = aIter.First(); pClient; pClient = aIter.Next() )
     {
         pPaM->DeleteMark();
         pClient->SwClientNotifyCall( *pType, aHint );
-     }
+    }
 
     Pop( false );
     EndAllAction();
commit b5cff1eb3f728a91df70fc72bf03e9b5558112b0
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Sun Mar 15 04:47:06 2015 +0100

    use SwIterator<>
    
    Change-Id: I04cba3d423db2dee670e22f7a01550059f1cf973

diff --git a/sw/source/core/fields/ddefld.cxx b/sw/source/core/fields/ddefld.cxx
index cc051fa..81d1517 100644
--- a/sw/source/core/fields/ddefld.cxx
+++ b/sw/source/core/fields/ddefld.cxx
@@ -33,6 +33,7 @@
 #include <swddetbl.hxx>
 #include <unofldmid.h>
 #include <hints.hxx>
+#include <switerator.hxx>
 
 using namespace ::com::sun::star;
 
@@ -105,25 +106,24 @@ public:
         bool bCallModify = false;
         rFldType.LockModify();
 
-        SwClientIter aIter( rFldType );     // TODO
-        SwClient * pLast = aIter.GoStart();
-        if( pLast )     // Could we jump to beginning?
-            do {
-                // a DDE table or a DDE field attribute in the text
-                if( !pLast->IsA( TYPE( SwFmtFld ) ) ||
-                    static_cast<SwFmtFld*>(pLast)->GetTxtFld() )
+        SwIterator<SwClient,SwFieldType> aIter(rFldType);
+        for(SwClient* pLast = aIter.First(); pLast; pLast = aIter.Next())
+        {
+            // a DDE table or a DDE field attribute in the text
+            if( !pLast->IsA( TYPE( SwFmtFld ) ) ||
+                static_cast<SwFmtFld*>(pLast)->GetTxtFld() )
+            {
+                if( !bCallModify )
                 {
-                    if( !bCallModify )
-                    {
-                        if( pESh )
-                            pESh->StartAllAction();
-                        else if( pSh )
-                            pSh->StartAction();
-                    }
-                    pLast->ModifyNotification( 0, &aUpdateDDE );
-                    bCallModify = true;
+                    if( pESh )
+                        pESh->StartAllAction();
+                    else if( pSh )
+                        pSh->StartAction();
                 }
-            } while( 0 != ( pLast = ++aIter ));
+                pLast->ModifyNotification( 0, &aUpdateDDE );
+                bCallModify = true;
+            }
+        }
 
         rFldType.UnlockModify();
 
@@ -169,25 +169,23 @@ const SwNode* SwIntrnlRefLink::GetAnchor() const
 {
     // here, any anchor of the normal NodesArray should be sufficient
     const SwNode* pNd = 0;
-    SwClientIter aIter( rFldType );     // TODO
-    SwClient * pLast = aIter.GoStart();
-    if( pLast )     // Could we jump to beginning?
-        do {
-            // a DDE table or a DDE field attribute in the text
-            if( !pLast->IsA( TYPE( SwFmtFld ) ))
-            {
-                SwDepend* pDep = static_cast<SwDepend*>(pLast);
-                SwDDETable* pDDETbl = static_cast<SwDDETable*>(pDep->GetToTell());
-                pNd = pDDETbl->GetTabSortBoxes()[0]->GetSttNd();
-            }
-            else if( static_cast<SwFmtFld*>(pLast)->GetTxtFld() )
-                pNd = static_cast<SwFmtFld*>(pLast)->GetTxtFld()->GetpTxtNode();
-
-            if( pNd && &rFldType.GetDoc()->GetNodes() == &pNd->GetNodes() )
-                break;
-            pNd = 0;
-        } while( 0 != ( pLast = ++aIter ));
+    SwIterator<SwClient,SwFieldType> aIter(rFldType);
+    for(SwClient* pLast = aIter.First(); pLast; pLast = aIter.Next())
+    {
+        // a DDE table or a DDE field attribute in the text
+        if( !pLast->IsA( TYPE( SwFmtFld ) ))
+        {
+            SwDepend* pDep = static_cast<SwDepend*>(pLast);
+            SwDDETable* pDDETbl = static_cast<SwDDETable*>(pDep->GetToTell());
+            pNd = pDDETbl->GetTabSortBoxes()[0]->GetSttNd();
+        }
+        else if( static_cast<SwFmtFld*>(pLast)->GetTxtFld() )
+            pNd = static_cast<SwFmtFld*>(pLast)->GetTxtFld()->GetpTxtNode();
 
+        if( pNd && &rFldType.GetDoc()->GetNodes() == &pNd->GetNodes() )
+            break;
+        pNd = 0;
+    }
     return pNd;
 }
 
@@ -196,36 +194,35 @@ bool SwIntrnlRefLink::IsInRange( sal_uLong nSttNd, sal_uLong nEndNd,
 {
     // here, any anchor of the normal NodesArray should be sufficient
     SwNodes* pNds = &rFldType.GetDoc()->GetNodes();
-    SwClientIter aIter( rFldType );         // TODO
-    SwClient * pLast = aIter.GoStart();
-    if( pLast )     // Could we jump to beginning?
-        do {
-            // a DDE table or a DDE field attribute in the text
-            if( !pLast->IsA( TYPE( SwFmtFld ) ))
+    SwIterator<SwClient,SwFieldType> aIter(rFldType);
+    for(SwClient* pLast = aIter.First(); pLast; pLast = aIter.Next())
+    {
+        // a DDE table or a DDE field attribute in the text
+        if( !pLast->IsA( TYPE( SwFmtFld ) ))
+        {
+            SwDepend* pDep = static_cast<SwDepend*>(pLast);
+            SwDDETable* pDDETbl = static_cast<SwDDETable*>(pDep->GetToTell());
+            const SwTableNode* pTblNd = pDDETbl->GetTabSortBoxes()[0]->
+                            GetSttNd()->FindTableNode();
+            if( pTblNd->GetNodes().IsDocNodes() &&
+                nSttNd < pTblNd->EndOfSectionIndex() &&
+                nEndNd > pTblNd->GetIndex() )
+                return true;
+        }
+        else if( static_cast<SwFmtFld*>(pLast)->GetTxtFld() )
+        {
+            const SwTxtFld* pTFld = static_cast<SwFmtFld*>(pLast)->GetTxtFld();
+            const SwTxtNode* pNd = pTFld->GetpTxtNode();
+            if( pNd && pNds == &pNd->GetNodes() )
             {
-                SwDepend* pDep = static_cast<SwDepend*>(pLast);
-                SwDDETable* pDDETbl = static_cast<SwDDETable*>(pDep->GetToTell());
-                const SwTableNode* pTblNd = pDDETbl->GetTabSortBoxes()[0]->
-                                GetSttNd()->FindTableNode();
-                if( pTblNd->GetNodes().IsDocNodes() &&
-                    nSttNd < pTblNd->EndOfSectionIndex() &&
-                    nEndNd > pTblNd->GetIndex() )
+                sal_uLong nNdPos = pNd->GetIndex();
+                if( nSttNd <= nNdPos && nNdPos <= nEndNd &&
+                    ( nNdPos != nSttNd || pTFld->GetStart() >= nStt ) &&
+                    ( nNdPos != nEndNd || pTFld->GetStart() < nEnd ))
                     return true;
             }
-            else if( static_cast<SwFmtFld*>(pLast)->GetTxtFld() )
-            {
-                const SwTxtFld* pTFld = static_cast<SwFmtFld*>(pLast)->GetTxtFld();
-                const SwTxtNode* pNd = pTFld->GetpTxtNode();
-                if( pNd && pNds == &pNd->GetNodes() )
-                {
-                    sal_uLong nNdPos = pNd->GetIndex();
-                    if( nSttNd <= nNdPos && nNdPos <= nEndNd &&
-                        ( nNdPos != nSttNd || pTFld->GetStart() >= nStt ) &&
-                        ( nNdPos != nEndNd || pTFld->GetStart() < nEnd ))
-                        return true;
-                }
-            }
-        } while( 0 != ( pLast = ++aIter ));
+        }
+    }
 
     return false;
 }
commit d4267231754c1e6b03c7723a6fecc46750e7c780
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Sun Mar 15 04:46:23 2015 +0100

    use SwIterator<>
    
    Change-Id: I464b22b2a418d20a4b230ebe10d36642ace84b35

diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 7d4ee2a..565cd47 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -118,13 +118,10 @@ void DelHFFormat( SwClient *pToRemove, SwFrmFmt *pFmt )
     {
         // nested scope because DTOR of SwClientIter resets the flag bTreeChg.
         // It's suboptimal if the format is deleted beforehand.
-        SwClientIter aIter( *pFmt );        // TODO
-        SwClient *pLast = aIter.GoStart();
-        if( pLast )
-            do {
-                bDel = pLast->IsA( TYPE(SwFrm) )
-                    || SwXHeadFootText::IsXHeadFootText(pLast);
-            } while( bDel && 0 != ( pLast = ++aIter ));
+        SwIterator<SwClient,SwFrmFmt> aIter(*pFmt);
+        for(SwClient* pLast = aIter.First(); bDel && pLast; pLast = aIter.Next())
+            if(!pLast->IsA(TYPE(SwFrm)) || !SwXHeadFootText::IsXHeadFootText(pLast))
+                bDel = false;
     }
 
     if ( bDel )
commit e9fc57cf8a3527976fc07285c9446b57eb0f9204
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Sat Mar 14 18:36:31 2015 +0100

    use SwIterator for typed iteration
    
    Change-Id: I04dc6e6a149cd5d7a5f44714e10909ef225c27c0

diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 398a8a3..16536f3 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -1338,15 +1338,13 @@ void SwAccessibleMap::InvalidateShapeInParaSelection()
                     if(nStartIndex.GetNode().IsCntntNode())
                     {
                         SwCntntNode* pCNd = static_cast<SwCntntNode*>(&(nStartIndex.GetNode()));
-                        SwClientIter aClientIter( *pCNd );
-                        pFrm = static_cast<SwFrm*>(aClientIter.First( TYPE(SwFrm)));
+                        pFrm = SwIterator<SwFrm, SwCntntNode>(*pCNd).First();
                     }
                     else if( nStartIndex.GetNode().IsTableNode() )
                     {
                         SwTableNode * pTable = static_cast<SwTableNode *>(&(nStartIndex.GetNode()));
                         SwFrmFmt* pFmt = const_cast<SwFrmFmt*>(pTable->GetTable().GetFrmFmt());
-                        SwClientIter aClientIter( *pFmt );
-                        pFrm = static_cast<SwFrm*>(aClientIter.First( TYPE(SwFrm)));
+                        pFrm = SwIterator<SwFrm, SwFrmFmt>(*pFmt).First();
                     }
 
                     if( pFrm && mpFrmMap)
commit 0d97d25d56a5a8466d698e0f5831f2072c8e8baf
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Sat Mar 14 18:34:28 2015 +0100

    use SwIterator for typed iteration
    
    Change-Id: Icc1a04304e182687a306e9d08cbf7d46b0adbee6

diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 2af2a44..5a659da 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -1434,45 +1434,33 @@ bool SwDoc::RemoveInvisibleContent()
 
 bool SwDoc::HasInvisibleContent() const
 {
-    bool bRet = false;
-
-    SwClientIter aIter( *getIDocumentFieldsAccess().GetSysFldType( RES_HIDDENPARAFLD ) );
-    if( aIter.First( TYPE( SwFmtFld ) ) )
-        bRet = true;
+    if(SwIterator<SwFmtFld,SwFieldType>(*getIDocumentFieldsAccess().GetSysFldType( RES_HIDDENPARAFLD)).First())
+        return true;
 
     // Search for any hidden paragraph (hidden text attribute)
-    if( ! bRet )
+    for( sal_uLong n = GetNodes().Count()-1; n; --n)
     {
-        for( sal_uLong n = GetNodes().Count(); !bRet && (n > 0); )
+        SwTxtNode* pTxtNd = GetNodes()[ n ]->GetTxtNode();
+        if ( pTxtNd )
         {
-            SwTxtNode* pTxtNd = GetNodes()[ --n ]->GetTxtNode();
-            if ( pTxtNd )
-            {
-                SwPaM aPam(*pTxtNd, 0, *pTxtNd, pTxtNd->GetTxt().getLength());
-                if( pTxtNd->HasHiddenCharAttribute( true ) ||  ( pTxtNd->HasHiddenCharAttribute( false ) ) )
-                {
-                    bRet = true;
-                }
-            }
+            SwPaM aPam(*pTxtNd, 0, *pTxtNd, pTxtNd->GetTxt().getLength());
+            if( pTxtNd->HasHiddenCharAttribute( true ) ||  ( pTxtNd->HasHiddenCharAttribute( false ) ) )
+                return true;
         }
     }
 
-    if( ! bRet )
+    const SwSectionFmts& rSectFmts = GetSections();
+    for( SwSectionFmts::size_type n = rSectFmts.size()-1; n; --n )
     {
-        const SwSectionFmts& rSectFmts = GetSections();
-
-        for( SwSectionFmts::size_type n = rSectFmts.size(); !bRet && (n > 0); )
-        {
-            SwSectionFmt* pSectFmt = rSectFmts[ --n ];
-            // don't add sections in Undo/Redo
-            if( !pSectFmt->IsInNodesArr())
-                continue;
-            SwSection* pSect = pSectFmt->GetSection();
-            if( pSect->IsHidden() )
-                bRet = true;
-        }
+        SwSectionFmt* pSectFmt = rSectFmts[ n ];
+        // don't add sections in Undo/Redo
+        if( !pSectFmt->IsInNodesArr())
+            continue;
+        SwSection* pSect = pSectFmt->GetSection();
+        if( pSect->IsHidden() )
+            return true;
     }
-    return bRet;
+    return false;
 }
 
 bool SwDoc::RestoreInvisibleContent()
commit 5111ad57871ed2473337fbf2cc351bf1b18a756f
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Sat Mar 14 15:08:15 2015 +0100

    nonsense SwClientIter::operator() isnt used, better remove before someone does
    
    Change-Id: I6e1573576aca4b7536668d1ef03ba72fdae15e28

diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index ac573da..89f9f75 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -283,10 +283,6 @@ public:
         return m_pCurrent = m_pPosition;
     }
 
-    // returns the current SwClient object, if its still a listener
-    // otherwise it returns the next SwClient that still is
-    SwClient* operator()() const
-        { return m_pPosition; }
     // returns the current SwClient object, wether it is still a client or not
     SwClient& operator*() const
         { return *m_pCurrent; }


More information about the Libreoffice-commits mailing list