summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-06-25 12:43:18 +0200
committerMiklos Vajna <vmiklos@suse.cz>2012-06-25 12:46:42 +0200
commiteae88a9cb1120aecf2e296277778fb22a70a62dc (patch)
tree9b95c806574d5cf449e6483d66c543eb253bf965
parent66ea6d9801ea8e214f39a70251e5ccc5f47c315a (diff)
n#766481 dmapper: don't import fake paragraph containing sectpr only
Change-Id: I5eaf8b765d03b898c1c9a466802b75bbfe05a622
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx10
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx14
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.hxx6
3 files changed, 30 insertions, 0 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index f51ce3f71e23..9b7ee2974405 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 8e6d2c63c245..fb4dbccb2975 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 77a2b62adc6c..55c8e6ebeaf1 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 );