diff options
author | Oliver Bolte <obo@openoffice.org> | 2009-09-08 13:44:38 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2009-09-08 13:44:38 +0000 |
commit | 50dde3e4aeeb74226da13aba748ac1d677ec0f5a (patch) | |
tree | 597bafb43b986fc2b2f379d7a86c16622ed50169 /sw/source/core | |
parent | aabbeb69c723fbf3cd4eac8391cdf0acabf66f33 (diff) |
CWS-TOOLING: integrate CWS sw32numbf01
2009-09-04 10:01:07 +0200 od r275780 : #i95907# method <SwWrtShell::NumOfBulletOn(..)>
- adjust indentation of newly created automatic list style
--> due to MRU add actual paragraph indentation to created automatic list style's indentation
2009-09-02 11:57:40 +0200 od r275703 : #i95907# method <SwTxtMargin::CtorInitTxtMargin(..)>
- correct handling of paragraph indents, when list level indents are applicable.
2009-09-01 16:59:47 +0200 od r275671 : CWS-TOOLING: rebase CWS sw32numbf01 to trunk@275331 (milestone: DEV300:m56)
2009-08-28 16:42:34 +0200 od r275540 : #i102458# method <SwFlowFrm::CalcUpperSpace(..)>
- correct handling of leading line spacing
method <GetSpacingValuesOfFrm(..)>
- add output parameter <obIsLineSpacingProportional>
2009-08-27 17:03:07 +0200 od r275496 : #i101516# method <SwTxtNode::SwTxtNode(..)>
- in case that the paragraph is add to a list, apply paragraph style's assigned
outline style list level as list level, if paragraph has no list level set already.
2009-08-27 15:23:34 +0200 od r275489 : #i101234# method <SwWrtShell::NumOrBulletOn(..)>
- check before activation of certain list level of outline numbering,
a numbering format is already set. In this only continue the outline numbering.
2009-08-27 14:15:07 +0200 od r275483 : #i95907# method <SwWrtShell::NumOrBulletOn(..)>
- consider leading tab stops and intentation of paragraph first text line,
when a new list style is created for its application to the selection.
2009-08-26 09:51:39 +0200 od r275401 : #i86492# Adjust copy of text nodes regarding lists
- copy of part of paragraph in list does not copy list style and list id
- copy of paragraphs in list into another list continues destination list
- copy of paragraphs (at least one not in a list) at empty paragraph following a list
does not continue the destination list.
2009-08-25 10:30:53 +0200 od r275339 : #i101349# method <XMLTextImportHelper::SetStyleAndAttrs(..)
- assure that list style of automatic paragraph style is applied at paragraph.
Diffstat (limited to 'sw/source/core')
-rw-r--r-- | sw/source/core/doc/docnum.cxx | 62 | ||||
-rw-r--r-- | sw/source/core/docnode/ndcopy.cxx | 292 | ||||
-rw-r--r-- | sw/source/core/edit/ednumber.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/inc/frmtool.hxx | 17 | ||||
-rw-r--r-- | sw/source/core/layout/flowfrm.cxx | 51 | ||||
-rw-r--r-- | sw/source/core/layout/frmtool.cxx | 31 | ||||
-rw-r--r-- | sw/source/core/text/itrcrsr.cxx | 24 | ||||
-rw-r--r-- | sw/source/core/txtnode/ndtxt.cxx | 10 |
8 files changed, 334 insertions, 161 deletions
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index 97333d063e..5600f198b9 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -1128,29 +1128,29 @@ void SwDoc::SetCounted(const SwPaM & rPam, bool bCounted) } } -void SwDoc::ReplaceNumRule(const SwPaM & rPaM, const SwNumRule & rNumRule) -{ - if (DoesUndo()) - StartUndo(UNDO_START, NULL); +//void SwDoc::ReplaceNumRule(const SwPaM & rPaM, const SwNumRule & rNumRule) +//{ +// if (DoesUndo()) +// StartUndo(UNDO_START, NULL); - ULONG nStt = rPaM.Start()->nNode.GetIndex(); - ULONG nEnd = rPaM.End()->nNode.GetIndex(); +// ULONG nStt = rPaM.Start()->nNode.GetIndex(); +// ULONG nEnd = rPaM.End()->nNode.GetIndex(); - for (ULONG n = nStt; n <= nEnd; n++) - { - SwTxtNode * pCNd = GetNodes()[n]->GetTxtNode(); +// for (ULONG n = nStt; n <= nEnd; n++) +// { +// SwTxtNode * pCNd = GetNodes()[n]->GetTxtNode(); - if (pCNd && NULL != pCNd->GetNumRule()) - { - SwPaM aPam(*pCNd); +// if (pCNd && NULL != pCNd->GetNumRule()) +// { +// SwPaM aPam(*pCNd); - Insert(aPam, SwNumRuleItem(rNumRule.GetName()), 0); - } - } +// Insert(aPam, SwNumRuleItem(rNumRule.GetName()), 0); +// } +// } - if (DoesUndo()) - EndUndo(UNDO_START, NULL); -} +// if (DoesUndo()) +// EndUndo(UNDO_START, NULL); +//} void SwDoc::SetNumRuleStart( const SwPosition& rPos, BOOL bFlag ) { @@ -1544,8 +1544,8 @@ void SwDoc::MakeUniqueNumRules(const SwPaM & rPaM) SwPosition aPos(*pCNd); aListStyleData.pReplaceNumRule = const_cast<SwNumRule *> - (SearchNumRule( aPos, FALSE, pCNd->HasNumber(), - FALSE, 0, + (SearchNumRule( aPos, false, pCNd->HasNumber(), + false, 0, aListStyleData.sListId, true )); } @@ -1668,7 +1668,7 @@ void SwDoc::DelNumRules( const SwPaM& rPam ) pTNd->ChkCondColl(); //else if( !pOutlNd && NO_NUMBERING != //#outline level,zhaojianwei // ((SwTxtFmtColl*)pTNd->GetFmtColl())->GetOutlineLevel() ) - else if( !pOutlNd && + else if( !pOutlNd && ((SwTxtFmtColl*)pTNd->GetFmtColl())->IsAssignedToListLevelOfOutlineStyle() )//<-end,zhaojianwei pOutlNd = pTNd; } @@ -1849,13 +1849,13 @@ BOOL SwDoc::GotoNextNum( SwPosition& rPos, BOOL bOverUpper, // -> #i23731# // --> OD 2008-03-18 #refactorlists# - add output parameter <sListId> -const SwNumRule * SwDoc::SearchNumRule(SwPosition & rPos, - BOOL bForward, - BOOL bNum, - BOOL bOutline, +const SwNumRule * SwDoc::SearchNumRule(const SwPosition & rPos, + const bool bForward, + const bool bNum, + const bool bOutline, int nNonEmptyAllowed, String& sListId, - bool _bInvestigateStartNode) + const bool bInvestigateStartNode) { const SwNumRule * pResult = NULL; SwTxtNode * pTxtNd = rPos.nNode.GetNode().GetTxtNode(); @@ -1871,7 +1871,7 @@ const SwNumRule * SwDoc::SearchNumRule(SwPosition & rPos, do { // --> OD 2005-10-20 #i55391# - if ( !_bInvestigateStartNode ) + if ( !bInvestigateStartNode ) { if (bForward) aIdx++; @@ -1886,9 +1886,9 @@ const SwNumRule * SwDoc::SearchNumRule(SwPosition & rPos, const SwNumRule * pNumRule = pTxtNd->GetNumRule(); if (pNumRule) { - if (pNumRule->IsOutlineRule() == bOutline && // #115901# - ( (bNum && pNumRule->Get(0).IsEnumeration()) || - (!bNum && pNumRule->Get(0).IsItemize()) )) // #i22362#, #i29560# + if ( ( pNumRule->IsOutlineRule() == ( bOutline ? TRUE : FALSE ) ) && // #115901# + ( ( bNum && pNumRule->Get(0).IsEnumeration()) || + ( !bNum && pNumRule->Get(0).IsItemize() ) ) ) // #i22362#, #i29560# { pResult = pTxtNd->GetNumRule(); // --> OD 2008-03-18 #refactorlists# @@ -1911,7 +1911,7 @@ const SwNumRule * SwDoc::SearchNumRule(SwPosition & rPos, } // --> OD 2005-10-20 #i55391# - if ( _bInvestigateStartNode ) + if ( bInvestigateStartNode ) { if (bForward) aIdx++; diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx index dba567c545..cefb747485 100644 --- a/sw/source/core/docnode/ndcopy.cxx +++ b/sw/source/core/docnode/ndcopy.cxx @@ -795,34 +795,68 @@ bool SwDoc::Copy( SwPaM& rPam, SwPosition& rPos, bool bCopyAll ) const // Kopieren eines Bereiches im oder in ein anderes Dokument ! // Die Position darf nicht im Bereich liegen !! -BOOL lcl_MarksWholeNode(const SwPaM & rPam) +bool lcl_MarksWholeNode(const SwPaM & rPam) { - BOOL bResult = FALSE; - const SwPosition * pStt = rPam.Start(), * pEnd = rPam.End(); + bool bResult = false; + const SwPosition* pStt = rPam.Start(); + const SwPosition* pEnd = rPam.End(); if (NULL != pStt && NULL != pEnd) { - SwTxtNode * pSttNd = pStt->nNode.GetNode().GetTxtNode(); - SwTxtNode * pEndNd = pEnd->nNode.GetNode().GetTxtNode(); + const SwTxtNode* pSttNd = pStt->nNode.GetNode().GetTxtNode(); + const SwTxtNode* pEndNd = pEnd->nNode.GetNode().GetTxtNode(); if (NULL != pSttNd && NULL != pEndNd && pStt->nContent.GetIndex() == 0 && pEnd->nContent.GetIndex() == pEndNd->Len()) { - bResult = TRUE; + bResult = true; } } return bResult; } +// --> OD 2009-08-25 #i86492# +bool lcl_ContainsOnlyParagraphsInList( const SwPaM& rPam ) +{ + bool bRet = false; + + const SwTxtNode* pTxtNd = rPam.Start()->nNode.GetNode().GetTxtNode(); + const SwTxtNode* pEndTxtNd = rPam.End()->nNode.GetNode().GetTxtNode(); + if ( pTxtNd && pTxtNd->IsInList() && + pEndTxtNd && pEndTxtNd->IsInList() ) + { + bRet = true; + SwNodeIndex aIdx(rPam.Start()->nNode); + + do + { + aIdx++; + pTxtNd = aIdx.GetNode().GetTxtNode(); + + if ( !pTxtNd || !pTxtNd->IsInList() ) + { + bRet = false; + break; + } + } while ( pTxtNd && pTxtNd != pEndTxtNd ); + } + + + return bRet; +} +// <-- + BOOL SwDoc::_Copy( SwPaM& rPam, SwPosition& rPos, BOOL bMakeNewFrms, bool bCopyAll, SwPaM* pCpyRange ) const { SwDoc* pDoc = rPos.nNode.GetNode().GetDoc(); - bool bColumnSel = pDoc->IsClipBoard() && pDoc->IsColumnSelection(); + const bool bColumnSel = pDoc->IsClipBoard() && pDoc->IsColumnSelection(); + + SwPosition* pStt = rPam.Start(); + SwPosition* pEnd = rPam.End(); - SwPosition *pStt = rPam.Start(), *pEnd = rPam.End(); // kein Copy abfangen. if( !rPam.HasMark() || ( *pStt >= *pEnd && !bColumnSel ) || //JP 29.6.2001: 88963 - dont copy if inspos is in region of start to end @@ -830,7 +864,7 @@ BOOL SwDoc::_Copy( SwPaM& rPam, SwPosition& rPos, ( pDoc == this && *pStt <= rPos && rPos < *pEnd )) return FALSE; - BOOL bEndEqualIns = pDoc == this && rPos == *pEnd; + const bool bEndEqualIns = pDoc == this && rPos == *pEnd; // falls Undo eingeschaltet, erzeuge das UndoCopy-Objekt SwUndoCpyDoc* pUndo = 0; @@ -858,43 +892,63 @@ BOOL SwDoc::_Copy( SwPaM& rPam, SwPosition& rPos, SwNodeRange aRg( pStt->nNode, pEnd->nNode ); SwNodeIndex aInsPos( rPos.nNode ); - BOOL bOneNode = pStt->nNode == pEnd->nNode; - SwTxtNode* pSttNd = pStt->nNode.GetNode().GetTxtNode(); - SwTxtNode* pEndNd = pEnd->nNode.GetNode().GetTxtNode(); - SwTxtNode* pDestNd = aInsPos.GetNode().GetTxtNode(); - BOOL bCopyCollFmt = !pDoc->IsInsOnlyTextGlossary() && ( - ( pDestNd && !pDestNd->GetTxt().Len() ) || - ( !bOneNode && !rPos.nContent.GetIndex() )); - BOOL bCopyBookmarks = TRUE; - BOOL bStartIsTxtNode = 0 != pSttNd; - - // --> OD 2008-03-18 #refactorlists# - String aDummy; - const SwNumRule * pNumRuleToPropagate = - pDoc->SearchNumRule(rPos, FALSE, FALSE, TRUE, 0, aDummy); + const bool bOneNode = pStt->nNode == pEnd->nNode; + SwTxtNode* pSttTxtNd = pStt->nNode.GetNode().GetTxtNode(); + SwTxtNode* pEndTxtNd = pEnd->nNode.GetNode().GetTxtNode(); + SwTxtNode* pDestTxtNd = aInsPos.GetNode().GetTxtNode(); + bool bCopyCollFmt = !pDoc->IsInsOnlyTextGlossary() && + ( ( pDestTxtNd && !pDestTxtNd->GetTxt().Len() ) || + ( !bOneNode && !rPos.nContent.GetIndex() ) ); + bool bCopyBookmarks = true; + BOOL bStartIsTxtNode = 0 != pSttTxtNd; + + // --> OD 2009-08-25 #i86492# + // Correct the search for a previous list: + // First search for non-outline numbering list. Then search for non-outline + // bullet list. + // Keep also the <ListId> value for possible propagation. + String aListIdToPropagate; + const SwNumRule* pNumRuleToPropagate = + pDoc->SearchNumRule( rPos, false, true, false, 0, aListIdToPropagate, true ); + if ( !pNumRuleToPropagate ) + { + pNumRuleToPropagate = + pDoc->SearchNumRule( rPos, false, false, false, 0, aListIdToPropagate, true ); + } + // <-- + // --> OD 2009-08-25 #i86492# + // Do not propagate previous found list, if + // - destination is an empty paragraph which is not in a list and + // - source contains at least one paragraph which is not in a list + if ( pNumRuleToPropagate && + pDestTxtNd && !pDestTxtNd->GetTxt().Len() && !pDestTxtNd->IsInList() && + !lcl_ContainsOnlyParagraphsInList( rPam ) ) + { + pNumRuleToPropagate = 0; + } // <-- // Block, damit aus diesem gesprungen werden kann !! do { - if( pSttNd ) + if( pSttTxtNd ) { // den Anfang nicht komplett kopieren ? if( !bCopyCollFmt || bColumnSel || pStt->nContent.GetIndex() ) { SwIndex aDestIdx( rPos.nContent ); BOOL bCopyOk = FALSE; - if( !pDestNd ) + if( !pDestTxtNd ) { if( pStt->nContent.GetIndex() || bOneNode ) - pDestNd = pDoc->GetNodes().MakeTxtNode( aInsPos, + pDestTxtNd = pDoc->GetNodes().MakeTxtNode( aInsPos, pDoc->GetTxtCollFromPool(RES_POOLCOLL_STANDARD)); else { - pDestNd = (SwTxtNode*)pSttNd->MakeCopy( pDoc, aInsPos ); + pDestTxtNd = static_cast<SwTxtNode*>(pSttTxtNd->MakeCopy( pDoc, aInsPos )); bCopyOk = TRUE; } - aDestIdx.Assign( pDestNd, 0 ); - bCopyCollFmt = TRUE; + aDestIdx.Assign( pDestTxtNd, 0 ); + bCopyCollFmt = true; } else if( !bOneNode || bColumnSel ) { @@ -911,8 +965,8 @@ BOOL SwDoc::_Copy( SwPaM& rPam, SwPosition& rPos, aCpyPam.Move( fnMoveBackward, fnGoCntnt ); } - pDestNd = pDoc->GetNodes()[ aInsPos.GetIndex()-1 ]->GetTxtNode(); - aDestIdx.Assign( pDestNd, pDestNd->GetTxt().Len() ); + pDestTxtNd = pDoc->GetNodes()[ aInsPos.GetIndex()-1 ]->GetTxtNode(); + aDestIdx.Assign( pDestTxtNd, pDestTxtNd->GetTxt().Len() ); // korrigiere den Bereich wieder !! if( bEndEqualIns ) @@ -925,59 +979,83 @@ BOOL SwDoc::_Copy( SwPaM& rPam, SwPosition& rPos, rPam.Exchange(); aRg.aEnd = pEnd->nNode; - pEndNd = pEnd->nNode.GetNode().GetTxtNode(); + pEndTxtNd = pEnd->nNode.GetNode().GetTxtNode(); } else if( rPos == *pEnd ) // Wurde das Ende auch verschoben { pEnd->nNode--; - pEnd->nContent.Assign( pDestNd, nCntntEnd ); + pEnd->nContent.Assign( pDestTxtNd, nCntntEnd ); aRg.aEnd = pEnd->nNode; - pEndNd = pEnd->nNode.GetNode().GetTxtNode(); + pEndTxtNd = pEnd->nNode.GetNode().GetTxtNode(); } } - const SfxPoolItem * pItem = NULL; - const SfxItemSet * pAttrSet = pDestNd->GetpSwAttrSet(); - /* #107213#: Safe numrule item at destination. */ - int aState = SFX_ITEM_UNKNOWN; + // --> OD 2009-08-25 #i86492# + // Safe also <ListId> item of destination. + int aNumRuleState = SFX_ITEM_UNKNOWN; SwNumRuleItem aNumRuleItem; - - if (pAttrSet != NULL) + int aListIdState = SFX_ITEM_UNKNOWN; + SfxStringItem aListIdItem( RES_PARATR_LIST_ID, String() ); { - aState = - pAttrSet->GetItemState(RES_PARATR_NUMRULE, FALSE, &pItem); - - if (SFX_ITEM_SET == aState) - aNumRuleItem = *((SwNumRuleItem *) pItem); + const SfxItemSet * pAttrSet = pDestTxtNd->GetpSwAttrSet(); + if (pAttrSet != NULL) + { + const SfxPoolItem * pItem = NULL; + aNumRuleState = pAttrSet->GetItemState(RES_PARATR_NUMRULE, FALSE, &pItem); + if (SFX_ITEM_SET == aNumRuleState) + aNumRuleItem = *((SwNumRuleItem *) pItem); + + aListIdState = + pAttrSet->GetItemState(RES_PARATR_LIST_ID, FALSE, &pItem); + if (SFX_ITEM_SET == aListIdState) + { + aListIdItem.SetValue( static_cast<const SfxStringItem*>(pItem)->GetValue() ); + } + } } + // <-- /* #107213# */ if( !bCopyOk ) { - xub_StrLen nCpyLen = ( bOneNode ? pEnd->nContent.GetIndex() - : pSttNd->GetTxt().Len() ) - - pStt->nContent.GetIndex(); - pSttNd->Copy( pDestNd, aDestIdx, pStt->nContent, nCpyLen ); + xub_StrLen nCpyLen = ( bOneNode + ? pEnd->nContent.GetIndex() + : pSttTxtNd->GetTxt().Len() ) + - pStt->nContent.GetIndex(); + pSttTxtNd->Copy( pDestTxtNd, aDestIdx, pStt->nContent, nCpyLen ); if( bEndEqualIns ) pEnd->nContent -= nCpyLen; } if( bOneNode ) { - // ist der DestinationNode leer, kopiere die Vorlage mit if( bCopyCollFmt ) { - pSttNd->CopyCollFmt( *pDestNd ); + pSttTxtNd->CopyCollFmt( *pDestTxtNd ); /* #107213# If only a part of one paragraph is copied restore the numrule at the destination. */ - if (! lcl_MarksWholeNode(rPam)) + // --> OD 2009-08-25 #i86492# + // restore also <ListId> item + if ( !lcl_MarksWholeNode(rPam) ) { - if (SFX_ITEM_SET == aState) - pDestNd->SetAttr(aNumRuleItem); + if (SFX_ITEM_SET == aNumRuleState) + { + pDestTxtNd->SetAttr(aNumRuleItem); + } + else + { + pDestTxtNd->ResetAttr(RES_PARATR_NUMRULE); + } + if (SFX_ITEM_SET == aListIdState) + { + pDestTxtNd->SetAttr(aListIdItem); + } else - pDestNd->ResetAttr(RES_PARATR_NUMRULE); + { + pDestTxtNd->ResetAttr(RES_PARATR_LIST_ID); + } } } @@ -987,13 +1065,13 @@ BOOL SwDoc::_Copy( SwPaM& rPam, SwPosition& rPos, aRg.aStart++; } } - else if( pDestNd ) + else if( pDestTxtNd ) { // Problems with insertion of table selections into "normal" text solved. // We have to set the correct PaM for Undo, if this PaM starts in a textnode, // the undo operation will try to merge this node after removing the table. // If we didn't split a textnode, the PaM should start at the inserted table node - if( rPos.nContent.GetIndex() == pDestNd->Len() ) + if( rPos.nContent.GetIndex() == pDestTxtNd->Len() ) { // Insertion at the last position of a textnode (empty or not) aInsPos++; // The table will be inserted behind the text node } @@ -1040,15 +1118,15 @@ BOOL SwDoc::_Copy( SwPaM& rPam, SwPosition& rPos, } } - pDestNd = aInsPos.GetNode().GetTxtNode(); - if( pEndNd ) + pDestTxtNd = aInsPos.GetNode().GetTxtNode(); + if( pEndTxtNd ) { SwIndex aDestIdx( rPos.nContent ); - if( !pDestNd ) + if( !pDestTxtNd ) { - pDestNd = pDoc->GetNodes().MakeTxtNode( aInsPos, + pDestTxtNd = pDoc->GetNodes().MakeTxtNode( aInsPos, pDoc->GetTxtCollFromPool(RES_POOLCOLL_STANDARD)); - aDestIdx.Assign( pDestNd, 0 ); + aDestIdx.Assign( pDestTxtNd, 0 ); aInsPos--; // #112756# #98130# if we have to insert an extra text node @@ -1060,42 +1138,66 @@ BOOL SwDoc::_Copy( SwPaM& rPam, SwPosition& rPos, bStartIsTxtNode = TRUE; } - const SfxPoolItem * pItem = NULL; - const SfxItemSet* pAttrSet = pDestNd->GetpSwAttrSet(); - /* #107213# Save numrule at destination */ - int aState = SFX_ITEM_UNKNOWN; + // --> OD 2009-08-25 #i86492# + // Safe also <ListId> item of destination. + int aNumRuleState = SFX_ITEM_UNKNOWN; SwNumRuleItem aNumRuleItem; - - if (pAttrSet != NULL) + int aListIdState = SFX_ITEM_UNKNOWN; + SfxStringItem aListIdItem( RES_PARATR_LIST_ID, String() ); { - aState = - pAttrSet->GetItemState(RES_PARATR_NUMRULE, FALSE, &pItem); + const SfxItemSet* pAttrSet = pDestTxtNd->GetpSwAttrSet(); + if (pAttrSet != NULL) + { + const SfxPoolItem * pItem = NULL; + + aNumRuleState = + pAttrSet->GetItemState(RES_PARATR_NUMRULE, FALSE, &pItem); + if (SFX_ITEM_SET == aNumRuleState) + aNumRuleItem = *((SwNumRuleItem *) pItem); - if (SFX_ITEM_SET == aState) - aNumRuleItem = *((SwNumRuleItem *) pItem); + aListIdState = + pAttrSet->GetItemState(RES_PARATR_LIST_ID, FALSE, &pItem); + if (SFX_ITEM_SET == aListIdState) + aListIdItem.SetValue( static_cast<const SfxStringItem*>(pItem)->GetValue() ); + } } + // <-- /* #107213# */ - BOOL bEmptyDestNd = 0 == pDestNd->GetTxt().Len(); - pEndNd->Copy( pDestNd, aDestIdx, SwIndex( pEndNd ), + BOOL bEmptyDestNd = 0 == pDestTxtNd->GetTxt().Len(); + pEndTxtNd->Copy( pDestTxtNd, aDestIdx, SwIndex( pEndTxtNd ), pEnd->nContent.GetIndex() ); // auch alle FormatVorlagen kopieren if( bCopyCollFmt && ( bOneNode || bEmptyDestNd )) { - pEndNd->CopyCollFmt( *pDestNd ); + pEndTxtNd->CopyCollFmt( *pDestTxtNd ); - if (bOneNode) + if ( bOneNode ) { /* #107213# If only a part of one paragraph is copied restore the numrule at the destination. */ - if ( ! lcl_MarksWholeNode(rPam)) + // --> OD 2009-08-25 #i86492# + // restore also <ListId> item + if ( !lcl_MarksWholeNode(rPam) ) { - if (SFX_ITEM_SET == aState) - pDestNd->SetAttr(aNumRuleItem); + if (SFX_ITEM_SET == aNumRuleState) + { + pDestTxtNd->SetAttr(aNumRuleItem); + } else - pDestNd->ResetAttr(RES_PARATR_NUMRULE); + { + pDestTxtNd->ResetAttr(RES_PARATR_NUMRULE); + } + if (SFX_ITEM_SET == aListIdState) + { + pDestTxtNd->SetAttr(aListIdItem); + } + else + { + pDestTxtNd->ResetAttr(RES_PARATR_LIST_ID); + } } } } @@ -1104,13 +1206,13 @@ BOOL SwDoc::_Copy( SwPaM& rPam, SwPosition& rPos, if( bCopyAll || aRg.aStart != aRg.aEnd ) { SfxItemSet aBrkSet( pDoc->GetAttrPool(), aBreakSetRange ); - if( pSttNd && bCopyCollFmt && pDestNd->HasSwAttrSet() ) + if( pSttTxtNd && bCopyCollFmt && pDestTxtNd->HasSwAttrSet() ) { - aBrkSet.Put( *pDestNd->GetpSwAttrSet() ); + aBrkSet.Put( *pDestTxtNd->GetpSwAttrSet() ); if( SFX_ITEM_SET == aBrkSet.GetItemState( RES_BREAK, FALSE ) ) - pDestNd->ResetAttr( RES_BREAK ); + pDestTxtNd->ResetAttr( RES_BREAK ); if( SFX_ITEM_SET == aBrkSet.GetItemState( RES_PAGEDESC, FALSE ) ) - pDestNd->ResetAttr( RES_PAGEDESC ); + pDestTxtNd->ResetAttr( RES_PAGEDESC ); } if( aInsPos == pEnd->nNode ) @@ -1124,13 +1226,13 @@ BOOL SwDoc::_Copy( SwPaM& rPam, SwPosition& rPos, else CopyWithFlyInFly( aRg, pEnd->nContent.GetIndex(), aInsPos, bMakeNewFrms, FALSE ); - bCopyBookmarks = FALSE; + bCopyBookmarks = false; // harte Umbrueche wieder in den ersten Node setzen - if( aBrkSet.Count() && 0 != ( pDestNd = pDoc->GetNodes()[ + if( aBrkSet.Count() && 0 != ( pDestTxtNd = pDoc->GetNodes()[ aCpyPam.GetPoint()->nNode.GetIndex()+1 ]->GetTxtNode() ) ) { - pDestNd->SetAttr( aBrkSet ); + pDestTxtNd->SetAttr( aBrkSet ); } } } while( FALSE ); @@ -1169,8 +1271,14 @@ BOOL SwDoc::_Copy( SwPaM& rPam, SwPosition& rPos, *pCpyRange->GetMark() = *aCpyPam.GetMark(); } - if (pNumRuleToPropagate) - pDoc->ReplaceNumRule(aCpyPam, *pNumRuleToPropagate); + if ( pNumRuleToPropagate ) + { + // --> OD 2009-08-25 #i86492# + // use <SwDoc::SetNumRule(..)>, because it also handles the <ListId> +// pDoc->ReplaceNumRule(aCpyPam, *pNumRuleToPropagate); + pDoc->SetNumRule( aCpyPam, *pNumRuleToPropagate, false, + aListIdToPropagate, sal_True, true ); + } pDoc->SetRedlineMode_intern( eOld ); pDoc->SetModified(); @@ -1181,7 +1289,7 @@ BOOL SwDoc::_Copy( SwPaM& rPam, SwPosition& rPos, // ----- Copy-Methode vom SwDoc - "kopiere Fly's in Fly's" ------ -void SwDoc::CopyWithFlyInFly( const SwNodeRange& rRg, const xub_StrLen nEndContentIndex, +void SwDoc::CopyWithFlyInFly( const SwNodeRange& rRg, const xub_StrLen nEndContentIndex, const SwNodeIndex& rInsPos, BOOL bMakeNewFrms, BOOL bDelRedlines, BOOL bCopyFlyAtFly ) const { @@ -1324,11 +1432,11 @@ void SwDoc::_CopyFlyInFly( const SwNodeRange& rRg, const xub_StrLen nEndContentI { if( bAtCntnt ) bAdd = nEndContentIndex > 0; - else + else bAdd = pAPos->nContent <= nEndContentIndex; } } - if( bAdd ) + if( bAdd ) aArr.Insert( _ZSortFly( pFmt, pAnchor, nArrLen + aArr.Count() )); } } diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx index ba06e528b4..b9d4523edb 100644 --- a/sw/source/core/edit/ednumber.cxx +++ b/sw/source/core/edit/ednumber.cxx @@ -565,7 +565,7 @@ BOOL SwEditShell::IsProtectedOutlinePara() const // BYTE nTmpLvl = GetRealLevel( pTmpNd->GetTxtNode()-> // GetTxtColl()->GetOutlineLevel() ); // int nTmpLvl = pTmpNd->GetTxtNode()->GetOutlineLevel();//#outline level,zhaojianwei - int nTmpLvl = pTmpNd->GetTxtNode()->GetAttrOutlineLevel(); + int nTmpLvl = pTmpNd->GetTxtNode()->GetAttrOutlineLevel(); // ASSERT( nTmpLvl >= 0 && nTmpLvl < MAXLEVEL, ASSERT( nTmpLvl >= 0 && nTmpLvl <= MAXLEVEL, //<-end,zhaojianwei "<SwEditShell::IsProtectedOutlinePara()>" ); @@ -825,9 +825,9 @@ USHORT SwEditShell::GetNodeNumStart() const -----------------------------------------------------------------------*/ // --> OD 2008-03-18 #refactorlists# -const SwNumRule * SwEditShell::SearchNumRule( BOOL bForward, - BOOL bNum, - BOOL bOutline, +const SwNumRule * SwEditShell::SearchNumRule( const bool bForward, + const bool bNum, + const bool bOutline, int nNonEmptyAllowed, String& sListId ) { diff --git a/sw/source/core/inc/frmtool.hxx b/sw/source/core/inc/frmtool.hxx index 584c22ec09..199be26f58 100644 --- a/sw/source/core/inc/frmtool.hxx +++ b/sw/source/core/inc/frmtool.hxx @@ -518,21 +518,26 @@ inline BOOL SwBorderAttrs::IsLine() const OD 2004-03-10 #i28701# Values only provided for flow frames (table, section or text frames) Note: line spacing value is only determined for text frames + OD 2009-08-28 #i102458# + Add output parameter <obIsLineSpacingProportional> - @param _rFrm + @param rFrm input parameter - frame, for which the spacing values are determined. - @param _roPrevLowerSpacing + @param onPrevLowerSpacing output parameter - lower spacing of the frame in SwTwips - @param _roPrevLineSpacing + @param onPrevLineSpacing output parameter - line spacing of the frame in SwTwips + @param obIsLineSpacingProportional + @author OD */ -void GetSpacingValuesOfFrm( const SwFrm& _rFrm, - SwTwips& _roLowerSpacing, - SwTwips& _roLineSpacing ); +void GetSpacingValuesOfFrm( const SwFrm& rFrm, + SwTwips& onLowerSpacing, + SwTwips& onLineSpacing, + bool& obIsLineSpacingProportional ); /** method to get the content of the table cell diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index ba9f0f9b99..4968601e7a 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -1514,7 +1514,12 @@ SwTwips SwFlowFrm::CalcUpperSpace( const SwBorderAttrs *pAttrs, // values of found previous frame and use these values. SwTwips nPrevLowerSpace = 0; SwTwips nPrevLineSpacing = 0; - GetSpacingValuesOfFrm( (*pPrevFrm), nPrevLowerSpace, nPrevLineSpacing ); + // --> OD 2009-08-28 #i102458# + bool bPrevLineSpacingPorportional = false; + GetSpacingValuesOfFrm( (*pPrevFrm), + nPrevLowerSpace, nPrevLineSpacing, + bPrevLineSpacingPorportional ); + // <-- if( pIDSA->get(IDocumentSettingAccess::PARA_SPACE_MAX) ) { nUpper = nPrevLowerSpace + pAttrs->GetULSpace().GetUpper(); @@ -1539,7 +1544,22 @@ SwTwips SwFlowFrm::CalcUpperSpace( const SwBorderAttrs *pAttrs, // building its maximum. if ( pOwn->IsTxtFrm() ) { - nAdd += static_cast<SwTxtFrm&>(rThis).GetLineSpace( true ); + // --> OD 2009-08-28 #i102458# + // Correction: + // A proportional line spacing of the previous text frame + // is added up to a own leading line spacing. + // Otherwise, the maximum of the leading line spacing + // of the previous text frame and the own leading line + // spacing is built. + if ( bPrevLineSpacingPorportional ) + { + nAdd += static_cast<SwTxtFrm&>(rThis).GetLineSpace( true ); + } + else + { + nAdd = Max( nAdd, static_cast<SwTxtFrm&>(rThis).GetLineSpace( true ) ); + } + // <-- } nUpper += nAdd; } @@ -1571,7 +1591,22 @@ SwTwips SwFlowFrm::CalcUpperSpace( const SwBorderAttrs *pAttrs, SwTwips nAdd = nPrevLineSpacing; if ( pOwn->IsTxtFrm() ) { - nAdd += static_cast<SwTxtFrm&>(rThis).GetLineSpace( true ); + // --> OD 2009-08-28 #i102458# + // Correction: + // A proportional line spacing of the previous text frame + // is added up to a own leading line spacing. + // Otherwise, the maximum of the leading line spacing + // of the previous text frame and the own leading line + // spacing is built. + if ( bPrevLineSpacingPorportional ) + { + nAdd += static_cast<SwTxtFrm&>(rThis).GetLineSpace( true ); + } + else + { + nAdd = Max( nAdd, static_cast<SwTxtFrm&>(rThis).GetLineSpace( true ) ); + } + // <-- } nUpper += nAdd; } @@ -1675,7 +1710,10 @@ SwTwips SwFlowFrm::_GetUpperSpaceAmountConsideredForPrevFrm() const { SwTwips nPrevLowerSpace = 0; SwTwips nPrevLineSpacing = 0; - GetSpacingValuesOfFrm( (*pPrevFrm), nPrevLowerSpace, nPrevLineSpacing ); + // --> OD 2009-08-28 #i102458# + bool bDummy = false; + GetSpacingValuesOfFrm( (*pPrevFrm), nPrevLowerSpace, nPrevLineSpacing, bDummy ); + // <-- if ( nPrevLowerSpace > 0 || nPrevLineSpacing > 0 ) { const IDocumentSettingAccess* pIDSA = rThis.GetUpper()->GetFmt()->getIDocumentSettingAccess(); @@ -2697,8 +2735,3 @@ const SwFlowFrm *SwFlowFrm::CastFlowFrm( const SwFrm *pFrm ) return (SwSectionFrm*)pFrm; return 0; } - - - - - diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index 6e96769025..756269cd03 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -3655,30 +3655,37 @@ const SwRect SwPageFrm::PrtWithoutHeaderAndFooter() const /** method to determine the spacing values of a frame OD 2004-03-10 #i28701# + OD 2009-08-28 #i102458# + Add output parameter <obIsLineSpacingProportional> @author OD */ -void GetSpacingValuesOfFrm( const SwFrm& _rFrm, - SwTwips& _roLowerSpacing, - SwTwips& _roLineSpacing ) +void GetSpacingValuesOfFrm( const SwFrm& rFrm, + SwTwips& onLowerSpacing, + SwTwips& onLineSpacing, + bool& obIsLineSpacingProportional ) { - if ( !_rFrm.IsFlowFrm() ) + if ( !rFrm.IsFlowFrm() ) { - _roLowerSpacing = 0L; - _roLineSpacing = 0L; + onLowerSpacing = 0; + onLineSpacing = 0; } else { - const SvxULSpaceItem& rULSpace = _rFrm.GetAttrSet()->GetULSpace(); - _roLowerSpacing = rULSpace.GetLower(); + const SvxULSpaceItem& rULSpace = rFrm.GetAttrSet()->GetULSpace(); + onLowerSpacing = rULSpace.GetLower(); - _roLineSpacing = 0; - if ( _rFrm.IsTxtFrm() ) + onLineSpacing = 0; + obIsLineSpacingProportional = false; + if ( rFrm.IsTxtFrm() ) { - _roLineSpacing = static_cast<const SwTxtFrm&>(_rFrm).GetLineSpace(); + onLineSpacing = static_cast<const SwTxtFrm&>(rFrm).GetLineSpace(); + obIsLineSpacingProportional = + onLineSpacing != 0 && + static_cast<const SwTxtFrm&>(rFrm).GetLineSpace( true ) == 0; } - ASSERT( _roLowerSpacing >= 0 && _roLineSpacing >= 0, + ASSERT( onLowerSpacing >= 0 && onLineSpacing >= 0, "<GetSpacingValuesOfFrm(..)> - spacing values aren't positive!" ); } } diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx index 25ad1a25ca..7fbb6bae55 100644 --- a/sw/source/core/text/itrcrsr.cxx +++ b/sw/source/core/text/itrcrsr.cxx @@ -157,8 +157,10 @@ void SwTxtMargin::CtorInitTxtMargin( SwTxtFrm *pNewFrm, SwTxtSizeInfo *pNewInf ) GetInfo().SetFont( GetFnt() ); const SwTxtNode *pNode = pFrm->GetTxtNode(); - const SvxLRSpaceItem &rSpace = - pFrm->GetTxtNode()->GetSwAttrSet().GetLRSpace(); + const SvxLRSpaceItem &rSpace = pFrm->GetTxtNode()->GetSwAttrSet().GetLRSpace(); + // --> OD 2009-09-02 #i95907# + const bool bListLevelIndentsApplicable = pFrm->GetTxtNode()->AreListLevelIndentsApplicable(); + // <-- // // Carefully adjust the text formatting ranges. @@ -181,8 +183,13 @@ void SwTxtMargin::CtorInitTxtMargin( SwTxtFrm *pNewFrm, SwTxtSizeInfo *pNewInf ) pFrm->Prt().Left() + nLMWithNum - pNode->GetLeftMarginWithNum( sal_False ) - - rSpace.GetLeft() + - rSpace.GetTxtLeft(); + // --> OD 2009-09-02 #i95907# +// rSpace.GetLeft() + +// rSpace.GetTxtLeft(); + ( bListLevelIndentsApplicable + ? 0 + : ( rSpace.GetLeft() - rSpace.GetTxtLeft() ) ); + // <-- } else { @@ -193,8 +200,13 @@ void SwTxtMargin::CtorInitTxtMargin( SwTxtFrm *pNewFrm, SwTxtSizeInfo *pNewInf ) pFrm->Prt().Left() + nLMWithNum - pNode->GetLeftMarginWithNum( sal_False ) - - rSpace.GetLeft() + - rSpace.GetTxtLeft(); + // --> OD 2009-09-02 #i95907# +// rSpace.GetLeft() + +// rSpace.GetTxtLeft(); + ( bListLevelIndentsApplicable + ? 0 + : ( rSpace.GetLeft() - rSpace.GetTxtLeft() ) ); + // <-- } else { diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 201ac8049a..ed037311e5 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -234,7 +234,6 @@ SwTxtNode::SwTxtNode( const SwNodeIndex &rWhere, mpNodeNum( 0 ), m_bLastOutlineState( false ), m_bNotifiable( false ), - //nOutlineLevel( pTxtColl->GetOutlineLevel() )//#outline level, removed by zhaojianwei. // --> OD 2008-11-19 #i70748# mbEmptyListStyleSetDueToSetOutlineLevelAttr( false ), // <-- @@ -253,6 +252,15 @@ SwTxtNode::SwTxtNode( const SwNodeIndex &rWhere, // SyncNumberAndNumRule(); if ( !IsInList() && GetNumRule() && GetListId().Len() > 0 ) { + // --> OD 2009-08-27 #i101516# + // apply paragraph style's assigned outline style list level as + // list level of the paragraph, if it has none set already. + if ( !HasAttrListLevel() && + pTxtColl && pTxtColl->IsAssignedToListLevelOfOutlineStyle() ) + { + SetAttrListLevel( pTxtColl->GetAssignedOutlineStyleLevel() ); + } + // <-- AddToList(); } // <-- |