[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Jul 25 08:20:04 UTC 2018


 sw/source/core/inc/rowfrm.hxx    |    2 +-
 sw/source/core/layout/tabfrm.cxx |   12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 6db143f43874a817b7a920dea41939bf9439ca9b
Author:     Justin Luth <justin_luth at sil.org>
AuthorDate: Wed Jul 18 09:01:43 2018 +0300
Commit:     Miklos Vajna <vmiklos at collabora.co.uk>
CommitDate: Wed Jul 25 10:19:40 2018 +0200

    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 at sil.org>
    (cherry picked from commit ef86b2e7a08ea25c434db85087d094f030f762cc)
    Reviewed-on: https://gerrit.libreoffice.org/57697
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

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 8fad05cf2508..ae20788f9da0 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -1777,16 +1777,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;
@@ -1863,8 +1863,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
@@ -4613,7 +4613,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() )
@@ -4623,7 +4623,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)


More information about the Libreoffice-commits mailing list