diff options
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf123116_oversizedRowSplit.odt | bin | 0 -> 11843 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 7 | ||||
-rw-r--r-- | sw/source/core/inc/rowfrm.hxx | 3 | ||||
-rw-r--r-- | sw/source/core/layout/tabfrm.cxx | 23 |
4 files changed, 31 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf123116_oversizedRowSplit.odt b/sw/qa/extras/ooxmlexport/data/tdf123116_oversizedRowSplit.odt Binary files differnew file mode 100644 index 000000000000..aafc27ae2260 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf123116_oversizedRowSplit.odt diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index 447767e864f5..049218cc8ac8 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -321,6 +321,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf108350_noFontdefaults, "tdf108350_noFontdefaults //CPPUNIT_ASSERT_EQUAL_MESSAGE("Font size", 10.f, getProperty<float>(xStyleProps, "CharHeight")); } +DECLARE_OOXMLEXPORT_TEST(testTdf123116_oversizedRowSplit, "tdf123116_oversizedRowSplit.odt") +{ + // For highest backward compatibility and interoperability, the now-splitable-row + // should start on a new page. + CPPUNIT_ASSERT_EQUAL_MESSAGE("Row splits over 5 pages", 5, getPages()); +} + DECLARE_OOXMLEXPORT_TEST(testTdf129522_removeShadowStyle, "tdf129522_removeShadowStyle.odt") { uno::Reference< container::XNameAccess > paragraphStyles = getStyles("ParagraphStyles"); diff --git a/sw/source/core/inc/rowfrm.hxx b/sw/source/core/inc/rowfrm.hxx index 3786d00f8347..e131730c20e6 100644 --- a/sw/source/core/inc/rowfrm.hxx +++ b/sw/source/core/inc/rowfrm.hxx @@ -43,6 +43,7 @@ class SwRowFrame: public SwLayoutFrame bool m_bIsRepeatedHeadline; bool m_bIsRowSpanLine; + bool m_bForceRowSplitAllowed; bool m_bIsInSplit; virtual void DestroyImpl() override; @@ -90,6 +91,8 @@ public: // --> split table rows bool IsRowSplitAllowed() const; + bool IsForceRowSplitAllowed() const { return m_bForceRowSplitAllowed; } + void SetForceRowSplitAllowed( bool bNew) { m_bForceRowSplitAllowed = bNew; }; bool IsFollowFlowRow() const { return m_bIsFollowFlowRow; } void SetFollowFlowRow( bool bNew ) { m_bIsFollowFlowRow = bNew; } // <-- split table rows 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(); |