diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-08-03 09:07:14 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-08-03 09:08:26 +0100 |
commit | 4ba497818357b000016a16ec041517de57820e9e (patch) | |
tree | 35ef43f5f0ef6165031ad8065b8269f0d9c74944 /sw/source | |
parent | 00f1a3ed8ec17b8274a7bf3ee8f5d394a8a16bab (diff) |
split CalcHiddenRanges into hidden text and redline deletion handlers
Change-Id: I17f0a5e0a076af86a49070debe2c4990fcd95e21
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/inc/scriptinfo.hxx | 5 | ||||
-rw-r--r-- | sw/source/core/text/porlay.cxx | 39 |
2 files changed, 27 insertions, 17 deletions
diff --git a/sw/source/core/inc/scriptinfo.hxx b/sw/source/core/inc/scriptinfo.hxx index d4738cadcf2d..df22ffaf372b 100644 --- a/sw/source/core/inc/scriptinfo.hxx +++ b/sw/source/core/inc/scriptinfo.hxx @@ -130,8 +130,9 @@ public: inline size_t CountHiddenChg() const; inline xub_StrLen GetHiddenChg( const size_t nCnt ) const; - static void CalcHiddenRanges( const SwTxtNode& rNode, - MultiSelection& rHiddenMulti ); + static void CalcHiddenRanges(const SwTxtNode& rNode, MultiSelection& rHiddenMulti); + static void selectHiddenTextProperty(const SwTxtNode& rNode, MultiSelection &rHiddenMulti); + static void selectRedLineDeleted(const SwTxtNode& rNode, MultiSelection &rHiddenMulti, bool bSelect=true); // "high" level operations, nPos refers to string position xub_StrLen NextScriptChg( const xub_StrLen nPos ) const; diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx index e1305f0794dd..64e67b87d285 100644 --- a/sw/source/core/text/porlay.cxx +++ b/sw/source/core/text/porlay.cxx @@ -2192,14 +2192,7 @@ SwTwips SwTxtFrm::HangingMargin() const return nRet; } - -/************************************************************************* - * SwScriptInfo::CalcHiddenRanges() - * - * Returns a MultiSection indicating the hidden ranges. - *************************************************************************/ - -void SwScriptInfo::CalcHiddenRanges( const SwTxtNode& rNode, MultiSelection& rHiddenMulti ) +void SwScriptInfo::selectHiddenTextProperty(const SwTxtNode& rNode, MultiSelection &rHiddenMulti) { const SfxPoolItem* pItem = 0; if( SFX_ITEM_SET == rNode.GetSwAttrSet().GetItemState( RES_CHRATR_HIDDEN, sal_True, &pItem ) && @@ -2209,7 +2202,6 @@ void SwScriptInfo::CalcHiddenRanges( const SwTxtNode& rNode, MultiSelection& rHi } const SwpHints* pHints = rNode.GetpSwpHints(); - const SwTxtAttr* pTxtAttr = 0; if( pHints ) { @@ -2217,8 +2209,9 @@ void SwScriptInfo::CalcHiddenRanges( const SwTxtNode& rNode, MultiSelection& rHi while( nTmp < pHints->GetStartCount() ) { - pTxtAttr = pHints->GetStart( nTmp++ ); - const SvxCharHiddenItem* pHiddenItem = static_cast<const SvxCharHiddenItem*>( CharFmt::GetItem( *pTxtAttr, RES_CHRATR_HIDDEN ) ); + const SwTxtAttr* pTxtAttr = pHints->GetStart( nTmp++ ); + const SvxCharHiddenItem* pHiddenItem = + static_cast<const SvxCharHiddenItem*>( CharFmt::GetItem( *pTxtAttr, RES_CHRATR_HIDDEN ) ); if( pHiddenItem ) { xub_StrLen nSt = *pTxtAttr->GetStart(); @@ -2231,11 +2224,12 @@ void SwScriptInfo::CalcHiddenRanges( const SwTxtNode& rNode, MultiSelection& rHi } } } +} - // If there are any hidden ranges in the current text node, we have - // to unhide the redlining ranges: +void SwScriptInfo::selectRedLineDeleted(const SwTxtNode& rNode, MultiSelection &rHiddenMulti, bool bSelect) +{ const IDocumentRedlineAccess& rIDRA = *rNode.getIDocumentRedlineAccess(); - if ( rHiddenMulti.GetRangeCount() && IDocumentRedlineAccess::IsShowChanges( rIDRA.GetRedlineMode() ) ) + if ( IDocumentRedlineAccess::IsShowChanges( rIDRA.GetRedlineMode() ) ) { sal_uInt16 nAct = rIDRA.GetRedlinePos( rNode, USHRT_MAX ); @@ -2252,10 +2246,25 @@ void SwScriptInfo::CalcHiddenRanges( const SwTxtNode& rNode, MultiSelection& rHi if ( nRedlnEnd > nRedlStart ) { Range aTmp( nRedlStart, nRedlnEnd - 1 ); - rHiddenMulti.Select( aTmp, false ); + rHiddenMulti.Select( aTmp, bSelect ); } } } +} + +/************************************************************************* + * SwScriptInfo::CalcHiddenRanges() + * + * Returns a MultiSection indicating the hidden ranges. + *************************************************************************/ + +void SwScriptInfo::CalcHiddenRanges( const SwTxtNode& rNode, MultiSelection& rHiddenMulti ) +{ + selectHiddenTextProperty(rNode, rHiddenMulti); + + // If there are any hidden ranges in the current text node, we have + // to unhide the redlining ranges: + selectRedLineDeleted(rNode, rHiddenMulti, false); // // We calculated a lot of stuff. Finally we can update the flags at the text node. |