summaryrefslogtreecommitdiff
path: root/sw/source/core/layout
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2020-03-04 16:31:14 +0300
committerMiklos Vajna <vmiklos@collabora.com>2020-03-12 09:10:23 +0100
commitb271cc46851c61ddef20dc869bf339c857f76b18 (patch)
treee25706e19270e49cd1881e0ac5706340e4efebf9 /sw/source/core/layout
parent845c7a3bd93f25e6138cff61fa91e346746174d2 (diff)
tdf#123116 sw layout: allow rows larger than page to split anyway
Even if the row is set to not allow splitting across pages, ignore that setting if the row is too big to fit on a single page. Don't worry too much about compatibility, because there is no sensible reason why anyone would have hidden content like this intentionally. An oversized row has always moved to start a new page. While that may not strictly be necessary anymore, to approximate a bit of backward compatibility, continue to do that. MS Word will do the same... Word, prior to 2013, always tries to keep the whole row on one page. In 2013 (compatibleMode == 15), native documents will be treated like this patch. So, although this patch throws away senseless compatibility with existing documents, it is interoperable with anything authored by Word >= 2013. Word 2013/2016 also opens .odt files this way. HOWEVER, LO authored .docx files do not set compatibleMode=15, so Word will treat them the old way - hiding all the content on a single page. Change-Id: I306e22230ed6fe21f6b66700ffd7615678859f5d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90005 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/source/core/layout')
-rw-r--r--sw/source/core/layout/tabfrm.cxx23
1 files changed, 21 insertions, 2 deletions
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 2a9b98e4869e..9beef619ed4a 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -1056,7 +1056,16 @@ bool SwTabFrame::Split( const SwTwips nCutPos, bool bTryToSplit, bool bTableRowK
// table, or it will be set to false under certain
// conditions that are not suitable for splitting
// the row.
- bool bSplitRowAllowed = pRow->IsRowSplitAllowed() && !IsSplitRowDisabled();
+ bool bSplitRowAllowed = !IsSplitRowDisabled();
+ if ( bSplitRowAllowed && !pRow->IsRowSplitAllowed() )
+ {
+ // A row larger than the entire page ought to be allowed to split regardless of setting,
+ // otherwise it has hidden content and that makes no sense
+ if ( !pRow->GetPrev() && pRow->getFrameArea().Height() > FindPageFrame()->getFramePrintArea().Height() )
+ pRow->SetForceRowSplitAllowed( true );
+ else
+ bSplitRowAllowed = false;
+ }
// #i29438#
// #i26945# - Floating screen objects no longer forbid
@@ -3531,6 +3540,13 @@ bool SwTabFrame::ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool &rReformat )
rReformat = true;
return true;
}
+
+ // Unsplitable rows have always started on a new page, so don't movebwd, even though we now allow splitting in some cases.
+ // This also matches Word - so good for interoperability (tdf#123116)
+ const SwRowFrame* pFirstRow = GetFirstNonHeadlineRow();
+ if ( pFirstRow && pFirstRow->IsForceRowSplitAllowed() )
+ return false;
+
bool bFits = nSpace > 0;
if (!bFits && aRectFnSet.GetHeight(getFrameArea()) == 0)
// This frame fits into pNewUpper in case it has no space, but this
@@ -3541,7 +3557,6 @@ bool SwTabFrame::ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool &rReformat )
// #i26945# - check, if follow flow line
// contains frame, which are moved forward due to its object
// positioning.
- SwRowFrame* pFirstRow = GetFirstNonHeadlineRow();
if ( pFirstRow && pFirstRow->IsInFollowFlowRow() &&
SwLayouter::DoesRowContainMovedFwdFrame(
*(pFirstRow->GetFormat()->GetDoc()),
@@ -3745,6 +3760,7 @@ SwRowFrame::SwRowFrame(const SwTableLine &rLine, SwFrame* pSib, bool bInsertCont
// <-- split table rows
, m_bIsRepeatedHeadline( false )
, m_bIsRowSpanLine( false )
+ , m_bForceRowSplitAllowed( false )
, m_bIsInSplit( false )
{
mnFrameType = SwFrameType::Row;
@@ -4693,6 +4709,9 @@ bool SwRowFrame::IsRowSplitAllowed() const
pTabFrame->IsInHeadline( *this ) )
return false;
+ if ( IsForceRowSplitAllowed() )
+ return true;
+
const SwTableLineFormat* pFrameFormat = static_cast<SwTableLineFormat*>(GetTabLine()->GetFrameFormat());
const SwFormatRowSplit& rLP = pFrameFormat->GetRowSplit();
return rLP.GetValue();