diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2009-01-07 11:57:24 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2009-01-07 11:57:24 +0000 |
commit | 507a9f5181f8897945ed931fb914a85ffc676f63 (patch) | |
tree | e51912ffcc97f5974a479de6075d4a3f2b737dfa /sw/source/core | |
parent | 0d2514f7aced0cd05f9bd2c922649b21dde87fb1 (diff) |
CWS-TOOLING: integrate CWS outlinelevel
2008-12-19 10:32:51 +0100 od r265718 : #i70748# method <SwWW8Writer::StartTOX(..)>
- correction for custom to outline style
assigned paragraph styles
2008-12-19 09:24:41 +0100 od r265715 : #i70748# method <HandleModifyAtTxtNode(..)>
- retrieve former applied list style before potential
reset of empty list style due to set outline level
2008-12-17 15:33:57 +0100 hde r265608 : #i97013#
2008-12-17 14:43:42 +0100 od r265603 : #i70748# adjust fix i44177 - adjustment of to outline style assigned
paragraph styles only for OOo-Templates.
2008-12-17 12:59:42 +0100 od r265598 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)>
- special handling of OOo 2.x document regarding
outline numbering of headings.
2008-12-17 12:45:53 +0100 od r265597 : #i70748# method <HandleModifyAtTxtNode(..)>
- correct determination of new and former applied list style
2008-12-17 10:18:41 +0100 od r265581 : #i97312# method <XMLTextNumRuleInfo::Set(..)>
- check, if numbering rules instance contains any numbering rule.
2008-12-16 14:34:22 +0100 hde r265542 : #i97013
2008-12-16 14:20:24 +0100 od r265541 : #i70748# adjust documentation of "Which"-ID numbers
2008-12-16 14:19:49 +0100 od r265539 : #i70748# Adjust Attribute-Function-Mapping table due to new attribute
2008-12-16 14:06:24 +0100 od r265538 : #i70748# - Correct handling of to outline style assigned paragraph styles
on reset of all paragraph style attributes
- WW8 import: Consider refactoring of paragraph style's outline
level attribute - NO_NUMBERING define no longer exsits.
2008-12-16 10:37:19 +0100 od r265530 : #i70478# Correction on moving outline paragraph up respectively down
in its outline level:
- Check also outline paragraph, which are not an outline via
a to outline style assigned paragraph style, if action is applicable.
2008-12-16 09:10:13 +0100 hde r265523 : #i97277
2008-12-16 09:09:30 +0100 hde r265522 : #i97277
2008-12-16 09:07:40 +0100 hde r265521 : Added control and purged obsolete id's
2008-12-10 13:09:36 +0100 od r265174 : #i70748# correction of previous fix due to warning-free code
2008-12-10 13:03:30 +0100 od r265172 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)>
- Due to performance issues avoid retrieving outline level value from paragraph's paragraph
style for each paragraph. Instead retrieve current outline level value from paragraph,
which is the inherited value from its paragraph style, and only when it is needed.
2008-12-09 16:50:36 +0100 ufi r265117 : help
2008-12-09 16:49:50 +0100 ufi r265116 : help
2008-12-09 15:45:05 +0100 od r265107 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)>
- some minor rework and check access to paragraph styles
2008-12-09 15:42:04 +0100 od r265106 : #i70748# adjust name of local variable to avoid hiding of class variable
2008-12-09 15:40:51 +0100 od r265105 : #i70748# correct initialization order
2008-12-09 15:35:07 +0100 od r265101 : #i70748# remove duplicate entry in certain property map
2008-12-09 15:33:39 +0100 od r265100 : #i70748# add end of file token
2008-12-07 15:11:54 +0100 zhaojianwei r264952 : conflicts left not to be resolved when cws rebase
2008-12-04 14:52:21 +0100 zhaojianwei r264846 : CWS-TOOLING: rebase CWS outlinelevel to trunk@264325 (milestone: DEV300:m36)
2008-11-28 03:42:09 +0100 zhaojianwei r264525 : #i70748#: migrate CWS outlinelevel to SVN
2008-11-28 03:41:39 +0100 zhaojianwei r264524 : #i70748#: migrate CWS outlinelevel to SVN
2008-11-28 03:41:11 +0100 zhaojianwei r264523 : #i70748#: migrate CWS outlinelevel to SVN
Diffstat (limited to 'sw/source/core')
31 files changed, 1117 insertions, 322 deletions
diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index 01540ceb90..ca1a599968 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -358,6 +358,9 @@ SfxItemInfo __FAR_DATA aSlotTab[] = { SID_PARA_VERTALIGN, SFX_ITEM_POOLABLE }, // RES_PARATR_VERTALIGN { SID_ATTR_PARA_SNAPTOGRID, SFX_ITEM_POOLABLE }, // RES_PARATR_SNAPTOGRID { SID_ATTR_BORDER_CONNECT, SFX_ITEM_POOLABLE }, // RES_PARATR_CONNECT_BORDER + + { SID_ATTR_PARA_OUTLINE_LEVEL, SFX_ITEM_POOLABLE }, // RES_PARATR_OUTLINELEVEL //#outline level,zhaojianwei + // --> OD 2008-02-19 #refactorlists# { 0, SFX_ITEM_POOLABLE }, // RES_PARATR_LIST_ID { 0, SFX_ITEM_POOLABLE }, // RES_PARATR_LIST_LEVEL @@ -573,6 +576,9 @@ void _InitCore() aAttrTab[ RES_PARATR_VERTALIGN - POOLATTR_BEGIN ] = new SvxParaVertAlignItem( 0, RES_PARATR_VERTALIGN ); aAttrTab[ RES_PARATR_SNAPTOGRID - POOLATTR_BEGIN ] = new SvxParaGridItem( sal_True, RES_PARATR_SNAPTOGRID ); aAttrTab[ RES_PARATR_CONNECT_BORDER - POOLATTR_BEGIN ] = new SwParaConnectBorderItem; + + aAttrTab[ RES_PARATR_OUTLINELEVEL - POOLATTR_BEGIN ] = new SfxUInt16Item( RES_PARATR_OUTLINELEVEL, 0 );//#outline level,zhaojianwei + // --> OD 2008-02-19 #refactorlists# aAttrTab[ RES_PARATR_LIST_ID - POOLATTR_BEGIN ] = new SfxStringItem( RES_PARATR_LIST_ID, aEmptyStr ); aAttrTab[ RES_PARATR_LIST_LEVEL - POOLATTR_BEGIN ] = new SfxInt16Item( RES_PARATR_LIST_LEVEL, 0 ); diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index 87b1f80987..050467217c 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -904,8 +904,11 @@ USHORT SwCrsrShell::GetOutlinePos( BYTE nLevel ) while( nPos-- ) // immer den davor testen ! { pNd = rNds.GetOutLineNds()[ nPos ]; - if( ((SwTxtNode*)pNd)->GetTxtColl()->GetOutlineLevel() <= nLevel ) + + //if( ((SwTxtNode*)pNd)->GetTxtColl()->GetOutlineLevel() <= nLevel )//#outline level,zhaojianwei + if( ((SwTxtNode*)pNd)->GetAttrOutlineLevel()-1 <= nLevel )//<-end,zhaojianwei return nPos; + } return USHRT_MAX; // davor keiner mehr also Ende } @@ -935,11 +938,13 @@ BOOL SwCrsrShell::MakeOutlineSel( USHORT nSttPos, USHORT nEndPos, if( bWithChilds ) { - BYTE nLevel = pEndNd->GetTxtNode()->GetTxtColl()->GetOutlineLevel(); + //BYTE nLevel = pEndNd->GetTxtNode()->GetTxtColl()->GetOutlineLevel();//#outline level,zhaojianwei + const int nLevel = pEndNd->GetTxtNode()->GetAttrOutlineLevel()-1;//<-end.zhaojianwei for( ++nEndPos; nEndPos < rOutlNds.Count(); ++nEndPos ) { pEndNd = rOutlNds[ nEndPos ]; - BYTE nNxtLevel = pEndNd->GetTxtNode()->GetTxtColl()->GetOutlineLevel(); + //BYTE nNxtLevel = pEndNd->GetTxtNode()->GetTxtColl()->GetOutlineLevel();//#outline level,zhaojianwei + const int nNxtLevel = pEndNd->GetTxtNode()->GetAttrOutlineLevel()-1;//<-end,zhaojianwei if( nNxtLevel <= nLevel ) break; // EndPos steht jetzt auf dem naechsten } diff --git a/sw/source/core/doc/dbgoutsw.cxx b/sw/source/core/doc/dbgoutsw.cxx index da9f2dd269..3726fb4ffa 100644 --- a/sw/source/core/doc/dbgoutsw.cxx +++ b/sw/source/core/doc/dbgoutsw.cxx @@ -574,9 +574,14 @@ String lcl_dbg_out(const SwNode & rNode) aTmpStr += String("<tbl/>", RTL_TEXTENCODING_ASCII_US); aTmpStr += String("<outlinelevel>", RTL_TEXTENCODING_ASCII_US); +<<<<<<< .working + //aTmpStr += String::CreateFromInt32(pTxtNode->GetOutlineLevel());//#outline level,zhaojianwei + aTmpStr += String::CreateFromInt32(pTxtNode->GetAttrOutlineLevel()-1);//<-end,zhaojianwei +======= aTmpStr += String::CreateFromInt32(pTxtNode->GetOutlineLevel()); aTmpStr += String("</outlinelevel>", RTL_TEXTENCODING_ASCII_US); +>>>>>>> .merge-right.r264324 const SwNumRule * pNumRule = pTxtNode->GetNumRule(); if (pNumRule != NULL) @@ -630,7 +635,8 @@ String lcl_dbg_out(const SwNode & rNode) aTmpStr += String("(", RTL_TEXTENCODING_ASCII_US); aTmpStr += String::CreateFromInt32 - (static_cast<SwTxtFmtColl *>(pColl)->GetOutlineLevel()); + //(static_cast<SwTxtFmtColl *>(pColl)->GetOutlineLevel());//#outline level,zhaojianwei + (static_cast<SwTxtFmtColl *>(pColl)->GetAssignedOutlineStyleLevel());//<-end,zhaojianwei const SwNumRuleItem & rItem = static_cast<const SwNumRuleItem &> @@ -906,7 +912,7 @@ String lcl_dbg_out(const SwTxtFmtColl & rFmt) String aResult(rFmt.GetName()); aResult += String("(", RTL_TEXTENCODING_ASCII_US); - aResult += String::CreateFromInt32(rFmt.GetOutlineLevel()); + aResult += String::CreateFromInt32(rFmt.GetAttrOutlineLevel()); aResult += String(")", RTL_TEXTENCODING_ASCII_US); return aResult; diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 7ffb60f126..dce2e6f4e0 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1414,9 +1414,10 @@ void SwDoc::Summary( SwDoc* pExtDoc, BYTE nLevel, BYTE nPara, BOOL bImpress ) for( i = 0; i < rOutNds.Count(); ++i ) { ::SetProgressState( i, GetDocShell() ); - ULONG nIndex = rOutNds[ i ]->GetIndex(); - BYTE nLvl = ((SwTxtNode*)GetNodes()[ nIndex ])->GetTxtColl() - ->GetOutlineLevel(); + const ULONG nIndex = rOutNds[ i ]->GetIndex(); + //BYTE nLvl = ((SwTxtNode*)GetNodes()[ nIndex ])->GetTxtColl()//#outline level,zhaojianwei + // ->GetOutlineLevel(); + const int nLvl = ((SwTxtNode*)GetNodes()[ nIndex ])->GetAttrOutlineLevel()-1;//<-end,zhaojianwei if( nLvl > nLevel ) continue; USHORT nEndOfs = 1; @@ -1454,8 +1455,11 @@ void SwDoc::Summary( SwDoc* pExtDoc, BYTE nLevel, BYTE nPara, BOOL bImpress ) if( bImpress ) { SwTxtFmtColl* pMyColl = pNd->GetTxtColl(); - USHORT nHeadLine = static_cast<USHORT>(pMyColl->GetOutlineLevel()==NO_NUMBERING ? - RES_POOLCOLL_HEADLINE2 : RES_POOLCOLL_HEADLINE1); + //USHORT nHeadLine = static_cast<USHORT>(pMyColl->GetOutlineLevel()==NO_NUMBERING ?//#outlinelevel,zhaojianwei + const USHORT nHeadLine = static_cast<USHORT>( + !pMyColl->IsAssignedToListLevelOfOutlineStyle() //<-end,zhaojianwei + ? RES_POOLCOLL_HEADLINE2 + : RES_POOLCOLL_HEADLINE1 ); pMyColl = pExtDoc->GetTxtCollFromPool( nHeadLine ); pNd->ChgFmtColl( pMyColl ); } diff --git a/sw/source/core/doc/docdde.cxx b/sw/source/core/doc/docdde.cxx index 40f6b59fb9..374968db94 100644 --- a/sw/source/core/doc/docdde.cxx +++ b/sw/source/core/doc/docdde.cxx @@ -340,7 +340,8 @@ BOOL SwDoc::SelectServerObj( const String& rStr, SwPaM*& rpPam, if( GotoOutline( aPos, sName )) { SwNode* pNd = &aPos.nNode.GetNode(); - BYTE nLvl = pNd->GetTxtNode()->GetTxtColl()->GetOutlineLevel(); + //BYTE nLvl = pNd->GetTxtNode()->GetTxtColl()->GetOutlineLevel();//#outline level,zhaojianwei + const int nLvl = pNd->GetTxtNode()->GetAttrOutlineLevel()-1;//<-end,zhaojianwei const SwOutlineNodes& rOutlNds = GetNodes().GetOutLineNds(); USHORT nTmpPos; @@ -351,7 +352,8 @@ BOOL SwDoc::SelectServerObj( const String& rStr, SwPaM*& rpPam, for( ++nTmpPos; nTmpPos < rOutlNds.Count() && nLvl < rOutlNds[ nTmpPos ]->GetTxtNode()-> - GetTxtColl()->GetOutlineLevel(); + //GetTxtColl()->GetOutlineLevel();//#outline level,zhaojianwei + GetAttrOutlineLevel()-1;//<-end,zhaojianwei ++nTmpPos ) ; // es gibt keinen Block diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx index fe1d70e659..46ba60ffea 100644 --- a/sw/source/core/doc/docfld.cxx +++ b/sw/source/core/doc/docfld.cxx @@ -1506,7 +1506,7 @@ void SwDoc::UpdateExpFlds( SwTxtFld* pUpdtFld, bool bUpdRefFlds ) if( pSFld->IsSequenceFld() ) { - BYTE nLvl = pSFldTyp->GetOutlineLvl(); + const BYTE nLvl = pSFldTyp->GetOutlineLvl(); if( MAXLEVEL > nLvl ) { // dann teste, ob die Nummer neu aufsetzen muss @@ -2199,8 +2199,9 @@ bool SwDoc::SetFieldsDirty( bool b, const SwNode* pChk, ULONG nLen ) const SwTxtNode* pTNd = rNds[ nStt++ ]->GetTxtNode(); if( pTNd ) { - if( pTNd->GetFmtColl() && - MAXLEVEL > pTNd->GetTxtColl()->GetOutlineLevel() ) + if( //pTNd->GetFmtColl() && //#outline level,zhaojianwei + // MAXLEVEL > pTNd->GetTxtColl()->GetOutlineLevel() ) + pTNd->GetAttrOutlineLevel() != 0 )//<-end,zhaojianwei // Kapitelfelder aktualisieren b = TRUE; else if( pTNd->GetpSwpHints() && pTNd->GetSwpHints().Count() ) diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index afa2b0a078..0a5c07a84d 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -131,6 +131,8 @@ struct ParaRstFmt bool bResetAll; bool bInclRefToxMark; + bool bKeepOutlineLevelAttr; //#outline level,add by zhaojianwei + ParaRstFmt( const SwPosition* pStt, const SwPosition* pEnd, SwHistory* pHst, USHORT nWhch = 0, const SfxItemSet* pSet = 0 ) : pFmtColl(0), @@ -144,7 +146,8 @@ struct ParaRstFmt bResetListAttrs( false ), // <-- bResetAll( true ), - bInclRefToxMark( false ) + bInclRefToxMark( false ), + bKeepOutlineLevelAttr( false ) //#outline level,add by zhaojianwei {} ParaRstFmt( SwHistory* pHst ) @@ -159,7 +162,8 @@ struct ParaRstFmt bResetListAttrs( false ), // <-- bResetAll( true ), - bInclRefToxMark( false ) + bInclRefToxMark( false ), + bKeepOutlineLevelAttr( false ) //#outline level,add by zhaojianwei {} }; @@ -217,6 +221,7 @@ BOOL lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs ) 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(); @@ -247,9 +252,13 @@ BOOL lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs ) // <-- const SfxPoolItem* pItem; - USHORT __READONLY_DATA aSavIds[ 3 ] = { RES_PAGEDESC, RES_BREAK, - RES_PARATR_NUMRULE }; - for( USHORT n = 0; n < 3; ++n ) + // USHORT __READONLY_DATA aSavIds[ 3 ] = { RES_PAGEDESC, RES_BREAK, //#outline level,removed by zhaojianwei + // RES_PARATR_NUMRULE }; + //for( USHORT n = 0; n < 3; ++n ) + USHORT __READONLY_DATA aSavIds[ 4 ] = { RES_PAGEDESC, RES_BREAK, //->add by zhaojianwei + RES_PARATR_NUMRULE, + RES_PARATR_OUTLINELEVEL }; + for( USHORT n = 0; n < 4; ++n ) //<-end,zhaojianwei { if( SFX_ITEM_SET == pSet->GetItemState( aSavIds[ n ], FALSE, &pItem )) { @@ -267,6 +276,11 @@ BOOL lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs ) 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 ) { @@ -1707,8 +1721,12 @@ BOOL lcl_SetTxtFmtColl( const SwNodePtr& rpNode, void* pArgs ) SwTxtFmtColl* pFmt = static_cast<SwTxtFmtColl*>(pPara->pFmtColl); if ( pPara->bReset ) { - lcl_RstAttr( pCNd, pPara ); + + if( pFmt->GetAttrOutlineLevel() == 0 && pPara ) + pPara->bKeepOutlineLevelAttr = true; + lcl_RstAttr( pCNd, pPara ); + // --> OD 2007-11-06 #i62675# // --> OD 2008-04-15 #refactorlists# // check, if paragraph style has changed @@ -1894,9 +1912,11 @@ SwTxtFmtColl* SwDoc::CopyTxtColl( const SwTxtFmtColl& rColl ) pNewColl->CopyAttrs( rColl, TRUE ); // setze noch den Outline-Level - if( NO_NUMBERING != rColl.GetOutlineLevel() ) - pNewColl->SetOutlineLevel( rColl.GetOutlineLevel() ); - + //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() ); @@ -2046,8 +2066,11 @@ void SwDoc::CopyFmtArr( const SvPtrarr& rSourceArr, rDestArr, pSrcColl->GetNextTxtFmtColl().GetName() ) ); // setze noch den Outline-Level - if( NO_NUMBERING != pSrcColl->GetOutlineLevel() ) - pDstColl->SetOutlineLevel( pSrcColl->GetOutlineLevel() ); + //if( NO_NUMBERING != pSrcColl->GetOutlineLevel() ) //#outline level,zhaojianwei + // pDstColl->SetOutlineLevel( pSrcColl->GetOutlineLevel() ); + if(pSrcColl->IsAssignedToListLevelOfOutlineStyle()) + pDstColl->AssignToListLevelOfOutlineStyle(pSrcColl->GetAssignedOutlineStyleLevel());//<-end,zhaojianwei + //<-end //FEATURE::CONDCOLL if( RES_CONDTXTFMTCOLL == pSrc->Which() ) @@ -2604,7 +2627,8 @@ namespace docfunc SwTxtFmtColl* pTxtFmtColl = (*pTxtFmtColls)[i]; if ( pTxtFmtColl->IsDefault() || - pTxtFmtColl->GetOutlineLevel() == NO_NUMBERING ) + // pTxtFmtColl->GetOutlineLevel() == NO_NUMBERING ) //#outline level,zhaojianwei + ! pTxtFmtColl->IsAssignedToListLevelOfOutlineStyle() ) //<-end,zhaojianwei { continue; } diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx index 9f070e9b83..a761724337 100644 --- a/sw/source/core/doc/docglbl.cxx +++ b/sw/source/core/doc/docglbl.cxx @@ -79,6 +79,17 @@ BOOL SwDoc::GenerateGlobalDoc( const String& rPath, return SplitDoc( SPLITDOC_TO_GLOBALDOC, rPath, pSplitColl ); } +//#outline level,add by zhaojianwei +BOOL SwDoc::GenerateGlobalDoc( const String& rPath, int nOutlineLevel ) +{ + return SplitDoc( SPLITDOC_TO_GLOBALDOC, rPath, nOutlineLevel ); +} +BOOL SwDoc::GenerateHTMLDoc( const String& rPath, int nOutlineLevel ) +{ + return SplitDoc( SPLITDOC_TO_HTML, rPath, nOutlineLevel ); +} +//<-end,zhaojianwei + BOOL SwDoc::GenerateHTMLDoc( const String& rPath, const SwTxtFmtColl* pSplitColl ) { @@ -88,7 +99,8 @@ BOOL SwDoc::GenerateHTMLDoc( const String& rPath, BYTE nLvl = 1; const SwTxtFmtColls& rFmtColls =*GetTxtFmtColls(); for( USHORT n = rFmtColls.Count(); n; ) - if( nLvl == rFmtColls[ --n ]->GetOutlineLevel() ) + //if( nLvl == rFmtColls[ --n ]->GetOutlineLevel() )//#outline level,zhaojianwei + if( nLvl == rFmtColls[ --n ]->GetAttrOutlineLevel() -1 )//<-end,zhaojianwei 0814 { pSplitColl = rFmtColls[ n ]; break; @@ -123,7 +135,8 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, { // wenn keine OutlineNumerierung ist, dann benutze eigenes Array // und sammel die Nodes zusammen. - if( NO_NUMBERING == pSplitColl->GetOutlineLevel() ) + //if( NO_NUMBERING == pSplitColl->GetOutlineLevel() )//#outline level,zhaojianwei + if( pSplitColl->GetAttrOutlineLevel() == 0 )//<-end,zhaojianwei, 0814 { pOutlNds = new SwOutlineNodes( 8, 8 ); SwClientIter aIter( *(SwModify*)pSplitColl ); @@ -144,7 +157,8 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, // dann suche die Gliederungs - Vorlage, der 1. Ebene const SwTxtFmtColls& rFmtColls =*GetTxtFmtColls(); for( USHORT n = rFmtColls.Count(); n; ) - if( !rFmtColls[ --n ]->GetOutlineLevel() ) + //if( !rFmtColls[ --n ]->GetOutlineLevel() )//#outline level,zhaojianwei + if ( rFmtColls[ --n ]->GetAttrOutlineLevel() == 1 )//<-end,zhaojianwei { pSplitColl = rFmtColls[ n ]; break; @@ -223,11 +237,17 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, pNd = pOutlNds->GetObject( nOutl ); SwTxtFmtColl* pTColl = pNd->GetTxtNode()->GetTxtColl(); + //if( ( pTColl == pSplitColl || //#outline level,zhaojianwei + // ( NO_NUMBERING != pSplitColl->GetOutlineLevel() && + // pTColl->GetOutlineLevel() < + // pSplitColl->GetOutlineLevel() )) && + // !pNd->FindTableNode() ) if( ( pTColl == pSplitColl || - ( NO_NUMBERING != pSplitColl->GetOutlineLevel() && - pTColl->GetOutlineLevel() < - pSplitColl->GetOutlineLevel() )) && - !pNd->FindTableNode() ) + ( pSplitColl->GetAttrOutlineLevel() > 0 && + pTColl->GetAttrOutlineLevel() > 0 && + pTColl->GetAttrOutlineLevel() < + pSplitColl->GetAttrOutlineLevel() )) && + !pNd->FindTableNode() ) //<-end,zhaojianwei { pEndNd = pNd; @@ -493,4 +513,340 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, return pRet && pRet->GetValue(); } +//#outline level,add by zhaojianwei +BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, int nOutlineLevel ) +{ + if( !pDocShell || !pDocShell->GetMedium() || + ( SPLITDOC_TO_GLOBALDOC == eDocType && get(IDocumentSettingAccess::GLOBAL_DOCUMENT) ) ) + return FALSE; + + USHORT nOutl = 0; + SwOutlineNodes* pOutlNds = (SwOutlineNodes*)&GetNodes().GetOutLineNds(); + SwNodePtr pSttNd; + + const SfxFilter* pFilter; + switch( eDocType ) + { + case SPLITDOC_TO_HTML: + pFilter = SwIoSystem::GetFilterOfFormat( String::CreateFromAscii( + RTL_CONSTASCII_STRINGPARAM( "HTML" ))); + break; + + default: +// case SPLITDOC_TO_GLOBALDOC: + pFilter = SwIoSystem::GetFilterOfFormat( + String::CreateFromAscii( FILTER_XML )); + eDocType = SPLITDOC_TO_GLOBALDOC; + break; + } + + if( !pFilter ) + return FALSE; + + // Undo/Redline aufjedenfall abschalten + DoUndo( FALSE ); + SetRedlineMode_intern( (RedlineMode_t)(GetRedlineMode() & ~nsRedlineMode_t::REDLINE_ON)); + + String sExt( pFilter->GetSuffixes().GetToken(0, ',') ); + if( !sExt.Len() ) + sExt.AssignAscii( "sxw" ); + if( '.' != sExt.GetChar( 0 ) ) + sExt.Insert( '.', 0 ); + + INetURLObject aEntry(rPath); + String sLeading(aEntry.GetBase()); + aEntry.removeSegment(); + String sPath = aEntry.GetMainURL( INetURLObject::NO_DECODE ); + utl::TempFile aTemp(sLeading,&sExt,&sPath ); + aTemp.EnableKillingFile(); + + DateTime aTmplDate; + { + Time a2Min( 0 ); a2Min.SetMin( 2 ); + aTmplDate += a2Min; + } + + + // alle Ungueltigen ueberspringen + while( nOutl < pOutlNds->Count() && + pOutlNds->GetObject( nOutl )->GetIndex() < GetNodes().GetEndOfExtras().GetIndex() ) + ++nOutl; + + do { + pSttNd = 0; + + SwNodePtr pNd; + for( ; nOutl < pOutlNds->Count(); ++nOutl ) + if( ( pNd = pOutlNds->GetObject( nOutl ))->GetTxtNode()->GetAttrOutlineLevel() == nOutlineLevel && + !pNd->FindTableNode() ) + { + pSttNd = pNd; + break; + } + + if( pSttNd ) + { + SwNodePtr pEndNd = 0; + for( ++nOutl; nOutl < pOutlNds->Count(); ++nOutl ) + { + pNd = pOutlNds->GetObject( nOutl ); + + const int nLevel = pNd->GetTxtNode()->GetAttrOutlineLevel(); + + if( ( 0 < nLevel && nLevel <= nOutlineLevel ) && + !pNd->FindTableNode() ) + { + pEndNd = pNd; + + break; + } + } + SwNodeIndex aEndIdx( pEndNd ? *pEndNd + : GetNodes().GetEndOfContent() ); + + String sFileName; + if( pSttNd->GetIndex() + 1 < aEndIdx.GetIndex() ) + { + SfxObjectShellRef xDocSh( new SwDocShell( SFX_CREATE_MODE_INTERNAL )); + if( xDocSh->DoInitNew( 0 ) ) + { + SwDoc* pDoc = ((SwDocShell*)(&xDocSh))->GetDoc(); + + uno::Reference<document::XDocumentPropertiesSupplier> xDPS( + ((SwDocShell*)(&xDocSh))->GetModel(), + uno::UNO_QUERY_THROW); + uno::Reference<document::XDocumentProperties> xDocProps( + xDPS->getDocumentProperties()); + DBG_ASSERT(xDocProps.is(), "Doc has no DocumentProperties"); + // the GlobalDoc is the template + xDocProps->setTemplateName(aEmptyStr); + ::util::DateTime uDT(aTmplDate.Get100Sec(), + aTmplDate.GetSec(), aTmplDate.GetMin(), + aTmplDate.GetHour(), aTmplDate.GetDay(), + aTmplDate.GetMonth(), aTmplDate.GetYear()); + xDocProps->setTemplateDate(uDT); + xDocProps->setTemplateURL(rPath); + //JP 14.06.99: Set the text of the "split para" as title + // from the new doc. Is the current doc has + // a title, insert it at begin. + String sTitle( xDocProps->getTitle() ); + if( sTitle.Len() ) + sTitle.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " )); + sTitle += ((SwTxtNode*)pSttNd)->GetExpandTxt(); + xDocProps->setTitle( sTitle ); + + // Vorlagen ersetzen + pDoc->ReplaceStyles( *this ); + + // KapitelNumerierung uebernehmen + if( pOutlineRule ) + pDoc->SetOutlineNumRule( *pOutlineRule ); + + SwNodeRange aRg( *pSttNd, 0, aEndIdx.GetNode() ); + SwNodeIndex aTmpIdx( pDoc->GetNodes().GetEndOfContent() ); + GetNodes()._Copy( aRg, aTmpIdx, FALSE ); + + // den initialen TextNode loeschen + SwNodeIndex aIdx( pDoc->GetNodes().GetEndOfExtras(), 2 ); + if( aIdx.GetIndex() + 1 != + pDoc->GetNodes().GetEndOfContent().GetIndex() ) + pDoc->GetNodes().Delete( aIdx, 1 ); + + // alle Flys in dem Bereich + _CopyFlyInFly( aRg, aIdx ); + + + // und noch alle Bookmarks + // ????? + + utl::TempFile aTempFile2(sLeading,&sExt,&sPath ); + sFileName = aTempFile2.GetURL(); + SfxMedium* pTmpMed = new SfxMedium( sFileName, + STREAM_STD_READWRITE, TRUE ); + pTmpMed->SetFilter( pFilter ); + + // fuer den HTML-Filter mussen wir aber ein Layout + // haben, damit Textrahmen/Controls/OLE-Objecte korrekt + // als Grafik exportiert werden koennen. + if( SPLITDOC_TO_HTML == eDocType && + pDoc->GetSpzFrmFmts()->Count() ) + { + /* SfxViewFrame* pFrame = */ + SfxViewFrame::CreateViewFrame( *xDocSh, 0, TRUE ); + } + xDocSh->DoSaveAs( *pTmpMed ); + xDocSh->DoSaveCompleted( pTmpMed ); + + // beim Fehler wird keine FileLinkSection eingefuegt + if( xDocSh->GetError() ) + sFileName.Erase(); + } + xDocSh->DoClose(); + } + + // dann koennen ja die Bereiche eingefuegt werden + if( sFileName.Len() ) + { + switch( eDocType ) + { + case SPLITDOC_TO_HTML: + { + // loesche alle Nodes im Bereich und setze im "Start- + // Node" den Link auf das gespeicherte Doc + ULONG nNodeDiff = aEndIdx.GetIndex() - + pSttNd->GetIndex() - 1; + if( nNodeDiff ) + { + SwPaM aTmp( *pSttNd, aEndIdx.GetNode(), 1, -1 ); + aTmp.GetPoint()->nContent.Assign( 0, 0 ); + aTmp.GetMark()->nContent.Assign( 0, 0 ); + SwNodeIndex aSIdx( aTmp.GetMark()->nNode ); + SwNodeIndex aEIdx( aTmp.GetPoint()->nNode ); + + // versuche hinters Ende zu verschieben + if( !aTmp.Move( fnMoveForward, fnGoNode ) ) + { + // na gut, dann an den Anfang + aTmp.Exchange(); + if( !aTmp.Move( fnMoveBackward, fnGoNode )) + { + ASSERT( FALSE, "kein Node mehr vorhanden" ); + } + } + // Bookmarks usw. verschieben + CorrAbs( aSIdx, aEIdx, *aTmp.GetPoint(), TRUE); + + // stehen noch FlyFrames rum, loesche auch diese + const SwPosition* pAPos; + for( USHORT n = 0; n < GetSpzFrmFmts()->Count(); ++n ) + { + SwFrmFmt* pFly = (*GetSpzFrmFmts())[n]; + const SwFmtAnchor* pAnchor = &pFly->GetAnchor(); + if( ( FLY_AT_CNTNT == pAnchor->GetAnchorId() || + FLY_AUTO_CNTNT == pAnchor->GetAnchorId() ) && + 0 != ( pAPos = pAnchor->GetCntntAnchor() ) && + aSIdx <= pAPos->nNode && + pAPos->nNode < aEIdx ) + { + DelLayoutFmt( pFly ); + --n; + } + } + + GetNodes().Delete( aSIdx, nNodeDiff ); + } + + // dann setze im StartNode noch den Link: + SwFmtINetFmt aINet( sFileName , aEmptyStr ); + SwTxtNode* pTNd = (SwTxtNode*)pSttNd; + pTNd->InsertItem( aINet, 0, pTNd->GetTxt().Len() ); + + // wenn der nicht mehr gefunden wird, kann das nur + // ein Bug sein! + if( !pOutlNds->Seek_Entry( pSttNd, &nOutl )) + pSttNd = 0; + ++nOutl; + } + break; + + default: + { + String sNm( INetURLObject( sFileName ).GetName() ); + SwSection aSect( FILE_LINK_SECTION, + GetUniqueSectionName( &sNm )); + SwSectionFmt* pFmt = MakeSectionFmt( 0 ); + aSect.SetLinkFileName(sFileName ); + aSect.SetProtect(); + + aEndIdx--; // im InsertSection ist Ende inclusive + while( aEndIdx.GetNode().IsStartNode() ) + aEndIdx--; + + // JP 06.07.99 - Bug 67361 - is any Section ends or + // starts in the new sectionrange, they must end or + // start before or behind the range! + SwSectionNode* pSectNd = pSttNd->FindSectionNode(); + while( pSectNd && pSectNd->EndOfSectionIndex() + <= aEndIdx.GetIndex() ) + { + const SwNode* pSectEnd = pSectNd->EndOfSectionNode(); + if( pSectNd->GetIndex() + 1 == + pSttNd->GetIndex() ) + { + BOOL bMvIdx = aEndIdx == *pSectEnd; + DelSectionFmt( pSectNd->GetSection().GetFmt() ); + if( bMvIdx ) + aEndIdx--; + } + else + { + SwNodeRange aRg( *pSttNd, *pSectEnd ); + SwNodeIndex aIdx( *pSectEnd, 1 ); + GetNodes()._MoveNodes( aRg, GetNodes(), aIdx ); + } + pSectNd = pSttNd->FindSectionNode(); + } + + pSectNd = aEndIdx.GetNode().FindSectionNode(); + while( pSectNd && pSectNd->GetIndex() > + pSttNd->GetIndex() ) + { + if( aEndIdx < pSectNd->EndOfSectionIndex() ) + { + SwNodeRange aRg( *pSectNd, 1, aEndIdx, 1 ); + SwNodeIndex aIdx( *pSectNd ); + GetNodes()._MoveNodes( aRg, GetNodes(), aIdx ); + } + + pSectNd = pSttNd->FindSectionNode(); + } + + SwNodeIndex aStartIdx(*pSttNd); + + if (aEndIdx >= aStartIdx) + pSectNd = GetNodes().InsertSection + (aStartIdx, *pFmt, aSect, &aEndIdx, FALSE ); + else + pSectNd = GetNodes().InsertSection + (aEndIdx, *pFmt, aSect, &aStartIdx, FALSE ); + + pSectNd->GetSection().CreateLink( CREATE_CONNECT ); + } + break; + } + } + } + } while( pSttNd ); + + if( pOutlNds != &GetNodes().GetOutLineNds() ) + delete pOutlNds; + + switch( eDocType ) + { + case SPLITDOC_TO_HTML: + if( get(IDocumentSettingAccess::GLOBAL_DOCUMENT) ) + { + while( GetSections().Count() ) + DelSectionFmt( GetSections()[ 0 ] ); + + SfxFilterContainer* pFCntnr = pDocShell->GetFactory().GetFilterContainer(); + pFilter = pFCntnr->GetFilter4EA( pFilter->GetTypeName(), SFX_FILTER_EXPORT ); + } + break; + +// case SPLITDOC_TO_GLOBALDOC: + default: + set(IDocumentSettingAccess::GLOBAL_DOCUMENT, true); + set(IDocumentSettingAccess::GLOBAL_DOCUMENT_SAVE_LINKS, false); + } + + SfxRequest aReq( SID_SAVEASDOC, SFX_CALLMODE_SYNCHRON, GetAttrPool() ); + aReq.AppendItem( SfxStringItem( SID_FILE_NAME, rPath ) ); + aReq.AppendItem( SfxBoolItem( SID_SAVETO, sal_True ) ); + if(pFilter) + aReq.AppendItem( SfxStringItem( SID_FILTER_NAME, pFilter->GetName() ) ); + const SfxBoolItem *pRet = (const SfxBoolItem*)pDocShell->ExecuteSlot( aReq ); + + return pRet && pRet->GetValue(); +}//<-end,zhaojianwei diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index e1da4f1c83..a7385f093c 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -137,7 +137,8 @@ void SwDoc::PropagateOutlineRule() { SwTxtFmtColl *pColl = (*pTxtFmtCollTbl)[n]; - if (NO_NUMBERING != pColl->GetOutlineLevel()) + // if (NO_NUMBERING != pColl->GetOutlineLevel())//#outline level,zhaojianwei + if(pColl->IsAssignedToListLevelOfOutlineStyle())//<-end,zhaojianwei { SwClientIter aIter(*pColl); @@ -160,36 +161,6 @@ void SwDoc::PropagateOutlineRule() pColl->SetFmtAttr(aNumItem); } } - - SwClient * pClient = aIter.First(TYPE(SwTxtNode)); - while (pClient) - { - SwTxtNode * pTxtNode = ((SwTxtNode *) pClient); - - if (pTxtNode->GetOutlineLevel() == NO_NUMBERING) - { - BYTE nOutlineLevel = pColl->GetOutlineLevel(); - - if (nOutlineLevel < MAXLEVEL) - { - aNodes.UpdateOutlineNode(*pTxtNode); - pTxtNode->UpdateOutlineState(); - } - } - - // --> OD 2006-01-12 #126588# - applying outline level of - // paragraph style at text node, if its numbering rule is the - // outline numbering rule doesn't seem to be necessary due to - // the changes in <SwTxtNode::SyncNumberAndNumRule()>. - // Thus, only assert, if numbering level of text node with - // outline numbering rule doesn't fit to outline level of - // its paragraph style. - ASSERT( pTxtNode->GetNumRule() != GetOutlineNumRule() || - pTxtNode->GetActualListLevel() == pColl->GetOutlineLevel(), - "<SwDoc::PropagateOutlineRule()> - text node doesn't have excepted numbering level" ); - - pClient = aIter.Next(); - } } } } @@ -226,9 +197,14 @@ BOOL SwDoc::OutlineUpDown( const SwPaM& rPam, short nOffset ) for( n = 0; n < pTxtFmtCollTbl->Count(); ++n ) { - BYTE nLevel = (*pTxtFmtCollTbl)[ n ]->GetOutlineLevel(); - if( nLevel < MAXLEVEL ) + //BYTE nLevel = (*pTxtFmtCollTbl)[ n ]->GetOutlineLevel();//#outline level,zhaojianwei + //if( nLevel < MAXLEVEL ) + // aCollArr[ nLevel ] = (*pTxtFmtCollTbl)[ n ]; + if((*pTxtFmtCollTbl)[ n ]->IsAssignedToListLevelOfOutlineStyle()) + { + const int nLevel = (*pTxtFmtCollTbl)[ n ]->GetAssignedOutlineStyleLevel(); aCollArr[ nLevel ] = (*pTxtFmtCollTbl)[ n ]; + }//<-end,zhaojianwei } /* --> #111107# */ @@ -252,10 +228,11 @@ BOOL SwDoc::OutlineUpDown( const SwPaM& rPam, short nOffset ) SwTxtFmtColl *aTmpColl = GetTxtCollFromPool(static_cast<sal_uInt16>(RES_POOLCOLL_HEADLINE1 + n)); - if (aTmpColl->GetOutlineLevel() == n) + //if (aTmpColl->GetOutlineLevel() == n)//#outline level,zhaojianwei + if( aTmpColl->IsAssignedToListLevelOfOutlineStyle() && + aTmpColl->GetAssignedOutlineStyleLevel() == n )//<-end,zhaojianwei { aCollArr[n] = aTmpColl; - break; } } @@ -281,10 +258,11 @@ BOOL SwDoc::OutlineUpDown( const SwPaM& rPam, short nOffset ) SwTxtFmtColl *aTmpColl = GetTxtCollFromPool(static_cast<sal_uInt16>(RES_POOLCOLL_HEADLINE1 + n)); - if (aTmpColl->GetOutlineLevel() == n) + //if (aTmpColl->GetOutlineLevel() == n)//#outline level,zhaojianwei + if( aTmpColl->IsAssignedToListLevelOfOutlineStyle() && + aTmpColl->GetAssignedOutlineStyleLevel() == n )//<-end,zhaojianwei { aCollArr[n] = aTmpColl; - break; } } @@ -361,10 +339,27 @@ BOOL SwDoc::OutlineUpDown( const SwPaM& rPam, short nOffset ) { SwTxtNode* pTxtNd = rOutlNds[ n ]->GetTxtNode(); SwTxtFmtColl* pColl = pTxtNd->GetTxtColl(); - int nLevel = pColl->GetOutlineLevel(); - - if (aMoveArr[nLevel] == -1) - bMoveApplicable = false; +// int nLevel = pColl->GetOutlineLevel();//#outline level,zhaojianwei +// if (aMoveArr[nLevel] == -1) +// bMoveApplicable = false; + if( pColl->IsAssignedToListLevelOfOutlineStyle() ) + { + const int nLevel = pColl->GetAssignedOutlineStyleLevel(); + if (aMoveArr[nLevel] == -1) + bMoveApplicable = false; + }//<-end,zhaojianwei + // --> OD 2008-12-16 #i70748# + // Check on outline level attribute of text node, if text node is + // not an outline via a to outline style assigned paragraph style. + else + { + const int nNewOutlineLevel = pTxtNd->GetAttrOutlineLevel() + nOffset; + if ( nNewOutlineLevel < 1 || nNewOutlineLevel > MAXLEVEL ) + { + bMoveApplicable = false; + } + } + // <-- } if (! bMoveApplicable ) @@ -386,22 +381,33 @@ BOOL SwDoc::OutlineUpDown( const SwPaM& rPam, short nOffset ) SwTxtNode* pTxtNd = rOutlNds[ n ]->GetTxtNode(); SwTxtFmtColl* pColl = pTxtNd->GetTxtColl(); - ASSERT(pColl->GetOutlineLevel() < MAXLEVEL, - "non outline node in outline nodes?"); + if( pColl->IsAssignedToListLevelOfOutlineStyle() ) + { + // ASSERT(pColl->GetOutlineLevel() < MAXLEVEL, //#outline level,removed by zhaojianwei + // "non outline node in outline nodes?"); + //int nLevel = pColl->GetOutlineLevel(); + const int nLevel = pColl->GetAssignedOutlineStyleLevel();//#outline level,add by zhaojianwei - int nLevel = pColl->GetOutlineLevel(); + ASSERT(aMoveArr[nLevel] >= 0, + "move table: current TxtColl not found when building table!"); - ASSERT(aMoveArr[nLevel] >= 0, - "move table: current TxtColl not found when building table!"); + if (nLevel < MAXLEVEL && aMoveArr[nLevel] >= 0) + { + pColl = aCollArr[ aMoveArr[nLevel] ]; - if (nLevel < MAXLEVEL && aMoveArr[nLevel] >= 0) - { - pColl = aCollArr[ aMoveArr[nLevel] ]; + if (pColl != NULL) + pColl = (SwTxtFmtColl*)pTxtNd->ChgFmtColl( pColl ); + } - if (pColl != NULL) - pColl = (SwTxtFmtColl*)pTxtNd->ChgFmtColl( pColl ); } + else if( pTxtNd->GetAttrOutlineLevel() > 0) //#outline level,add by zhaojianwei + { + int nLevel = pTxtNd->GetAttrOutlineLevel() + nOffset; + if( 0 <= nLevel && nLevel <= MAXLEVEL) + pTxtNd->SetAttrOutlineLevel( nLevel ); + + }//<-end,zhaojianwei n++; // Undo ??? @@ -432,10 +438,13 @@ BOOL SwDoc::MoveOutlinePara( const SwPaM& rPam, short nOffset ) USHORT nAktPos = 0; SwNodeIndex aSttRg( rStt.nNode ), aEndRg( rEnd.nNode ); - BYTE nOutLineLevel = NO_NUMBERING; + //BYTE nOutLineLevel = NO_NUMBERING; //#outline level,zhaojianwei + int nOutLineLevel = MAXLEVEL; //<-end,zhaojianwei SwNode* pSrch = &aSttRg.GetNode(); - if( pSrch->IsTxtNode() ) - nOutLineLevel = static_cast<BYTE>(((SwTxtNode*)pSrch)->GetOutlineLevel()); + //if( pSrch->IsTxtNode() ) //#outline level,zhaojianwei + // nOutLineLevel = static_cast<BYTE>(((SwTxtNode*)pSrch)->GetOutlineLevel()); + if( pSrch->IsTxtNode()) + nOutLineLevel = static_cast<BYTE>(((SwTxtNode*)pSrch)->GetAttrOutlineLevel()-1);//<-end,zhaojianwei SwNode* pEndSrch = &aEndRg.GetNode(); if( !GetNodes().GetOutLineNds().Seek_Entry( pSrch, &nAktPos ) ) { @@ -457,7 +466,8 @@ BOOL SwDoc::MoveOutlinePara( const SwPaM& rPam, short nOffset ) if( GetNodes().GetOutLineNds().Seek_Entry( pEndSrch, &nTmpPos ) ) { if( !pEndSrch->IsTxtNode() || pEndSrch == pSrch || - nOutLineLevel < ((SwTxtNode*)pEndSrch)->GetOutlineLevel() ) + //nOutLineLevel < ((SwTxtNode*)pEndSrch)->GetOutlineLevel() )//#outline level,zhaojianwei + nOutLineLevel < ((SwTxtNode*)pEndSrch)->GetAttrOutlineLevel()-1 )//<-end,zhaojianwei ++nTmpPos; // For sub outlines only! } @@ -648,7 +658,8 @@ USHORT lcl_FindOutlineNum( const SwNodes& rNds, String& rName ) for( ; nPos < rOutlNds.Count(); ++nPos ) { pNd = rOutlNds[ nPos ]->GetTxtNode(); - BYTE nLvl = pNd->GetTxtColl()->GetOutlineLevel(); + //BYTE nLvl = pNd->GetTxtColl()->GetOutlineLevel(); //#outline level,zhaojianwei + const int nLvl = pNd->GetAttrOutlineLevel()-1; //<-end,zhaojianwei if( nLvl == nLevel - 1) { // check for the outline num @@ -1649,8 +1660,10 @@ void SwDoc::DelNumRules( const SwPaM& rPam ) if( RES_CONDTXTFMTCOLL == pTNd->GetFmtColl()->Which() ) pTNd->ChkCondColl(); - else if( !pOutlNd && NO_NUMBERING != - ((SwTxtFmtColl*)pTNd->GetFmtColl())->GetOutlineLevel() ) + //else if( !pOutlNd && NO_NUMBERING != //#outline level,zhaojianwei + // ((SwTxtFmtColl*)pTNd->GetFmtColl())->GetOutlineLevel() ) + else if( !pOutlNd && + ((SwTxtFmtColl*)pTNd->GetFmtColl())->IsAssignedToListLevelOfOutlineStyle() )//<-end,zhaojianwei pOutlNd = pTNd; } } @@ -2739,7 +2752,8 @@ sal_Int32 SwDoc::getOutlineNodesCount() const int SwDoc::getOutlineLevel( const sal_Int32 nIdx ) const { return GetNodes().GetOutLineNds()[ static_cast<USHORT>(nIdx) ]-> - GetTxtNode()->GetOutlineLevel(); + // GetTxtNode()->GetOutlineLevel(); //#outline level,zhaojianwei + GetTxtNode()->GetAttrOutlineLevel()-1; //<-end,zhaojianwei } String SwDoc::getOutlineText( const sal_Int32 nIdx, diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index aa9f8b3cc0..f37103ff87 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -1297,7 +1297,8 @@ void SwTOXBaseSection::UpdateOutline( const SwTxtNode* pOwnChapterNode ) ::SetProgressState( 0, pDoc->GetDocShell() ); SwTxtNode* pTxtNd = rOutlNds[ n ]->GetTxtNode(); if( pTxtNd && pTxtNd->Len() && pTxtNd->GetDepends() && - USHORT(pTxtNd->GetTxtColl()->GetOutlineLevel()+1) <= GetLevel() && + //USHORT(pTxtNd->GetTxtColl()->GetOutlineLevel()+1) <= GetLevel() && //#outline level,zhaojianwei + USHORT( pTxtNd->GetAttrOutlineLevel()) <= GetLevel() && //<-end,zhaojianwei pTxtNd->GetFrm() && !pTxtNd->HasHiddenParaField() && !pTxtNd->HasHiddenCharAttribute( true ) && @@ -1330,8 +1331,9 @@ void SwTOXBaseSection::UpdateTemplate( const SwTxtNode* pOwnChapterNode ) if( !pColl || ( TOX_CONTENT == SwTOXBase::GetType() && GetCreateType() & nsSwTOXElement::TOX_OUTLINELEVEL && - NO_NUMBERING != pColl->GetOutlineLevel() ) ) - continue; + //NO_NUMBERING != pColl->GetOutlineLevel() ) )//#outline level,zhaojianwei + pColl->IsAssignedToListLevelOfOutlineStyle()) )//<-end,zhaojianwei + continue; SwClientIter aIter( *pColl ); SwTxtNode* pTxtNd = (SwTxtNode*)aIter.First( TYPE( SwTxtNode )); @@ -1549,7 +1551,7 @@ void SwTOXBaseSection::UpdateCntnt( SwTOXElement eMyType, if( pCNd ) { //find node in body text - USHORT nSetLevel = USHRT_MAX; + int nSetLevel = USHRT_MAX; //#111105# tables of tables|illustrations|objects don't support hierarchies if( IsLevelFromChapter() && @@ -1561,9 +1563,11 @@ void SwTOXBaseSection::UpdateCntnt( SwTOXElement eMyType, MAXLEVEL - 1 ); if( pOutlNd ) { - USHORT nTmp = pOutlNd->GetTxtColl()->GetOutlineLevel(); - if( nTmp < NO_NUMBERING ) - nSetLevel = nTmp + 1; + //USHORT nTmp = pOutlNd->GetTxtColl()->GetOutlineLevel();//#outline level,zhaojianwei + //if( nTmp < NO_NUMBERING ) + // nSetLevel = nTmp + 1; + if( pOutlNd->GetTxtColl()->IsAssignedToListLevelOfOutlineStyle()) + nSetLevel = pOutlNd->GetTxtColl()->GetAttrOutlineLevel() ;//<-end,zhaojianwei } } @@ -1571,7 +1575,9 @@ void SwTOXBaseSection::UpdateCntnt( SwTOXElement eMyType, ::lcl_FindChapterNode( *pCNd, 0 ) == pOwnChapterNode )) { SwTOXPara * pNew = new SwTOXPara( *pCNd, eMyType, - USHRT_MAX != nSetLevel ? nSetLevel : FORM_ALPHA_DELIMITTER ); + ( USHRT_MAX != nSetLevel ) + ? static_cast<USHORT>(nSetLevel) + : FORM_ALPHA_DELIMITTER ); InsertSorted( pNew ); } } @@ -1616,9 +1622,14 @@ void SwTOXBaseSection::UpdateTable( const SwTxtNode* pOwnChapterNode ) ::lcl_FindChapterNode( *pCNd, MAXLEVEL - 1 ); if( pOutlNd ) { - USHORT nTmp = pOutlNd->GetTxtColl()->GetOutlineLevel(); - if( nTmp < NO_NUMBERING ) - pNew->SetLevel( nTmp + 1 ); + //USHORT nTmp = pOutlNd->GetTxtColl()->GetOutlineLevel();//#outline level,zhaojianwei + //if( nTmp < NO_NUMBERING ) + // pNew->SetLevel( nTmp + 1 ); + if( pOutlNd->GetTxtColl()->IsAssignedToListLevelOfOutlineStyle()) + { + const int nTmp = pOutlNd->GetTxtColl()->GetAttrOutlineLevel(); + pNew->SetLevel( static_cast<USHORT>(nTmp) );//<-end ,zhaojianwei + } } } InsertSorted(pNew); diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx index 6859aeeb0a..002c482f03 100644 --- a/sw/source/core/doc/fmtcol.cxx +++ b/sw/source/core/doc/fmtcol.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -46,6 +46,12 @@ #include <numrule.hxx> #include <paratr.hxx> +//--> #outlinelevel added by zhaojianwei +#ifndef _SFXINTITEM_HXX +#include <svtools/intitem.hxx> +#endif +//<--end + TYPEINIT1( SwTxtFmtColl, SwFmtColl ); TYPEINIT1( SwGrfFmtColl, SwFmtColl ); TYPEINIT1( SwConditionTxtFmtColl, SwTxtFmtColl ); @@ -75,7 +81,7 @@ namespace TxtFmtCollFunc // --> OD 2007-01-24 #i73790# // if ( pTxtFmtColl->AssignedToListLevelOfOutlineStyle() ) if ( !pTxtFmtColl->StayAssignedToListLevelOfOutlineStyle() && - pTxtFmtColl->AssignedToListLevelOfOutlineStyle() ) + pTxtFmtColl->IsAssignedToListLevelOfOutlineStyle() ) // <-- { if ( !pNewNumRuleItem ) @@ -153,7 +159,7 @@ void SwTxtFmtColl::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) SvxLRSpaceItem *pNewLRSpace = 0, *pOldLRSpace = 0; SvxFontHeightItem* aFontSizeArr[3] = {0,0,0}; // --> OD 2006-10-17 #i70223# - const bool bAssignedToListLevelOfOutlineStyle( AssignedToListLevelOfOutlineStyle() ); + const bool bAssignedToListLevelOfOutlineStyle(IsAssignedToListLevelOfOutlineStyle());//#outline level ,zhaojianwei const SwNumRuleItem* pNewNumRuleItem( 0L ); // <-- @@ -428,9 +434,24 @@ USHORT 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; + // <-- USHORT nRet = SwFmtColl::ResetAllFmtAttr(); + // --> OD 2008-12-16 #i70748# + if ( nAssignedOutlineStyleLevel != -1 ) + { + AssignToListLevelOfOutlineStyle( nAssignedOutlineStyleLevel ); + } + // <-- + mbStayAssignedToListLevelOfOutlineStyle = bOldState; return nRet; @@ -640,18 +661,38 @@ void SwConditionTxtFmtColl::SetConditions( const SwFmtCollConditions& rCndClls ) aCondColls.Insert( pNew, n ); } } +//#outline level, zhaojianwei +void SwTxtFmtColl::SetAttrOutlineLevel( int nLevel) +{ + ASSERT( 0 <= nLevel && nLevel <= MAXLEVEL ,"SwTxtFmtColl: Level Out Of Range" ); + SetFmtAttr( SfxUInt16Item( RES_PARATR_OUTLINELEVEL, + static_cast<UINT16>(nLevel) ) ); +} -void SwTxtFmtColl::SetOutlineLevel( BYTE nLevel ) +int SwTxtFmtColl::GetAttrOutlineLevel() const { - ASSERT( nLevel < MAXLEVEL || nLevel == NO_NUMBERING , - "SwTxtFmtColl: Level too low" ); - if (!(nLevel < MAXLEVEL || nLevel == NO_NUMBERING)) - // take care of out-of-bounds values that may occasionally crash the office - // such values may for example occur directly from some bad used API calls - nOutlineLevel = NO_NUMBERING; - else - nOutlineLevel = nLevel; + return ((const SfxUInt16Item &)GetFmtAttr(RES_PARATR_OUTLINELEVEL)).GetValue(); } +int SwTxtFmtColl::GetAssignedOutlineStyleLevel() const +{ + ASSERT( IsAssignedToListLevelOfOutlineStyle(), + "<SwTxtFmtColl::GetAssignedOutlineStyleLevel()> - misuse of method"); + return GetAttrOutlineLevel() - 1; +} + +void SwTxtFmtColl::AssignToListLevelOfOutlineStyle(const int nAssignedListLevel) +{ + + mbAssignedToOutlineStyle = true; + SetAttrOutlineLevel(nAssignedListLevel+1); +} + +void SwTxtFmtColl::DeleteAssignmentToListLevelOfOutlineStyle() +{ + mbAssignedToOutlineStyle = false; + ResetFmtAttr(RES_PARATR_OUTLINELEVEL); +} +//<-end,zhaojianwei //FEATURE::CONDCOLL diff --git a/sw/source/core/doc/ftnidx.cxx b/sw/source/core/doc/ftnidx.cxx index 4731d2e652..b0a8cb67af 100644 --- a/sw/source/core/doc/ftnidx.cxx +++ b/sw/source/core/doc/ftnidx.cxx @@ -113,11 +113,13 @@ void SwFtnIdxs::UpdateFtn( const SwNodeIndex& rStt ) for( n = 0; n < rOutlNds.Count(); ++n ) if( rOutlNds[ n ]->GetIndex() > rStt.GetIndex() ) break; // gefunden - else if( !rOutlNds[ n ]->GetTxtNode()->GetTxtColl()->GetOutlineLevel() ) + //else if( !rOutlNds[ n ]->GetTxtNode()->GetTxtColl()->GetOutlineLevel() ) //#outline level,zhaojianwei + else if ( rOutlNds[ n ]->GetTxtNode()->GetAttrOutlineLevel() == 1 ) //<-end,zhaojianwei pCapStt = rOutlNds[ n ]; // Start eines neuen Kapitels // dann suche jetzt noch das Ende vom Bereich for( ; n < rOutlNds.Count(); ++n ) - if( !rOutlNds[ n ]->GetTxtNode()->GetTxtColl()->GetOutlineLevel() ) + //if( !rOutlNds[ n ]->GetTxtNode()->GetTxtColl()->GetOutlineLevel() )//#outline level,zhaojianwei + if ( rOutlNds[ n ]->GetTxtNode()->GetAttrOutlineLevel() == 1 )//<-end,zhaojianwei { nCapEnd = rOutlNds[ n ]->GetIndex(); // Ende des gefundenen Kapitels break; @@ -231,7 +233,8 @@ void SwFtnIdxs::UpdateAllFtn() nFtnIdx = 0; // Index in das FtnIdx-Array for( USHORT n = 0; n < rOutlNds.Count(); ++n ) { - if( !rOutlNds[ n ]->GetTxtNode()->GetTxtColl()->GetOutlineLevel() ) + //if( !rOutlNds[ n ]->GetTxtNode()->GetTxtColl()->GetOutlineLevel() )//#outline level,zhaojianwei + if ( rOutlNds[ n ]->GetTxtNode()->GetAttrOutlineLevel() == 1 )//<-end,zhaojianwei { ULONG nCapStt = rOutlNds[ n ]->GetIndex(); // Start eines neuen Kapitels for( ; nFtnIdx < Count(); ++nFtnIdx ) diff --git a/sw/source/core/doc/poolfmt.cxx b/sw/source/core/doc/poolfmt.cxx index c555614013..3580b03437 100644 --- a/sw/source/core/doc/poolfmt.cxx +++ b/sw/source/core/doc/poolfmt.cxx @@ -233,7 +233,8 @@ void lcl_SetHeadline( SwDoc* pDoc, SwTxtFmtColl* pColl, { if( !( nOutLvlBits & ( 1 << nLevel )) ) { - pColl->SetOutlineLevel( nLevel ); + //pColl->SetOutlineLevel( nLevel ); //#outline level zhaojianwei + pColl->AssignToListLevelOfOutlineStyle(nLevel);//<-end,zhaojianwei if( !bHTMLMode ) { SwNumRule * pOutlineRule = pDoc->GetOutlineNumRule(); @@ -344,8 +345,10 @@ SwTxtFmtColl* SwDoc::GetTxtCollFromPool( USHORT nId, bool bRegardLanguage ) { return pNewColl; } - if( pNewColl->GetOutlineLevel() < MAXLEVEL ) - nOutLvlBits |= ( 1 << pNewColl->GetOutlineLevel() ); + //if( pNewColl->GetOutlineLevel() < MAXLEVEL ) //#outline level,zhaojianwei + //nOutLvlBits |= ( 1 << pNewColl->GetOutlineLevel() ); + if( pNewColl->IsAssignedToListLevelOfOutlineStyle()) + nOutLvlBits |= ( 1 << pNewColl->GetAssignedOutlineStyleLevel() );//<-end,zhaojianwei } // bis hierher nicht gefunden -> neu anlegen diff --git a/sw/source/core/docnode/ndnum.cxx b/sw/source/core/docnode/ndnum.cxx index 033ed5f7be..ef07ac70f6 100644 --- a/sw/source/core/docnode/ndnum.cxx +++ b/sw/source/core/docnode/ndnum.cxx @@ -125,75 +125,84 @@ void SwNodes::UpdateOutlineNode(SwNode & rNd) // die Gliederungs-Felder Updaten GetDoc()->GetSysFldType( RES_CHAPTERFLD )->UpdateFlds(); } -} - -void SwNodes::UpdateOutlineNode( const SwNode& rNd, BYTE nOldLevel, - BYTE nNewLevel ) -{ - const SwNodePtr pSrch = (SwNodePtr)&rNd; - USHORT nSttPos; - BOOL bSeekIdx = pOutlineNds->Seek_Entry( pSrch, &nSttPos ); - - if( NO_NUMBERING == nOldLevel ) // neuen Level einfuegen - { - // nicht vorhanden, also einfuegen - //ASSERT( !bSeekIdx, "Der Node ist schon als OutlineNode vorhanden" ); - - //JP 12.03.99: 63293 - Nodes vom RedlineBereich NIE aufnehmen - ULONG nNd = rNd.GetIndex(); - if( nNd < GetEndOfRedlines().GetIndex() && - nNd > GetEndOfRedlines().StartOfSectionNode()->GetIndex() ) - return ; - - // jetzt noch alle nachfolgende Outline-Nodes updaten - if (! bSeekIdx) - { - // --> OD 2005-11-03 #125329# - // assure that node <pSrch> is in the correct nodes array - if ( &(pSrch->GetNodes()) == this ) - { - pOutlineNds->Insert( pSrch ); - } - else - { - ASSERT( false, - "<SwNodes::UpdateOutlineNode(..)> - node <pSrch> isn't in correct nodes array. This is a serious defect -> inform OD" ); - } - // <-- - } - - } - else if( NO_NUMBERING == nNewLevel ) // Level entfernen - { - if( !bSeekIdx ) - return; - - // jetzt noch alle nachfolgende Outline-Nodes updaten - pOutlineNds->Remove( nSttPos ); - } - else if( !bSeekIdx ) // Update und Index nicht gefunden ?? - return ; - - { - SwTxtNode & rTxtNd = (SwTxtNode &) rNd; - SwPaM aPam(rTxtNd); // #115901# - - if (nNewLevel != NO_NUMBERING) // #115901# - { - rTxtNd.SetAttrListLevel(rTxtNd.GetTxtColl()->GetOutlineLevel()); - - rTxtNd.NumRuleChgd(); - } - else - { - GetDoc()->DelNumRules(aPam); - } - } - - // die Gliederungs-Felder Updaten - GetDoc()->GetSysFldType( RES_CHAPTERFLD )->UpdateFlds(); - GetDoc()->ChkCondColls(); -} +} + +//void SwNodes::UpdateOutlineNode( const SwNode& rNd, BYTE nOldLevel, //#outline level,removed by zhaojianwei +// BYTE nNewLevel ) +//{ +// const SwNodePtr pSrch = (SwNodePtr)&rNd; +// USHORT nSttPos; +// BOOL bSeekIdx = pOutlineNds->Seek_Entry( pSrch, &nSttPos ); +// +// //if( NO_NUMBERING == nOldLevel ) //#outline level,zhaojianwei +// if( 0 == nOldLevel ) //<-end, zhaojianwei +// { +// // nicht vorhanden, also einfuegen +// //ASSERT( !bSeekIdx, "Der Node ist schon als OutlineNode vorhanden" ); +// +// //JP 12.03.99: 63293 - Nodes vom RedlineBereich NIE aufnehmen +// ULONG nNd = rNd.GetIndex(); +// if( nNd < GetEndOfRedlines().GetIndex() && +// nNd > GetEndOfRedlines().StartOfSectionNode()->GetIndex() ) +// return ; +// +// // jetzt noch alle nachfolgende Outline-Nodes updaten +// if (! bSeekIdx) +// { +// // --> OD 2005-11-03 #125329# +// // assure that node <pSrch> is in the correct nodes array +// if ( &(pSrch->GetNodes()) == this ) +// { +// pOutlineNds->Insert( pSrch ); +// } +// else +// { +// ASSERT( false, +// "<SwNodes::UpdateOutlineNode(..)> - node <pSrch> isn't in correct nodes array. This is a serious defect -> inform OD" ); +// } +// // <-- +// } +// +// } +// //else if( NO_NUMBERING == nNewLevel ) //#outline level,removed by zhaojianwei +// else if( 0 == nNewLevel ) //<-end,added by zhaojianwei // Level entfernen +// { +// if( !bSeekIdx ) +// return; +// +// // jetzt noch alle nachfolgende Outline-Nodes updaten +// pOutlineNds->Remove( nSttPos ); +// } +// else if( !bSeekIdx ) // Update und Index nicht gefunden ?? +// return ; +// +// { +// SwTxtNode & rTxtNd = (SwTxtNode &) rNd; +// SwPaM aPam(rTxtNd); // #115901# +// +// //if (nNewLevel != NO_NUMBERING) //#outline level,zhaojianwei // #115901# +// if (nNewLevel != 0) //<-end,zhaojianwei // #115901# +// { +// //rTxtNd.SetLevel(rTxtNd.GetTxtColl()->GetOutlineLevel()); //#outline level,zhaojianwei +// //rTxtNd.NumRuleChgd(); +// if(rTxtNd.GetTxtColl()->IsAssignedToListLevelOfOutlineStyle()) +// { +// rTxtNd.SetLevel(rTxtNd.GetTxtColl()->GetAssignedOutlineStyleLevel()); +// rTxtNd.NumRuleChgd(); +// }//<-end,zhaojianwei +// +// //GetDoc()->SetNumRule(aPam, *GetDoc()->GetOutlineNumRule()); +// } +// else +// { +// GetDoc()->DelNumRules(aPam); +// } +// } +// +// // die Gliederungs-Felder Updaten +// GetDoc()->GetSysFldType( RES_CHAPTERFLD )->UpdateFlds(); +// GetDoc()->ChkCondColls(); +//}//<-end,zhaojianwei void SwNodes::UpdtOutlineIdx( const SwNode& rNd ) { diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 42c58ee12f..4c7e845fa5 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -344,7 +344,8 @@ BOOL SwNodes::InsBoxen( SwTableNode* pTblNd, pPrvBox = new SwTableBox( pBoxFmt, *pSttNd, pLine ); pLine->GetTabBoxes().C40_INSERT( SwTableBox, pPrvBox, nInsPos + n ); - if( NO_NUMBERING == pTxtColl->GetOutlineLevel() + //if( NO_NUMBERING == pTxtColl->GetOutlineLevel()//#outline level,zhaojianwei + if( ! pTxtColl->IsAssignedToListLevelOfOutlineStyle()//<-end,zhaojianwei //FEATURE::CONDCOLL && RES_CONDTXTFMTCOLL != pTxtColl->Which() //FEATURE::CONDCOLL diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index e8e7c4b776..e32c2ab9b1 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -880,8 +880,10 @@ const SwTxtNode* SwNode::FindOutlineNodeOfLevel( BYTE nLvl ) const else { // oder ans Feld und von dort holen !! - while( nPos && nLvl < ( pRet = rONds[nPos]->GetTxtNode() ) - ->GetTxtColl()->GetOutlineLevel() ) + while( nPos && + nLvl < ( pRet = rONds[nPos]->GetTxtNode() ) + //->GetTxtColl()->GetOutlineLevel() )//#outline level,zhaojianwei + ->GetAttrOutlineLevel() - 1 ) //<-end,zhaojianwei --nPos; if( !nPos ) // bei 0 gesondert holen !! @@ -1998,7 +2000,7 @@ BOOL SwCntntNode::IsAnyCondition( SwCollCondition& rTmp ) const if( pOutlNd->IsOutline()) { - rTmp.SetCondition( PARA_IN_OUTLINE, pOutlNd->GetOutlineLevel() ); + rTmp.SetCondition( PARA_IN_OUTLINE, pOutlNd->GetAttrOutlineLevel() - 1 ); return TRUE; } } diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx index f809c692db..4cefc2dd5a 100644 --- a/sw/source/core/docnode/nodes.cxx +++ b/sw/source/core/docnode/nodes.cxx @@ -188,7 +188,8 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, ULONG nSz, pTxtNode->RemoveFromList(); // <-- - if ( pTxtNode->GetTxtColl()->GetOutlineLevel() != NO_NUMBERING ) + //if ( pTxtNode->GetTxtColl()->GetOutlineLevel() != NO_NUMBERING )//#outline level,zhaojianwei + if ( pTxtNode->GetAttrOutlineLevel() != 0 )//<-end,zhaojianwei { const SwNodePtr pSrch = (SwNodePtr)&rNd; pOutlineNds->Remove( pSrch ); @@ -207,7 +208,8 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, ULONG nSz, // <-- if( bInsOutlineIdx && - NO_NUMBERING != rTxtNd.GetTxtColl()->GetOutlineLevel() ) + //NO_NUMBERING != rTxtNd.GetTxtColl()->GetOutlineLevel() )//#outline level,zhaojianwei + 0 != rTxtNd.GetAttrOutlineLevel() )//<-end,zhaojianwei { const SwNodePtr pSrch = (SwNodePtr)&rNd; pOutlineNds->Insert( pSrch ); @@ -248,7 +250,8 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, ULONG nSz, SwTxtNode* pTxtNd = (SwTxtNode*)pNd; // loesche die Gliederungs-Indizies aus dem alten Nodes-Array - if( NO_NUMBERING != pTxtNd->GetTxtColl()->GetOutlineLevel() ) + //if( NO_NUMBERING != pTxtNd->GetTxtColl()->GetOutlineLevel() )//#outline level,zhaojianwei + if( 0 != pTxtNd->GetAttrOutlineLevel() )//<-end,zhaojianwei pOutlineNds->Remove( pNd ); // muss die Rule kopiere werden? @@ -287,9 +290,13 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, ULONG nSz, { const SwpHints* pHts = pTxtNd->GetpSwpHints(); // setze die OultineNodes im neuen Nodes-Array - if( bInsOutlineIdx && NO_NUMBERING != - pTxtNd->GetTxtColl()->GetOutlineLevel() ) + //if( bInsOutlineIdx && NO_NUMBERING != //#outline level,removed by zhaojianwei + // pTxtNd->GetTxtColl()->GetOutlineLevel() ) + if( bInsOutlineIdx && + 0 != pTxtNd->GetAttrOutlineLevel() ) //#outline level,added by zhaojianwei + { rNds.pOutlineNds->Insert( pTxtNd ); + } // --> OD 2008-03-13 #refactorlists# // pTxtNd->SyncNumberAndNumRule(); @@ -554,8 +561,10 @@ BOOL SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, // setze bei Start/EndNodes die richtigen Indizies // loesche die Gliederungs-Indizies aus // dem alten Nodes-Array - if( pCNd->IsTxtNode() && NO_NUMBERING != - ((SwTxtNode*)pCNd)->GetTxtColl()->GetOutlineLevel() ) + //if( pCNd->IsTxtNode() && NO_NUMBERING != //#outline level,zhaojianwei + // ((SwTxtNode*)pCNd)->GetTxtColl()->GetOutlineLevel() ) + if( pCNd->IsTxtNode() && 0 != + ((SwTxtNode*)pCNd)->GetAttrOutlineLevel() )//<-end,by zhaojianwei pOutlineNds->Remove( pCNd ); else pCNd = 0; @@ -593,8 +602,10 @@ BOOL SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, ((SwSectionNode*)pNd)->DelFrms(); } */ - BOOL bOutlNd = pNd->IsTxtNode() && NO_NUMBERING != - ((SwTxtNode*)pNd)->GetTxtColl()->GetOutlineLevel(); + //BOOL bOutlNd = pNd->IsTxtNode() && NO_NUMBERING !=//#outline level,zhaojianwei + // ((SwTxtNode*)pNd)->GetTxtColl()->GetOutlineLevel(); + const bool bOutlNd = pNd->IsTxtNode() && + 0 != ((SwTxtNode*)pNd)->GetAttrOutlineLevel();//<-end,zhaojianwei // loesche die Gliederungs-Indizies aus // dem alten Nodes-Array if( bOutlNd ) @@ -1280,9 +1291,10 @@ void SwNodes::Delete(const SwNodeIndex &rIndex, ULONG nNodes) if( pNd->IsTxtNode() ) { - if( NO_NUMBERING != - ((SwTxtNode*)pNd)->GetTxtColl()->GetOutlineLevel() && - pOutlineNds->Seek_Entry( pNd, &nIdxPos )) + //if( NO_NUMBERING != //#outline level,zhaojianwei + // ((SwTxtNode*)pNd)->GetTxtColl()->GetOutlineLevel() && + if( 0 != ((SwTxtNode*)pNd)->GetAttrOutlineLevel() &&//<-end,zhaojianwei + pOutlineNds->Seek_Entry( pNd, &nIdxPos )) { // loesche die Gliederungs-Indizies. pOutlineNds->Remove( nIdxPos ); @@ -1669,7 +1681,8 @@ void SwNodes::DelNodes( const SwNodeIndex & rStart, ULONG nCnt ) SwNode* pNd = (*this)[ n ]; if( pNd->IsTxtNode() && - NO_NUMBERING != ((SwTxtNode*)pNd)->GetTxtColl()->GetOutlineLevel() ) + //NO_NUMBERING != ((SwTxtNode*)pNd)->GetTxtColl()->GetOutlineLevel() )//#outline level,zhaojianwei + 0 != ((SwTxtNode*)pNd)->GetAttrOutlineLevel() ) //<-end,zhaojianwei { // loesche die Gliederungs-Indizies. USHORT nIdxPos; if( pOutlineNds->Seek_Entry( pNd, &nIdxPos )) diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx index 4f6b5373e3..1fee0dd0b1 100644 --- a/sw/source/core/edit/acorrect.cxx +++ b/sw/source/core/edit/acorrect.cxx @@ -284,8 +284,8 @@ const String* SwAutoCorrDoc::GetPrevPara( BOOL bAtNormalPos ) (*pIdx)--; pTNd = pIdx->GetNode().GetTxtNode(); } - - if( pTNd && NO_NUMBERING == pTNd->GetTxtColl()->GetOutlineLevel() ) + //if( pTNd && NO_NUMBERING == pTNd->GetTxtColl()->GetOutlineLevel() ) + if( pTNd && 0 == pTNd->GetAttrOutlineLevel() )//#outline level,zhaojianwei pStr = &pTNd->GetTxt(); if( bUndoIdInitialized ) diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx index f427769ddd..ba06e528b4 100644 --- a/sw/source/core/edit/ednumber.cxx +++ b/sw/source/core/edit/ednumber.cxx @@ -392,6 +392,19 @@ BOOL SwEditShell::MoveParagraph( long nOffset ) return bRet; } +//#outline level add by zhaojianwei +int SwEditShell::GetCurrentParaOutlineLevel( ) const +{ + int nLevel = 0; + + SwPaM* pCrsr = GetCrsr(); + const SwTxtNode* pTxtNd = pCrsr->GetNode()->GetTxtNode(); + if( pTxtNd ) + nLevel = pTxtNd->GetAttrOutlineLevel(); + return nLevel; +} +//<-end,zhaojianwei + void SwEditShell::GetCurrentOutlineLevels( sal_uInt8& rUpper, sal_uInt8& rLower ) { SwPaM* pCrsr = GetCrsr(); @@ -547,11 +560,14 @@ BOOL SwEditShell::IsProtectedOutlinePara() const for( ; nPos < rOutlNd.Count(); ++nPos ) { SwNodePtr pTmpNd = rOutlNd[ nPos ]; + // --> OD 2008-04-02 #refactorlists# // BYTE nTmpLvl = GetRealLevel( pTmpNd->GetTxtNode()-> // GetTxtColl()->GetOutlineLevel() ); - int nTmpLvl = pTmpNd->GetTxtNode()->GetOutlineLevel(); - ASSERT( nTmpLvl >= 0 && nTmpLvl < MAXLEVEL, + // int nTmpLvl = pTmpNd->GetTxtNode()->GetOutlineLevel();//#outline level,zhaojianwei + int nTmpLvl = pTmpNd->GetTxtNode()->GetAttrOutlineLevel(); + // ASSERT( nTmpLvl >= 0 && nTmpLvl < MAXLEVEL, + ASSERT( nTmpLvl >= 0 && nTmpLvl <= MAXLEVEL, //<-end,zhaojianwei "<SwEditShell::IsProtectedOutlinePara()>" ); // <-- if( bFirst ) @@ -644,7 +660,8 @@ BOOL SwEditShell::IsNoNum( BOOL bChkStart ) const BYTE SwEditShell::GetNumLevel() const { // gebe die akt. Ebene zurueck, auf der sich der Point vom Cursor befindet - BYTE nLevel = NO_NUMBERING; + //BYTE nLevel = NO_NUMBERING; //#outline level,zhaojianwei + BYTE nLevel = MAXLEVEL; //end,zhaojianwei SwPaM* pCrsr = GetCrsr(); const SwTxtNode* pTxtNd = pCrsr->GetNode()->GetTxtNode(); diff --git a/sw/source/core/fields/chpfld.cxx b/sw/source/core/fields/chpfld.cxx index 48919159f7..15c2e23c01 100644 --- a/sw/source/core/fields/chpfld.cxx +++ b/sw/source/core/fields/chpfld.cxx @@ -156,13 +156,18 @@ void SwChapterField::ChangeExpansion(const SwTxtNode &rTxtNd, sal_Bool bSrchNum) if( pONd && pONd->GetTxtColl() ) { BYTE nPrevLvl = nLevel; + // --> OD 2008-04-02 #refactorlists# // nLevel = GetRealLevel( pONd->GetTxtColl()-> // GetOutlineLevel() ); - ASSERT( pONd->GetOutlineLevel() >= 0 && pONd->GetOutlineLevel() < MAXLEVEL, + //ASSERT( pONd->GetOutlineLevel() >= 0 && pONd->GetOutlineLevel() < MAXLEVEL, //#outline level,zhaojianwei + // "<SwChapterField::ChangeExpansion(..)> - outline node with inconsistent outline level. Serious defect -> please inform OD." ); + //nLevel = static_cast<BYTE>(pONd->GetOutlineLevel()); + ASSERT( pONd->GetAttrOutlineLevel() >= 0 && pONd->GetAttrOutlineLevel() <= MAXLEVEL, "<SwChapterField::ChangeExpansion(..)> - outline node with inconsistent outline level. Serious defect -> please inform OD." ); - nLevel = static_cast<BYTE>(pONd->GetOutlineLevel()); + nLevel = static_cast<BYTE>(pONd->GetAttrOutlineLevel()); //<-end,zhaojianwei // <-- + if( nPrevLvl < nLevel ) nLevel = nPrevLvl; else if( SVX_NUM_NUMBER_NONE != pDoc->GetOutlineNumRule() diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index d274dd2bca..40e4e9401d 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -1161,8 +1161,9 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() // if ( pTxtNd->IsOutline() ) { - int nRealLevel = pTxtNd->GetOutlineLevel(); - nRealLevel = nRealLevel > 5 ? 5 : nRealLevel; + //int nRealLevel = pTxtNd->GetOutlineLevel(); //#outline level,zhaojianwei + int nRealLevel = pTxtNd->GetAttrOutlineLevel()-1; //<-end,zhaojianwei + nRealLevel = nRealLevel > 5 ? 5 : nRealLevel; nPDFType = static_cast<USHORT>(vcl::PDFWriter::H1 + nRealLevel); switch(nRealLevel) diff --git a/sw/source/core/tox/txmsrt.cxx b/sw/source/core/tox/txmsrt.cxx index 85952baddd..e713bc3748 100644 --- a/sw/source/core/tox/txmsrt.cxx +++ b/sw/source/core/tox/txmsrt.cxx @@ -696,9 +696,12 @@ USHORT SwTOXPara::GetLevel() const if( nsSwTOXElement::TOX_OUTLINELEVEL == eType && pNd->GetTxtNode() ) { - USHORT nTmp = ((SwTxtNode*)pNd)->GetTxtColl()->GetOutlineLevel(); - if(nTmp < NO_NUMBERING) - nRet = nTmp + 1; + //USHORT nTmp = ((SwTxtNode*)pNd)->GetTxtColl()->GetOutlineLevel();//#outline level,zhaojianwei + //if(nTmp < NO_NUMBERING) + // nRet = nTmp + 1; + const int nTmp = ((SwTxtNode*)pNd)->GetAttrOutlineLevel();//#outline level,zhaojianwei???? + if(nTmp != 0 ) + nRet = static_cast<USHORT>(nTmp); } return nRet; } @@ -715,7 +718,8 @@ String SwTOXPara::GetURL() const { const SwTxtNode * pTxtNd = static_cast<const SwTxtNode *>(pNd); - if( MAXLEVEL >= pTxtNd->GetTxtColl()->GetOutlineLevel()) + //if( MAXLEVEL >= pTxtNd->GetTxtColl()->GetOutlineLevel()) //#outline level,zhaojianwei + if ( pTxtNd->GetAttrOutlineLevel() > 0) //<-end,zhaojianwei { aTxt = '#'; const SwNumRule * pRule = pTxtNd->GetNumRule(); diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 5c775f6b43..e62bc467f3 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -94,6 +94,11 @@ #include <SwStyleNameMapper.hxx> #include <numrule.hxx> +//--> #outlinelevel added by zhaojianwei +#ifndef _SFXINTITEM_HXX +#include <svtools/intitem.hxx> +#endif +//<--end #include <swtable.hxx> #include <docsh.hxx> #include <SwNodeNum.hxx> @@ -133,11 +138,15 @@ SwTxtNode *SwNodes::MakeTxtNode( const SwNodeIndex & rWhere, // call method <UpdateOutlineNode(..)> only for the document nodes array if ( IsDocNodes() ) { - if ( pColl && NO_NUMBERING != pColl->GetOutlineLevel() ) - { - UpdateOutlineNode( *pNode, NO_NUMBERING, pColl->GetOutlineLevel() ); - } - else + //if ( pColl && NO_NUMBERING != pColl->GetOutlineLevel() ) //#outline level,removed by zhaojianwei + //{ + // UpdateOutlineNode( *pNode, NO_NUMBERING, pColl->GetOutlineLevel() ); + //} +// if ( pColl && 0 != pColl->GetAttrOutlineLevel() )//#outline level,added by zhaojianwei +// { +// UpdateOutlineNode( *pNode, 0, pColl->GetAttrOutlineLevel() ); +// }//<--end +// else { UpdateOutlineNode(*pNode); } @@ -230,7 +239,10 @@ SwTxtNode::SwTxtNode( const SwNodeIndex &rWhere, mpNodeNum( 0 ), bNotifiable( false ), bLastOutlineState( FALSE ), - nOutlineLevel( pTxtColl->GetOutlineLevel() ), + //nOutlineLevel( pTxtColl->GetOutlineLevel() )//#outline level, removed by zhaojianwei. + // --> OD 2008-11-19 #i70748# + mbEmptyListStyleSetDueToSetOutlineLevelAttr( false ), + // <-- // --> OD 2008-05-06 #refactorlists# mbInSetOrResetAttr( false ), mpList( 0 ) @@ -1050,10 +1062,15 @@ void SwTxtNode::_ChgTxtCollUpdateNum( const SwTxtFmtColl *pOldColl, ASSERT( pDoc, "Kein Doc?" ); // erfrage die OutlineLevel und update gegebenenfalls das Nodes-Array, // falls sich die Level geaendert haben ! - const BYTE nOldLevel = pOldColl ? pOldColl->GetOutlineLevel():NO_NUMBERING; - const BYTE nNewLevel = pNewColl ? pNewColl->GetOutlineLevel():NO_NUMBERING; - - if ( NO_NUMBERING != nNewLevel ) + //const BYTE nOldLevel = pOldColl ? pOldColl->GetOutlineLevel():NO_NUMBERING;//#outline level,removed by zhaojianwei + //const BYTE nNewLevel = pNewColl ? pNewColl->GetOutlineLevel():NO_NUMBERING;//<-end,zhaojianwei + const int nOldLevel = pOldColl && pOldColl->IsAssignedToListLevelOfOutlineStyle() ? + pOldColl->GetAssignedOutlineStyleLevel() : MAXLEVEL; + const int nNewLevel = pNewColl && pNewColl->IsAssignedToListLevelOfOutlineStyle() ? + pNewColl->GetAssignedOutlineStyleLevel() : MAXLEVEL; + +// if ( NO_NUMBERING != nNewLevel ) //#outline level,zhaojianwei + if ( MAXLEVEL != nNewLevel ) //<-end,zhaojianwei { SetAttrListLevel(nNewLevel); } @@ -1063,9 +1080,10 @@ void SwTxtNode::_ChgTxtCollUpdateNum( const SwTxtFmtColl *pOldColl, pDoc->GetNodes().UpdateOutlineNode(*this); } + SwNodes& rNds = GetNodes(); // Update beim Level 0 noch die Fussnoten !! - if( (!nNewLevel || !nOldLevel) && pDoc->GetFtnIdxs().Count() && + if( ( !nNewLevel || !nOldLevel) && pDoc->GetFtnIdxs().Count() && FTNNUM_CHAPTER == pDoc->GetFtnInfo().eNum && rNds.IsDocNodes() ) { @@ -2750,7 +2768,7 @@ long SwTxtNode::GetLeftMarginForTabCalculation() const long nLeftMarginForTabCalc = 0; bool bLeftMarginForTabCalcSetToListLevelIndent( false ); - const SwNumRule* pRule = GetNum() ? GetNum()->GetNumRule() : 0L; + const SwNumRule* pRule = GetNum() ? GetNum()->GetNumRule() : 0; if( pRule ) { const SwNumFmt& rFmt = pRule->Get(static_cast<USHORT>(GetActualListLevel())); @@ -3245,46 +3263,114 @@ namespace { bParagraphStyleChanged = true; if( rTxtNode.GetNodes().IsDocNodes() ) { + // --> OD 2008-12-17 #i70748# + // The former list style set at the paragraph can not be + // retrieved from the change set. +// sOldNumRule = +// dynamic_cast<const SwFmtChg*>(pOldValue)->pChangedFmt->GetNumRule().GetValue(); + const SwNumRule* pFormerNumRuleAtTxtNode = + rTxtNode.GetNum() ? rTxtNode.GetNum()->GetNumRule() : 0; + if ( pFormerNumRuleAtTxtNode ) + { + sOldNumRule = pFormerNumRuleAtTxtNode->GetName(); + } + // <-- + // --> OD 2008-11-19 #i70748# + if ( rTxtNode.IsEmptyListStyleDueToSetOutlineLevelAttr() ) + { + const SwNumRuleItem& rNumRuleItem = rTxtNode.GetTxtColl()->GetNumRule(); + if ( rNumRuleItem.GetValue().Len() > 0 ) + { + rTxtNode.ResetEmptyListStyleDueToResetOutlineLevelAttr(); + } + } + // <-- const SwNumRule* pNumRuleAtTxtNode = rTxtNode.GetNumRule(); if ( pNumRuleAtTxtNode ) { bNumRuleSet = true; sNumRule = pNumRuleAtTxtNode->GetName(); } - sOldNumRule = - dynamic_cast<const SwFmtChg*>(pOldValue)->pChangedFmt->GetNumRule().GetValue(); } break; } case RES_ATTRSET_CHG: { const SfxPoolItem* pItem = 0; + // --> OD 2008-12-19 #i70748# + // The former list style set at the paragraph can not be + // retrieved from the change set. +// if ( dynamic_cast<const SwAttrSetChg*>(pOldValue)->GetChgSet()->GetItemState( RES_PARATR_NUMRULE, FALSE, &pItem ) == +// SFX_ITEM_SET ) +// { +// sOldNumRule = dynamic_cast<const SwNumRuleItem*>(pItem)->GetValue(); +// } + const SwNumRule* pFormerNumRuleAtTxtNode = + rTxtNode.GetNum() ? rTxtNode.GetNum()->GetNumRule() : 0; + if ( pFormerNumRuleAtTxtNode ) + { + sOldNumRule = pFormerNumRuleAtTxtNode->GetName(); + } + // <-- if ( dynamic_cast<const SwAttrSetChg*>(pNewValue)->GetChgSet()->GetItemState( RES_PARATR_NUMRULE, FALSE, &pItem ) == SFX_ITEM_SET ) { + // --> OD 2008-11-19 #i70748# + rTxtNode.ResetEmptyListStyleDueToResetOutlineLevelAttr(); + // <-- bNumRuleSet = true; - sNumRule = dynamic_cast<const SwNumRuleItem*>(pItem)->GetValue(); + // The new list style set at the paragraph can not be + // retrieved from the change set. +// sNumRule = dynamic_cast<const SwNumRuleItem*>(pItem)->GetValue(); + // <-- } - if ( dynamic_cast<const SwAttrSetChg*>(pOldValue)->GetChgSet()->GetItemState( RES_PARATR_NUMRULE, FALSE, &pItem ) == - SFX_ITEM_SET ) + // --> OD 2008-12-17 #i70748# + // The new list style set at the paragraph. + const SwNumRule* pNumRuleAtTxtNode = rTxtNode.GetNumRule(); + if ( pNumRuleAtTxtNode ) { - sOldNumRule = dynamic_cast<const SwNumRuleItem*>(pItem)->GetValue(); + sNumRule = pNumRuleAtTxtNode->GetName(); } + // <-- break; } case RES_PARATR_NUMRULE: { if ( rTxtNode.GetNodes().IsDocNodes() ) { + // The former list style set at the paragraph can not be + // retrieved from the change set. +// if ( pOldValue ) +// { +// sOldNumRule = dynamic_cast<const SwNumRuleItem*>(pOldValue)->GetValue(); +// } + const SwNumRule* pFormerNumRuleAtTxtNode = + rTxtNode.GetNum() ? rTxtNode.GetNum()->GetNumRule() : 0; + if ( pFormerNumRuleAtTxtNode ) + { + sOldNumRule = pFormerNumRuleAtTxtNode->GetName(); + } + // <-- if ( pNewValue ) { + // --> OD 2008-11-19 #i70748# + rTxtNode.ResetEmptyListStyleDueToResetOutlineLevelAttr(); + // <-- bNumRuleSet = true; - sNumRule = dynamic_cast<const SwNumRuleItem*>(pNewValue)->GetValue(); + // --> OD 2008-12-17 #i70748# + // The new list style set at the paragraph can not be + // retrieved from the change set. +// sNumRule = dynamic_cast<const SwNumRuleItem*>(pNewValue)->GetValue(); + // <-- } - if ( pOldValue ) + // --> OD 2008-12-17 #i70748# + // The new list style set at the paragraph. + const SwNumRule* pNumRuleAtTxtNode = rTxtNode.GetNumRule(); + if ( pNumRuleAtTxtNode ) { - sOldNumRule = dynamic_cast<const SwNumRuleItem*>(pOldValue)->GetValue(); + sNumRule = pNumRuleAtTxtNode->GetName(); } + // <-- } break; } @@ -3321,8 +3407,12 @@ namespace { if ( sNumRule == String::CreateFromAscii( SwNumRule::GetOutlineRuleName() ) ) { + // --> OD 2008-09-10 #i70748# + ASSERT( rTxtNode.GetTxtColl()->IsAssignedToListLevelOfOutlineStyle(), + "<HandleModifyAtTxtNode()> - text node with outline style, but its paragraph style is not assigned to outline style." ); int nNewListLevel = - rTxtNode.GetTxtColl()->GetOutlineLevel(); + rTxtNode.GetTxtColl()->GetAssignedOutlineStyleLevel(); + // <-- if ( 0 <= nNewListLevel && nNewListLevel < MAXLEVEL ) { rTxtNode.SetAttrListLevel( nNewListLevel ); @@ -3349,6 +3439,12 @@ namespace { &aResetAttrsArray, false ); // <-- + // --> OD 2008-11-19 #i70748# + if ( dynamic_cast<const SfxUInt16Item &>(rTxtNode.GetAttr( RES_PARATR_OUTLINELEVEL, FALSE )).GetValue() > 0 ) + { + rTxtNode.SetEmptyListStyleDueToSetOutlineLevelAttr(); + } + // <-- } } } @@ -3484,7 +3580,8 @@ BOOL SwTxtNode::IsOutline() const { BOOL bResult = FALSE; - if ( GetOutlineLevel() != NO_NUMBERING ) + //if ( GetOutlineLevel() != NO_NUMBERING )//#outline level,removed by zhaojianwei + if ( GetAttrOutlineLevel() > 0 ) //<-end,zhaojianwei { bResult = !IsInRedlines(); } @@ -3510,21 +3607,47 @@ void SwTxtNode::UpdateOutlineState() bLastOutlineState = IsOutline(); } -int SwTxtNode::GetOutlineLevel() const +//#outline level, zhaojianwei +int SwTxtNode::GetAttrOutlineLevel() const { -#if 1 - int aResult = NO_NUMBERING; + return ((const SfxUInt16Item &)GetAttr(RES_PARATR_OUTLINELEVEL)).GetValue(); +} +void SwTxtNode::SetAttrOutlineLevel(int nLevel) +{ + ASSERT( 0 <= nLevel && nLevel <= MAXLEVEL ,"SwTxtNode: Level Out Of Range" );//#outline level,zhaojianwei + if ( 0 <= nLevel && nLevel <= MAXLEVEL ) + { + SetAttr( SfxUInt16Item( RES_PARATR_OUTLINELEVEL, + static_cast<UINT16>(nLevel) ) ); + } +} +//<-end - SwFmtColl * pFmtColl = GetFmtColl(); +// --> OD 2008-11-19 #i70748# +bool SwTxtNode::IsEmptyListStyleDueToSetOutlineLevelAttr() +{ + return mbEmptyListStyleSetDueToSetOutlineLevelAttr; +} - if (pFmtColl) - aResult = ((SwTxtFmtColl *) pFmtColl)->GetOutlineLevel(); +void SwTxtNode::SetEmptyListStyleDueToSetOutlineLevelAttr() +{ + if ( !mbEmptyListStyleSetDueToSetOutlineLevelAttr ) + { + SetAttr( SwNumRuleItem() ); + mbEmptyListStyleSetDueToSetOutlineLevelAttr = true; + } +} - return aResult; -#else // for OOo3 - return nOutlineLevel -#endif +void SwTxtNode::ResetEmptyListStyleDueToResetOutlineLevelAttr() +{ + if ( mbEmptyListStyleSetDueToSetOutlineLevelAttr ) + { + ResetAttr( RES_PARATR_NUMRULE ); + mbEmptyListStyleSetDueToSetOutlineLevelAttr = false; + } } +// <-- + // --> OD 2008-02-27 #refactorlists# void SwTxtNode::SetAttrListLevel( int nLevel ) @@ -4061,6 +4184,7 @@ namespace { // is set and changed after the attributes have been set // (6) Notify list tree, if count in list - RES_PARATR_LIST_ISCOUNTED - is set // and changed after the attributes have been set + // (7) Set or Reset emtpy list style due to changed outline level - RES_PARATR_OUTLINELEVEL. class HandleSetAttrAtTxtNode { public: @@ -4076,6 +4200,9 @@ namespace { bool mbUpdateListLevel; bool mbUpdateListRestart; bool mbUpdateListCount; + // --> OD 2008-11-19 #i70748# + bool mbOutlineLevelSet; + // <-- }; HandleSetAttrAtTxtNode::HandleSetAttrAtTxtNode( SwTxtNode& rTxtNode, @@ -4084,7 +4211,10 @@ namespace { mbAddTxtNodeToList( false ), mbUpdateListLevel( false ), mbUpdateListRestart( false ), - mbUpdateListCount( false ) + mbUpdateListCount( false ), + // --> OD 2008-11-19 #i70748# + mbOutlineLevelSet( false ) + // <-- { switch ( pItem.Which() ) { @@ -4175,6 +4305,20 @@ namespace { } } break; + + // --> OD 2008-11-19 #i70748# + // handle RES_PARATR_OUTLINELEVEL + case RES_PARATR_OUTLINELEVEL: + { + const SfxUInt16Item& aOutlineLevelItem = + dynamic_cast<const SfxUInt16Item&>(pItem); + if ( aOutlineLevelItem.GetValue() != mrTxtNode.GetAttrOutlineLevel() ) + { + mbOutlineLevelSet = true; + } + } + break; + // <-- } } @@ -4185,7 +4329,10 @@ namespace { mbAddTxtNodeToList( false ), mbUpdateListLevel( false ), mbUpdateListRestart( false ), - mbUpdateListCount( false ) + mbUpdateListCount( false ), + // --> OD 2008-11-19 #i70748# + mbOutlineLevelSet( false ) + // <-- { const SfxPoolItem* pItem = 0; // handle RES_PARATR_NUMRULE @@ -4198,6 +4345,9 @@ namespace { if ( pNumRuleItem->GetValue().Len() > 0 ) { mbAddTxtNodeToList = true; + // --> OD 2008-11-19 #i70748# + mrTxtNode.ResetEmptyListStyleDueToResetOutlineLevelAttr(); + // <-- } } @@ -4269,6 +4419,19 @@ namespace { mbUpdateListCount = true; } } + + // --> OD 2008-11-19 #i70748# + // handle RES_PARATR_OUTLINELEVEL + if ( rItemSet.GetItemState( RES_PARATR_OUTLINELEVEL, FALSE, &pItem ) == SFX_ITEM_SET ) + { + const SfxUInt16Item* pOutlineLevelItem = + dynamic_cast<const SfxUInt16Item*>(pItem); + if ( pOutlineLevelItem->GetValue() != mrTxtNode.GetAttrOutlineLevel() ) + { + mbOutlineLevelSet = true; + } + } + // <-- } HandleSetAttrAtTxtNode::~HandleSetAttrAtTxtNode() @@ -4301,6 +4464,26 @@ namespace { const_cast<SwNodeNum*>(mrTxtNode.GetNum())->InvalidateAndNotifyTree(); } } + + // --> OD 2008-11-19 #i70748# + if ( mbOutlineLevelSet ) + { + if ( mrTxtNode.GetAttrOutlineLevel() == 0 ) + { + mrTxtNode.ResetEmptyListStyleDueToResetOutlineLevelAttr(); + } + else + { + const SfxPoolItem* pItem = 0; + if ( mrTxtNode.GetSwAttrSet().GetItemState( RES_PARATR_NUMRULE, + TRUE, &pItem ) + != SFX_ITEM_SET ) + { + mrTxtNode.SetEmptyListStyleDueToSetOutlineLevelAttr(); + } + } + } + // <-- } // End of class <HandleSetAttrAtTxtNode> } @@ -4349,6 +4532,7 @@ namespace { // (4) Notify list tree, if list restart - RES_PARATR_LIST_ISRESTART - is reset. // (5) Notify list tree, if list restart value - RES_PARATR_LIST_RESTARTVALUE - is reset. // (6) Notify list tree, if count in list - RES_PARATR_LIST_ISCOUNTED - is reset. + // (7) Reset empty list style, if outline level attribute - RES_PARATR_OUTLINELEVEL - is reset. class HandleResetAttrAtTxtNode { public: @@ -4415,6 +4599,14 @@ namespace { ( nWhich1 <= RES_PARATR_LIST_ISCOUNTED && RES_PARATR_LIST_ISCOUNTED <= nWhich2 && !mrTxtNode.IsCountedInList() ); } + + // --> OD 2008-11-19 #i70748# + // RES_PARATR_OUTLINELEVEL + if ( nWhich1 <= RES_PARATR_OUTLINELEVEL && RES_PARATR_OUTLINELEVEL <= nWhich2 ) + { + mrTxtNode.ResetEmptyListStyleDueToResetOutlineLevelAttr(); + } + // <-- } else { @@ -4432,6 +4624,13 @@ namespace { mbListStyleOrIdReset = true; // <-- } + // --> OD 2008-11-19 #i70748# + // RES_PARATR_OUTLINELEVEL + else if ( nWhich1 == RES_PARATR_OUTLINELEVEL ) + { + mrTxtNode.ResetEmptyListStyleDueToResetOutlineLevelAttr(); + } + // <-- if ( !bRemoveFromList ) { @@ -4486,6 +4685,13 @@ namespace { mbListStyleOrIdReset = true; // <-- } + // --> OD 2008-11-19 #i70748# + // RES_PARATR_OUTLINELEVEL + else if ( rWhichArr[ n ] == RES_PARATR_OUTLINELEVEL ) + { + mrTxtNode.ResetEmptyListStyleDueToResetOutlineLevelAttr(); + } + // <-- if ( !bRemoveFromList ) { @@ -4527,6 +4733,9 @@ namespace { { rTxtNode.RemoveFromList(); } + // --> OD 2008-11-19 #i70748# + mrTxtNode.ResetEmptyListStyleDueToResetOutlineLevelAttr(); + // <-- } HandleResetAttrAtTxtNode::~HandleResetAttrAtTxtNode() @@ -4540,6 +4749,12 @@ namespace { { mrTxtNode.AddToList(); } + // --> OD 2008-11-19 #i70748# + else if ( dynamic_cast<const SfxUInt16Item &>(mrTxtNode.GetAttr( RES_PARATR_OUTLINELEVEL, FALSE )).GetValue() > 0 ) + { + mrTxtNode.SetEmptyListStyleDueToSetOutlineLevelAttr(); + } + // <-- } if ( mrTxtNode.IsInList() ) diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx index a72d42af3b..4493d02f2e 100644 --- a/sw/source/core/undo/rolbck.cxx +++ b/sw/source/core/undo/rolbck.cxx @@ -722,7 +722,8 @@ SwHstrySetAttrSet::SwHstrySetAttrSet( const SfxItemSet& rSet, ULONG nNodePos, aResetArr( 0, 4 ), nNode( nNodePos ), // --> OD 2007-07-09 #i77372# - mnNumLvl( NO_NUMBERING ), + //mnNumLvl( MAXLEVEL),//NO_NUMBERING ), + mnNumLvl( MAXLEVEL), //#outline level,zhaojianwei mbIsRestart( false ), mnRestartVal( USHRT_MAX ), mbIsCounted( false ) diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index d1a280d095..d7915fc309 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -154,7 +154,23 @@ sal_Bool getCrsrPropertyValue(const SfxItemPropertyMap* pMap } break; // <-- - case FN_UNO_PARA_CHAPTER_NUMBERING_LEVEL: + // --> OD 2008-05-20 #outlinelevel# - no longer needed +// case FN_UNO_PARA_CHAPTER_NUMBERING_LEVEL: +// if (pAny) +// { +// const SwTxtNode * pTmpNode = pNode; + +// if (!pTmpNode) +// pTmpNode = rPam.GetNode()->GetTxtNode(); + +// sal_Int8 nRet = -1; +// if (pTmpNode && pTmpNode->GetOutlineLevel() != NO_NUMBERING) +// nRet = sal::static_int_cast< sal_Int8 >(pTmpNode->GetOutlineLevel()); +// *pAny <<= nRet; +// } +// break; + // <-- + case RES_PARATR_OUTLINELEVEL: //#outlinelevel added by zhaojianwei if (pAny) { const SwTxtNode * pTmpNode = pNode; @@ -162,13 +178,13 @@ sal_Bool getCrsrPropertyValue(const SfxItemPropertyMap* pMap if (!pTmpNode) pTmpNode = rPam.GetNode()->GetTxtNode(); - sal_Int8 nRet = -1; - if (pTmpNode && pTmpNode->GetOutlineLevel() != NO_NUMBERING) - nRet = sal::static_int_cast< sal_Int8 >(pTmpNode->GetOutlineLevel()); + sal_Int16 nRet = -1; + if ( pTmpNode ) + nRet = sal::static_int_cast< sal_Int16 >( pTmpNode->GetAttrOutlineLevel() ); *pAny <<= nRet; } - break; + break; //<-end,zhaojianwei case FN_UNO_PARA_CONDITIONAL_STYLE_NAME: case FN_UNO_PARA_STYLE : { diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx index 0058346697..53a5a3acc9 100644 --- a/sw/source/core/unocore/unomap.cxx +++ b/sw/source/core/unocore/unomap.cxx @@ -275,7 +275,8 @@ void SwUnoPropertyMapProvider::Sort( sal_uInt16 nId ) { SW_PROP_NMID(UNO_NAME_LIST_ID), FN_UNO_LIST_ID, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, 0}, \ { SW_PROP_NMID(UNO_NAME_PARA_IS_NUMBERING_RESTART), FN_NUMBER_NEWSTART, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, 0 }, \ { SW_PROP_NMID(UNO_NAME_PARA_CONTINUEING_PREVIOUS_SUB_TREE), FN_UNO_PARA_CONT_PREV_SUBTREE, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::READONLY, 0 }, \ - { SW_PROP_NMID(UNO_NAME_PARA_LIST_LABEL_STRING), FN_UNO_PARA_NUM_STRING, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0 }, + { SW_PROP_NMID(UNO_NAME_PARA_LIST_LABEL_STRING), FN_UNO_PARA_NUM_STRING, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0 }, \ + { SW_PROP_NMID(UNO_NAME_OUTLINE_LEVEL), RES_PARATR_OUTLINELEVEL, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, 0}, //#outline level, zhaojianwei #define COMMON_HYPERLINK_PROPERTIES \ { SW_PROP_NMID(UNO_NAME_HYPER_LINK_U_R_L), RES_TXTATR_INETFMT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID ,MID_URL_URL}, \ @@ -499,6 +500,8 @@ void SwUnoPropertyMapProvider::Sort( sal_uInt16 nId ) { SW_PROP_NMID(UNO_NAME_CHAR_DIFF_HEIGHT_COMPLEX), RES_CHRATR_CTL_FONTSIZE , CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE , MID_FONTHEIGHT_DIFF|CONVERT_TWIPS}, +//#outline level, zhaojianwei delete { SW_PROP_NMID(UNO_NAME_DEFAULT_OUTLINE_LEVEL), FN_UNO_DEFAULT_OUTLINE_LEVEL, CPPU_E2T(CPPUTYPE_INT8), PropertyAttribute::MAYBEVOID, 0}, +//add { SW_PROP_NMID(UNO_NAME_OUTLINE_LEVEL), RES_PARATR_OUTLINELEVEL,CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, 0}, #define COMMON_PARA_STYLE_PROPERTIES \ { SW_PROP_NMID(UNO_NAME_BREAK_TYPE), RES_BREAK, CPPU_E2T(CPPUTYPE_BREAK), PROPERTY_NONE, 0},\ { SW_PROP_NMID(UNO_NAME_PAGE_DESC_NAME), RES_PAGEDESC, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_PAGEDESC_PAGEDESCNAME },\ @@ -595,8 +598,9 @@ void SwUnoPropertyMapProvider::Sort( sal_uInt16 nId ) { SW_PROP_NMID(UNO_NAME_CATEGORY), FN_UNO_CATEGORY, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE , 0 },\ { SW_PROP_NMID(UNO_NAME_WRITING_MODE), RES_FRAMEDIR, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0 },\ { SW_PROP_NMID(UNO_NAME_PARA_IS_CONNECT_BORDER), RES_PARATR_CONNECT_BORDER, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, 0},\ - { SW_PROP_NMID(UNO_NAME_DEFAULT_OUTLINE_LEVEL), FN_UNO_DEFAULT_OUTLINE_LEVEL, CPPU_E2T(CPPUTYPE_INT8), PropertyAttribute::MAYBEVOID, 0},\ { SW_PROP_NMID(UNO_NAME_SNAP_TO_GRID), RES_PARATR_SNAPTOGRID, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, 0 }, \ + { SW_PROP_NMID(UNO_NAME_OUTLINE_LEVEL), RES_PARATR_OUTLINELEVEL,CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, 0}, + #define COMMON_FLDTYP_PROPERTIES \ { SW_PROP_NMID(UNO_NAME_IS_FIELD_USED), FIELD_PROP_IS_FIELD_USED, CPPU_E2T(CPPUTYPE_FLOAT), PropertyAttribute::READONLY, 0},\ @@ -650,7 +654,8 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP { SW_PROP_NMID(UNO_NAME_TEXT_SECTION), FN_UNO_TEXT_SECTION, CPPU_E2T(CPPUTYPE_REFTEXTSECTION), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 }, \ { SW_PROP_NMID(UNO_NAME_PARA_CHAPTER_NUMBERING_LEVEL), FN_UNO_PARA_CHAPTER_NUMBERING_LEVEL,CPPU_E2T(CPPUTYPE_INT8), PROPERTY_NONE, 0}, \ { SW_PROP_NMID(UNO_NAME_PARA_CONDITIONAL_STYLE_NAME), RES_FRMATR_CONDITIONAL_STYLE_NAME, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0}, \ - { SW_PROP_NMID(UNO_NAME_PARA_IS_NUMBERING_RESTART), FN_NUMBER_NEWSTART, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, 0 }, + { SW_PROP_NMID(UNO_NAME_PARA_IS_NUMBERING_RESTART), FN_NUMBER_NEWSTART, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, 0 }, \ + { SW_PROP_NMID(UNO_NAME_OUTLINE_LEVEL), RES_PARATR_OUTLINELEVEL, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, 0}, //#outline level,zhaojianwei COMMON_CRSR_PARA_PROPERTIES_WITHOUT_FN TABSTOPS_MAP_ENTRY COMMON_TEXT_CONTENT_PROPERTIES diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index 1b8833e3c5..859dc8a35e 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -544,24 +544,6 @@ sal_Bool lcl_setCrsrPropertyValue(const SfxItemPropertyMap* pMap, case FN_UNO_NUM_START_VALUE : lcl_SetNodeNumStart( rPam, aValue ); break; - case FN_UNO_PARA_CHAPTER_NUMBERING_LEVEL: - { -/* Will be used in OOo 3.0 - SwTxtNode * pTmpNode = rPam.GetNode()->GetTxtNode(); - - BYTE nLevel; - aValue >>= nLevel; - - if ( pTmpNode ) - { - pTmpNode->SetOutlineLevel(nLevel); - - // --> OD 2005-09-01 #i53198# - update outline nodes array - rPam.GetDoc()->GetNodes().UpdateOutlineNode( *pTmpNode ); - // <-- - }*/ - } - break; case FN_UNO_NUM_LEVEL : // --> OD 2008-07-14 #i91601# case FN_UNO_LIST_ID: @@ -2352,9 +2334,9 @@ Sequence< Any > SAL_CALL SwXTextCursor::getPropertyDefaults( const Sequence< OUS /*-- 10.03.2008 09:58:47--------------------------------------------------- -----------------------------------------------------------------------*/ -void SwXTextCursor::makeRedline( - const ::rtl::OUString& rRedlineType, - const uno::Sequence< beans::PropertyValue >& rRedlineProperties ) +void SwXTextCursor::makeRedline( + const ::rtl::OUString& rRedlineType, + const uno::Sequence< beans::PropertyValue >& rRedlineProperties ) throw (lang::IllegalArgumentException, uno::RuntimeException) { vos::OGuard aGuard(Application::GetSolarMutex()); diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx index 4625822d05..b1afd37175 100644 --- a/sw/source/core/unocore/unoobj2.cxx +++ b/sw/source/core/unocore/unoobj2.cxx @@ -780,6 +780,17 @@ void SwXTextCursor::SetCrsrAttr(SwPaM& rPam, const SfxItemSet& rSet, USHORT nAtt // UpdateAttr(); pDoc->Insert( *pCrsr, rSet, nFlags ); } + //#outline level,add by zhaojianwei + if( rSet.GetItemState( RES_PARATR_OUTLINELEVEL, false ) >= SFX_ITEM_AVAILABLE ) + { + SwTxtNode * pTmpNode = rPam.GetNode()->GetTxtNode(); + if ( pTmpNode ) + { + rPam.GetDoc()->GetNodes().UpdateOutlineNode( *pTmpNode ); + } + + } + //<-end,zhaojianwei } /*-- 09.12.98 14:19:04--------------------------------------------------- diff --git a/sw/source/core/unocore/unoprnms.cxx b/sw/source/core/unocore/unoprnms.cxx index 36ba9f5581..fa5712a8d4 100644 --- a/sw/source/core/unocore/unoprnms.cxx +++ b/sw/source/core/unocore/unoprnms.cxx @@ -718,7 +718,7 @@ const SwPropNameTab aPropNameTab = { /* 0673 UNO_NAME_TRANSFORMATION_IN_HORI_L2R*/ {MAP_CHAR_LEN("TransformationInHoriL2R")}, /* 0674 UNO_NAME_POSITION_LAYOUT_DIR*/ {MAP_CHAR_LEN("PositionLayoutDir")}, /* 0675 UNO_NAME_NUMBERING_IS_OUTLINE*/ {MAP_CHAR_LEN("NumberingIsOutline")}, -/* 0676 UNO_NAME_DEFAULT_OUTLINE_LEVEL*/ {MAP_CHAR_LEN("DefaultOutlineLevel")}, +///* 0676 UNO_NAME_DEFAULT_OUTLINE_LEVEL*/ {MAP_CHAR_LEN("DefaultOutlineLevel")}, //#outline level,removed by zhaojianwei /* 0677 UNO_NAME_STARTPOSITION_IN_HORI_L2R*/ {MAP_CHAR_LEN("StartPositionInHoriL2R")}, /* 0678 UNO_NAME_ENDPOSITION_IN_HORI_L2R*/ {MAP_CHAR_LEN("EndPositionInHoriL2R")}, /* 0679 UNO_NAME_SUBJECT */ {MAP_CHAR_LEN("Subject")}, @@ -777,7 +777,8 @@ const SwPropNameTab aPropNameTab = { /* 0732 UNO_NAME_PARA_LIST_LABEL_STRING */ {MAP_CHAR_LEN("ListLabelString")}, /* 0733 CHAR_OVERLINE */ {MAP_CHAR_LEN("CharOverline")}, /* 0734 CHAR_OVERLINE_COLOR */ {MAP_CHAR_LEN("CharOverlineColor")}, -/* 0735 CHAR_OVERLINE_HAS_COLOR */ {MAP_CHAR_LEN("CharOverlineHasColor")} +/* 0735 CHAR_OVERLINE_HAS_COLOR */ {MAP_CHAR_LEN("CharOverlineHasColor")}, +/* 0736 UNO_NAME_OUTLINE_LEVEL */ {MAP_CHAR_LEN("OutlineLevel")}//#outline level,add<-zhaojianwei Outlinelevel }; const SwPropNameLen& SwGetPropName( USHORT nId ) diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx index 675021b518..238e0fba99 100644 --- a/sw/source/core/unocore/unosett.cxx +++ b/sw/source/core/unocore/unosett.cxx @@ -1695,8 +1695,11 @@ uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetNumberingRuleByIndex( if(rTxtColl.IsDefault()) continue; - sal_Int8 nOutLevel = rTxtColl.GetOutlineLevel(); - if(nOutLevel == nIndex) + //sal_Int8 nOutLevel = rTxtColl.GetOutlineLevel(); //#outline level,zhaojianwei + const sal_Int16 nOutLevel = rTxtColl.IsAssignedToListLevelOfOutlineStyle() + ? static_cast<sal_Int16>(rTxtColl.GetAssignedOutlineStyleLevel()) + : MAXLEVEL; //<-end,zhaojianwei + if ( nOutLevel == nIndex ) { sValue = rTxtColl.GetName(); break; // the style for the level in question has been found @@ -2181,11 +2184,21 @@ void SwXNumberingRules::SetNumberingRuleByIndex( SwTxtFmtColl &rTxtColl = *((*pColls)[k]); if(rTxtColl.IsDefault()) continue; - if(rTxtColl.GetOutlineLevel() == nIndex && - rTxtColl.GetName() != sStyleName) - rTxtColl.SetOutlineLevel(NO_NUMBERING); - else if(rTxtColl.GetName() == sStyleName) - rTxtColl.SetOutlineLevel(sal_Int8(nIndex)); + //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 ) + { + rTxtColl.DeleteAssignmentToListLevelOfOutlineStyle(); + } + else if ( rTxtColl.GetName() == sStyleName ) + { + rTxtColl.AssignToListLevelOfOutlineStyle( nIndex ); + } //<-end,,zhaojianwei, } } break; diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 3960ce2909..623d909f00 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -1964,15 +1964,23 @@ void lcl_SetStyleProperty(const SfxItemPropertyMap* pMap, throw lang::IllegalArgumentException(); } break; - case FN_UNO_DEFAULT_OUTLINE_LEVEL: + // case FN_UNO_DEFAULT_OUTLINE_LEVEL: //#outline level,removed by zahojianwei + //{ + // sal_Int8 nLevel = 0; + // if( rValue >>= nLevel ) + // rBase.mxNewBase->GetCollection()->SetOutlineLevel( nLevel ); + // else + // rBase.mxNewBase->GetCollection()->SetOutlineLevel( NO_NUMBERING ); + //} + //break; + case RES_PARATR_OUTLINELEVEL: //add by zahojianwei { - sal_Int8 nLevel = 0; - if( rValue >>= nLevel ) - rBase.mxNewBase->GetCollection()->SetOutlineLevel( nLevel ); - else - rBase.mxNewBase->GetCollection()->SetOutlineLevel( NO_NUMBERING ); - } - break; + sal_Int16 nLevel = 0; + rValue >>= nLevel; + if( 0 <= nLevel && nLevel <= MAXLEVEL) + rBase.mxNewBase->GetCollection()->SetAttrOutlineLevel( nLevel ); + } + break; //<-end,zhaojianwei case FN_UNO_FOLLOW_STYLE: { OUString sTmp; @@ -2214,7 +2222,9 @@ put_itemset: if ( SFX_STYLE_FAMILY_PARA == eFamily && pMap->nWID == RES_PARATR_NUMRULE && rBase.mxNewBase.is() && rBase.mxNewBase->GetCollection() && - rBase.mxNewBase->GetCollection()->GetOutlineLevel() < MAXLEVEL /* assigned to list level of outline style */) + //rBase.mxNewBase->GetCollection()->GetOutlineLevel() < MAXLEVEL /* assigned to list level of outline style */) //#outline level,removed by zhaojianwei + rBase.mxNewBase->GetCollection()->IsAssignedToListLevelOfOutlineStyle() ) ////<-end,add by zhaojianwei + { OUString sNewNumberingRuleName; rValue >>= sNewNumberingRuleName; @@ -2223,7 +2233,8 @@ put_itemset: sTmp != pDoc->GetOutlineNumRule()->GetName() ) { // delete assignment to list level of outline style. - rBase.mxNewBase->GetCollection()->SetOutlineLevel( NO_NUMBERING ); + //rBase.mxNewBase->GetCollection()->SetOutlineLevel( NO_NUMBERING ); //#outline level,removed by zhaojianwei + rBase.mxNewBase->GetCollection()->DeleteAssignmentToListLevelOfOutlineStyle(); //<-end,adde by zhaojianwei } } } @@ -2377,14 +2388,21 @@ uno::Any lcl_GetStyleProperty(const SfxItemPropertyMap* pMap, aRet.setValue(&xRules, ::getCppuType((uno::Reference<container::XIndexReplace>*)0)); } break; - case FN_UNO_DEFAULT_OUTLINE_LEVEL: + //case FN_UNO_DEFAULT_OUTLINE_LEVEL: //#outline level,removed by zahojianwei + //{ + // DBG_ASSERT( SFX_STYLE_FAMILY_PARA == eFamily, "only paras" ); + // BYTE nLevel = rBase.mxNewBase->GetCollection()->GetOutlineLevel(); + // if( nLevel != NO_NUMBERING ) + // aRet <<= static_cast<sal_Int8>( nLevel ); + //} + //break; + case RES_PARATR_OUTLINELEVEL: //add by zahojianwei { DBG_ASSERT( SFX_STYLE_FAMILY_PARA == eFamily, "only paras" ); - BYTE nLevel = rBase.mxNewBase->GetCollection()->GetOutlineLevel(); - if( nLevel != NO_NUMBERING ) - aRet <<= static_cast<sal_Int8>( nLevel ); + int nLevel = rBase.mxNewBase->GetCollection()->GetAttrOutlineLevel(); + aRet <<= static_cast<sal_Int16>( nLevel ); } - break; + break; //<-end,zhaojianwei case FN_UNO_FOLLOW_STYLE: { String aString; @@ -2779,14 +2797,14 @@ uno::Sequence< beans::PropertyState > SwXStyle::getPropertyStates( { pStates[i] = beans::PropertyState_DIRECT_VALUE; } - else if( FN_UNO_DEFAULT_OUTLINE_LEVEL == pMap->nWID ) - { - pStates[i] = - ( xStyle->GetCollection()->GetOutlineLevel() - == NO_NUMBERING ) - ? beans::PropertyState_DEFAULT_VALUE - : beans::PropertyState_DIRECT_VALUE; - } + // else if( FN_UNO_DEFAULT_OUTLINE_LEVEL == pMap->nWID ) //#outline level,removed by zahojianwei + // { + // pStates[i] = + // ( xStyle->GetCollection()->GetOutlineLevel() + // == NO_NUMBERING ) + // ? beans::PropertyState_DEFAULT_VALUE + // : beans::PropertyState_DIRECT_VALUE; + // } //<-end,zhaojianwei else if(SFX_STYLE_FAMILY_PAGE == eFamily && (rPropName.EqualsAscii("Header", 0, 6) || rPropName.EqualsAscii("Footer", 0, 6))) @@ -2910,10 +2928,14 @@ void SAL_CALL SwXStyle::setPropertiesToDefault( const uno::Sequence< OUString >& if ( pMap->nFlags & beans::PropertyAttribute::READONLY ) throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "setPropertiesToDefault: property is read-only: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); - if( pMap->nWID == FN_UNO_DEFAULT_OUTLINE_LEVEL ) - static_cast<SwTxtFmtColl*>(pTargetFmt)->SetOutlineLevel( NO_NUMBERING ); + //if( pMap->nWID == FN_UNO_DEFAULT_OUTLINE_LEVEL ) //#outline level, removed by zhaojianwei + // static_cast<SwTxtFmtColl*>(pTargetFmt)->SetOutlineLevel( NO_NUMBERING ); + //else + // pTargetFmt->ResetFmtAttr( pMap->nWID ); + if( pMap->nWID == RES_PARATR_OUTLINELEVEL ) //add by zhaojianwei + static_cast<SwTxtFmtColl*>(pTargetFmt)->DeleteAssignmentToListLevelOfOutlineStyle(); else - pTargetFmt->ResetFmtAttr( pMap->nWID ); + pTargetFmt->ResetFmtAttr( pMap->nWID ); //<-end,zhaojianwei } } else if ( bIsDescriptor ) @@ -2950,7 +2972,8 @@ void SAL_CALL SwXStyle::setAllPropertiesToDefault( ) // --> OD 2007-07-25 #132402# - make code robust if ( xStyle->GetCollection() ) { - xStyle->GetCollection()->SetOutlineLevel( NO_NUMBERING ); + // xStyle->GetCollection()->SetOutlineLevel( NO_NUMBERING ); //#outline level,removed by zhaojianwei + xStyle->GetCollection()->DeleteAssignmentToListLevelOfOutlineStyle(); //<-end,add by zhaojianwei } // <-- } |