diff options
author | László Németh <nemeth@numbertext.org> | 2024-11-27 16:52:10 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2024-11-28 12:39:47 +0100 |
commit | 32398232e925d18d2ac5a6d467b61e1a84a0df7c (patch) | |
tree | f23d19fe363894ea2afbc094749d5fd7a935c5b7 /sw/inc | |
parent | 60047110c19a403e51c767cb003b0cf989f6b2bc (diff) |
tdf#164074 sw inline heading: add up/down outline moving
Move inline headings with their outline tree in
Navigator, clicking on the Move Heading Up/Down icons.
Instead of changing CompareSwOutlineNodes, which breaks
the code at other places, add a new SwOutlineNodesInline
and CompareSwOutlineNodesInline to sort inline headings
(put in Inline Heading frames) with normal headings only
for MoveOutlinePara and other part of Navigator's
outline moving.
Reordering chapters and sections using the Navigator was
limited for normal (root) headings, but not for headings
in text frames and tables.
Recent implementation of inline headings use text frames
with Inline Heading frame style, anchored as characters
to their paragraphs. Now these inline headings are movable
with the Navigator, with their outline tree, i.e. the paragraph
where the inline heading anchored as character, the following
paragraphs without inline heading, or the following subsections.
Note: selecting the inline headings is possible by the Navigator
content tree or or by clicking inside the text of the inline
heading in the document.
Note: according to the fix for tdf#143569, multiple headings
in the same text frame or table are ordered alphabetically in
the Navigator. This doesn't effect the inline headings, where
there is only a single heading in an Inline Heading text frame.
Follow-up to commit 7a35f3dc7419d833b8f47069c4df63e900ccb880
"tdf#48459 sw inline heading: apply it on the selected words",
commit d87cf67f8f3346a1e380383917a3a4552fd9248e
"tdf#131728 sw inline heading: fix missing/broken DOCX export"
and commit a1dcbd1d1ce6071d48bb5df26d7839aeb21b75a8
"tdf48459 sw inline heading: add Inline Heading frame style".
Change-Id: I7618aa1d4e1ddc20512d81c9a2babfa660053cbf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177438
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw/inc')
-rw-r--r-- | sw/inc/crsrsh.hxx | 2 | ||||
-rw-r--r-- | sw/inc/doc.hxx | 4 | ||||
-rw-r--r-- | sw/inc/editsh.hxx | 3 | ||||
-rw-r--r-- | sw/inc/ndarr.hxx | 15 | ||||
-rw-r--r-- | sw/inc/ndtxt.hxx | 9 |
5 files changed, 28 insertions, 5 deletions
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx index 2d7f279c8aa3..2fc9598401cc 100644 --- a/sw/inc/crsrsh.hxx +++ b/sw/inc/crsrsh.hxx @@ -663,7 +663,7 @@ public: // select the given range of OutlineNodes. Optionally including the children // the sal_uInt16s are the positions in OutlineNodes-Array (EditShell) void MakeOutlineSel(SwOutlineNodes::size_type nSttPos, SwOutlineNodes::size_type nEndPos, - bool bWithChildren, bool bKillPams = true ); + bool bWithChildren, bool bKillPams = true, SwOutlineNodesInline* pOutlNdsInline = nullptr); bool GotoNextOutline(); bool GotoPrevOutline(); diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 7d0c2955721e..ca8da4e293e3 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -1050,7 +1050,9 @@ public: bool OutlineUpDown(const SwPaM& rPam, short nOffset, SwRootFrame const* pLayout = nullptr); /// Outline - move up / move down. - bool MoveOutlinePara( const SwPaM& rPam, SwOutlineNodes::difference_type nOffset); + bool MoveOutlinePara( const SwPaM& rPam, + SwOutlineNodes::difference_type nOffset, + SwOutlineNodesInline* pOutlNdsInline = nullptr); SW_DLLPUBLIC bool GotoOutline(SwPosition& rPos, const OUString& rName, SwRootFrame const* = nullptr) const; diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx index 0e9d8064901b..5a16812e89da 100644 --- a/sw/inc/editsh.hxx +++ b/sw/inc/editsh.hxx @@ -498,7 +498,8 @@ public: bool OutlineUpDown( short nOffset = 1 ); - bool MoveOutlinePara( SwOutlineNodes::difference_type nOffset ); + bool MoveOutlinePara( SwOutlineNodes::difference_type nOffset, + SwOutlineNodesInline* pOutlineNodesInline = nullptr ); bool IsProtectedOutlinePara() const; diff --git a/sw/inc/ndarr.hxx b/sw/inc/ndarr.hxx index 7bcebeda22db..5c423e11378c 100644 --- a/sw/inc/ndarr.hxx +++ b/sw/inc/ndarr.hxx @@ -81,6 +81,21 @@ public: static constexpr auto npos = std::numeric_limits<size_type>::max(); bool Seek_Entry(const SwNode* rP, size_type* pnPos) const; + static const SwNode* GetRootNode(const SwNode* pNode); +}; + +struct CompareSwOutlineNodesInline +{ + bool operator()(const SwNode* lhs, const SwNode* rhs) const; +}; + +class SwOutlineNodesInline : public o3tl::sorted_vector<SwNode*, CompareSwOutlineNodesInline> +{ +public: + static constexpr auto npos = std::numeric_limits<size_type>::max(); + + bool Seek_Entry(const SwNode* rP, size_type* pnPos) const; + bool Seek_Entry_By_Anchor(const SwNode* rAnchor, size_type* pnPos) const; }; struct SwTableToTextSave; diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx index 8c7e32662aa6..174a88e74c53 100644 --- a/sw/inc/ndtxt.hxx +++ b/sw/inc/ndtxt.hxx @@ -619,6 +619,8 @@ public: /** Returns outline level of this text node. + @param bInlineHeading it can return the outline level of the inline heading + If a text node has an outline number (i.e. it has an SwNodeNum and an outline numbering rule) the outline level is the level of this SwNodeNum. @@ -627,7 +629,10 @@ public: attached the outline level is the outline level of the paragraph style. - Otherwise the text node has no outline level (NO_NUMBERING). + Otherwise the text node has no outline level (NO_NUMBERING), + except if bInlineHeading is true, and there is an inline heading + at the beginning of the paragraph anchored as character and + with a different outline level. NOTE: The outline level of text nodes is subject to change. The plan is to have an SwTextNode::nOutlineLevel member that is @@ -636,7 +641,7 @@ public: @return outline level or NO_NUMBERING if there is no outline level */ - int GetAttrOutlineLevel() const; + int GetAttrOutlineLevel(bool bInlineHeading = false) const; /** Sets the out line level *at* a text node. |