Author: orw Date: Fri Jun 27 12:27:55 2014 New Revision: 1606055 URL: http://svn.apache.org/r1606055 Log: 78498: Do not keep OutlineLevel attribute at paragraph when a Paragraph Style is assigned.
Modified: openoffice/trunk/main/sw/inc/doc.hxx openoffice/trunk/main/sw/inc/editsh.hxx openoffice/trunk/main/sw/inc/fmtcol.hxx openoffice/trunk/main/sw/inc/ndtxt.hxx openoffice/trunk/main/sw/source/core/attr/format.cxx openoffice/trunk/main/sw/source/core/doc/docfmt.cxx openoffice/trunk/main/sw/source/core/doc/docglbl.cxx openoffice/trunk/main/sw/source/core/doc/doctxm.cxx openoffice/trunk/main/sw/source/core/doc/fmtcol.cxx openoffice/trunk/main/sw/source/core/edit/edfcol.cxx openoffice/trunk/main/sw/source/core/txtnode/ndtxt.cxx openoffice/trunk/main/sw/source/core/undo/unfmco.cxx openoffice/trunk/main/sw/source/core/unocore/unosett.cxx openoffice/trunk/main/sw/source/core/unocore/unostyle.cxx Modified: openoffice/trunk/main/sw/inc/doc.hxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/inc/doc.hxx?rev=1606055&r1=1606054&r2=1606055&view=diff ============================================================================== --- openoffice/trunk/main/sw/inc/doc.hxx (original) +++ openoffice/trunk/main/sw/inc/doc.hxx Fri Jun 27 12:27:55 2014 @@ -1310,7 +1310,7 @@ public: sal_Bool bBroadcast = sal_False); void DelTxtFmtColl(sal_uInt16 nFmt, sal_Bool bBroadcast = sal_False); void DelTxtFmtColl( SwTxtFmtColl* pColl, sal_Bool bBroadcast = sal_False ); - // --> OD 2007-11-06 #i62675# + // Add 4th optional parameter <bResetListAttrs>. // 'side effect' of <SetTxtFmtColl> with <bReset = true> is that the hard // attributes of the affected text nodes are cleared, except the break @@ -1318,10 +1318,12 @@ 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. - sal_Bool SetTxtFmtColl( const SwPaM &rRg, SwTxtFmtColl *pFmt, - bool bReset = true, - bool bResetListAttrs = false ); - // <-- + sal_Bool SetTxtFmtColl( + const SwPaM &rRg, + SwTxtFmtColl *pFmt, + const bool bReset = true, + const bool bResetListAttrs = false ); + SwTxtFmtColl* FindTxtFmtCollByName( const String& rName ) const { return (SwTxtFmtColl*)FindFmtByName( (SvPtrarr&)*pTxtFmtCollTbl, rName ); } Modified: openoffice/trunk/main/sw/inc/editsh.hxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/inc/editsh.hxx?rev=1606055&r1=1606054&r2=1606055&view=diff ============================================================================== --- openoffice/trunk/main/sw/inc/editsh.hxx (original) +++ openoffice/trunk/main/sw/inc/editsh.hxx Fri Jun 27 12:27:55 2014 @@ -303,11 +303,11 @@ public: sal_uInt16 GetTxtFmtCollCount() const; SwTxtFmtColl& GetTxtFmtColl( sal_uInt16 nTxtFmtColl) const; SwTxtFmtColl* GetCurTxtFmtColl() const; - // --> OD 2007-11-06 #i62675# + // Add 2nd optional parameter <bResetListAttrs> - see also <SwDoc::SetTxtFmtColl(..)> void SetTxtFmtColl( SwTxtFmtColl*, - bool bResetListAttrs = false ); - // <-- + const bool bResetListAttrs = false ); + SwTxtFmtColl *MakeTxtFmtColl(const String &rFmtCollName, SwTxtFmtColl *pDerivedFrom = 0); void FillByEx(SwTxtFmtColl*, sal_Bool bReset = sal_False); Modified: openoffice/trunk/main/sw/inc/fmtcol.hxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/inc/fmtcol.hxx?rev=1606055&r1=1606054&r2=1606055&view=diff ============================================================================== --- openoffice/trunk/main/sw/inc/fmtcol.hxx (original) +++ openoffice/trunk/main/sw/inc/fmtcol.hxx Fri Jun 27 12:27:55 2014 @@ -69,29 +69,31 @@ protected: SwTxtFmtColl *pNextTxtFmtColl; - SwTxtFmtColl( SwAttrPool& rPool, const sal_Char* pFmtCollName, - SwTxtFmtColl* pDerFrom = 0, - sal_uInt16 nFmtWh = RES_TXTFMTCOLL ) - : SwFmtColl( rPool, pFmtCollName, aTxtFmtCollSetRange, - pDerFrom, nFmtWh ), - // --> OD 2007-01-24 #i73790# - mbStayAssignedToListLevelOfOutlineStyle( false ), - // <-- - //nOutlineLevel( NO_NUMBERING ) //<-#outline level,removed by zhaojianwei - mbAssignedToOutlineStyle(false) //<-#outline level,added by zhaojianwei - { pNextTxtFmtColl = this; } - - SwTxtFmtColl( SwAttrPool& rPool, const String &rFmtCollName, - SwTxtFmtColl* pDerFrom = 0, - sal_uInt16 nFmtWh = RES_TXTFMTCOLL ) - : SwFmtColl( rPool, rFmtCollName, aTxtFmtCollSetRange, - pDerFrom, nFmtWh ), - // --> OD 2007-01-24 #i73790# - mbStayAssignedToListLevelOfOutlineStyle( false ), - // <-- - //nOutlineLevel( NO_NUMBERING ) //<-#outline level,removed by zhaojianwei - mbAssignedToOutlineStyle(false) //<-#outline level,added by zhaojianwei - { pNextTxtFmtColl = this; } + 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; + } + + SwTxtFmtColl( + SwAttrPool& rPool, + const String &rFmtCollName, + SwTxtFmtColl* pDerFrom = 0, + sal_uInt16 nFmtWh = RES_TXTFMTCOLL ) + : SwFmtColl( rPool, rFmtCollName, aTxtFmtCollSetRange + , pDerFrom, nFmtWh ) + , mbStayAssignedToListLevelOfOutlineStyle( false ) + , mbAssignedToOutlineStyle( false ) + { + pNextTxtFmtColl = this; + } // zum "abfischen" von UL-/LR-/FontHeight Aenderungen virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ); @@ -105,29 +107,30 @@ public: sal_Bool IsAtDocNodeSet() const; - // --> OD 2006-11-22 #i71574# - //<-#outline level,zhaojianwei - void SetAttrOutlineLevel( int ); - int GetAttrOutlineLevel() const; - int GetAssignedOutlineStyleLevel() const; + 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; } - void AssignToListLevelOfOutlineStyle(const int nAssignedListLevel); - void DeleteAssignmentToListLevelOfOutlineStyle(); - //<-end - // <-- - // --> OD 2008-03-04 #refactorlists# + // 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( const bool bResetOutlineLevel = true ); + // override to recognize changes on the <SwNumRuleItem> and register/unregister // the paragragh style at the corresponding <SwNumRule> instance virtual sal_Bool SetFmtAttr( const SfxPoolItem& rAttr ); virtual sal_Bool SetFmtAttr( const SfxItemSet& rSet ); virtual sal_Bool ResetFmtAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 = 0 ); - // <-- - // --> OD 2007-01-24 #i73790# // override <ResetAllFmtAttr()> to stay assigned to list level of outline style virtual sal_uInt16 ResetAllFmtAttr(); Modified: openoffice/trunk/main/sw/inc/ndtxt.hxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/inc/ndtxt.hxx?rev=1606055&r1=1606054&r2=1606055&view=diff ============================================================================== --- openoffice/trunk/main/sw/inc/ndtxt.hxx (original) +++ openoffice/trunk/main/sw/inc/ndtxt.hxx Fri Jun 27 12:27:55 2014 @@ -600,7 +600,7 @@ public: @return outline level or NO_NUMBERING if there is no outline level */ - int GetAttrOutlineLevel() const;//#OutlineLevel,added by zhaojianwei + int GetAttrOutlineLevel() const; /** Sets the out line level *at* a text node. @@ -615,14 +615,12 @@ public: NOTE: This is subject to change, see GetOutlineLevel. */ - //void SetOutlineLevel(int nLevel); - void SetAttrOutlineLevel(int nLevel);//#OutlineLevel,added by zhaojianwei + void SetAttrOutlineLevel(int nLevel); - // --> OD 2008-11-19 #i70748# bool IsEmptyListStyleDueToSetOutlineLevelAttr(); void SetEmptyListStyleDueToSetOutlineLevelAttr(); void ResetEmptyListStyleDueToResetOutlineLevelAttr(); - // <-- + /** Returns the width of leading tabs/blanks in this paragraph. Modified: openoffice/trunk/main/sw/source/core/attr/format.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/attr/format.cxx?rev=1606055&r1=1606054&r2=1606055&view=diff ============================================================================== --- openoffice/trunk/main/sw/source/core/attr/format.cxx (original) +++ openoffice/trunk/main/sw/source/core/attr/format.cxx Fri Jun 27 12:27:55 2014 @@ -548,12 +548,10 @@ sal_Bool SwFmt::SetFmtAttr(const SfxPool { if( 0 != ( bRet = (0 != aSet.Put( rAttr ))) ) aSet.SetModifyAtAttr( this ); - // --> OD 2006-11-22 #i71574# if ( nFmtWhich == RES_TXTFMTCOLL && rAttr.Which() == RES_PARATR_NUMRULE ) { TxtFmtCollFunc::CheckTxtFmtCollForDeletionOfAssignmentToOutlineStyle( this ); } - // <-- } else { @@ -656,12 +654,10 @@ sal_Bool SwFmt::SetFmtAttr( const SfxIte { if( 0 != ( bRet = (0 != aSet.Put( aTempSet ))) ) aSet.SetModifyAtAttr( this ); - // --> OD 2006-11-22 #i71574# if ( nFmtWhich == RES_TXTFMTCOLL ) { TxtFmtCollFunc::CheckTxtFmtCollForDeletionOfAssignmentToOutlineStyle( this ); } - // <-- } else { Modified: openoffice/trunk/main/sw/source/core/doc/docfmt.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/doc/docfmt.cxx?rev=1606055&r1=1606054&r2=1606055&view=diff ============================================================================== --- openoffice/trunk/main/sw/source/core/doc/docfmt.cxx (original) +++ openoffice/trunk/main/sw/source/core/doc/docfmt.cxx Fri Jun 27 12:27:55 2014 @@ -116,14 +116,10 @@ struct ParaRstFmt const SfxItemSet* pDelSet; sal_uInt16 nWhich; bool bReset; - // --> OD 2007-11-06 #i62575# bool bResetListAttrs; - // <-- bool bResetAll; bool bInclRefToxMark; - bool bKeepOutlineLevelAttr; //#outline level,add by zhaojianwei - ParaRstFmt( const SwPosition* pStt, const SwPosition* pEnd, SwHistory* pHst, sal_uInt16 nWhch = 0, const SfxItemSet* pSet = 0 ) : pFmtColl(0), @@ -132,14 +128,12 @@ struct ParaRstFmt pEndNd(pEnd), pDelSet(pSet), nWhich(nWhch), - // --> OD 2007-11-06 #i62675# bReset( false ), bResetListAttrs( false ), - // <-- bResetAll( true ), - bInclRefToxMark( false ), - bKeepOutlineLevelAttr( false ) //#outline level,add by zhaojianwei - {} + bInclRefToxMark( false ) + { + } ParaRstFmt( SwHistory* pHst ) : pFmtColl(0), @@ -148,14 +142,12 @@ struct ParaRstFmt pEndNd(0), pDelSet(0), nWhich(0), - // --> OD 2007-11-06 #i62675# bReset( false ), bResetListAttrs( false ), - // <-- bResetAll( true ), - bInclRefToxMark( false ), - bKeepOutlineLevelAttr( false ) //#outline level,add by zhaojianwei - {} + bInclRefToxMark( false ) + { + } }; /* in pArgs steht die ChrFmtTablle vom Dokument @@ -197,8 +189,8 @@ sal_Bool lcl_RstTxtAttr( const SwNodePtr sal_Bool lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs ) { - ParaRstFmt* pPara = (ParaRstFmt*)pArgs; - SwCntntNode* pNode = (SwCntntNode*)rpNd->GetCntntNode(); + const ParaRstFmt* pPara = (ParaRstFmt*) pArgs; + SwCntntNode* pNode = (SwCntntNode*) rpNd->GetCntntNode(); if( pNode && pNode->HasSwAttrSet() ) { const sal_Bool bLocked = pNode->IsModifyLocked(); @@ -206,31 +198,24 @@ sal_Bool lcl_RstAttr( const SwNodePtr& r SwDoc* pDoc = pNode->GetDoc(); - // --> OD 2008-04-14 #refactorlists# - // 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,//#outline level,removed by zhaojianwei - 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(); - // --> OD 2008-04-15 #refactorlists# -// std::vector<sal_uInt16> aClearWhichIds; SvUShorts aClearWhichIds; - // <-- - // --> OD 2008-04-15 #refactorlists# // restoring all paragraph list attributes { SfxItemSet aListAttrSet( pDoc->GetAttrPool(), RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END - 1, 0 ); - 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 ) @@ -240,117 +225,94 @@ sal_Bool lcl_RstAttr( const SwNodePtr& r } } } - // <-- - const SfxPoolItem* pItem; - // sal_uInt16 __READONLY_DATA aSavIds[ 3 ] = { RES_PAGEDESC, RES_BREAK, //#outline level,removed by zhaojianwei - // RES_PARATR_NUMRULE }; - //for( sal_uInt16 n = 0; n < 3; ++n ) - sal_uInt16 __READONLY_DATA aSavIds[ 4 ] = { RES_PAGEDESC, RES_BREAK, //->add by zhaojianwei - RES_PARATR_NUMRULE, - RES_PARATR_OUTLINELEVEL }; - for( sal_uInt16 n = 0; n < 4; ++n ) //<-end,zhaojianwei + const SfxPoolItem* pItem; + sal_uInt16 __READONLY_DATA 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 ], sal_False, &pItem )) - { + if ( SFX_ITEM_SET == pAttrSetOfNode->GetItemState( aSavIds[n], sal_False, &pItem ) ) + { bool bSave = false; - switch( aSavIds[ n ] ) - { - case RES_PAGEDESC: - bSave = 0 != ((SwFmtPageDesc*)pItem)->GetPageDesc(); + switch (aSavIds[n]) + { + case RES_PAGEDESC: + bSave = 0 != ( (SwFmtPageDesc*) pItem )->GetPageDesc(); break; - case RES_BREAK: - bSave = SVX_BREAK_NONE != ((SvxFmtBreakItem*)pItem)->GetBreak(); + case RES_BREAK: + bSave = SVX_BREAK_NONE != ( (SvxFmtBreakItem*) pItem )->GetBreak(); break; - case RES_PARATR_NUMRULE: - { - bSave = 0 != ((SwNumRuleItem*)pItem)->GetValue().Len(); - } + case RES_PARATR_NUMRULE: + bSave = 0 != ( (SwNumRuleItem*) pItem )->GetValue().Len(); break; - case RES_PARATR_OUTLINELEVEL: //#outline level,add by zhaojianwei - { - bSave = pPara && pPara->bKeepOutlineLevelAttr; - } - break; //<-end,zhaojianwei - } - if( bSave ) - { - aSet.Put( *pItem ); - // --> OD 2008-04-15 #refactorlists# -// aClearWhichIds.push_back( aSavIds[n] ); + } + if ( bSave ) + { + aSavedAttrsSet.Put( *pItem ); aClearWhichIds.Insert( aSavIds[n], aClearWhichIds.Count() ); } - } + } } - // --> OD 2008-04-14 #refactorlists# // do not clear items directly from item set and only clear to be kept // attributes, if no deletion item set is found. -// pNode->ClearItemsFromAttrSet( aClearWhichIds ); const bool bKeepAttributes = !pPara || !pPara->pDelSet || pPara->pDelSet->Count() == 0; if ( bKeepAttributes ) { pNode->ResetAttr( aClearWhichIds ); } - // <-- if( !bLocked ) pNode->UnlockModify(); - if( pPara ) - { - SwRegHistory aRegH( pNode, *pNode, pPara->pHistory ); + if ( pPara ) + { + SwRegHistory aRegH( pNode, *pNode, pPara->pHistory ); - if( pPara->pDelSet && pPara->pDelSet->Count() ) - { - // --> OD 2008-04-15 #refactorlists# + if ( pPara->pDelSet && pPara->pDelSet->Count() ) + { ASSERT( !bKeepAttributes, "<lcl_RstAttr(..)> - certain attributes are kept, but not needed. -> please inform OD" ); - // <-- - SfxItemIter aIter( *pPara->pDelSet ); - pItem = aIter.FirstItem(); - while( sal_True ) - { - // --> OD 2008-04-14 #refactorlists# - // + SfxItemIter aIter( *pPara->pDelSet ); + pItem = aIter.FirstItem(); + while ( sal_True ) + { if ( ( pItem->Which() != RES_PAGEDESC && pItem->Which() != RES_BREAK && pItem->Which() != RES_PARATR_NUMRULE ) || - ( aSet.GetItemState( pItem->Which(), sal_False ) != SFX_ITEM_SET ) ) + ( aSavedAttrsSet.GetItemState( pItem->Which(), sal_False ) != SFX_ITEM_SET ) ) { pNode->ResetAttr( pItem->Which() ); } - // <-- - if( aIter.IsAtEnd() ) - break; - pItem = aIter.NextItem(); - } - } - else if( pPara->bResetAll ) - pNode->ResetAllAttr(); - else - pNode->ResetAttr( RES_PARATR_BEGIN, POOLATTR_END - 1 ); - } - else - pNode->ResetAllAttr(); + if ( aIter.IsAtEnd() ) + break; + pItem = aIter.NextItem(); + } + } + else if ( pPara->bResetAll ) + pNode->ResetAllAttr(); + else + pNode->ResetAttr( RES_PARATR_BEGIN, POOLATTR_END - 1 ); + } + else + pNode->ResetAllAttr(); - // --> OD 2008-04-15 #refactorlists# // 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(); - } - } - return sal_True; + if ( !bLocked ) + pNode->UnlockModify(); + } + } + return sal_True; } + void SwDoc::RstTxtAttrs(const SwPaM &rRg, sal_Bool bInclRefToxMark ) { SwHistory* pHst = 0; @@ -1746,23 +1708,17 @@ void SwDoc::DelTxtFmtColl( SwTxtFmtColl sal_Bool lcl_SetTxtFmtColl( const SwNodePtr& rpNode, void* pArgs ) { - // ParaSetFmtColl * pPara = (ParaSetFmtColl*)pArgs; - SwCntntNode* pCNd = (SwCntntNode*)rpNode->GetTxtNode(); - if( pCNd ) - { - ParaRstFmt* pPara = (ParaRstFmt*)pArgs; + SwCntntNode* pCNd = (SwCntntNode*) rpNode->GetTxtNode(); + if ( pCNd ) + { + ParaRstFmt* pPara = (ParaRstFmt*) pArgs; - SwTxtFmtColl* pFmt = static_cast<SwTxtFmtColl*>(pPara->pFmtColl); - if ( pPara->bReset ) + SwTxtFmtColl* pFmt = static_cast< SwTxtFmtColl* >( pPara->pFmtColl ); + if ( pPara->bReset ) { - if( pFmt->GetAttrOutlineLevel() == 0 && pPara ) - pPara->bKeepOutlineLevelAttr = true; - - lcl_RstAttr( pCNd, pPara ); + lcl_RstAttr( pCNd, pPara ); - // --> OD 2007-11-06 #i62675# - // --> OD 2008-04-15 #refactorlists# // check, if paragraph style has changed if ( pPara->bResetListAttrs && pFmt != pCNd->GetFmtColl() && @@ -1790,7 +1746,6 @@ sal_Bool lcl_SetTxtFmtColl( const SwNode if ( bChangeOfListStyleAtParagraph ) { - // --> OD 2008-04-08 #refactorlists# std::auto_ptr< SwRegHistory > pRegH; if ( pPara->pHistory ) { @@ -1806,9 +1761,7 @@ sal_Bool lcl_SetTxtFmtColl( const SwNode pCNd->ResetAttr( RES_PARATR_LIST_ISCOUNTED ); pCNd->ResetAttr( RES_PARATR_LIST_ID ); } - // <-- } - // <-- } // erst in die History aufnehmen, damit ggfs. alte Daten @@ -1824,10 +1777,12 @@ sal_Bool lcl_SetTxtFmtColl( const SwNode return sal_True; } -sal_Bool SwDoc::SetTxtFmtColl( const SwPaM &rRg, - SwTxtFmtColl *pFmt, - bool bReset, - bool bResetListAttrs ) + +sal_Bool SwDoc::SetTxtFmtColl( + const SwPaM &rRg, + SwTxtFmtColl *pFmt, + const bool bReset, + const bool bResetListAttrs ) { SwDataChanged aTmp( rRg, 0 ); const SwPosition *pStt = rRg.Start(), *pEnd = rRg.End(); @@ -1836,30 +1791,29 @@ sal_Bool SwDoc::SetTxtFmtColl( const SwP if (GetIDocumentUndoRedo().DoesUndo()) { - // --> OD 2008-04-15 #refactorlists# SwUndoFmtColl* pUndo = new SwUndoFmtColl( rRg, pFmt, bReset, bResetListAttrs ); - // <-- - pHst = pUndo->GetHistory(); + pHst = pUndo->GetHistory(); GetIDocumentUndoRedo().AppendUndo(pUndo); } ParaRstFmt aPara( pStt, pEnd, pHst ); aPara.pFmtColl = pFmt; aPara.bReset = bReset; - // --> OD 2007-11-06 #i62675# aPara.bResetListAttrs = bResetListAttrs; - // <-- GetNodes().ForEach( pStt->nNode.GetIndex(), pEnd->nNode.GetIndex()+1, lcl_SetTxtFmtColl, &aPara ); - if( !aPara.nWhich ) + if ( !aPara.nWhich ) bRet = sal_False; // keinen gueltigen Node gefunden - if( bRet ) - SetModified(); - return bRet; + if ( bRet ) + { + SetModified(); + } + + return bRet; } @@ -1953,14 +1907,12 @@ SwTxtFmtColl* SwDoc::CopyTxtColl( const // kopiere jetzt noch die Auto-Formate oder kopiere die Attribute pNewColl->CopyAttrs( rColl, sal_True ); - // setze noch den Outline-Level - //if( NO_NUMBERING != rColl.GetOutlineLevel() ) //#outline level,zhaojianwei - // pNewColl->SetOutlineLevel( rColl.GetOutlineLevel() ); - if(rColl.IsAssignedToListLevelOfOutlineStyle()) - pNewColl->AssignToListLevelOfOutlineStyle(rColl.GetAssignedOutlineStyleLevel());//<-end,zhaojianwei - //<-end - pNewColl->SetPoolFmtId( rColl.GetPoolFmtId() ); - pNewColl->SetPoolHelpId( rColl.GetPoolHelpId() ); + // setze noch den Outline-Level + if ( rColl.IsAssignedToListLevelOfOutlineStyle() ) + pNewColl->AssignToListLevelOfOutlineStyle( rColl.GetAssignedOutlineStyleLevel() ); + + pNewColl->SetPoolFmtId( rColl.GetPoolFmtId() ); + pNewColl->SetPoolHelpId( rColl.GetPoolHelpId() ); // HelpFile-Id immer auf dflt setzen !! pNewColl->SetPoolHlpFileId( UCHAR_MAX ); @@ -2111,11 +2063,8 @@ void SwDoc::CopyFmtArr( const SvPtrarr& rDestArr, pSrcColl->GetNextTxtFmtColl().GetName() ) ); // setze noch den Outline-Level - //if( NO_NUMBERING != pSrcColl->GetOutlineLevel() ) //#outline level,zhaojianwei - // pDstColl->SetOutlineLevel( pSrcColl->GetOutlineLevel() ); if(pSrcColl->IsAssignedToListLevelOfOutlineStyle()) - pDstColl->AssignToListLevelOfOutlineStyle(pSrcColl->GetAssignedOutlineStyleLevel());//<-end,zhaojianwei - //<-end + pDstColl->AssignToListLevelOfOutlineStyle(pSrcColl->GetAssignedOutlineStyleLevel()); //FEATURE::CONDCOLL if( RES_CONDTXTFMTCOLL == pSrc->Which() ) Modified: openoffice/trunk/main/sw/source/core/doc/docglbl.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/doc/docglbl.cxx?rev=1606055&r1=1606054&r2=1606055&view=diff ============================================================================== --- openoffice/trunk/main/sw/source/core/doc/docglbl.cxx (original) +++ openoffice/trunk/main/sw/source/core/doc/docglbl.cxx Fri Jun 27 12:27:55 2014 @@ -125,8 +125,7 @@ sal_Bool SwDoc::SplitDoc( sal_uInt16 eDo { // wenn keine OutlineNumerierung ist, dann benutze eigenes Array // und sammel die Nodes zusammen. - //if( NO_NUMBERING == pSplitColl->GetOutlineLevel() )//#outline level,zhaojianwei - if( pSplitColl->GetAttrOutlineLevel() == 0 )//<-end,zhaojianwei, 0814 + if( pSplitColl->GetAttrOutlineLevel() == 0 ) { pOutlNds = new SwOutlineNodes( 8, 8 ); SwIterator<SwTxtNode,SwFmtColl> aIter( *pSplitColl ); Modified: openoffice/trunk/main/sw/source/core/doc/doctxm.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/doc/doctxm.cxx?rev=1606055&r1=1606054&r2=1606055&view=diff ============================================================================== --- openoffice/trunk/main/sw/source/core/doc/doctxm.cxx (original) +++ openoffice/trunk/main/sw/source/core/doc/doctxm.cxx Fri Jun 27 12:27:55 2014 @@ -1534,32 +1534,32 @@ void SwTOXBaseSection::UpdateCntnt( SwTO TOX_TABLES != SwTOXBase::GetType() && TOX_ILLUSTRATIONS != SwTOXBase::GetType() && TOX_OBJECTS != SwTOXBase::GetType() ) - { - const SwTxtNode* pOutlNd = ::lcl_FindChapterNode( *pCNd, - MAXLEVEL - 1 ); - if( pOutlNd ) - { - //sal_uInt16 nTmp = pOutlNd->GetTxtColl()->GetOutlineLevel();//#outline level,zhaojianwei - //if( nTmp < NO_NUMBERING ) - // nSetLevel = nTmp + 1; - if( pOutlNd->GetTxtColl()->IsAssignedToListLevelOfOutlineStyle()) - nSetLevel = pOutlNd->GetTxtColl()->GetAttrOutlineLevel() ;//<-end,zhaojianwei - } - } + { + const SwTxtNode* pOutlNd = ::lcl_FindChapterNode( *pCNd, + MAXLEVEL - 1 ); + if ( pOutlNd ) + { + if ( pOutlNd->GetTxtColl()->IsAssignedToListLevelOfOutlineStyle() ) + { + nSetLevel = pOutlNd->GetTxtColl()->GetAttrOutlineLevel(); + } + } + } - if( pCNd->getLayoutFrm( pDoc->GetCurrentLayout() ) && ( !IsFromChapter() || - ::lcl_FindChapterNode( *pCNd, 0 ) == pOwnChapterNode )) - { - SwTOXPara * pNew = new SwTOXPara( *pCNd, eMyType, - ( USHRT_MAX != nSetLevel ) - ? static_cast<sal_uInt16>(nSetLevel) - : FORM_ALPHA_DELIMITTER ); - InsertSorted( pNew ); - } - } + if ( pCNd->getLayoutFrm( pDoc->GetCurrentLayout() ) && ( !IsFromChapter() || + ::lcl_FindChapterNode( *pCNd, 0 ) == pOwnChapterNode ) ) + { + SwTOXPara * pNew = + new SwTOXPara( + *pCNd, + eMyType, + ( USHRT_MAX != nSetLevel ) ? static_cast< sal_uInt16 >( nSetLevel ) : FORM_ALPHA_DELIMITTER ); + InsertSorted( pNew ); + } + } nIdx = pNd->StartOfSectionNode()->EndOfSectionIndex() + 2; // 2 == End-/StartNode - } + } } /*-------------------------------------------------------------------- @@ -1584,36 +1584,33 @@ void SwTOXBaseSection::UpdateTable( cons const SwTableNode* pTblNd = pFBox->GetSttNd()->FindTableNode(); SwNodeIndex aCntntIdx( *pTblNd, 1 ); - SwCntntNode* pCNd; - while( 0 != ( pCNd = rNds.GoNext( &aCntntIdx ) ) && - aCntntIdx.GetIndex() < pTblNd->EndOfSectionIndex() ) - { - if( pCNd->getLayoutFrm( pDoc->GetCurrentLayout() ) && (!IsFromChapter() || - ::lcl_FindChapterNode( *pCNd, 0 ) == pOwnChapterNode )) - { - SwTOXTable * pNew = new SwTOXTable( *pCNd ); - if( IsLevelFromChapter() && TOX_TABLES != SwTOXBase::GetType()) + SwCntntNode* pCNd; + while (0 != ( pCNd = rNds.GoNext( &aCntntIdx ) ) && + aCntntIdx.GetIndex() < pTblNd->EndOfSectionIndex()) + { + if ( pCNd->getLayoutFrm( pDoc->GetCurrentLayout() ) + && ( !IsFromChapter() + || ::lcl_FindChapterNode( *pCNd, 0 ) == pOwnChapterNode ) ) + { + SwTOXTable * pNew = new SwTOXTable( *pCNd ); + if ( IsLevelFromChapter() && TOX_TABLES != SwTOXBase::GetType() ) { - const SwTxtNode* pOutlNd = - ::lcl_FindChapterNode( *pCNd, MAXLEVEL - 1 ); - if( pOutlNd ) + const SwTxtNode* pOutlNd = ::lcl_FindChapterNode( *pCNd, MAXLEVEL - 1 ); + if ( pOutlNd ) { - //sal_uInt16 nTmp = pOutlNd->GetTxtColl()->GetOutlineLevel();//#outline level,zhaojianwei - //if( nTmp < NO_NUMBERING ) - // pNew->SetLevel( nTmp + 1 ); - if( pOutlNd->GetTxtColl()->IsAssignedToListLevelOfOutlineStyle()) - { + if ( pOutlNd->GetTxtColl()->IsAssignedToListLevelOfOutlineStyle() ) + { const int nTmp = pOutlNd->GetTxtColl()->GetAttrOutlineLevel(); - pNew->SetLevel( static_cast<sal_uInt16>(nTmp) );//<-end ,zhaojianwei - } + pNew->SetLevel( static_cast< sal_uInt16 >( nTmp ) ); + } } } - InsertSorted(pNew); - break; - } - } - } - } + InsertSorted( pNew ); + break; + } + } + } + } } /*-------------------------------------------------------------------- Modified: openoffice/trunk/main/sw/source/core/doc/fmtcol.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/doc/fmtcol.cxx?rev=1606055&r1=1606054&r2=1606055&view=diff ============================================================================== --- openoffice/trunk/main/sw/source/core/doc/fmtcol.cxx (original) +++ openoffice/trunk/main/sw/source/core/doc/fmtcol.cxx Fri Jun 27 12:27:55 2014 @@ -65,17 +65,14 @@ namespace TxtFmtCollFunc return; } - // --> OD 2007-01-24 #i73790# - // if ( pTxtFmtColl->AssignedToListLevelOfOutlineStyle() ) - if ( !pTxtFmtColl->StayAssignedToListLevelOfOutlineStyle() && - pTxtFmtColl->IsAssignedToListLevelOfOutlineStyle() ) - // <-- + if ( !pTxtFmtColl->StayAssignedToListLevelOfOutlineStyle() + && pTxtFmtColl->IsAssignedToListLevelOfOutlineStyle() ) { - if ( !pNewNumRuleItem ) + if ( pNewNumRuleItem == NULL ) { pTxtFmtColl->GetItemState( RES_PARATR_NUMRULE, sal_False, (const SfxPoolItem**)&pNewNumRuleItem ); } - if ( pNewNumRuleItem ) + if ( pNewNumRuleItem != NULL ) { String sNumRuleName = pNewNumRuleItem->GetValue(); if ( sNumRuleName.Len() == 0 || @@ -87,7 +84,7 @@ namespace TxtFmtCollFunc } } } - // <-- + SwNumRule* GetNumRule( SwTxtFmtColl& rTxtFmtColl ) { @@ -212,7 +209,6 @@ void SwTxtFmtColl::Modify( const SfxPool case RES_CHRATR_CTL_FONTSIZE: aFontSizeArr[2] = (SvxFontHeightItem*)pNew; break; - // --> OD 2006-10-17 #i70223# case RES_PARATR_NUMRULE: { if ( bAssignedToListLevelOfOutlineStyle ) @@ -220,19 +216,18 @@ void SwTxtFmtColl::Modify( const SfxPool pNewNumRuleItem = (SwNumRuleItem*)pNew; } } + break; default: break; - } + } - // --> OD 2006-10-17 #i70223# - if ( bAssignedToListLevelOfOutlineStyle && pNewNumRuleItem ) + if ( bAssignedToListLevelOfOutlineStyle + && pNewNumRuleItem != NULL ) { - TxtFmtCollFunc::CheckTxtFmtCollForDeletionOfAssignmentToOutlineStyle( - this, pNewNumRuleItem ); + TxtFmtCollFunc::CheckTxtFmtCollForDeletionOfAssignmentToOutlineStyle( this, pNewNumRuleItem ); } - // <-- - int bWeiter = sal_True; + int bWeiter = sal_True; // dann pruefe doch mal gegen die eigenen Attribute if( pNewLRSpace && SFX_ITEM_SET == GetItemState( RES_LR_SPACE, sal_False, @@ -416,28 +411,24 @@ sal_Bool SwTxtFmtColl::ResetFmtAttr( sal } // <-- -// --> OD 2007-01-24 #i73790# + sal_uInt16 SwTxtFmtColl::ResetAllFmtAttr() { const bool bOldState( mbStayAssignedToListLevelOfOutlineStyle ); mbStayAssignedToListLevelOfOutlineStyle = true; - // --> OD 2008-12-16 #i70748# // Outline level is no longer a member, it is a attribute now. // Thus, it needs to be restored, if the paragraph style is assigned // to the outline style const int nAssignedOutlineStyleLevel = IsAssignedToListLevelOfOutlineStyle() ? GetAssignedOutlineStyleLevel() : -1; - // <-- sal_uInt16 nRet = SwFmtColl::ResetAllFmtAttr(); - // --> OD 2008-12-16 #i70748# if ( nAssignedOutlineStyleLevel != -1 ) { AssignToListLevelOfOutlineStyle( nAssignedOutlineStyleLevel ); } - // <-- mbStayAssignedToListLevelOfOutlineStyle = bOldState; @@ -654,7 +645,9 @@ void SwConditionTxtFmtColl::SetCondition aCondColls.Insert( pNew, n ); } } -//#outline level, zhaojianwei +//FEATURE::CONDCOLL + + void SwTxtFmtColl::SetAttrOutlineLevel( int nLevel) { ASSERT( 0 <= nLevel && nLevel <= MAXLEVEL ,"SwTxtFmtColl: Level Out Of Range" ); @@ -662,24 +655,26 @@ void SwTxtFmtColl::SetAttrOutlineLevel( static_cast<sal_uInt16>(nLevel) ) ); } + int SwTxtFmtColl::GetAttrOutlineLevel() const { - return ((const SfxUInt16Item &)GetFmtAttr(RES_PARATR_OUTLINELEVEL)).GetValue(); + return ( (const SfxUInt16Item &) GetFmtAttr( RES_PARATR_OUTLINELEVEL ) ).GetValue(); } + int SwTxtFmtColl::GetAssignedOutlineStyleLevel() const { - ASSERT( IsAssignedToListLevelOfOutlineStyle(), - "<SwTxtFmtColl::GetAssignedOutlineStyleLevel()> - misuse of method"); - return GetAttrOutlineLevel() - 1; + ASSERT( IsAssignedToListLevelOfOutlineStyle(), + "<SwTxtFmtColl::GetAssignedOutlineStyleLevel()> - misuse of method" ); + return GetAttrOutlineLevel() - 1; } + void SwTxtFmtColl::AssignToListLevelOfOutlineStyle(const int nAssignedListLevel) { - mbAssignedToOutlineStyle = true; - SetAttrOutlineLevel(nAssignedListLevel+1); + mbAssignedToOutlineStyle = true; + SetAttrOutlineLevel( nAssignedListLevel + 1 ); - // --> OD 2009-03-18 #i100277# SwIterator<SwTxtFmtColl,SwFmtColl> aIter( *this ); SwTxtFmtColl* pDerivedTxtFmtColl = aIter.First(); while ( pDerivedTxtFmtColl != 0 ) @@ -699,14 +694,16 @@ void SwTxtFmtColl::AssignToListLevelOfOu pDerivedTxtFmtColl = aIter.Next(); } - // <-- } -void SwTxtFmtColl::DeleteAssignmentToListLevelOfOutlineStyle() + +void SwTxtFmtColl::DeleteAssignmentToListLevelOfOutlineStyle( + const bool bResetOutlineLevel ) { - mbAssignedToOutlineStyle = false; - ResetFmtAttr(RES_PARATR_OUTLINELEVEL); + mbAssignedToOutlineStyle = false; + if ( bResetOutlineLevel ) + { + ResetFmtAttr( RES_PARATR_OUTLINELEVEL ); + } } -//<-end,zhaojianwei -//FEATURE::CONDCOLL Modified: openoffice/trunk/main/sw/source/core/edit/edfcol.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/edit/edfcol.cxx?rev=1606055&r1=1606054&r2=1606055&view=diff ============================================================================== --- openoffice/trunk/main/sw/source/core/edit/edfcol.cxx (original) +++ openoffice/trunk/main/sw/source/core/edit/edfcol.cxx Fri Jun 27 12:27:55 2014 @@ -66,7 +66,7 @@ SwTxtFmtColl& SwEditShell::GetTxtFmtColl // --> OD 2007-11-06 #i62675# void SwEditShell::SetTxtFmtColl( SwTxtFmtColl *pFmt, - bool bResetListAttrs ) + const bool bResetListAttrs ) { SwTxtFmtColl *pLocal = pFmt? pFmt: (*GetDoc()->GetTxtFmtColls())[0]; StartAllAction(); Modified: openoffice/trunk/main/sw/source/core/txtnode/ndtxt.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/txtnode/ndtxt.cxx?rev=1606055&r1=1606054&r2=1606055&view=diff ============================================================================== --- openoffice/trunk/main/sw/source/core/txtnode/ndtxt.cxx (original) +++ openoffice/trunk/main/sw/source/core/txtnode/ndtxt.cxx Fri Jun 27 12:27:55 2014 @@ -4680,6 +4680,7 @@ namespace { // --> OD 2008-11-19 #i70748# if ( mbOutlineLevelSet ) { + mrTxtNode.GetNodes().UpdateOutlineNode( mrTxtNode ); if ( mrTxtNode.GetAttrOutlineLevel() == 0 ) { mrTxtNode.ResetEmptyListStyleDueToResetOutlineLevelAttr(); Modified: openoffice/trunk/main/sw/source/core/undo/unfmco.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/undo/unfmco.cxx?rev=1606055&r1=1606054&r2=1606055&view=diff ============================================================================== --- openoffice/trunk/main/sw/source/core/undo/unfmco.cxx (original) +++ openoffice/trunk/main/sw/source/core/undo/unfmco.cxx Fri Jun 27 12:27:55 2014 @@ -94,14 +94,13 @@ void SwUndoFmtColl::DoSetFmtColl(SwDoc & sal_uInt16 const nPos = rDoc.GetTxtFmtColls()->GetPos( (SwTxtFmtColl*)pFmtColl ); // does the format still exist? - if( USHRT_MAX != nPos ) + if ( USHRT_MAX != nPos ) { - // --> OD 2008-04-15 #refactorlists# - rDoc.SetTxtFmtColl(rPaM, - (SwTxtFmtColl*)pFmtColl, - mbReset, - mbResetListAttrs ); - // <-- + rDoc.SetTxtFmtColl( + rPaM, + (SwTxtFmtColl*) pFmtColl, + mbReset, + mbResetListAttrs ); } } Modified: openoffice/trunk/main/sw/source/core/unocore/unosett.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/unocore/unosett.cxx?rev=1606055&r1=1606054&r2=1606055&view=diff ============================================================================== --- openoffice/trunk/main/sw/source/core/unocore/unosett.cxx (original) +++ openoffice/trunk/main/sw/source/core/unocore/unosett.cxx Fri Jun 27 12:27:55 2014 @@ -2163,40 +2163,35 @@ void SwXNumberingRules::SetNumberingRule } break; case 23: //"HeadingStyleName" - { - OUString uTmp; - pData->aVal >>= uTmp; - String sStyleName; - SwStyleNameMapper::FillUIName(uTmp, sStyleName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True ); - const SwTxtFmtColls* pColls = pDocShell->GetDoc()->GetTxtFmtColls(); - const sal_uInt16 nCount = pColls->Count(); - for(sal_uInt16 k = 0; k < nCount; ++k) - { - SwTxtFmtColl &rTxtColl = *((*pColls)[k]); - if(rTxtColl.IsDefault()) - continue; - //if(rTxtColl.GetOutlineLevel() == nIndex && //#outline level,removed by zhaojianwei - // rTxtColl.GetName() != sStyleName) - // rTxtColl..SetOutlineLevel(NO_NUMBERING); - //else if(rTxtColl.GetName() == sStyleName) - // rTxtColl.SetOutlineLevel(sal_Int8(nIndex)); - if ( rTxtColl.IsAssignedToListLevelOfOutlineStyle() && //add by zhaojianwei - rTxtColl.GetAssignedOutlineStyleLevel() == nIndex && - rTxtColl.GetName() != sStyleName ) + { + OUString uTmp; + pData->aVal >>= uTmp; + String sStyleName; + SwStyleNameMapper::FillUIName( uTmp, sStyleName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True ); + const SwTxtFmtColls* pColls = pDocShell->GetDoc()->GetTxtFmtColls(); + const sal_uInt16 nCount = pColls->Count(); + for ( sal_uInt16 k = 0; k < nCount; ++k ) + { + SwTxtFmtColl &rTxtColl = *( ( *pColls )[k] ); + if ( rTxtColl.IsDefault() ) + continue; + if ( rTxtColl.IsAssignedToListLevelOfOutlineStyle() + && rTxtColl.GetAssignedOutlineStyleLevel() == nIndex + && rTxtColl.GetName() != sStyleName ) { - rTxtColl.DeleteAssignmentToListLevelOfOutlineStyle(); + rTxtColl.DeleteAssignmentToListLevelOfOutlineStyle(); } else if ( rTxtColl.GetName() == sStyleName ) { rTxtColl.AssignToListLevelOfOutlineStyle( nIndex ); - } //<-end,,zhaojianwei, - } - } - break; + } + } + } + break; case 24: // BulletRelSize - unsupported - only available in Impress - break; - } - } + break; + } + } if(!bExcept && !bWrongArg && (pSetBrush || pSetSize || pSetVOrient)) { if(!pSetBrush && aFmt.GetBrush()) Modified: openoffice/trunk/main/sw/source/core/unocore/unostyle.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/unocore/unostyle.cxx?rev=1606055&r1=1606054&r2=1606055&view=diff ============================================================================== --- openoffice/trunk/main/sw/source/core/unocore/unostyle.cxx (original) +++ openoffice/trunk/main/sw/source/core/unocore/unostyle.cxx Fri Jun 27 12:27:55 2014 @@ -2075,27 +2075,18 @@ throw(beans::PropertyVetoException, lang bDone = true; break; } - // case FN_UNO_DEFAULT_OUTLINE_LEVEL: //#outline level,removed by zahojianwei - //{ - // sal_Int8 nLevel = 0; - // if( aValue >>= nLevel ) - // rBase.getNewBase()->GetCollection()->SetOutlineLevel( nLevel ); - // else - // rBase.getNewBase()->GetCollection()->SetOutlineLevel( NO_NUMBERING ); - // - // bDone = true; - // break; - //} - case RES_PARATR_OUTLINELEVEL: //add by zahojianwei + + case RES_PARATR_OUTLINELEVEL: { sal_Int16 nLevel = 0; - aValue >>= nLevel; + aValue >>= nLevel; if( 0 <= nLevel && nLevel <= MAXLEVEL) rBase.getNewBase()->GetCollection()->SetAttrOutlineLevel( nLevel ); bDone = true; - break; //<-end,zhaojianwei + break; } + case FN_UNO_FOLLOW_STYLE: { OUString sTmp;