Kaydet (Commit) 40d93d97 authored tarafından Miklos Vajna's avatar Miklos Vajna

n#782345 import DOCX w:splitPgBreakAndParaMark compat option

This fixes docx import of page breaks in empty paragraphs, when the
compat option in question is set.

Even empty paragraphs have an "end of paragraph" character in dmapper:
import page breaks there, instead of delaying the import till the
all-catcher importer at the start of the next paragraph.

Change-Id: Ie5c37042b3c445e0669771d15c8eb46380192db3
üst 67081cdf
......@@ -3542,6 +3542,16 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len)
if(len == 1 && (sText[0] == 0x0d || sText[0] == 0x07))
{
PropertyMapPtr pContext = m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH);
if (pContext && m_pImpl->GetSettingsTable()->GetSplitPgBreakAndParaMark())
{
if (m_pImpl->isBreakDeferred(PAGE_BREAK))
pContext->Insert(PROP_BREAK_TYPE, true, uno::makeAny( com::sun::star::style::BreakType_PAGE_BEFORE));
else if (m_pImpl->isBreakDeferred(COLUMN_BREAK))
pContext->Insert(PROP_BREAK_TYPE, true, uno::makeAny( com::sun::star::style::BreakType_COLUMN_BEFORE));
m_pImpl->clearDeferredBreaks();
}
bool bSingleParagraph = m_pImpl->GetIsFirstParagraphInSection() && m_pImpl->GetIsLastParagraphInSection();
// If the paragraph contains only the section properties and it has
// no runs, we should not create a paragraph for it in Writer, unless that would remove the whole section.
......
......@@ -72,6 +72,7 @@ struct SettingsTable_Impl
bool embedTrueTypeFonts;
bool embedSystemFonts;
bool m_bDoNotUseHTMLParagraphAutoSpacing;
bool m_bSplitPgBreakAndParaMark;
SettingsTable_Impl( DomainMapper& rDMapper, const uno::Reference< lang::XMultiServiceFactory > xTextFactory ) :
m_rDMapper( rDMapper )
......@@ -95,6 +96,7 @@ struct SettingsTable_Impl
, embedTrueTypeFonts(false)
, embedSystemFonts(false)
, m_bDoNotUseHTMLParagraphAutoSpacing(false)
, m_bSplitPgBreakAndParaMark(false)
{}
};
......@@ -214,6 +216,9 @@ void SettingsTable::lcl_sprm(Sprm& rSprm)
case NS_ooxml::LN_CT_Compat_doNotUseHTMLParagraphAutoSpacing:
m_pImpl->m_bDoNotUseHTMLParagraphAutoSpacing = nIntValue;
break;
case NS_ooxml::LN_CT_Compat_splitPgBreakAndParaMark:
m_pImpl->m_bSplitPgBreakAndParaMark = nIntValue;
break;
default:
{
#ifdef DEBUG_DMAPPER_SETTINGS_TABLE
......@@ -271,6 +276,11 @@ bool SettingsTable::GetDoNotUseHTMLParagraphAutoSpacing() const
return m_pImpl->m_bDoNotUseHTMLParagraphAutoSpacing;
}
bool SettingsTable::GetSplitPgBreakAndParaMark() const
{
return m_pImpl->m_bSplitPgBreakAndParaMark;
}
void SettingsTable::ApplyProperties( uno::Reference< text::XTextDocument > xDoc )
{
uno::Reference< beans::XPropertySet> xDocProps( xDoc, uno::UNO_QUERY );
......
......@@ -69,6 +69,7 @@ class WRITERFILTER_DLLPRIVATE SettingsTable : public LoggedProperties, public Lo
bool GetEmbedSystemFonts() const;
bool GetDoNotUseHTMLParagraphAutoSpacing() const;
bool GetSplitPgBreakAndParaMark() const;
void ApplyProperties( uno::Reference< text::XTextDocument > xDoc );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment