[Libreoffice-commits] core.git: 2 commits - editeng/source svtools/source svx/source sw/inc sw/source

Caolán McNamara caolanm at redhat.com
Fri Jun 27 09:22:46 PDT 2014


 editeng/source/editeng/impedit5.cxx |   12 +---
 svtools/source/control/valueacc.cxx |   16 ------
 svx/source/gallery2/galbrws1.cxx    |    4 -
 sw/inc/doc.hxx                      |    6 +-
 sw/inc/editsh.hxx                   |    3 -
 sw/inc/fmtcol.hxx                   |   36 ++++++++-----
 sw/source/core/doc/docfmt.cxx       |   94 +++++++++++++++---------------------
 sw/source/core/doc/doctxm.cxx       |    4 +
 sw/source/core/doc/fmtcol.cxx       |   14 +++--
 sw/source/core/edit/edfcol.cxx      |    4 -
 sw/source/core/layout/findfrm.cxx   |    6 +-
 sw/source/core/txtnode/ndtxt.cxx    |    5 +
 sw/source/core/undo/unfmco.cxx      |    6 --
 sw/source/core/unocore/unostyle.cxx |    2 
 sw/source/filter/html/svxcss1.cxx   |    4 -
 sw/source/filter/xml/xmltbli.cxx    |    2 
 sw/source/uibase/fldui/fldwrap.cxx  |    5 -
 sw/source/uibase/uiview/viewmdi.cxx |    8 +--
 18 files changed, 109 insertions(+), 122 deletions(-)

New commits:
commit 78bea877ff9471d7308041e65e0d6864a862c91b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jun 27 17:04:52 2014 +0100

    OSL_ENSURE->assert where guaranteed deref follows
    
    Change-Id: I6e007cc3a9fd222c1c1381c8b4f890966c05cbab

diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx
index fe9cf60..a884eb2 100644
--- a/editeng/source/editeng/impedit5.cxx
+++ b/editeng/source/editeng/impedit5.cxx
@@ -700,24 +700,22 @@ void ImpEditEngine::SetParaAttribs( sal_Int32 nPara, const SfxItemSet& rSet )
 const SfxItemSet& ImpEditEngine::GetParaAttribs( sal_Int32 nPara ) const
 {
     const ContentNode* pNode = aEditDoc.GetObject( nPara );
-    DBG_ASSERT( pNode, "Node not found: GetParaAttribs" );
+    assert(pNode && "Node not found: GetParaAttribs");
     return pNode->GetContentAttribs().GetItems();
 }
 
 bool ImpEditEngine::HasParaAttrib( sal_Int32 nPara, sal_uInt16 nWhich ) const
 {
     const ContentNode* pNode = aEditDoc.GetObject( nPara );
-    DBG_ASSERT( pNode, "Node not found: HasParaAttrib" );
-
+    assert(pNode && "Node not found: HasParaAttrib");
     return pNode->GetContentAttribs().HasItem( nWhich );
 }
 
 const SfxPoolItem& ImpEditEngine::GetParaAttrib( sal_Int32 nPara, sal_uInt16 nWhich ) const
 {
-    const ContentNode* pNode = aEditDoc.GetObject( nPara );
-    DBG_ASSERT( pNode, "Node not found: GetParaAttrib" );
-
-    return pNode->GetContentAttribs().GetItem( nWhich );
+    const ContentNode* pNode = aEditDoc.GetObject(nPara);
+    assert(pNode && "Node not found: GetParaAttrib");
+    return pNode->GetContentAttribs().GetItem(nWhich);
 }
 
 void ImpEditEngine::GetCharAttribs( sal_Int32 nPara, std::vector<EECharAttrib>& rLst ) const
diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx
index f0d7ede..585908b 100644
--- a/svtools/source/control/valueacc.cxx
+++ b/svtools/source/control/valueacc.cxx
@@ -776,35 +776,23 @@ void ValueSetAcc::ThrowIfDisposed (void)
     }
 }
 
