merge the formfield patch from ooo-build
[ooovba.git] / applied_patches / 0557-sw-insert-pagebreak-in-numbered-paragraph.diff
blob263c778191c3764ee0249986ba58de3a252c3a3e
1 diff --git sw/inc/doc.hxx sw/inc/doc.hxx
2 index 0831e56..c2e7a26 100644
3 --- sw/inc/doc.hxx
4 +++ sw/inc/doc.hxx
5 @@ -1737,6 +1737,7 @@ public:
6 void ChkBoxNumFmt( SwTableBox& rAktBox, sal_Bool bCallUpdate );
7 void SetTblBoxFormulaAttrs( SwTableBox& rBox, const SfxItemSet& rSet );
8 void ClearBoxNumAttrs( const SwNodeIndex& rNode );
9 + void ClearLineNumAttrs( SwPosition & rPos );
11 sal_Bool InsCopyOfTbl( SwPosition& rInsPos, const SwSelBoxes& rBoxes,
12 const SwTable* pCpyTbl = 0, sal_Bool bCpyName = sal_False,
13 diff --git sw/source/core/docnode/ndtbl.cxx sw/source/core/docnode/ndtbl.cxx
14 index 14aedd0..53df862 100644
15 --- sw/source/core/docnode/ndtbl.cxx
16 +++ sw/source/core/docnode/ndtbl.cxx
17 @@ -43,6 +43,7 @@
18 #include <svx/brkitem.hxx>
19 #include <svx/protitem.hxx>
20 #include <svx/boxitem.hxx>
21 +#include <svtools/stritem.hxx>
22 // OD 06.08.2003 #i17174#
23 #include <svx/shaditem.hxx>
24 #include <fmtfsize.hxx>
25 @@ -4210,6 +4211,48 @@ void SwDoc::SetTblBoxFormulaAttrs( SwTableBox& rBox, const SfxItemSet& rSet )
26 SetModified();
29 +void SwDoc::ClearLineNumAttrs( SwPosition & rPos )
31 + SwPaM aPam(rPos);
32 + aPam.Move(fnMoveBackward);
33 + SwCntntNode *pNode = aPam.GetCntntNode();
34 + if ( 0 == pNode )
35 + return ;
36 + if( pNode->IsTxtNode() )
37 + {
38 + SwTxtNode * pTxtNode = pNode->GetTxtNode();
39 + if ( pTxtNode && pTxtNode->IsNumbered() && pTxtNode->GetTxt().Len()==0 )
40 + {
41 + const SfxPoolItem* pFmtItem = 0;
42 + SfxItemSet rSet( const_cast<SwAttrPool&>(pTxtNode->GetDoc()->GetAttrPool()),
43 + RES_PARATR_BEGIN, RES_PARATR_END - 1,
44 + 0);
45 + pTxtNode->SwCntntNode::GetAttr( rSet );
46 + if ( SFX_ITEM_SET == rSet.GetItemState( RES_PARATR_NUMRULE , FALSE , &pFmtItem ) )
47 + {
48 + SwUndoDelNum * pUndo;
49 + if( DoesUndo() )
50 + {
51 + ClearRedo();
52 + AppendUndo( pUndo = new SwUndoDelNum( aPam ) );
53 + }
54 + else
55 + pUndo = 0;
56 + SwRegHistory aRegH( pUndo ? pUndo->GetHistory() : 0 );
57 + aRegH.RegisterInModify( pTxtNode , *pTxtNode );
58 + if ( pUndo )
59 + pUndo->AddNode( *pTxtNode , FALSE );
60 + String aStyle = String::CreateFromAscii("");
61 + SfxStringItem * pNewItem = (SfxStringItem*)pFmtItem->Clone();
62 + pNewItem->SetValue( aStyle );
63 + rSet.Put( *pNewItem );
64 + pTxtNode->SetAttr( rSet );
65 + delete pNewItem;
66 + }
67 + }
68 + }
71 void SwDoc::ClearBoxNumAttrs( const SwNodeIndex& rNode )
73 SwStartNode* pSttNd;
74 diff --git sw/source/ui/wrtsh/wrtsh1.cxx sw/source/ui/wrtsh/wrtsh1.cxx
75 index 1fb80ff..0a4f55a 100644
76 --- sw/source/ui/wrtsh/wrtsh1.cxx
77 +++ sw/source/ui/wrtsh/wrtsh1.cxx
78 @@ -929,6 +929,8 @@ void SwWrtShell::InsertPageBreak(const String *pPageDesc, USHORT nPgNum )
79 if(HasSelection())
80 DelRight();
81 SwFEShell::SplitNode();
82 + // delete the numbered attribute of the last line if the last line is empty
83 + GetDoc()->ClearLineNumAttrs( *GetCrsr()->GetPoint() );
86 const SwPageDesc *pDesc = pPageDesc