[Libreoffice-commits] .: writerfilter/source
Miklos Vajna
vmiklos at kemper.freedesktop.org
Mon Jun 25 03:45:27 PDT 2012
writerfilter/source/dmapper/DomainMapper.cxx | 10 ++++++++++
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 14 ++++++++++++++
writerfilter/source/dmapper/DomainMapper_Impl.hxx | 6 ++++++
3 files changed, 30 insertions(+)
New commits:
commit eae88a9cb1120aecf2e296277778fb22a70a62dc
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Mon Jun 25 12:43:18 2012 +0200
n#766481 dmapper: don't import fake paragraph containing sectpr only
Change-Id: I5eaf8b765d03b898c1c9a466802b75bbfe05a622
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index f51ce3f..9b7ee29 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -2795,6 +2795,8 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
case NS_ooxml::LN_CT_Style_rPr:
case NS_ooxml::LN_CT_PPr_rPr:
case NS_ooxml::LN_CT_PPrBase_numPr:
+ if (nSprmId == NS_ooxml::LN_CT_PPr_sectPr)
+ m_pImpl->SetParaSectpr(true);
resolveSprmProps(*this, rSprm);
break;
case NS_ooxml::LN_EG_SectPrContents_footnotePr:
@@ -3396,7 +3398,15 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len)
// RTF always uses text() instead of utext() for run break
if(len == 1 && ((*data_) == 0x0d || (*data_) == 0x07) && !IsRTFImport())
+ {
+ // If the paragraph contains only the section properties and it has
+ // no runs, we should not create a paragraph for it in Writer.
+ bool bRemove = !m_pImpl->GetParaChanged() && m_pImpl->GetParaSectpr();
+ m_pImpl->SetParaSectpr(false);
m_pImpl->finishParagraph(m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH));
+ if (bRemove)
+ m_pImpl->RemoveLastParagraph();
+ }
else
{
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 8e6d2c6..fb4dbcc 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -207,6 +207,7 @@ DomainMapper_Impl::DomainMapper_Impl(
m_bIsParaChange( false ),
m_bParaChanged( false ),
m_bIsLastParaInSection( false ),
+ m_bParaSectpr( false ),
m_bUsingEnhancedFields( false )
{
appendTableManager( );
@@ -307,7 +308,20 @@ void DomainMapper_Impl::SetIsLastParagraphInSection( bool bIsLast )
m_bIsLastParaInSection = bIsLast;
}
+void DomainMapper_Impl::SetParaSectpr(bool bParaSectpr)
+{
+ m_bParaSectpr = bParaSectpr;
+}
+bool DomainMapper_Impl::GetParaSectpr()
+{
+ return m_bParaSectpr;
+}
+
+bool DomainMapper_Impl::GetParaChanged()
+{
+ return m_bParaChanged;
+}
void DomainMapper_Impl::PushProperties(ContextType eId)
{
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 77a2b62..55c8e6e 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -349,8 +349,11 @@ private:
RedlineParamsPtr m_pParaRedline;
bool m_bIsParaChange;
+ /// If the current paragraph has any runs.
bool m_bParaChanged;
bool m_bIsLastParaInSection;
+ /// If the current paragraph contains section property definitions.
+ bool m_bParaSectpr;
bool m_bUsingEnhancedFields;
//annotation import
@@ -406,6 +409,9 @@ public:
void RemoveLastParagraph( );
void SetIsLastParagraphInSection( bool bIsLast );
+ void SetParaSectpr(bool bParaSectpr);
+ bool GetParaSectpr();
+ bool GetParaChanged();
void deferBreak( BreakType deferredBreakType );
bool isBreakDeferred( BreakType deferredBreakType );
More information about the Libreoffice-commits
mailing list