1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ednumber.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
35 #include <hintids.hxx>
42 #include <numrule.hxx>
44 SV_IMPL_VARARR_SORT( _SwPamRanges
, SwPamRange
)
47 SwPamRanges::SwPamRanges( const SwPaM
& rRing
)
49 const SwPaM
* pTmp
= &rRing
;
51 Insert( pTmp
->GetMark()->nNode
, pTmp
->GetPoint()->nNode
);
52 } while( &rRing
!= ( pTmp
= (const SwPaM
*)pTmp
->GetNext() ));
56 void SwPamRanges::Insert( const SwNodeIndex
& rIdx1
, const SwNodeIndex
& rIdx2
)
58 SwPamRange
aRg( rIdx1
.GetIndex(), rIdx2
.GetIndex() );
59 if( aRg
.nEnd
< aRg
.nStart
)
60 { aRg
.nStart
= aRg
.nEnd
; aRg
.nEnd
= rIdx1
.GetIndex(); }
63 const SwPamRange
* pTmp
;
64 if( Count() && Seek_Entry( aRg
, &nPos
)) // suche Insert Position
66 // ist der im Array stehende kleiner ??
67 if( ( pTmp
= GetData()+ nPos
)->nEnd
< aRg
.nEnd
)
69 aRg
.nEnd
= pTmp
->nEnd
;
70 Remove( nPos
, 1 ); // zusammenfassen
73 return; // ende, weil schon alle zusammengefasst waren
80 // mit dem Vorgaenger zusammenfassen ??
83 if( ( pTmp
= GetData()+( nPos
-1 ))->nEnd
== aRg
.nStart
84 || pTmp
->nEnd
+1 == aRg
.nStart
)
86 aRg
.nStart
= pTmp
->nStart
;
88 Remove( --nPos
, 1 ); // zusammenfassen
90 // SSelection im Bereich ??
91 else if( pTmp
->nStart
<= aRg
.nStart
&& aRg
.nEnd
<= pTmp
->nEnd
)
94 // mit dem Nachfolger zusammenfassen ??
97 if( ( pTmp
= GetData() + nPos
)->nStart
== aRg
.nEnd
||
98 pTmp
->nStart
== aRg
.nEnd
+1 )
100 aRg
.nEnd
= pTmp
->nEnd
;
102 Remove( nPos
, 1 ); // zusammenfassen
105 // SSelection im Bereich ??
106 else if( pTmp
->nStart
<= aRg
.nStart
&& aRg
.nEnd
<= pTmp
->nEnd
)
111 _SwPamRanges::Insert( aRg
);
116 SwPaM
& SwPamRanges::SetPam( USHORT nArrPos
, SwPaM
& rPam
)
118 ASSERT_ID( nArrPos
< Count(), ERR_VAR_IDX
);
119 const SwPamRange
& rTmp
= *(GetData() + nArrPos
);
120 rPam
.GetPoint()->nNode
= rTmp
.nStart
;
121 rPam
.GetPoint()->nContent
.Assign( rPam
.GetCntntNode(), 0 );
123 rPam
.GetPoint()->nNode
= rTmp
.nEnd
;
124 rPam
.GetPoint()->nContent
.Assign( rPam
.GetCntntNode(), 0 );
130 // Numerierung Outline Regelwerk
133 void SwEditShell::SetOutlineNumRule(const SwNumRule
& rRule
)
135 StartAllAction(); // Klammern fuers Updaten !!
136 GetDoc()->SetOutlineNumRule(rRule
);
141 const SwNumRule
* SwEditShell::GetOutlineNumRule() const
143 return GetDoc()->GetOutlineNumRule();
146 // setzt, wenn noch keine Numerierung, sonst wird geaendert
147 // arbeitet mit alten und neuen Regeln, nur Differenzen aktualisieren
149 // Absaetze ohne Numerierung, aber mit Einzuegen
151 BOOL
SwEditShell::NoNum()
156 SwPaM
* pCrsr
= GetCrsr();
157 if( pCrsr
->GetNext() != pCrsr
) // Mehrfachselektion ?
159 GetDoc()->StartUndo( UNDO_START
, NULL
);
160 SwPamRanges
aRangeArr( *pCrsr
);
161 SwPaM
aPam( *pCrsr
->GetPoint() );
162 for( USHORT n
= 0; n
< aRangeArr
.Count(); ++n
)
163 bRet
= bRet
&& GetDoc()->NoNum( aRangeArr
.SetPam( n
, aPam
));
164 GetDoc()->EndUndo( UNDO_END
, NULL
);
167 bRet
= GetDoc()->NoNum( *pCrsr
);
172 // Loeschen, Splitten der Aufzaehlungsliste
175 BOOL
SwEditShell::HasNumber() const
177 BOOL bResult
= FALSE
;
179 const SwTxtNode
* pTxtNd
=
180 GetCrsr()->GetPoint()->nNode
.GetNode().GetTxtNode();
184 bResult
= pTxtNd
->HasNumber();
186 // --> OD 2005-10-26 #b6340308#
187 // special case: outline numbered, not counted paragraph
189 pTxtNd
->GetNumRule() == GetDoc()->GetOutlineNumRule() &&
190 !pTxtNd
->IsCountedInList() )
200 BOOL
SwEditShell::HasBullet() const
202 BOOL bResult
= FALSE
;
204 const SwTxtNode
* pTxtNd
=
205 GetCrsr()->GetPoint()->nNode
.GetNode().GetTxtNode();
209 bResult
= pTxtNd
->HasBullet();
216 void SwEditShell::DelNumRules()
220 SwPaM
* pCrsr
= GetCrsr();
221 if( pCrsr
->GetNext() != pCrsr
) // Mehrfachselektion ?
223 GetDoc()->StartUndo( UNDO_START
, NULL
);
224 SwPamRanges
aRangeArr( *pCrsr
);
225 SwPaM
aPam( *pCrsr
->GetPoint() );
226 for( USHORT n
= 0; n
< aRangeArr
.Count(); ++n
)
228 GetDoc()->DelNumRules( aRangeArr
.SetPam( n
, aPam
) );
230 GetDoc()->EndUndo( UNDO_END
, NULL
);
233 GetDoc()->DelNumRules( *pCrsr
);
235 // rufe das AttrChangeNotify auf der UI-Seite. Sollte eigentlich
236 // ueberfluessig sein, aber VB hatte darueber eine Bugrep.
239 // --> OD 2005-10-24 #126346# - cursor can not be anymore in
240 // front of a label, because numbering/bullet is deleted.
241 SetInFrontOfLabel( FALSE
);
244 GetDoc()->SetModified();
248 // Hoch-/Runterstufen
251 BOOL
SwEditShell::NumUpDown( BOOL bDown
)
256 SwPaM
* pCrsr
= GetCrsr();
257 if( pCrsr
->GetNext() == pCrsr
) // keine Mehrfachselektion ?
258 bRet
= GetDoc()->NumUpDown( *pCrsr
, bDown
);
261 GetDoc()->StartUndo( UNDO_START
, NULL
);
262 SwPamRanges
aRangeArr( *pCrsr
);
263 SwPaM
aPam( *pCrsr
->GetPoint() );
264 for( USHORT n
= 0; n
< aRangeArr
.Count(); ++n
)
265 bRet
= bRet
&& GetDoc()->NumUpDown( aRangeArr
.SetPam( n
, aPam
), bDown
);
266 GetDoc()->EndUndo( UNDO_END
, NULL
);
268 GetDoc()->SetModified();
270 // --> FME 2005-09-19 #i54693# Update marked numbering levels
271 if ( IsInFrontOfLabel() )
272 UpdateMarkedListLevel();
281 BOOL
SwEditShell::IsFirstOfNumRule() const
283 BOOL bResult
= FALSE
;
285 SwPaM
* pCrsr
= GetCrsr();
286 if (pCrsr
->GetNext() == pCrsr
)
288 bResult
= IsFirstOfNumRule(*pCrsr
);
294 BOOL
SwEditShell::IsFirstOfNumRule(const SwPaM
& rPaM
) const
296 BOOL bResult
= FALSE
;
298 SwPosition
aPos(*rPaM
.GetPoint());
299 bResult
= GetDoc()->IsFirstOfNumRule(aPos
);
306 // --> OD 2008-06-09 #i90078#
307 // Remove unused default parameter <nLevel> and <bRelative>.
308 // Adjust method name and parameter name
309 void SwEditShell::ChangeIndentOfAllListLevels( short nDiff
)
313 const SwNumRule
*pCurNumRule
= GetCurNumRule();
314 //#120911# check if numbering rule really exists
317 SwNumRule
aRule(*pCurNumRule
);
318 // --> OD 2008-06-09 #i90078#
319 aRule
.ChangeIndent( nDiff
);
322 // --> OD 2008-03-17 #refactorlists#
323 // no start of new list
324 SetCurNumRule( aRule
, false );
331 // --> OD 2008-06-09 #i90078#
332 // Adjust method name
333 void SwEditShell::SetIndent(short nIndent
, const SwPosition
& rPos
)
338 SwNumRule
*pCurNumRule
= GetDoc()->GetCurrNumRule(rPos
);
343 SwTxtNode
* pTxtNode
= aPaM
.GetNode()->GetTxtNode();
345 // --> OD 2008-06-09 #i90078#
347 // int nReferenceLevel = pTxtNode->GetActualListLevel();
348 // if (! IsFirstOfNumRule(aPaM))
349 // nLevel = nReferenceLevel;
351 SwNumRule
aRule(*pCurNumRule
);
352 // aRule.ChangeIndent(nIndent, nLevel, nReferenceLevel, FALSE);
353 if ( IsFirstOfNumRule() )
355 aRule
.SetIndentOfFirstListLevelAndChangeOthers( nIndent
);
357 else if ( pTxtNode
->GetActualListLevel() >= 0 )
359 aRule
.SetIndent( nIndent
,
360 static_cast<USHORT
>(pTxtNode
->GetActualListLevel()) );
364 // --> OD 2005-02-18 #i42921# - 3rd parameter = false in order to
365 // suppress setting of num rule at <aPaM>.
366 // --> OD 2008-03-17 #refactorlists#
367 // do not apply any list
368 GetDoc()->SetNumRule( aPaM
, aRule
, false, String(), sal_False
);
376 BOOL
SwEditShell::MoveParagraph( long nOffset
)
380 SwPaM
*pCrsr
= GetCrsr();
381 if( !pCrsr
->HasMark() )
383 // sorge dafuer, das Bound1 und Bound2 im gleichen Node stehen
388 BOOL bRet
= GetDoc()->MoveParagraph( *pCrsr
, nOffset
);
390 GetDoc()->SetModified();
395 //#outline level add by zhaojianwei
396 int SwEditShell::GetCurrentParaOutlineLevel( ) const
400 SwPaM
* pCrsr
= GetCrsr();
401 const SwTxtNode
* pTxtNd
= pCrsr
->GetNode()->GetTxtNode();
403 nLevel
= pTxtNd
->GetAttrOutlineLevel();
408 void SwEditShell::GetCurrentOutlineLevels( sal_uInt8
& rUpper
, sal_uInt8
& rLower
)
410 SwPaM
* pCrsr
= GetCrsr();
411 SwPaM
aCrsr( *pCrsr
->Start() );
413 if( pCrsr
->HasMark() )
414 *aCrsr
.GetPoint() = *pCrsr
->End();
415 GetDoc()->GotoNextNum( *aCrsr
.GetPoint(), FALSE
,
419 BOOL
SwEditShell::MoveNumParas( BOOL bUpperLower
, BOOL bUpperLeft
)
423 // auf alle Selektionen ??
424 SwPaM
* pCrsr
= GetCrsr();
425 SwPaM
aCrsr( *pCrsr
->Start() );
428 if( pCrsr
->HasMark() )
429 *aCrsr
.GetPoint() = *pCrsr
->End();
432 BYTE nUpperLevel
, nLowerLevel
;
433 if( GetDoc()->GotoNextNum( *aCrsr
.GetPoint(), FALSE
,
434 &nUpperLevel
, &nLowerLevel
))
438 // ueber die naechste Nummerierung
442 if( bUpperLeft
) // verschiebe nach oben
444 SwPosition
aPos( *aCrsr
.GetMark() );
445 if( GetDoc()->GotoPrevNum( aPos
, FALSE
) )
446 nOffset
= aPos
.nNode
.GetIndex() -
447 aCrsr
.GetMark()->nNode
.GetIndex();
450 ULONG nStt
= aPos
.nNode
.GetIndex(), nIdx
= nStt
- 1;
452 ( pNd
= GetDoc()->GetNodes()[ nIdx
])->IsSectionNode() ||
453 ( pNd
->IsEndNode() && pNd
->StartOfSectionNode()->IsSectionNode())))
455 if( GetDoc()->GetNodes()[ nIdx
]->IsTxtNode() )
456 nOffset
= nIdx
- nStt
;
459 else // verschiebe nach unten
461 const SwNumRule
* pOrig
= aCrsr
.GetNode(FALSE
)->GetTxtNode()->GetNumRule();
462 if( aCrsr
.GetNode()->IsTxtNode() &&
463 pOrig
== aCrsr
.GetNode()->GetTxtNode()->GetNumRule() )
465 ULONG nStt
= aCrsr
.GetPoint()->nNode
.GetIndex(), nIdx
= nStt
+1;
467 while (nIdx
< GetDoc()->GetNodes().Count()-1)
469 pNd
= GetDoc()->GetNodes()[ nIdx
];
471 if (pNd
->IsSectionNode() ||
472 ( pNd
->IsEndNode() && pNd
->StartOfSectionNode()->IsSectionNode()) ||
473 ( pNd
->IsTxtNode() && pOrig
== ((SwTxtNode
*)pNd
)->GetNumRule() &&
474 ((SwTxtNode
*)pNd
)->GetActualListLevel() > nUpperLevel
))
478 // --> OD 2005-11-14 #i57856#
486 if( nStt
== nIdx
|| !GetDoc()->GetNodes()[ nIdx
]->IsTxtNode() )
489 nOffset
= nIdx
- nStt
;
497 aCrsr
.Move( fnMoveBackward
, fnGoNode
);
498 bRet
= GetDoc()->MoveParagraph( aCrsr
, nOffset
);
501 else if( bUpperLeft
? nUpperLevel
: nLowerLevel
+1 < MAXLEVEL
)
503 aCrsr
.Move( fnMoveBackward
, fnGoNode
);
504 bRet
= GetDoc()->NumUpDown( aCrsr
, !bUpperLeft
);
508 GetDoc()->SetModified();
513 BOOL
SwEditShell::OutlineUpDown( short nOffset
)
518 SwPaM
* pCrsr
= GetCrsr();
519 if( pCrsr
->GetNext() == pCrsr
) // keine Mehrfachselektion ?
520 bRet
= GetDoc()->OutlineUpDown( *pCrsr
, nOffset
);
523 GetDoc()->StartUndo( UNDO_START
, NULL
);
524 SwPamRanges
aRangeArr( *pCrsr
);
525 SwPaM
aPam( *pCrsr
->GetPoint() );
526 for( USHORT n
= 0; n
< aRangeArr
.Count(); ++n
)
527 bRet
= bRet
&& GetDoc()->OutlineUpDown(
528 aRangeArr
.SetPam( n
, aPam
), nOffset
);
529 GetDoc()->EndUndo( UNDO_END
, NULL
);
531 GetDoc()->SetModified();
537 BOOL
SwEditShell::MoveOutlinePara( short nOffset
)
540 BOOL bRet
= GetDoc()->MoveOutlinePara( *GetCrsr(), nOffset
);
545 // Outlines and SubOutline are ReadOnly?
546 BOOL
SwEditShell::IsProtectedOutlinePara() const
549 const SwNode
& rNd
= GetCrsr()->Start()->nNode
.GetNode();
550 if( rNd
.IsTxtNode() )
552 const SwOutlineNodes
& rOutlNd
= GetDoc()->GetNodes().GetOutLineNds();
553 SwNodePtr pNd
= (SwNodePtr
)&rNd
;
557 if( !rOutlNd
.Seek_Entry( pNd
, &nPos
) && nPos
)
560 for( ; nPos
< rOutlNd
.Count(); ++nPos
)
562 SwNodePtr pTmpNd
= rOutlNd
[ nPos
];
564 // --> OD 2008-04-02 #refactorlists#
565 // BYTE nTmpLvl = GetRealLevel( pTmpNd->GetTxtNode()->
566 // GetTxtColl()->GetOutlineLevel() );
567 // int nTmpLvl = pTmpNd->GetTxtNode()->GetOutlineLevel();//#outline level,zhaojianwei
568 int nTmpLvl
= pTmpNd
->GetTxtNode()->GetAttrOutlineLevel();
569 // ASSERT( nTmpLvl >= 0 && nTmpLvl < MAXLEVEL,
570 ASSERT( nTmpLvl
>= 0 && nTmpLvl
<= MAXLEVEL
, //<-end,zhaojianwei
571 "<SwEditShell::IsProtectedOutlinePara()>" );
578 else if( nLvl
>= nTmpLvl
)
581 if( pTmpNd
->IsProtect() )
591 ASSERT(!this, "Cursor not on an outline node" );
597 /** Test whether outline may be moved (bCopy == false)
598 * or copied (bCopy == true)
599 * Verify these conditions:
600 * 1) outline must be within main body (and not in redline)
601 * 2) outline must not be within table
602 * 3) if bCopy is set, outline must not be write protected
604 BOOL
lcl_IsOutlineMoveAndCopyable( const SwDoc
* pDoc
, USHORT nIdx
, bool bCopy
)
606 const SwNodes
& rNds
= pDoc
->GetNodes();
607 const SwNode
* pNd
= rNds
.GetOutLineNds()[ nIdx
];
608 return pNd
->GetIndex() >= rNds
.GetEndOfExtras().GetIndex() && // 1) body
609 !pNd
->FindTableNode() && // 2) table
610 ( bCopy
|| !pNd
->IsProtect() ); // 3) write
613 BOOL
SwEditShell::IsOutlineMovable( USHORT nIdx
) const
615 return lcl_IsOutlineMoveAndCopyable( GetDoc(), nIdx
, false );
618 BOOL
SwEditShell::IsOutlineCopyable( USHORT nIdx
) const
620 return lcl_IsOutlineMoveAndCopyable( GetDoc(), nIdx
, true );
624 BOOL
SwEditShell::NumOrNoNum( BOOL bNumOn
, BOOL bChkStart
) // #115901#
627 SwPaM
* pCrsr
= GetCrsr();
628 if( pCrsr
->GetNext() == pCrsr
&& !pCrsr
->HasMark() &&
629 ( !bChkStart
|| !pCrsr
->GetPoint()->nContent
.GetIndex()) )
631 StartAllAction(); // Klammern fuers Updaten !!
633 bRet
= GetDoc()->NumOrNoNum( pCrsr
->GetPoint()->nNode
, !bNumOn
); // #i29560#
639 BOOL
SwEditShell::IsNoNum( BOOL bChkStart
) const
641 // ein Backspace im Absatz ohne Nummer wird zum Delete
642 BOOL bResult
= FALSE
;
643 SwPaM
* pCrsr
= GetCrsr();
645 if (pCrsr
->GetNext() == pCrsr
&& !pCrsr
->HasMark() &&
646 (!bChkStart
|| !pCrsr
->GetPoint()->nContent
.GetIndex()))
648 const SwTxtNode
* pTxtNd
= pCrsr
->GetNode()->GetTxtNode();
652 bResult
= ! pTxtNd
->IsCountedInList();
659 // --> OD 2008-02-29 #refactorlists# - removed <pHasChilds>
660 BYTE
SwEditShell::GetNumLevel() const
662 // gebe die akt. Ebene zurueck, auf der sich der Point vom Cursor befindet
663 //BYTE nLevel = NO_NUMBERING; //#outline level,zhaojianwei
664 BYTE nLevel
= MAXLEVEL
; //end,zhaojianwei
666 SwPaM
* pCrsr
= GetCrsr();
667 const SwTxtNode
* pTxtNd
= pCrsr
->GetNode()->GetTxtNode();
669 // --> FME 2005-09-12 #124972# Made code robust:
670 ASSERT( pTxtNd
, "GetNumLevel() without text node" )
675 const SwNumRule
* pRule
= pTxtNd
->GetNumRule();
678 // --> OD 2008-05-09 #refactorlists#
679 const int nListLevelOfTxtNode( pTxtNd
->GetActualListLevel() );
680 if ( nListLevelOfTxtNode
>= 0 )
682 nLevel
= static_cast<BYTE
>( nListLevelOfTxtNode
);
690 const SwNumRule
* SwEditShell::GetCurNumRule() const
692 return GetDoc()->GetCurrNumRule( *GetCrsr()->GetPoint() );
695 // OD 2008-02-08 #newlistlevelattrs# - add handling of parameter <bResetIndentAttrs>
696 // --> OD 2008-03-17 #refactorlists#
697 void SwEditShell::SetCurNumRule( const SwNumRule
& rRule
,
698 const bool bCreateNewList
,
699 const String sContinuedListId
,
700 const bool bResetIndentAttrs
)
704 SwPaM
* pCrsr
= GetCrsr();
705 if( pCrsr
->GetNext() != pCrsr
) // Mehrfachselektion ?
707 GetDoc()->StartUndo( UNDO_START
, NULL
);
708 SwPamRanges
aRangeArr( *pCrsr
);
709 SwPaM
aPam( *pCrsr
->GetPoint() );
710 for( USHORT n
= 0; n
< aRangeArr
.Count(); ++n
)
712 aRangeArr
.SetPam( n
, aPam
);
713 // --> OD 2008-02-08 #newlistlevelattrs#
714 // --> OD 2008-03-17 #refactorlists#
715 GetDoc()->SetNumRule( aPam
, rRule
,
716 bCreateNewList
, sContinuedListId
,
717 sal_True
, bResetIndentAttrs
);
719 GetDoc()->SetCounted( aPam
, true );
721 GetDoc()->EndUndo( UNDO_END
, NULL
);
725 GetDoc()->StartUndo( UNDO_START
, NULL
);
727 // --> OD 2008-02-08 #newlistlevelattrs#
728 // --> OD 2008-03-17 #refactorlists#
729 GetDoc()->SetNumRule( *pCrsr
, rRule
,
730 bCreateNewList
, sContinuedListId
,
731 sal_True
, bResetIndentAttrs
);
732 GetDoc()->SetCounted( *pCrsr
, true );
734 GetDoc()->EndUndo( UNDO_END
, NULL
);
740 String
SwEditShell::GetUniqueNumRuleName( const String
* pChkStr
, BOOL bAutoNum
) const
742 return GetDoc()->GetUniqueNumRuleName( pChkStr
, bAutoNum
);
745 void SwEditShell::ChgNumRuleFmts( const SwNumRule
& rRule
)
748 GetDoc()->ChgNumRuleFmts( rRule
);
752 BOOL
SwEditShell::ReplaceNumRule( const String
& rOldRule
, const String
& rNewRule
)
755 BOOL bRet
= GetDoc()->ReplaceNumRule( *GetCrsr()->GetPoint(), rOldRule
, rNewRule
);
760 void SwEditShell::SetNumRuleStart( BOOL bFlag
)
764 SwPaM
* pCrsr
= GetCrsr();
765 if( pCrsr
->GetNext() != pCrsr
) // Mehrfachselektion ?
767 GetDoc()->StartUndo( UNDO_START
, NULL
);
768 SwPamRanges
aRangeArr( *pCrsr
);
769 SwPaM
aPam( *pCrsr
->GetPoint() );
770 for( USHORT n
= 0; n
< aRangeArr
.Count(); ++n
)
771 GetDoc()->SetNumRuleStart( *aRangeArr
.SetPam( n
, aPam
).GetPoint(), bFlag
);
772 GetDoc()->EndUndo( UNDO_END
, NULL
);
775 GetDoc()->SetNumRuleStart( *pCrsr
->GetPoint(), bFlag
);
780 BOOL
SwEditShell::IsNumRuleStart() const
782 BOOL bResult
= FALSE
;
783 const SwTxtNode
* pTxtNd
= GetCrsr()->GetNode()->GetTxtNode();
785 bResult
= pTxtNd
->IsListRestart() ? TRUE
: FALSE
;
789 void SwEditShell::SetNodeNumStart( USHORT nStt
)
793 SwPaM
* pCrsr
= GetCrsr();
794 if( pCrsr
->GetNext() != pCrsr
) // Mehrfachselektion ?
796 GetDoc()->StartUndo( UNDO_START
, NULL
);
797 SwPamRanges
aRangeArr( *pCrsr
);
798 SwPaM
aPam( *pCrsr
->GetPoint() );
799 for( USHORT n
= 0; n
< aRangeArr
.Count(); ++n
)
800 GetDoc()->SetNodeNumStart( *aRangeArr
.SetPam( n
, aPam
).GetPoint(), nStt
);
801 GetDoc()->EndUndo( UNDO_END
, NULL
);
804 GetDoc()->SetNodeNumStart( *pCrsr
->GetPoint(), nStt
);
809 USHORT
SwEditShell::GetNodeNumStart() const
811 const SwTxtNode
* pTxtNd
= GetCrsr()->GetNode()->GetTxtNode();
812 // --> OD 2008-02-28 #refactorlists#
813 // correction: check, if list restart value is set at text node and
814 // use new method <SwTxtNode::GetAttrListRestartValue()>.
815 // return USHRT_MAX, if no list restart value is found.
816 if ( pTxtNd
&& pTxtNd
->HasAttrListRestartValue() )
818 return static_cast<USHORT
>(pTxtNd
->GetAttrListRestartValue());
824 /*-- 26.08.2005 14:47:17---------------------------------------------------
826 -----------------------------------------------------------------------*/
827 // --> OD 2008-03-18 #refactorlists#
828 const SwNumRule
* SwEditShell::SearchNumRule( const bool bForward
,
831 int nNonEmptyAllowed
,
834 return GetDoc()->SearchNumRule( *(bForward
? GetCrsr()->End() : GetCrsr()->Start()),
835 bForward
, bNum
, bOutline
, nNonEmptyAllowed
,