diff options
author | Maxime de Roucy <mderoucy@linagora.com> | 2012-03-13 16:54:39 +0100 |
---|---|---|
committer | Cédric Bosdonnat <cedric.bosdonnat.ooo@free.fr> | 2012-03-15 16:57:44 +0100 |
commit | 5f679b3e8109cac5881d244a63bcdbc8fd21341d (patch) | |
tree | daa09bb18b691fcae4229788c1c9d41f42ab65cd /sw | |
parent | 685416523725d1971f39ad4b3971b7e22e7709a4 (diff) |
getMaxLookup in SwEditShell::GetPaMTxtFmtColl
Handle getMaxLookup as the maximum number of node to inspect.
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/edit/edattr.cxx | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx index 35f80c63c572..7f53689a18c1 100644 --- a/sw/source/core/edit/edattr.cxx +++ b/sw/source/core/edit/edattr.cxx @@ -72,6 +72,7 @@ const sal_uInt16& getMaxLookup() sal_Bool SwEditShell::GetPaMAttr( SwPaM* pPaM, SfxItemSet& rSet, const bool bMergeIndentValuesOfNumRule ) const { + // ??? pPaM can be different from the Cursor ??? if( GetCrsrCnt() > getMaxLookup() ) { rSet.InvalidateAllItems(); @@ -182,8 +183,8 @@ SwTxtFmtColl* SwEditShell::GetCurTxtFmtColl( ) const SwTxtFmtColl* SwEditShell::GetPaMTxtFmtColl( SwPaM* pPaM ) const { - if ( GetCrsrCnt() > getMaxLookup() ) - return NULL; + // number of nodes the function have explored so far + sal_uInt16 numberOfLookup = 0; SwPaM* pStartPaM = pPaM; do { // for all the point and mark (selections) @@ -200,14 +201,18 @@ SwTxtFmtColl* SwEditShell::GetPaMTxtFmtColl( SwPaM* pPaM ) const nEndNd = tmpNd; } - if( nEndNd - nSttNd >= getMaxLookup() ) - break; - // for all the nodes in the current Point and Mark for( sal_uLong n = nSttNd; n <= nEndNd; ++n ) { // get the node SwNode* pNd = GetDoc()->GetNodes()[ n ]; + + ++numberOfLookup; + + // if the maximum number of node that can be inspected has been reached + if (numberOfLookup >= getMaxLookup()) + return NULL; + if( pNd->IsTxtNode() ) { // if it's a text node get its named character format |