summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2013-05-17 00:09:39 +0200
committerFridrich Strba <fridrich@documentfoundation.org>2013-05-17 07:25:56 +0000
commiteebd5646baa7075b486563b84a2fad97c829fb2c (patch)
treeeb01a307affbb01cb24860219213a70ae27d1984 /sw
parent2d4e570f9d6e6464cf597a1a90e84ccb3b232b5a (diff)
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). Change-Id: Ia88b3c8958798fd9c64ee75b56c61d787079133e (cherry picked from commit 38b06c661559e6eca60e2c4a4a3637b8293307b2) Reviewed-on: https://gerrit.libreoffice.org/3928 Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org> Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/crsrsh.hxx1
-rw-r--r--sw/source/core/crsr/crsrsh.cxx17
-rw-r--r--sw/source/ui/wrtsh/delete.cxx23
3 files changed, 40 insertions, 1 deletions
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 5a061dbfa466..5b6f7410d76a 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -721,6 +721,7 @@ public:
sal_Bool IsEndSentence() const;
bool IsSttPara() const;
bool IsEndPara() const;
+ bool IsEndOfTable() const; ///< at the very last SwPosition inside a table
sal_Bool IsStartOfDoc() const;
sal_Bool IsEndOfDoc() const;
bool IsInFrontOfLabel() const;
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index ac00ff73114b..819fb163c54f 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -987,6 +987,23 @@ bool SwCrsrShell::IsSttPara() const
bool SwCrsrShell::IsEndPara() const
{ return pCurCrsr->GetPoint()->nContent == pCurCrsr->GetCntntNode()->Len(); }
+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);
+}
bool SwCrsrShell::IsInFrontOfLabel() const
{
diff --git a/sw/source/ui/wrtsh/delete.cxx b/sw/source/ui/wrtsh/delete.cxx
index f714f6ae59e7..0c23dabb1c04 100644
--- a/sw/source/ui/wrtsh/delete.cxx
+++ b/sw/source/ui/wrtsh/delete.cxx
@@ -469,7 +469,28 @@ long SwWrtShell::DelToEndOfSentence()
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;
}