summaryrefslogtreecommitdiff
path: root/sw/source/core/layout/tabfrm.cxx
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2019-07-31 18:01:30 +0200
committerMichael Stahl <Michael.Stahl@cib.de>2019-08-01 11:00:55 +0200
commit49a32d5567a07ce0deb901a491a9cedb3cd3bbfc (patch)
tree0db342a333097a83a9acf1f0356357886421139d /sw/source/core/layout/tabfrm.cxx
parentb93216e8253c984a3ce36a9fc55516aa85f98d5f (diff)
tdf#126138 sw: disambiguate SwTabFrame::FindLastContent()
Most callers don't actually care about the SwContentFrame but want its upper; introduce FindLastContentOrTable() for those. Last frame can be a SwTabFrame quite simply if you delete the trailing paragraph with Ctrl+Shift+Del from the last cell of nested table. Change-Id: Ieab9e1ff2a5fa7b75d84dfc3cc4d17c867751b0c Reviewed-on: https://gerrit.libreoffice.org/76759 Tested-by: Jenkins Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
Diffstat (limited to 'sw/source/core/layout/tabfrm.cxx')
-rw-r--r--sw/source/core/layout/tabfrm.cxx26
1 files changed, 15 insertions, 11 deletions
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 76a064017ad8..960bb9462007 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -3336,7 +3336,7 @@ bool SwTabFrame::GetInfo( SfxPoolItem &rHint ) const
return true;
}
-SwContentFrame *SwTabFrame::FindLastContent()
+SwFrame *SwTabFrame::FindLastContentOrTable()
{
SwFrame *pRet = m_pLower;
@@ -3398,19 +3398,23 @@ SwContentFrame *SwTabFrame::FindLastContent()
while ( pRet->GetNext() )
pRet = pRet->GetNext();
- while (pRet && pRet->IsTabFrame()) // possibly there's only tables here!
- { // tdf#126138 skip table, don't look inside
- // TODO this is actually not ideal, e.g. SwFrame::FindNext_() might
- // -if there's a table at the end- return a lower frame inside that
- // table instead of the "next" one... probably this function should
- // really return SwFrame* to be able to return a SwTabFrame?
- pRet = pRet->GetPrev();
- }
-
- if (pRet && pRet->IsSctFrame())
+ if (pRet->IsSctFrame())
pRet = static_cast<SwSectionFrame*>(pRet)->FindLastContent();
}
+ assert(pRet == nullptr || dynamic_cast<SwContentFrame*>(pRet) || dynamic_cast<SwTabFrame*>(pRet));
+ return pRet;
+}
+
+SwContentFrame *SwTabFrame::FindLastContent()
+{
+ SwFrame * pRet(FindLastContentOrTable());
+
+ while (pRet && pRet->IsTabFrame()) // possibly there's only tables here!
+ { // tdf#126138 skip table, don't look inside
+ pRet = pRet->GetPrev();
+ }
+
assert(pRet == nullptr || dynamic_cast<SwContentFrame*>(pRet));
return static_cast<SwContentFrame*>(pRet);
}