29 #include <osl/diagnose.h>
36 for(
SwPaM& rTmp : const_cast<SwPaM*>(&rRing)->GetRingContainer())
37 Insert( rTmp.GetMark()->nNode, rTmp.GetPoint()->nNode );
43 if( aRg.nEnd < aRg.nStart )
52 if( rTmp.
nEnd < aRg.nEnd )
69 if( rTmp.
nEnd == aRg.nStart
70 || rTmp.
nEnd+1 == aRg.nStart )
77 else if( rTmp.
nStart <= aRg.nStart && aRg.nEnd <= rTmp.
nEnd )
84 if( rTmp.
nStart == aRg.nEnd ||
85 rTmp.
nStart == aRg.nEnd+1 )
93 else if( rTmp.
nStart <= aRg.nStart && aRg.nEnd <= rTmp.
nEnd )
136 if( pCursor->
GetNext() != pCursor )
141 for(
size_t n = 0;
n < aRangeArr.
Count(); ++
n )
156 if (!bResult && pTextNd && pTextNd->
Len()==0 && !pTextNd->
GetNumRule()) {
159 for(
size_t n = 0;
n < aRangeArr.
Count(); ++
n )
167 sal_uInt32 nTmp = nStt; nStt = nEnd; nEnd = nTmp;
171 pTextNd =
mxDoc->GetNodes()[
nPos]->GetTextNode();
176 if (pTextNd && pTextNd->
Len()!=0)
205 if (!bResult && pTextNd && pTextNd->
Len()==0 && !pTextNd->
GetNumRule()) {
208 for(
size_t n = 0;
n < aRangeArr.
Count(); ++
n )
216 sal_uInt32 nTmp = nStt; nStt = nEnd; nEnd = nTmp;
220 pTextNd =
mxDoc->GetNodes()[
nPos]->GetTextNode();
225 if (pTextNd && pTextNd->
Len()!=0)
244 bool bResult =
false;
266 bool bResult =
false;
290 for(
size_t n = 0;
n < aRangeArr.
Count(); ++
n )
322 for(
size_t n = 0;
n < aRangeArr.
Count(); ++
n )
348 if ( pCurNumRule !=
nullptr )
352 if( nDiff > 0 || aRootNumFormat.GetIndentAt() + nDiff > 0)
382 if ( pTextNode !=
nullptr
399 class MakeAllOutlineContentTemporarilyVisibile
403 std::vector<SwNode*> aOutlineNdsArray;
405 MakeAllOutlineContentTemporarilyVisibile(
SwWrtShell* pShell)
419 bool bOutlineContentVisibleAttr =
true;
421 if (!bOutlineContentVisibleAttr)
423 aOutlineNdsArray.push_back(pNd);
430 ~MakeAllOutlineContentTemporarilyVisibile() COVERITY_NOEXCEPT_FALSE
435 for (
SwNode* pNd : aOutlineNdsArray)
444 MakeAllOutlineContentTemporarilyVisibile
a(dynamic_cast<SwWrtShell*>(
this));
474 *aCursor.GetPoint() = *pCursor->
End();
488 *aCursor.GetPoint() = *pCursor->
End();
493 &nUpperLevel, &nLowerLevel ))
506 aCursor.GetMark()->nNode.GetIndex();
509 sal_uLong nStt = aPos.nNode.GetIndex(), nIdx = nStt - 1;
513 std::pair<SwTextNode *, SwTextNode *> nodes(
515 nIdx = nodes.first->GetIndex() - 1;
522 nOffset = nIdx - nStt;
527 assert(!aCursor.GetNode().IsTextNode()
530 if( aCursor.GetNode().IsTextNode() &&
531 pOrig == aCursor.GetNode().GetTextNode()->GetNumRule() )
533 sal_uLong nStt = aCursor.GetPoint()->nNode.GetIndex(), nIdx = nStt+1;
536 std::pair<SwTextNode *, SwTextNode *> nodes(
538 nIdx = nodes.second->GetIndex() + 1;
557 std::pair<SwTextNode *, SwTextNode *> nodes(
559 nIdx = nodes.second->GetIndex() + 1;
576 nOffset = nIdx - nStt;
588 else if( (bUpperLeft ? nUpperLevel : nLowerLevel+1) <
MAXLEVEL )
613 for(
size_t n = 0;
n < aRangeArr.
Count(); ++
n )
643 if( !rOutlNd.
Seek_Entry( pNd, &nPos ) && nPos )
646 for( ; nPos < rOutlNd.
size(); ++nPos )
657 OSL_ENSURE( nTmpLvl >= 0 && nTmpLvl <=
MAXLEVEL,
658 "<SwEditShell::IsProtectedOutlinePara()>" );
665 else if( nLvl >= nTmpLvl )
675 #if OSL_DEBUG_LEVEL > 0
678 OSL_FAIL(
"Cursor not on an outline node");
733 bool bResult =
false;
740 if ( pTextNd !=
nullptr )
757 OSL_ENSURE( pTextNd,
"GetNumLevel() without text node" );
758 if ( pTextNd ==
nullptr )
762 if ( pRule !=
nullptr )
765 if ( nListLevelOfTextNode >= 0 )
767 nLevel =
static_cast<sal_uInt8>( nListLevelOfTextNode );
782 const SwNumRule* pNumRuleAtCurrentSelection =
nullptr;
784 bool bDifferentNumRuleFound =
false;
787 const SwNodeIndex aEndNode = rCurrentCursor.End()->nNode;
789 for (
SwNodeIndex aNode = rCurrentCursor.Start()->nNode; aNode <= aEndNode; ++aNode )
793 if ( pNumRule ==
nullptr )
797 else if ( pNumRule != pNumRuleAtCurrentSelection )
799 if ( pNumRuleAtCurrentSelection ==
nullptr )
801 pNumRuleAtCurrentSelection = pNumRule;
805 pNumRuleAtCurrentSelection =
nullptr;
806 bDifferentNumRuleFound =
true;
811 if(bDifferentNumRuleFound)
815 return pNumRuleAtCurrentSelection;
820 const OUString& rContinuedListId,
821 const bool bResetIndentAttrs )
832 OUString sContinuedListId(rContinuedListId);
833 for(
size_t n = 0;
n < aRangeArr.
Count(); ++
n )
837 bCreateNewList,
GetLayout(), sContinuedListId,
838 true, bResetIndentAttrs );
844 sContinuedListId = sListId;
845 bCreateNewList =
false;
854 bCreateNewList,
GetLayout(), rContinuedListId,
855 true, bResetIndentAttrs );
892 for(
size_t n = 0;
n < aRangeArr.
Count(); ++
n )
925 for(
size_t n = 0;
n < aRangeArr.
Count(); ++
n )
959 false, bNum,
false, -1,
bool IsNumRuleStart(SwPaM *pPaM=nullptr) const
const_iterator lower_bound(const Value &x) const
sal_uLong GetIndex() 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
SwPaM * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
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.
const SwPosition * GetMark() const
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.
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() 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
Used by the UI to modify the document model.
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.
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
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 &)
sal_uLong GetIndex() const
bool IsFirstOfNumRuleAtCursorPos() const
sal_uInt16 GetNodeNumStart(SwPaM *pPaM) const
void DelNumRules()
Delete, split enumeration list.
bool MoveParagraph(tools::Long nOffset=1)
SwPaM & SetPam(size_t nArrPos, SwPaM &rPam)
void ChgNumRuleFormats(const SwNumRule &rRule)
void SetCounted(const SwPaM &, bool bCounted, SwRootFrame const *pLayout)
bool IsShowOutlineContentVisibilityButton() const
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.
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
bool MoveParagraph(SwPaM &, tools::Long nOffset, bool bIsOutlMv=false)
Move selected paragraphs (not only numberings) according to offsets.
bool GetAttrOutlineContentVisible(bool &bOutlineContentVisibleAttr)
GetAttrOutlineContentVisible.
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
bool ReplaceNumRule(const SwPosition &rPos, const OUString &rOldRule, const OUString &rNewRule)
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
void ReplaceNumRule(const OUString &rOldRule, const OUString &rNewRule)
SwNumberTree::tSwNumTreeNumber GetAttrListRestartValue() const
const SwViewOption * GetViewOptions() const
void ToggleOutlineContentVisibility(SwNode *pNd, const bool bForceNotVisible=false)
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
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.
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 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.