diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2012-10-01 13:42:02 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2012-10-01 15:13:50 +0200 |
commit | 40d93d978d4f8fa709bdeb061b106122789d8e32 (patch) | |
tree | 1c5fb8f1b05c6ea83de1c723f87872f3a23742af | |
parent | 67081cdf67976a6478b406b6aadca6325691e605 (diff) |
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
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 10 | ||||
-rw-r--r-- | writerfilter/source/dmapper/SettingsTable.cxx | 10 | ||||
-rw-r--r-- | writerfilter/source/dmapper/SettingsTable.hxx | 1 |
3 files changed, 21 insertions, 0 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 8b5103495228..64618bf08614 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -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. diff --git a/writerfilter/source/dmapper/SettingsTable.cxx b/writerfilter/source/dmapper/SettingsTable.cxx index 18bef92d7b89..b01047ac0a9a 100644 --- a/writerfilter/source/dmapper/SettingsTable.cxx +++ b/writerfilter/source/dmapper/SettingsTable.cxx @@ -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 ); diff --git a/writerfilter/source/dmapper/SettingsTable.hxx b/writerfilter/source/dmapper/SettingsTable.hxx index 6a250a7157d0..14b7552135f3 100644 --- a/writerfilter/source/dmapper/SettingsTable.hxx +++ b/writerfilter/source/dmapper/SettingsTable.hxx @@ -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 ); |