[Libreoffice-commits] core.git: Branch 'libreoffice-5-4-7' - 2 commits - sw/qa writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Mon May 7 10:38:42 UTC 2018
sw/qa/extras/ooxmlexport/data/tdf116410.docx |binary
sw/qa/extras/ooxmlexport/data/tdf116976.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 13 +++++++++++++
sw/qa/extras/ooxmlimport/data/tdf115719b.docx |binary
sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 6 ++++++
writerfilter/source/dmapper/GraphicImport.cxx | 10 ++++++++--
writerfilter/source/dmapper/PropertyMap.cxx | 4 ++++
7 files changed, 31 insertions(+), 2 deletions(-)
New commits:
commit c7b4fb269034ec87700481d389f60ca181060c8c
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Apr 12 18:39:36 2018 +0200
tdf#116976 DOCX import: fix rel size of shape after bitmap
We have a queue of these odd relative sizes (which are not XML
attributes but text inside the XML element), if the bitmap doesn't pop
the queue, the following shape won't get its size.
Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
Change-Id: I1602208c9509d8889bf0be254f3b25fb25fafca2
Reviewed-on: https://gerrit.libreoffice.org/52984
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
(cherry picked from commit cba1897f3c063f8a535898bfd16a516c8de9ac21)
Reviewed-on: https://gerrit.libreoffice.org/53739
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
Tested-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
diff --git a/sw/qa/extras/ooxmlexport/data/tdf116976.docx b/sw/qa/extras/ooxmlexport/data/tdf116976.docx
new file mode 100644
index 000000000000..70492a4af2f3
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf116976.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 8ffe76e77f55..dd3b9759cf4b 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -716,6 +716,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf116410, "tdf116410.docx")
CPPUNIT_ASSERT_EQUAL(1, getPages());
}
+DECLARE_OOXMLEXPORT_TEST(testTdf116976, "tdf116976.docx")
+{
+ // This was 0, reltive size of shape after bitmap was ignored.
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(40),
+ getProperty<sal_Int16>(getShape(1), "RelativeWidth"));
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index e9826192143c..d6745f2dc162 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -1080,10 +1080,12 @@ void GraphicImport::lcl_sprm(Sprm& rSprm)
break;
case NS_ooxml::LN_CT_SizeRelH_pctWidth:
case NS_ooxml::LN_CT_SizeRelV_pctHeight:
- if (m_xShape.is() && !m_pImpl->m_rPositivePercentages.empty())
+ if (m_pImpl->m_rPositivePercentages.empty())
+ break;
+
+ if (m_xShape.is())
{
sal_Int16 nPositivePercentage = rtl::math::round(m_pImpl->m_rPositivePercentages.front().toDouble() / oox::drawingml::PER_PERCENT);
- m_pImpl->m_rPositivePercentages.pop();
if (nPositivePercentage)
{
@@ -1092,6 +1094,10 @@ void GraphicImport::lcl_sprm(Sprm& rSprm)
xPropertySet->setPropertyValue(aProperty, uno::makeAny(nPositivePercentage));
}
}
+
+ // Make sure the token is consumed even if xShape is an empty
+ // reference.
+ m_pImpl->m_rPositivePercentages.pop();
break;
case NS_ooxml::LN_EG_WrapType_wrapNone: // 90944; - doesn't contain attributes
//depending on the behindDoc attribute text wraps through behind or in front of the object
commit 90d298ba863210ac2ad140c7bf8e426fc39b10ca
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Mar 26 21:52:05 2018 +0200
tdf#116410 DOCX import: restrict increased object spacing to multiple shapes
This anchored object handling is just there to be bug-compatible with
Word, it's not needed for the case when there is a single shape in the
paragraph.
(cherry picked from commit 2c4d84e93901571ead79c85aa3894ef4e10bf5af)
Also:
Related: tdf#115719 DOCX import: fix ignore of increased anchored obj spacing
If there is only a single anchored object, then ignore only the current
paragraph, not all paragraphs of the section.
(cherry picked from commit 599ff05300599d4e4ce818092f18e76e738b921e)
Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
Change-Id: I5e3dc4ba9a4a6f459ec6217e8974ebc2d7303bcc
Reviewed-on: https://gerrit.libreoffice.org/52981
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
(cherry picked from commit 82f6da65acaf02bc3b9d6b2039a4c307d5593423)
Reviewed-on: https://gerrit.libreoffice.org/53738
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
Tested-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
diff --git a/sw/qa/extras/ooxmlexport/data/tdf116410.docx b/sw/qa/extras/ooxmlexport/data/tdf116410.docx
new file mode 100644
index 000000000000..5352a233ed70
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf116410.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index f5553c5b7d1d..8ffe76e77f55 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -710,6 +710,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf115719, "tdf115719.docx")
CPPUNIT_ASSERT_EQUAL(2, getPages());
}
+DECLARE_OOXMLEXPORT_TEST(testTdf116410, "tdf116410.docx")
+{
+ // Opposite of the above, was 2 pages, should be 1 page.
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/ooxmlimport/data/tdf115719b.docx b/sw/qa/extras/ooxmlimport/data/tdf115719b.docx
new file mode 100644
index 000000000000..551b9871fe60
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf115719b.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index d84bffd0f4cf..5e915c61803f 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -348,6 +348,12 @@ xray ThisComponent.StyleFamilies.PageStyles.Default.Width
CPPUNIT_ASSERT( pos.X > width / 2 );
}
+DECLARE_OOXMLIMPORT_TEST(testTdf115719b, "tdf115719b.docx")
+{
+ // This was 0, 4th (last) paragraph had no increased spacing.
+ CPPUNIT_ASSERT(getProperty<sal_Int32>(getParagraph(4), "ParaTopMargin") > 0);
+}
+
DECLARE_OOXMLIMPORT_TEST(testN766477, "n766477.docx")
{
/*
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index c00e4bfec593..8c87c2c91286 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1135,6 +1135,10 @@ void SectionPropertyMap::HandleIncreasedAnchoredObjectSpacing(DomainMapper_Impl&
std::vector<AnchoredObjectInfo>& rAnchoredObjectAnchors = rDM_Impl.m_aAnchoredObjectAnchors;
for (auto& rAnchor : rAnchoredObjectAnchors)
{
+ // Ignore this paragraph when there is a single shape only.
+ if (rAnchor.m_aAnchoredObjects.size() < 2)
+ continue;
+
// Analyze the anchored objects of this paragraph, now that we know the
// page width.
sal_Int32 nShapesWidth = 0;
More information about the Libreoffice-commits
mailing list