-
-
-bool ValueSetAcc::HasNoneField (void) const
+bool ValueSetAcc::HasNoneField() const
 {
-    DBG_ASSERT (mpParent!=NULL, "ValueSetAcc::HasNoneField called with mpParent==NULL");
+    assert(mpParent && "ValueSetAcc::HasNoneField called with mpParent==NULL");
     return ((mpParent->GetStyle() & WB_NONEFIELD) != 0);
 }
 
-
-
-
-
 // - ValueItemAcc -
-
-
 ValueItemAcc::ValueItemAcc( ValueSetItem* pParent, bool bIsTransientChildrenDisabled ) :
     mpParent( pParent ),
     mbIsTransientChildrenDisabled( bIsTransientChildrenDisabled )
 {
 }
 
-
-
 ValueItemAcc::~ValueItemAcc()
 {
 }
 
-
-
 void ValueItemAcc::FireAccessibleEvent( short nEventId, const uno::Any& rOldValue, const uno::Any& rNewValue )
 {
     if( nEventId )
diff --git a/svx/source/gallery2/galbrws1.cxx b/svx/source/gallery2/galbrws1.cxx
index ddb6bfa..3705fa9 100644
--- a/svx/source/gallery2/galbrws1.cxx
+++ b/svx/source/gallery2/galbrws1.cxx
@@ -272,9 +272,9 @@ void GalleryBrowser1::ImplGalleryThemeProperties( const OUString & rThemeName, b
     ImplFillExchangeData( pTheme, *mpExchangeData );
 
     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
-    DBG_ASSERT(pFact, "Got no AbstractDialogFactory!");
+    assert(pFact && "Got no AbstractDialogFactory!");
     VclAbstractDialog2* pThemeProps = pFact->CreateGalleryThemePropertiesDialog( NULL, mpExchangeData, mpThemePropsDlgItemSet );
-    DBG_ASSERT(pThemeProps, "Got no GalleryThemePropertiesDialog!");
+    assert(pThemeProps && "Got no GalleryThemePropertiesDialog!");
 
     if ( bCreateNew )
     {
diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx
index 8b4b1e4..749fa84 100644
--- a/sw/source/core/layout/findfrm.cxx
+++ b/sw/source/core/layout/findfrm.cxx
@@ -1365,13 +1365,13 @@ static SwCellFrm* lcl_FindCorrespondingCellFrm( const SwRowFrm& rOrigRow,
         pCorrCell = (SwCellFrm*)pCorrCell->GetNext();
     }
 
-    OSL_ENSURE( pCell && pCorrCell, "lcl_FindCorrespondingCellFrm does not work" );
+    assert(pCell && pCorrCell && "lcl_FindCorrespondingCellFrm does not work");
 
     if ( pCell != &rOrigCell )
     {
         // rOrigCell must be a lower of pCell. We need to recurse into the rows:
-        OSL_ENSURE( pCell->Lower() && pCell->Lower()->IsRowFrm(),
-                "lcl_FindCorrespondingCellFrm does not work" );
+        assert(pCell->Lower() && pCell->Lower()->IsRowFrm() &&
+               "lcl_FindCorrespondingCellFrm does not work");
 
         SwRowFrm* pRow = (SwRowFrm*)pCell->Lower();
         while ( !pRow->IsAnLower( &rOrigCell ) )
diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx
index 6882622..94376a0 100644
--- a/sw/source/filter/html/svxcss1.cxx
+++ b/sw/source/filter/html/svxcss1.cxx
@@ -1342,7 +1342,7 @@ static void ParseCSS1_column_count( const CSS1Expression *pExpr,
                              SvxCSS1PropertyInfo &rPropInfo,
                              const SvxCSS1Parser& /*rParser*/ )
 {
-    OSL_ENSURE( pExpr, "no expression" );
+    assert(pExpr && "no expression");
 
     if ( pExpr->GetType() == CSS1_NUMBER )
     {
@@ -1359,7 +1359,7 @@ static void ParseCSS1_direction( const CSS1Expression *pExpr,
                              SvxCSS1PropertyInfo& /*rPropInfo*/,
                              const SvxCSS1Parser& /*rParser*/ )
 {
-    OSL_ENSURE( pExpr, "no expression" );
+    assert(pExpr && "no expression");
 
     sal_uInt16 nDir;
     switch( pExpr->GetType() )
diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index f9a14fd..6e61252 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -701,7 +701,7 @@ void SwXMLTableCellContext_Impl::EndElement()
                             "missing XUnoTunnel for Cursor" );
                     OTextCursorHelper *pDstTxtCrsr = reinterpret_cast< OTextCursorHelper * >(
                             sal::static_int_cast< sal_IntPtr >( xDstCrsrTunnel->getSomething( OTextCursorHelper::getUnoTunnelId() )) );
-                    OSL_ENSURE( pDstTxtCrsr, "SwXTextCursor missing" );
+                    assert(pDstTxtCrsr && "SwXTextCursor missing");
                     SwPaM aSrcPaM( *pSrcPaM->GetPoint(),
                                    *pSrcPaM->GetMark() );
                     SwPosition aDstPos( *pDstTxtCrsr->GetPaM()->GetPoint() );
diff --git a/sw/source/uibase/fldui/fldwrap.cxx b/sw/source/uibase/fldui/fldwrap.cxx
index b3e71d3..522d50f 100644
--- a/sw/source/uibase/fldui/fldwrap.cxx
+++ b/sw/source/uibase/fldui/fldwrap.cxx
@@ -82,10 +82,9 @@ SwFldDlgWrapper::SwFldDlgWrapper( Window* _pParent, sal_uInt16 nId,
     : SwChildWinWrapper( _pParent, nId )
 {
     SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
-    OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
-
+    assert(pFact && "SwAbstractDialogFactory fail!");
     AbstractSwFldDlg* pDlg = pFact->CreateSwFldDlg(pB, this, _pParent);
-    OSL_ENSURE(pDlg, "Dialogdiet fail!");
+    assert(pDlg && "Dialogdiet fail!");
     pDlgInterface = pDlg;
     pWindow = pDlg->GetWindow();
     pDlg->Start();
diff --git a/sw/source/uibase/uiview/viewmdi.cxx b/sw/source/uibase/uiview/viewmdi.cxx
index ed80e0b..bc140f7 100644
--- a/sw/source/uibase/uiview/viewmdi.cxx
+++ b/sw/source/uibase/uiview/viewmdi.cxx
@@ -565,25 +565,25 @@ void SwView::SetActMark(sal_Int32 nSet)
 
 void SwView::ShowHScrollbar(bool bShow)
 {
-    OSL_ENSURE(m_pHScrollbar, "Scrollbar invalid");
+    assert(m_pHScrollbar && "Scrollbar invalid");
     m_pHScrollbar->ExtendedShow(bShow);
 }
 
 bool SwView::IsHScrollbarVisible()const
 {
-    OSL_ENSURE(m_pHScrollbar, "Scrollbar invalid");
+    assert(m_pHScrollbar && "Scrollbar invalid");
     return m_pHScrollbar->IsVisible( false ) || m_pHScrollbar->IsAuto();
 }
 
 void SwView::ShowVScrollbar(bool bShow)
 {
-    OSL_ENSURE(m_pVScrollbar, "Scrollbar invalid");
+    assert(m_pVScrollbar && "Scrollbar invalid");
     m_pVScrollbar->ExtendedShow(bShow);
 }
 
 bool SwView::IsVScrollbarVisible()const
 {
-    OSL_ENSURE(m_pVScrollbar, "Scrollbar invalid");
+    assert(m_pVScrollbar && "Scrollbar invalid");
     return m_pVScrollbar->IsVisible( false );
 }
 
commit b733d208b02facaaad8c4925277b34b9f7fd928f
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date:   Fri Jun 27 12:27:55 2014 +0000

    Related: #i78498# Do not keep OutlineLevel attribute at paragraph...
    
    when a Paragraph Style is assigned.
    
    (cherry picked from commit 6a1564284d90c7e175f7848520924f7f6a5884b7)
    (cherry picked from commit 4a381b1124f60b76cabb558fa24827448a1caab0)
    
    Conflicts:
    	sw/inc/doc.hxx
    	sw/inc/editsh.hxx
    	sw/inc/fmtcol.hxx
    	sw/inc/ndtxt.hxx
    	sw/source/core/attr/format.cxx
    	sw/source/core/doc/docfmt.cxx
    	sw/source/core/doc/docglbl.cxx
    	sw/source/core/doc/doctxm.cxx
    	sw/source/core/doc/fmtcol.cxx
    	sw/source/core/edit/edfcol.cxx
    	sw/source/core/txtnode/ndtxt.cxx
    	sw/source/core/undo/unfmco.cxx
    	sw/source/core/unocore/unosett.cxx
    	sw/source/core/unocore/unostyle.cxx
    
    Change-Id: Ifa1214876df296f2e1210cc4a35f2df67f9f6bc4

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 75eac11..37a6fda 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1086,9 +1086,9 @@ public:
      The new parameter <bResetListAttrs> indicates, if the list attributes
      (list style, restart at and restart with) are cleared as well in case
      that <bReset = true> and the paragraph style has a list style attribute set. */
-    bool SetTxtFmtColl( const SwPaM &rRg, SwTxtFmtColl *pFmt,
-                            bool bReset = true,
-                            bool bResetListAttrs = false );
+    bool SetTxtFmtColl(const SwPaM &rRg, SwTxtFmtColl *pFmt,
+                       const bool bReset = true,
+                       const bool bResetListAttrs = false);
     SwTxtFmtColl* FindTxtFmtCollByName( const OUString& rName ) const
         {   return (SwTxtFmtColl*)FindFmtByName( (SwFmtsBase&)*mpTxtFmtCollTbl, rName ); }
 
diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
index d85b55d..6691202 100644
--- a/sw/inc/editsh.hxx
+++ b/sw/inc/editsh.hxx
@@ -332,8 +332,7 @@ public:
 
     // #i62675#
     /// Add 2nd optional parameter <bResetListAttrs> - see also <SwDoc::SetTxtFmtColl(..)>
-    void SetTxtFmtColl( SwTxtFmtColl*,
-                        bool bResetListAttrs = false );
+    void SetTxtFmtColl(SwTxtFmtColl*, const bool bResetListAttrs = false);
     SwTxtFmtColl *MakeTxtFmtColl(const OUString &rFmtCollName,
         SwTxtFmtColl *pDerivedFrom = 0);
     void FillByEx(SwTxtFmtColl*, bool bReset = false);
diff --git a/sw/inc/fmtcol.hxx b/sw/inc/fmtcol.hxx
index 1b77f15..a3c5df6 100644
--- a/sw/inc/fmtcol.hxx
+++ b/sw/inc/fmtcol.hxx
@@ -67,23 +67,22 @@ protected:
     SwTxtFmtColl( SwAttrPool& rPool, const sal_Char* pFmtCollName,
                     SwTxtFmtColl* pDerFrom = 0,
                     sal_uInt16 nFmtWh = RES_TXTFMTCOLL )
-        : SwFmtColl( rPool, pFmtCollName, aTxtFmtCollSetRange,
-                        pDerFrom, nFmtWh ),
-          mbStayAssignedToListLevelOfOutlineStyle( false ),
-
-          mbAssignedToOutlineStyle(false)
-    { pNextTxtFmtColl = this; }
+        : SwFmtColl(rPool, pFmtCollName, aTxtFmtCollSetRange, pDerFrom, nFmtWh)
+        , mbStayAssignedToListLevelOfOutlineStyle(false)
+        , mbAssignedToOutlineStyle(false)
+    {
+        pNextTxtFmtColl = this;
+    }
 
     SwTxtFmtColl( SwAttrPool& rPool, const OUString &rFmtCollName,
                     SwTxtFmtColl* pDerFrom = 0,
                     sal_uInt16 nFmtWh = RES_TXTFMTCOLL )
-        : SwFmtColl( rPool, rFmtCollName, aTxtFmtCollSetRange,
-                        pDerFrom, nFmtWh ),
-
-          mbStayAssignedToListLevelOfOutlineStyle( false ),
-
-          mbAssignedToOutlineStyle(false)
-    { pNextTxtFmtColl = this; }
+        : SwFmtColl(rPool, rFmtCollName, aTxtFmtCollSetRange, pDerFrom, nFmtWh)
+        , mbStayAssignedToListLevelOfOutlineStyle(false)
+        , mbAssignedToOutlineStyle(false)
+    {
+        pNextTxtFmtColl = this;
+    }
 
     /// To get UL- / LR- / FontHeight-changes.
    virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) SAL_OVERRIDE;
@@ -99,13 +98,22 @@ public:
 
     void SetAttrOutlineLevel( int );
     int  GetAttrOutlineLevel() const;
+
+    // Return the list level of the Outline Style - the List Style for the
+    // outline numbering -
+    // to which the Paragraph Style is assigned.
     int  GetAssignedOutlineStyleLevel() const;
+
     inline bool IsAssignedToListLevelOfOutlineStyle() const
     {
         return mbAssignedToOutlineStyle;
     }
+
+    // If a Paragraph Style is assigned to list level N of the Outline Style,
+    // then its outline level - AttrOutlineLevel - is set to N+1
     void AssignToListLevelOfOutlineStyle(const int nAssignedListLevel);
-    void DeleteAssignmentToListLevelOfOutlineStyle();
+    void DeleteAssignmentToListLevelOfOutlineStyle(const bool bResetOutlineLevel
+                                                   = true);
 
     /** Override to recognize changes on the <SwNumRuleItem> and register/unregister
      the paragragh style at the corresponding <SwNumRule> instance. */
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 312c6c5..6e3d5d9 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -100,22 +100,21 @@ struct ParaRstFmt
     bool bResetListAttrs; // #i62575#
     bool bResetAll;
     bool bInclRefToxMark;
-    bool bKeepOutlineLevelAttr;
-
-    ParaRstFmt( const SwPosition* pStt, const SwPosition* pEnd,
-                SwHistory* pHst, sal_uInt16 nWhch = 0, const SfxItemSet* pSet = 0 )
-        : pFmtColl(0),
-          pHistory(pHst),
-          pSttNd(pStt),
-          pEndNd(pEnd),
-          pDelSet(pSet),
-          nWhich(nWhch),
-          bReset( false ), // #i62675#
-          bResetListAttrs( false ),
-          bResetAll( true ),
-          bInclRefToxMark( false ),
-          bKeepOutlineLevelAttr( false )
-    {}
+
+    ParaRstFmt(const SwPosition* pStt, const SwPosition* pEnd,
+               SwHistory* pHst, sal_uInt16 nWhch = 0, const SfxItemSet* pSet = 0)
+        : pFmtColl(0)
+        , pHistory(pHst)
+        , pSttNd(pStt)
+        , pEndNd(pEnd)
+        , pDelSet(pSet)
+        , nWhich(nWhch)
+        , bReset(false) // #i62675#
+        , bResetListAttrs(false)
+        , bResetAll(true)
+        , bInclRefToxMark(false)
+    {
+    }
 };
 
 /** @params pArgs contains the document's ChrFmtTable
@@ -156,7 +155,7 @@ static bool lcl_RstTxtAttr( const SwNodePtr& rpNd, void* pArgs )
 
 static bool lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs )
 {
-    ParaRstFmt* pPara = (ParaRstFmt*)pArgs;
+    const ParaRstFmt* pPara = (ParaRstFmt*)pArgs;
     SwCntntNode* pNode = (SwCntntNode*)rpNd->GetCntntNode();
     if( pNode && pNode->HasSwAttrSet() )
     {
@@ -167,22 +166,20 @@ static bool lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs )
 
         // remove unused attribute RES_LR_SPACE
         // add list attributes
-        SfxItemSet aSet( pDoc->GetAttrPool(),
-                         RES_PAGEDESC, RES_BREAK,
-                         RES_PARATR_NUMRULE, RES_PARATR_NUMRULE,
-                         RES_PARATR_OUTLINELEVEL,RES_PARATR_OUTLINELEVEL,
-                         RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END - 1,
-                         0 );
-        const SfxItemSet* pSet = pNode->GetpSwAttrSet();
+        SfxItemSet aSavedAttrsSet(pDoc->GetAttrPool(), RES_PAGEDESC, RES_BREAK,
+                                  RES_PARATR_NUMRULE, RES_PARATR_NUMRULE,
+                                  RES_PARATR_LIST_BEGIN,
+                                  RES_PARATR_LIST_END - 1, 0);
+        const SfxItemSet* pAttrSetOfNode = pNode->GetpSwAttrSet();
 
         std::vector<sal_uInt16> aClearWhichIds;
         // restoring all paragraph list attributes
         {
             SfxItemSet aListAttrSet( pDoc->GetAttrPool(), RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END - 1 );
-            aListAttrSet.Set( *pSet );
+            aListAttrSet.Set(*pAttrSetOfNode);
             if ( aListAttrSet.Count() )
             {
-                aSet.Put( aListAttrSet );
+                aSavedAttrsSet.Put(aListAttrSet);
                 SfxItemIter aIter( aListAttrSet );
                 const SfxPoolItem* pItem = aIter.GetCurItem();
                 while( pItem )
@@ -195,12 +192,10 @@ static bool lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs )
 
         const SfxPoolItem* pItem;
 
-        sal_uInt16 const aSavIds[ 4 ] = { RES_PAGEDESC, RES_BREAK,
-                                                RES_PARATR_NUMRULE,
-                                                RES_PARATR_OUTLINELEVEL };
-        for( sal_uInt16 n = 0; n < 4; ++n )
+        sal_uInt16 const aSavIds[3] = { RES_PAGEDESC, RES_BREAK, RES_PARATR_NUMRULE };
+        for (sal_uInt16 n = 0; n < 3; ++n)
         {
-            if( SFX_ITEM_SET == pSet->GetItemState( aSavIds[ n ], false, &pItem ))
+            if (SFX_ITEM_SET == pAttrSetOfNode->GetItemState(aSavIds[n], false, &pItem))
             {
                 bool bSave = false;
                 switch( aSavIds[ n ] )
@@ -212,20 +207,13 @@ static bool lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs )
                         bSave = SVX_BREAK_NONE != ((SvxFmtBreakItem*)pItem)->GetBreak();
                     break;
                     case RES_PARATR_NUMRULE:
-                    {
                         bSave = !((SwNumRuleItem*)pItem)->GetValue().isEmpty();
-                    }
-                    break;
-                    case RES_PARATR_OUTLINELEVEL:
-                    {
-                        bSave = pPara && pPara->bKeepOutlineLevelAttr;
-                    }
                     break;
                 }
                 if( bSave )
                 {
-                    aSet.Put( *pItem );
-                    aClearWhichIds.push_back( aSavIds[n] );
+                    aSavedAttrsSet.Put(*pItem);
+                    aClearWhichIds.push_back(aSavIds[n]);
                 }
             }
         }
@@ -257,11 +245,11 @@ static bool lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs )
                     if ( ( pItem->Which() != RES_PAGEDESC &&
                            pItem->Which() != RES_BREAK &&
                            pItem->Which() != RES_PARATR_NUMRULE ) ||
-                         ( aSet.GetItemState( pItem->Which(), false ) != SFX_ITEM_SET ) )
+                         ( aSavedAttrsSet.GetItemState( pItem->Which(), false ) != SFX_ITEM_SET ) )
                     {
                         pNode->ResetAttr( pItem->Which() );
                     }
-                    if( aIter.IsAtEnd() )
+                    if (aIter.IsAtEnd())
                         break;
                     pItem = aIter.NextItem();
                 }
@@ -275,11 +263,11 @@ static bool lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs )
             pNode->ResetAllAttr();
 
         // only restore saved attributes, if needed
-        if ( bKeepAttributes && aSet.Count() )
+        if (bKeepAttributes && aSavedAttrsSet.Count())
         {
             pNode->LockModify();
 
-            pNode->SetAttr( aSet );
+            pNode->SetAttr(aSavedAttrsSet);
 
             if( !bLocked )
                 pNode->UnlockModify();
@@ -1682,10 +1670,7 @@ static bool lcl_SetTxtFmtColl( const SwNodePtr& rpNode, void* pArgs )
     SwTxtFmtColl* pFmt = static_cast<SwTxtFmtColl*>(pPara->pFmtColl);
     if ( pPara->bReset )
     {
-        if( pFmt->GetAttrOutlineLevel() == 0 )
-            pPara->bKeepOutlineLevelAttr = true;
-
-        lcl_RstAttr( pCNd, pPara );
+        lcl_RstAttr(pCNd, pPara);
 
         // #i62675# check, if paragraph style has changed
         if ( pPara->bResetListAttrs &&
@@ -1742,10 +1727,10 @@ static bool lcl_SetTxtFmtColl( const SwNodePtr& rpNode, void* pArgs )
     return true;
 }
 
-bool SwDoc::SetTxtFmtColl( const SwPaM &rRg,
-                           SwTxtFmtColl *pFmt,
-                           bool bReset,
-                           bool bResetListAttrs )
+bool SwDoc::SetTxtFmtColl(const SwPaM &rRg,
+                          SwTxtFmtColl *pFmt,
+                          const bool bReset,
+                          const bool bResetListAttrs)
 {
     SwDataChanged aTmp( rRg );
     const SwPosition *pStt = rRg.Start(), *pEnd = rRg.End();
@@ -1772,8 +1757,11 @@ bool SwDoc::SetTxtFmtColl( const SwPaM &rRg,
     if( !aPara.nWhich )
         bRet = false;           // didn't find a valid Node
 
-    if( bRet )
+    if (bRet)
+    {
         SetModified();
+    }
+
     return bRet;
 }
 
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index d98edca..e601153 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -1463,7 +1463,9 @@ void SwTOXBaseSection::UpdateCntnt( SwTOXElement eMyType,
                 if( pOutlNd )
                 {
                     if( pOutlNd->GetTxtColl()->IsAssignedToListLevelOfOutlineStyle())
+                    {
                         nSetLevel = pOutlNd->GetTxtColl()->GetAttrOutlineLevel();
+                    }
                 }
             }
 
@@ -1518,7 +1520,7 @@ void SwTOXBaseSection::UpdateTable( const SwTxtNode* pOwnChapterNode )
                             if( pOutlNd->GetTxtColl()->IsAssignedToListLevelOfOutlineStyle())
                             {
                                 const int nTmp = pOutlNd->GetTxtColl()->GetAttrOutlineLevel();
-                                pNew->SetLevel( static_cast<sal_uInt16>(nTmp) );
+                                pNew->SetLevel(static_cast<sal_uInt16>(nTmp));
                             }
                         }
                     }
diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx
index 6843a81..3733281 100644
--- a/sw/source/core/doc/fmtcol.cxx
+++ b/sw/source/core/doc/fmtcol.cxx
@@ -186,12 +186,11 @@ void SwTxtFmtColl::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
         break;
     // #i70223#
     case RES_PARATR_NUMRULE:
-    {
-        if ( bAssignedToListLevelOfOutlineStyle )
+        if (bAssignedToListLevelOfOutlineStyle)
         {
             pNewNumRuleItem = (SwNumRuleItem*)pNew;
         }
-    }
+        break;
     default:
         break;
     }
@@ -607,6 +606,7 @@ void SwConditionTxtFmtColl::SetConditions( const SwFmtCollConditions& rCndClls )
     }
 }
 
+// FEATURE::CONDCOLL
 void SwTxtFmtColl::SetAttrOutlineLevel( int nLevel)
 {
     OSL_ENSURE( 0 <= nLevel && nLevel <= MAXLEVEL ,"SwTxtFmtColl: Level Out Of Range" );
@@ -653,10 +653,14 @@ void SwTxtFmtColl::AssignToListLevelOfOutlineStyle(const int nAssignedListLevel)
     }
 }
 
-void SwTxtFmtColl::DeleteAssignmentToListLevelOfOutlineStyle()
+void SwTxtFmtColl::DeleteAssignmentToListLevelOfOutlineStyle(
+    const bool bResetOutlineLevel)
 {
     mbAssignedToOutlineStyle = false;
-    ResetFmtAttr(RES_PARATR_OUTLINELEVEL);
+    if (bResetOutlineLevel)
+    {
+        ResetFmtAttr(RES_PARATR_OUTLINELEVEL);
+    }
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 3131956..1a02d9f 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -48,8 +48,8 @@ SwTxtFmtColl& SwEditShell::GetTxtFmtColl( sal_uInt16 nFmtColl) const
 }
 
 // #i62675#
-void SwEditShell::SetTxtFmtColl( SwTxtFmtColl *pFmt,
-                                 bool bResetListAttrs )
+void SwEditShell::SetTxtFmtColl(SwTxtFmtColl *pFmt,
+                                const bool bResetListAttrs)
 {
     SwTxtFmtColl *pLocal = pFmt? pFmt: (*GetDoc()->GetTxtFmtColls())[0];
     StartAllAction();
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 01f9e9a..2ba1b2b 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -4538,9 +4538,10 @@ namespace {
         }
 
         // #i70748#
-        if ( mbOutlineLevelSet )
+        if (mbOutlineLevelSet)
         {
-            if ( mrTxtNode.GetAttrOutlineLevel() == 0 )
+            mrTxtNode.GetNodes().UpdateOutlineNode(mrTxtNode);
+            if (mrTxtNode.GetAttrOutlineLevel() == 0)
             {
                 mrTxtNode.ResetEmptyListStyleDueToResetOutlineLevelAttr();
             }
diff --git a/sw/source/core/undo/unfmco.cxx b/sw/source/core/undo/unfmco.cxx
index d9d4b97..21b7b1d 100644
--- a/sw/source/core/undo/unfmco.cxx
+++ b/sw/source/core/undo/unfmco.cxx
@@ -77,10 +77,8 @@ void SwUndoFmtColl::DoSetFmtColl(SwDoc & rDoc, SwPaM & rPaM)
     // does the format still exist?
     if( USHRT_MAX != nPos )
     {
-        rDoc.SetTxtFmtColl(rPaM,
-                                          (SwTxtFmtColl*)pFmtColl,
-                                          mbReset,
-                                          mbResetListAttrs );
+        rDoc.SetTxtFmtColl(rPaM, (SwTxtFmtColl*)pFmtColl, mbReset,
+                           mbResetListAttrs);
     }
 }
 
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index f79beed..49ede1a 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -1902,6 +1902,7 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
             bDone = true;
             break;
         }
+
         case RES_PARATR_OUTLINELEVEL:
         {
             sal_Int16 nLevel = 0;
@@ -1912,6 +1913,7 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
             bDone = true;
             break;
         }
+
         case FN_UNO_FOLLOW_STYLE:
         {
             OUString sTmp;


More information about the Libreoffice-commits mailing list