summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2018-07-18 09:01:43 +0300
committerJustin Luth <justin_luth@sil.org>2018-07-18 21:17:00 +0200
commitef86b2e7a08ea25c434db85087d094f030f762cc (patch)
tree4b7e4085d84d70b6c21368dd4060c5bad08249a4
parent55b128760e8e7fb732b4627f3120ea5cba8755ce (diff)
tdf#118528 sw layout: only direct formatting for EmulateTableKeep
Emulating MSWord's way of keeping a table with the next paragraph has caused a few complaints, but never anything that seemed to clearly indicate a real problem - usually just badly designed documents. But a common theme has been the keep attribute coming through styles. Since our export-emulation writes directly to the paragraph properties, lets make the emulation dependent on direct formatting to avoid some of these complaints. Change-Id: I008fc7b6a7083292463c20972ad209761ec97601 Reviewed-on: https://gerrit.libreoffice.org/57613 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org>
-rw-r--r--sw/source/core/inc/rowfrm.hxx2
-rw-r--r--sw/source/core/layout/tabfrm.cxx12
2 files changed, 7 insertions, 7 deletions
diff --git a/sw/source/core/inc/rowfrm.hxx b/sw/source/core/inc/rowfrm.hxx
index 9ff22cc0a125..c3724667cdaf 100644
--- a/sw/source/core/inc/rowfrm.hxx
+++ b/sw/source/core/inc/rowfrm.hxx
@@ -97,7 +97,7 @@ public:
// <-- split table rows
// #131283# Table row keep feature
- bool ShouldRowKeepWithNext() const;
+ bool ShouldRowKeepWithNext( const bool bCheckParents = true ) const;
// #i4032# NEW TABLES
bool IsRowSpanLine() const { return m_bIsRowSpanLine; }
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index a5538ea3f707..7c62601414f0 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -1775,16 +1775,16 @@ SwFrame* sw_FormatNextContentForKeep( SwTabFrame* pTabFrame )
}
namespace {
- bool AreAllRowsKeepWithNext( const SwRowFrame* pFirstRowFrame )
+ bool AreAllRowsKeepWithNext( const SwRowFrame* pFirstRowFrame, const bool bCheckParents = true )
{
bool bRet = pFirstRowFrame != nullptr &&
- pFirstRowFrame->ShouldRowKeepWithNext();
+ pFirstRowFrame->ShouldRowKeepWithNext( bCheckParents );
while ( bRet && pFirstRowFrame->GetNext() != nullptr )
{
pFirstRowFrame = dynamic_cast<const SwRowFrame*>(pFirstRowFrame->GetNext());
bRet = pFirstRowFrame != nullptr &&
- pFirstRowFrame->ShouldRowKeepWithNext();
+ pFirstRowFrame->ShouldRowKeepWithNext( bCheckParents );
}
return bRet;
@@ -1861,8 +1861,8 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext)
const SwBorderAttrs *pAttrs = pAccess->Get();
const bool bLargeTable = GetTable()->GetTabLines().size() > 64; //arbitrary value, virtually guaranteed to be larger than one page.
+ const bool bEmulateTableKeep = !bLargeTable && AreAllRowsKeepWithNext( GetFirstNonHeadlineRow(), /*bCheckParents=*/false );
// The beloved keep attribute
- const bool bEmulateTableKeep = !bLargeTable && AreAllRowsKeepWithNext( GetFirstNonHeadlineRow() );
const bool bKeep = IsKeep(pAttrs->GetAttrSet().GetKeep(), GetBreakItem(), bEmulateTableKeep);
// All rows should keep together
@@ -4607,7 +4607,7 @@ bool SwRowFrame::IsRowSplitAllowed() const
return rLP.GetValue();
}
-bool SwRowFrame::ShouldRowKeepWithNext() const
+bool SwRowFrame::ShouldRowKeepWithNext( const bool bCheckParents ) const
{
// No KeepWithNext if nested in another table
if ( GetUpper()->GetUpper()->IsCellFrame() )
@@ -4617,7 +4617,7 @@ bool SwRowFrame::ShouldRowKeepWithNext() const
const SwFrame* pText = pCell->Lower();
return pText && pText->IsTextFrame() &&
- static_cast<const SwTextFrame*>(pText)->GetTextNodeForParaProps()->GetSwAttrSet().GetKeep().GetValue();
+ static_cast<const SwTextFrame*>(pText)->GetTextNodeForParaProps()->GetSwAttrSet().GetKeep(bCheckParents).GetValue();
}
SwCellFrame::SwCellFrame(const SwTableBox &rBox, SwFrame* pSib, bool bInsertContent)