[Libreoffice-commits] core.git: sw/qa writerfilter/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Aug 28 09:48:17 UTC 2018
sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 3 +++
writerfilter/source/dmapper/DomainMapper.cxx | 2 +-
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 7 +++++++
writerfilter/source/dmapper/DomainMapper_Impl.hxx | 2 +-
4 files changed, 12 insertions(+), 2 deletions(-)
New commits:
commit b88da9b4302fa324f061a4a26ab4b2d647fdc765
Author: Justin Luth <justin_luth at sil.org>
AuthorDate: Mon Aug 27 11:19:22 2018 +0300
Commit: László Németh <nemeth at numbertext.org>
CommitDate: Tue Aug 28 11:47:53 2018 +0200
writerfilter: not FirstParaInSection if IsInShape
Since anchored objects can contain paragraphs, considering all
of them to be "firstParagraphs" would generally be considered
an incorrect result. Browsing through the existing uses of
IsFirstPara.*InSection I didn't see any that looked like
it should be considered true if IsInShape.
Since this is the kind of gotcha that that the programmer
should be aware of, add it directly into the function instead
of requiring each use to have an additional qualification.
The following ooxml unit tests match these conditions, but
only one was fixed - the rest were unaffected since they just
avoided adding/removing dummy paragraphs.
fdo79540.docx - 5
tblppr-shape.docx - 5
ooo47778-3.odt- 5
ooo47778-4.odt- 5
textbox-rounded-corners.docx - 7
n780563.docx - 8
missing-path.docx - 10
floating-tables-anchor.docx - 10
tdf117805.odt - 11 (fixed - prevented extra section paragraphs)
Change-Id: I841475e214c194a673321c1229d9254dd07205f8
Reviewed-on: https://gerrit.libreoffice.org/59659
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth at numbertext.org>
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 263959520851..e02d829b734f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -271,6 +271,9 @@ DECLARE_OOXMLEXPORT_TEST(testTdf117805, "tdf117805.odt")
// This failed, the header was lost. It's still referenced at an incorrect
// location in document.xml, though.
CPPUNIT_ASSERT(xNameAccess->hasByName("word/header1.xml"));
+
+ uno::Reference<text::XText> textbox(getShape(1), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(8, getParagraphs(textbox));
}
DECLARE_OOXMLEXPORT_TEST(testTdf113183, "tdf113183.docx")
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index cfd44ab53dd9..4b07d253eb21 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -656,7 +656,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
else
{
// tdf#104354 first paragraphs of table cells and shapes get zero top margin
- if ((m_pImpl->GetIsFirstParagraphInSection() && !m_pImpl->IsInShape() && m_pImpl->m_nTableDepth > 0) ||
+ if ((m_pImpl->GetIsFirstParagraphInSection() && m_pImpl->m_nTableDepth > 0) ||
m_pImpl->GetIsFirstParagraphInShape())
default_spacing = 0;
else
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 0091f40aff28..508e74e017ae 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -478,6 +478,13 @@ void DomainMapper_Impl::SetIsFirstParagraphInSection( bool bIsFirst )
m_bIsFirstParaInSection = bIsFirst;
}
+bool DomainMapper_Impl::GetIsFirstParagraphInSection()
+{
+ // Anchored objects may include multiple paragraphs,
+ // and none of them should be considered the first para in section.
+ return m_bIsFirstParaInSection && !IsInShape();
+}
+
void DomainMapper_Impl::SetIsFirstParagraphInShape(bool bIsFirst)
{
m_bIsFirstParaInShape = bIsFirst;
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 72a9b56da66e..342fa4d0f006 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -594,7 +594,7 @@ public:
void SetIsLastSectionGroup( bool bIsLast );
bool GetIsLastSectionGroup() { return m_bIsLastSectionGroup;}
void SetIsFirstParagraphInSection( bool bIsFirst );
- bool GetIsFirstParagraphInSection() { return m_bIsFirstParaInSection;}
+ bool GetIsFirstParagraphInSection();
void SetIsFirstParagraphInShape(bool bIsFirst);
bool GetIsFirstParagraphInShape() { return m_bIsFirstParaInShape; }
void SetIsDummyParaAddedForTableInSection( bool bIsAdded );
More information about the Libreoffice-commits
mailing list