[Libreoffice-commits] .: sw/source

Caolán McNamara caolan at kemper.freedesktop.org
Fri Aug 3 01:08:54 PDT 2012


 sw/source/core/inc/scriptinfo.hxx |    5 ++--
 sw/source/core/text/porlay.cxx    |   39 +++++++++++++++++++++++---------------
 2 files changed, 27 insertions(+), 17 deletions(-)

New commits:
commit 4ba497818357b000016a16ec041517de57820e9e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Aug 3 09:07:14 2012 +0100

    split CalcHiddenRanges into hidden text and redline deletion handlers
    
    Change-Id: I17f0a5e0a076af86a49070debe2c4990fcd95e21

diff --git a/sw/source/core/inc/scriptinfo.hxx b/sw/source/core/inc/scriptinfo.hxx
index d4738ca..df22ffa 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 e1305f0..64e67b8 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.


More information about the Libreoffice-commits mailing list