summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorAttila Szűcs <szucs.attila3@nisz.hu>2021-02-26 11:19:01 +0100
committerLászló Németh <nemeth@numbertext.org>2021-03-20 14:27:42 +0100
commit9dfaf0fa1977f70341e4b9add2ecd2afb35bf1f2 (patch)
treef2bd16282ea3ede55d52c935058de19611afadbd /writerfilter
parentdf41967a29c4f8243d1df2d9b23d7c41d4a13819 (diff)
tdf#140182 DOCX table import: fix extra page break
Hack with m_bDummyParaAddedForTableInSection didn't handle the case, when a page break (empty w:p with a w:br) after the table followed by a paragraph with a section break, resulting 2 page breaks after the table instead of a single one. Co-authored-by: Tibor Nagy (NISZ) Change-Id: Ibd8ab5444becdfd09d0d05eb246e6853914e1f05 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111600 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx5
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx7
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.hxx3
3 files changed, 14 insertions, 1 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 964abf0e58fd..b36ec059cfde 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3253,7 +3253,10 @@ void DomainMapper::lcl_text(const sal_uInt8 * data_, size_t len)
case 0x0c: //page break
// page breaks aren't supported in footnotes and endnotes
if (!m_pImpl->IsInFootOrEndnote())
+ {
m_pImpl->deferBreak(PAGE_BREAK);
+ m_pImpl->SetIsDummyParaAddedForTableInSectionPage(false);
+ }
return;
case 0x0e: //column break
m_pImpl->deferBreak(COLUMN_BREAK);
@@ -3589,7 +3592,7 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len)
(!m_pImpl->GetParaChanged() && m_pImpl->GetParaSectpr()
&& !bSingleParagraphAfterRedline
&& !m_pImpl->GetParaHadField()
- && !m_pImpl->GetIsDummyParaAddedForTableInSection()
+ && (!m_pImpl->GetIsDummyParaAddedForTableInSectionPage())
&& !( pSectionContext && pSectionContext->GetBreakType() != -1 && pContext && pContext->isSet(PROP_BREAK_TYPE) )
&& !m_pImpl->GetIsPreviousParagraphFramed()
&& !m_pImpl->HasTopAnchoredObjects()
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index c102d7bcc565..311515fbc9a1 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -318,6 +318,7 @@ DomainMapper_Impl::DomainMapper_Impl(
m_bIsFirstParaInSection( true ),
m_bIsFirstParaInSectionAfterRedline( true ),
m_bDummyParaAddedForTableInSection( false ),
+ m_bDummyParaAddedForTableInSectionPage( false ),
m_bTextFrameInserted(false),
m_bIsPreviousParagraphFramed( false ),
m_bIsLastParaInSection( false ),
@@ -628,6 +629,12 @@ void DomainMapper_Impl::SetIsFirstParagraphInShape(bool bIsFirst)
void DomainMapper_Impl::SetIsDummyParaAddedForTableInSection( bool bIsAdded )
{
m_bDummyParaAddedForTableInSection = bIsAdded;
+ m_bDummyParaAddedForTableInSectionPage = bIsAdded;
+}
+
+void DomainMapper_Impl::SetIsDummyParaAddedForTableInSectionPage( bool bIsAdded )
+{
+ m_bDummyParaAddedForTableInSectionPage = bIsAdded;
}
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 4a654822fb90..0538b68e95a9 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -565,6 +565,7 @@ private:
bool m_bIsFirstParaInSectionAfterRedline;
bool m_bIsFirstParaInShape = false;
bool m_bDummyParaAddedForTableInSection;
+ bool m_bDummyParaAddedForTableInSectionPage;
bool m_bTextFrameInserted;
bool m_bIsPreviousParagraphFramed;
bool m_bIsLastParaInSection;
@@ -665,6 +666,8 @@ public:
bool GetIsFirstParagraphInShape() const { return m_bIsFirstParaInShape; }
void SetIsDummyParaAddedForTableInSection( bool bIsAdded );
bool GetIsDummyParaAddedForTableInSection() const { return m_bDummyParaAddedForTableInSection;}
+ void SetIsDummyParaAddedForTableInSectionPage(bool bIsAdded);
+ bool GetIsDummyParaAddedForTableInSectionPage() const { return m_bDummyParaAddedForTableInSectionPage; }
/// Track if a textframe has been inserted into this section
void SetIsTextFrameInserted( bool bIsInserted );