summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2016-10-22 15:20:38 +0300
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-01-05 11:28:21 +0100
commit89f7f15a94904214663b3caae7b721779d48bcef (patch)
treef426e0383c605c5000d7c45d8cdc610ec94fb0d0
parentfb0ed822ddf3e8a2ca6c87fd9c339264c39a574f (diff)
tdf#89377 writerfilter: table honors ParaStyle break-before-page
.doc format handled in prior patch. This import .docx patch checks to see if the very first paragraph style in a table is set with a page-break, and if so, then transfers that setting to the table itself. Change-Id: Ibb87eeb0fbdb7fdd84ef43dd1d7e0a6f8e1f8ad5 Reviewed-by: Aron Budea <aron.budea@collabora.com>
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx27
1 files changed, 25 insertions, 2 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 7f2d246cd3aa..fc03eeab8e01 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -2527,7 +2527,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext )
}
break;
case NS_ooxml::LN_tblStart:
-
+ {
/*
* Hack for Importing Section Properties
* LO is not able to import section properties if first element in the
@@ -2539,8 +2539,31 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext )
{
m_pImpl->AddDummyParaForTableInSection();
}
- m_pImpl->m_nTableDepth++;
+ // if first paragraph style in table has break-before-page, transfer that setting to the table itself.
+ if( m_pImpl->m_nTableDepth == 0 )
+ {
+ const uno::Any aBreakType = uno::makeAny(style::BreakType_PAGE_BEFORE);
+ const PropertyMapPtr pParagraphProps = m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH);
+ if( pParagraphProps && pParagraphProps->isSet(PROP_PARA_STYLE_NAME) )
+ {
+ StyleSheetEntryPtr pStyle = nullptr;
+ OUString sStyleName;
+ pParagraphProps->getProperty(PROP_PARA_STYLE_NAME)->second >>= sStyleName;
+ if( !sStyleName.isEmpty() && GetStyleSheetTable() )
+ pStyle = GetStyleSheetTable()->FindStyleSheetByStyleName( sStyleName );
+
+ if( pStyle && pStyle->pProperties
+ && pStyle->pProperties->isSet(PROP_BREAK_TYPE)
+ && pStyle->pProperties->getProperty(PROP_BREAK_TYPE)->second == aBreakType )
+ {
+ pParagraphProps->Insert(PROP_BREAK_TYPE, aBreakType);
+ }
+ }
+ }
+
+ m_pImpl->m_nTableDepth++;
+ }
break;
case NS_ooxml::LN_tblEnd:
m_pImpl->m_nTableDepth--;