Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/3927
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/27/3927/1
fdo#60967: re-enable deletion of paragraph following table
This was actually a documented feature, so removing it just because it
only happened to work sometimes by accident was a bad idea :)
(regression from f4b6c94c68b5f67b931cde8d0acda6ec8b288bb)
So implement this in a less accidental way, so that Ctrl+Shift+Del
at the last position inside a table will delete the following paragraph.
Do not implement the weird "only delete first sentence and merge rest of
paragraph into cell" behavior, because i don't think it makes sense;
much better to just delete the whole paragraph, that is also the most
likely use-case for this (with table in frame/header/footer).
(cherry picked from commit 38b06c661559e6eca60e2c4a4a3637b8293307b2)
Conflicts:
sw/inc/crsrsh.hxx
Change-Id: Ia88b3c8958798fd9c64ee75b56c61d787079133e
---
M sw/inc/crsrsh.hxx
M sw/source/core/crsr/crsrsh.cxx
M sw/source/ui/wrtsh/delete.cxx
3 files changed, 40 insertions(+), 1 deletion(-)
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index fa2b287..650493f 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -732,6 +732,7 @@
sal_Bool IsEndSentence() const;
sal_Bool IsSttPara() const;
sal_Bool IsEndPara() const;
+ bool IsEndOfTable() const; ///< at the very last SwPosition inside a table
sal_Bool IsStartOfDoc() const;
sal_Bool IsEndOfDoc() const;
sal_Bool IsInFrontOfLabel() const;
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 1493d14..01ee5c9 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -1024,6 +1024,23 @@
sal_Bool SwCrsrShell::IsEndPara() const
{ return( pCurCrsr->GetPoint()->nContent == pCurCrsr->GetCntntNode()->Len() ? sal_True :
sal_False ); }
+bool SwCrsrShell::IsEndOfTable() const
+{
+ if (IsTableMode() || IsBlockMode() || !IsEndPara())
+ {
+ return false;
+ }
+ SwTableNode const*const pTableNode( IsCrsrInTbl() );
+ if (!pTableNode)
+ {
+ return false;
+ }
+ SwEndNode const*const pEndTableNode(pTableNode->EndOfSectionNode());
+ SwNodeIndex const lastNode(*pEndTableNode, -2);
+ SAL_WARN_IF(!lastNode.GetNode().GetTxtNode(), "sw.core",
+ "text node expected");
+ return (lastNode == pCurCrsr->GetPoint()->nNode);
+}
sal_Bool SwCrsrShell::IsInFrontOfLabel() const
{
diff --git a/sw/source/ui/wrtsh/delete.cxx b/sw/source/ui/wrtsh/delete.cxx
index c323229..a3a03d4 100644
--- a/sw/source/ui/wrtsh/delete.cxx
+++ b/sw/source/ui/wrtsh/delete.cxx
@@ -480,7 +480,28 @@
if(IsEndOfDoc())
return 0;
OpenMark();
- long nRet = _FwdSentence() ? Delete() : 0;
+ long nRet(0);
+ // fdo#60967: special case that is documented in help: delete
+ // paragraph following table if cursor is at end of last cell in table
+ if (IsEndOfTable())
+ {
+ Push();
+ ClearMark();
+ if (SwCrsrShell::Right(1,CRSR_SKIP_CHARS))
+ {
+ SetMark();
+ SwCrsrShell::MovePara(fnParaCurr, fnParaEnd);
+ if (!IsEndOfDoc()) // do not delete last paragraph in body text
+ {
+ nRet = DelFullPara() ? 1 : 0;
+ }
+ }
+ Pop(false);
+ }
+ else
+ {
+ nRet = _FwdSentence() ? Delete() : 0;
+ }
CloseMark( 0 != nRet );
return nRet;
}
--
To view, visit https://gerrit.libreoffice.org/3927
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia88b3c8958798fd9c64ee75b56c61d787079133e
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-3-6
Gerrit-Owner: Michael Stahl <mstahl@redhat.com>
Context
- [PATCH libreoffice-3-6] fdo#60967: re-enable deletion of paragraph following table · Michael Stahl (via Code Review)
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.