29 #include <osl/diagnose.h>
33 for(
SwPaM& rTmp : const_cast<SwPaM*>(&rRing)->GetRingContainer())
34 Insert( rTmp.GetMark()->nNode, rTmp.GetPoint()->nNode );
40 if( aRg.nEnd < aRg.nStart )
49 if( rTmp.
nEnd < aRg.nEnd )
66 if( rTmp.
nEnd == aRg.nStart
67 || rTmp.
nEnd+1 == aRg.nStart )
74 else if( rTmp.
nStart <= aRg.nStart && aRg.nEnd <= rTmp.
nEnd )
81 if( rTmp.
nStart == aRg.nEnd ||
82 rTmp.
nStart == aRg.nEnd+1 )
90 else if( rTmp.
nStart <= aRg.nStart && aRg.nEnd <= rTmp.
nEnd )
100 assert( nArrPos <
Count() );
133 if( pCursor->
GetNext() != pCursor )
138 for(
size_t n = 0;
n < aRangeArr.
Count(); ++
n )
153 if (!bResult && pTextNd && pTextNd->
Len()==0 && !pTextNd->
GetNumRule()) {
156 for(
size_t n = 0;
n < aRangeArr.
Count(); ++
n )
164 pTextNd =
mxDoc->GetNodes()[
nPos]->GetTextNode();
169 if (pTextNd && pTextNd->
Len()!=0)
198 if (!bResult && pTextNd && pTextNd->
Len()==0 && !pTextNd->
GetNumRule()) {
201 for(
size_t n = 0;
n < aRangeArr.
Count(); ++
n )
209 pTextNd =
mxDoc->GetNodes()[
nPos]->GetTextNode();
214 if (pTextNd && pTextNd->
Len()!=0)
233 bool bResult =
false;
255 bool bResult =
false;
279 for(
size_t n = 0;
n < aRangeArr.
Count(); ++
n )
311 for(
size_t n = 0;
n < aRangeArr.
Count(); ++
n )
337 if ( pCurNumRule !=
nullptr )
341 if( nDiff > 0 || aRootNumFormat.GetIndentAt() + nDiff > 0)
371 if ( pTextNode !=
nullptr
416 *aCursor.GetPoint() = *pCursor->
End();
430 *aCursor.GetPoint() = *pCursor->
End();
435 &nUpperLevel, &nLowerLevel ))
447 nOffset = aPos.nNode.GetIndex() -
448 aCursor.GetMark()->nNode.GetIndex();
451 SwNodeOffset nStt = aPos.nNode.GetIndex(), nIdx = nStt - 1;
455 std::pair<SwTextNode *, SwTextNode *> nodes(
457 nIdx = nodes.first->GetIndex() - 1;
464 nOffset = nIdx - nStt;
469 assert(!aCursor.GetNode().IsTextNode()
472 if( aCursor.GetNode().IsTextNode() &&
473 pOrig == aCursor.GetNode().GetTextNode()->GetNumRule() )
475 SwNodeOffset nStt = aCursor.GetPoint()->nNode.GetIndex(), nIdx = nStt+1;
478 std::pair<SwTextNode *, SwTextNode *> nodes(
480 nIdx = nodes.second->GetIndex() + 1;
499 std::pair<SwTextNode *, SwTextNode *> nodes(
501 nIdx = nodes.second->GetIndex() + 1;
518 nOffset = nIdx - nStt;
530 else if( (bUpperLeft ? nUpperLevel : nLowerLevel+1) <
MAXLEVEL )
555 for(
size_t n = 0;
n < aRangeArr.
Count(); ++
n )
585 if( !rOutlNd.
Seek_Entry( pNd, &nPos ) && nPos )
588 for( ; nPos < rOutlNd.
size(); ++nPos )
590 SwNode* pTmpNd = rOutlNd[ nPos ];
599 OSL_ENSURE( nTmpLvl >= 0 && nTmpLvl <=
MAXLEVEL,
600 "<SwEditShell::IsProtectedOutlinePara()>" );
607 else if( nLvl >= nTmpLvl )
617 #if OSL_DEBUG_LEVEL > 0
620 OSL_FAIL(
"Cursor not on an outline node");
675 bool bResult =
false;
682 if ( pTextNd !=
nullptr )
699 OSL_ENSURE( pTextNd,
"GetNumLevel() without text node" );
700 if ( pTextNd ==
nullptr )
704 if ( pRule !=
nullptr )
707 if ( nListLevelOfTextNode >= 0 )
709 nLevel =
static_cast<sal_uInt8>( nListLevelOfTextNode );
724 const SwNumRule* pNumRuleAtCurrentSelection =
nullptr;
726 bool bDifferentNumRuleFound =
false;
729 const SwNodeIndex aEndNode = rCurrentCursor.End()->nNode;
731 for (
SwNodeIndex aNode = rCurrentCursor.Start()->nNode; aNode <= aEndNode; ++aNode )
735 if ( pNumRule ==
nullptr )
739 else if ( pNumRule != pNumRuleAtCurrentSelection )
741 if ( pNumRuleAtCurrentSelection ==
nullptr )
743 pNumRuleAtCurrentSelection = pNumRule;
747 pNumRuleAtCurrentSelection =
nullptr;
748 bDifferentNumRuleFound =
true;
753 if(bDifferentNumRuleFound)
757 return pNumRuleAtCurrentSelection;
762 const OUString& rContinuedListId,
763 const bool bResetIndentAttrs )
774 OUString sContinuedListId(rContinuedListId);
775 for(
size_t n = 0;
n < aRangeArr.
Count(); ++
n )
779 bCreateNewList,
GetLayout(), sContinuedListId,
780 true, bResetIndentAttrs );
786 sContinuedListId = sListId;
787 bCreateNewList =
false;
796 bCreateNewList,
GetLayout(), rContinuedListId,
797 true, bResetIndentAttrs );
834 for(
size_t n = 0;
n < aRangeArr.
Count(); ++
n )
867 for(
size_t n = 0;
n < aRangeArr.
Count(); ++
n )
901 false, bNum,
false, -1,
bool IsNumRuleStart(SwPaM *pPaM=nullptr) const
const_iterator lower_bound(const Value &x) const
bool HasBullet() const
Returns if this text node has a bullet.
Marks a position in the document model.
const SwNodes & GetNodes() const
bool IsSectionNode() const
bool IsMultiSelection() const
void GetCurrentOutlineLevels(sal_uInt8 &rUpper, sal_uInt8 &rLower)
Detect highest and lowest level to check moving of outline levels.
OUString GetUniqueNumRuleName() const
const SwNumRule * GetNumRuleAtCurrCursorPos() const
std::vector< SwNode * >::difference_type difference_type
virtual sal_Int32 Len() const override
virtual void SetModified()=0
Must be called manually at changes of format.
bool NumOrNoNum(const SwNodeIndex &rIdx, bool bDel=false)
bool MoveOutlinePara(const SwPaM &rPam, SwOutlineNodes::difference_type nOffset)
Outline - move up / move down.
virtual SwUndoId EndUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Closes undo block.
constexpr sal_uInt8 MAXLEVEL
bool SelectionHasNumber() const
void SetNumRuleStart(const SwPosition &rPos, bool bFlag=true)
OUString GetUniqueNumRuleName(const OUString *pChkStr=nullptr, bool bAutoNum=true) const
IDocumentUndoRedo & GetIDocumentUndoRedo()
bool NumUpDown(const SwPaM &, bool bDown, SwRootFrame const *pLayout=nullptr)
bool HasNumber(SwRootFrame const *pLayout=nullptr) const
Returns if this text node has a number.
bool IsListRestart() const
int GetActualListLevel() const
Returns the actual list level of this text node, when it is a list item.
sal_uInt8 GetNumLevel() const
int GetAttrOutlineLevel() const
Returns outline level of this text node.
bool HasSelection() const
Does the current cursor create a selection?
void ChangeIndentOfAllListLevels(sal_Int32 nDiff)
Remove unused default parameter and .
void SetCurNumRule(const SwNumRule &, const bool bCreateNewList, const OUString &sContinuedListId=OUString(), const bool bResetIndentAttrs=false)
Optional parameter (default value false).
SwContentNode * GetContentNode(bool bPoint=true) const
bool IsInFrontOfLabel() const
void SetNodeNumStart(sal_uInt16 nStt)
static bool lcl_IsOutlineMoveAndCopyable(SwEditShell const &rShell, SwOutlineNodes::size_type const nIdx, bool const bCopy)
Test whether outline may be moved (bCopy == false) or copied (bCopy == true) Verify these conditions:...
rtl::Reference< SwDoc > mxDoc
The document; never 0.
static SwNumRule * GetNumRuleAtPos(SwPosition &rPos, SwRootFrame const *pLayout=nullptr)
bool IsProtectedOutlinePara() const
bool IsOutlineMovable(SwOutlineNodes::size_type nIdx) const
May an outline be moved or copied? Check whether it's in text body, not in table, and not read-only (...
bool NoNum(const SwPaM &)
bool IsFirstOfNumRuleAtCursorPos() const
SwNodeOffset GetIndex() const
sal_uInt16 GetNodeNumStart(SwPaM *pPaM) const
void DelNumRules()
Delete, split enumeration list.
bool MoveParagraph(SwPaM &, SwNodeOffset nOffset, bool bIsOutlMv=false)
Move selected paragraphs (not only numberings) according to offsets.
SwPaM & SetPam(size_t nArrPos, SwPaM &rPam)
void ChgNumRuleFormats(const SwNumRule &rRule)
void SetCounted(const SwPaM &, bool bCounted, SwRootFrame const *pLayout)
void DelNumRules(const SwPaM &, SwRootFrame const *pLayout=nullptr)
void SetNodeNumStart(const SwPosition &rPos, sal_uInt16 nStt)
PaM is Point and Mark: a selection of the document model.
o3tl::sorted_vector< SwPamRange > maVector
virtual SwUndoId StartUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Opens undo block.
bool GoInNode(SwPaM &rPam, SwMoveFnCollection const &fnMove)
const SwStartNode * StartOfSectionNode() const
const SwPosition * GetPoint() const
SwIndex & Assign(SwIndexReg *, sal_Int32)
SAL_DLLPRIVATE void UpdateMarkedListLevel()
Updates the marked list level according to the cursor.
SwNodeOffset GetIndex() const
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
SwNumRule * GetNumRule(bool bInParent=true) const
Returns numbering rule of this text node.
IDocumentState const & getIDocumentState() const
Marks a node in the document model.
const SwOutlineNodes & GetOutLineNds() const
Array of all OutlineNodes.
ring_container GetRingContainer()
const_iterator end() const
void SetIndent(const short nNewIndent, const sal_uInt16 nListLevel)
set indent of certain list level to given value
const SwNumRule * GetOutlineNumRule() const
bool IsProtect() const
Is node in something that is protected (range, frame, table cells ...
const SwPosition * Start() const
void SetOutlineNumRule(const SwNumRule &rRule)
const SwNumRule * GetNumRuleAtCurrentSelection() const
Returns the numbering rule found at the paragraphs of the current selection, if all paragraphs of the...
bool SelectionHasBullet() const
SwTextNode * GetParaPropsNode(SwRootFrame const &rLayout, SwNodeIndex const &rNode)
void ChangeIndent(const sal_Int32 nDiff)
change indent of all list levels by given difference
bool NumOrNoNum(bool bDelete=false, bool bChkStart=true)
Switch on/off of numbering via Delete/Backspace.
const_iterator begin() const
SwPosition GetParaPropsPos(SwRootFrame const &rLayout, SwPosition const &rPos)
const SwNumFormat & Get(sal_uInt16 i) const
bool OutlineUpDown(short nOffset=1)
SwTextNode is a paragraph in the document model.
bool IsMultiSelection() const
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
void ReplaceNumRule(const OUString &rOldRule, const OUString &rNewRule)
SwNumberTree::tSwNumTreeNumber GetAttrListRestartValue() const
void ReplaceNumRule(const SwPosition &rPos, const OUString &rOldRule, const OUString &rNewRule)
bool IsCountedInList() const
void SetOutlineNumRule(const SwNumRule &)
const SwPosition * End() const
void SetNumRuleStart(bool bFlag, SwPaM *pCursor)
Set (and query if) a numbering with StartFlag starts at current PointPos.
bool IsNoNum(bool bChkStart=true) const
void NumUpDown(bool bDown=true)
static bool GotoNextNum(SwPosition &, SwRootFrame const *pLayout, bool bOverUpper=true, sal_uInt8 *pUpper=nullptr, sal_uInt8 *pLower=nullptr)
void NoNum()
Paragraphs without enumeration but with indents.
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
bool IsParaPropsNode(SwRootFrame const &rLayout, SwTextNode const &rNode)
void Insert(const SwNodeIndex &rIdx1, const SwNodeIndex &rIdx2)
static bool IsFirstOfNumRuleAtPos(const SwPosition &rPos, SwRootFrame const &rLayout)
static bool GotoPrevNum(SwPosition &, SwRootFrame const *pLayout, bool bOverUpper=true)
SwPamRanges(const SwPaM &rRing)
SwMoveFnCollection const & fnMoveBackward
SwTableNode * FindTableNode()
Search table node, in which it is.
const SwNumRule * SearchNumRule(const bool bNum, OUString &sListId)
Searches for a text node with a numbering rule.
bool MoveParagraph(SwNodeOffset nOffset=SwNodeOffset(1))
bool IsOutlineCopyable(SwOutlineNodes::size_type nIdx) const
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
bool Seek_Entry(SwNode *rP, size_type *pnPos) const
int GetCurrentParaOutlineLevel() const
Get Outline level of current paragraph.
bool MoveOutlinePara(SwOutlineNodes::difference_type nOffset)
std::pair< const_iterator, bool > insert(Value &&x)
void SetIndent(short nIndent, const SwPosition &rPos)
std::vector< SwNode * >::size_type size_type
const SwNumRule * SearchNumRule(const SwPosition &rPos, const bool bForward, const bool bNum, const bool bOutline, int nNonEmptyAllowed, OUString &sListId, SwRootFrame const *pLayout, const bool bInvestigateStartNode=false)
Searches for a text node with a numbering rule.
OUString SetNumRule(const SwPaM &, const SwNumRule &, bool bCreateNewList, SwRootFrame const *pLayout=nullptr, const OUString &sContinuedListId=OUString(), bool bSetItem=true, const bool bResetIndentAttrs=false)
Accept changes of outline styles for OutlineRule.
SwNode & GetEndOfExtras() const
This is the last EndNode of a special section.
bool HasAttrListRestartValue() const
void StartAllAction()
For all views of this document.
SwRootFrame * GetLayout() const
void SetIndentOfFirstListLevelAndChangeOthers(const short nNewIndent)
set indent of first list level to given value and change other list level's indents accordingly ...
SwNumRule * GetNumRule(SwTextFormatColl &rTextFormatColl)
determines the list style, which directly set at the given paragraph style
bool OutlineUpDown(const SwPaM &rPam, short nOffset, SwRootFrame const *pLayout=nullptr)
std::vector< Value >::const_iterator const_iterator
std::pair< SwTextNode *, SwTextNode * > GetFirstAndLastNode(SwRootFrame const &rLayout, SwNodeIndex const &rPos)
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
size_type erase(const Value &x)
SwNumRule * GetOutlineNumRule() const
bool SetInFrontOfLabel(bool bNew)
void ChgNumRuleFormats(const SwNumRule &rRule)
bool MoveNumParas(bool bUpperLower, bool bUpperLeft)
Base class of the Writer document model elements.