[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sw/qa writerfilter/source
Vasily Melenchuk
Vasily.Melenchuk at cib.de
Thu Jun 29 12:16:57 UTC 2017
sw/qa/extras/ooxmlexport/data/tdf100075.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 17 +++++++++
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 38 ++++++++++++++++++----
3 files changed, 49 insertions(+), 6 deletions(-)
New commits:
commit 94c533bc59a8fe50b3d44c3200646f99269faab5
Author: Vasily Melenchuk <Vasily.Melenchuk at cib.de>
Date: Tue Jun 20 14:20:31 2017 +0300
tdf#100075 DOCX frame height rule updated
According to "[MS-OE376]: Office Implementation Information for
ECMA-376 Standards Support" Word treats default value for
hRule attribute in a different way: if frame height is missing it
is "auto" (as in specification), but if frame height exist, then
default value for hRule is "atLeast".
Change-Id: I0ce30b61d1a6b85febbbd8a6bf5af3eb1bb2767f
Reviewed-on: https://gerrit.libreoffice.org/39065
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
(cherry picked from commit d5b19100ca4d3670d1b5367e8000739af60a6892)
Reviewed-on: https://gerrit.libreoffice.org/39384
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/sw/qa/extras/ooxmlexport/data/tdf100075.docx b/sw/qa/extras/ooxmlexport/data/tdf100075.docx
new file mode 100644
index 000000000000..6312050aaf2f
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf100075.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index d63a6183c5ba..97caff77803c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -588,6 +588,23 @@ DECLARE_OOXMLEXPORT_TEST(testTdf107618, "tdf107618.doc")
CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xPageStyle, "HeaderIsOn"));
}
+DECLARE_OOXMLEXPORT_TEST(testTdf100075, "tdf100075.docx")
+{
+ uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
+
+ // There are two frames in document
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), xIndexAccess->getCount());
+
+ uno::Reference<beans::XPropertySet> xFrame1(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xFrame2(xIndexAccess->getByIndex(1), uno::UNO_QUERY);
+
+ // Ensure that frame#1 height is more that frame#2: if no hRul attribute
+ // defined, MS Word will use hRul=auto if height is not defined,
+ // and hRul=atLeast if height is provided. So frame#1 should be higher
+ CPPUNIT_ASSERT(getProperty<sal_Int32>(xFrame1, "Height") > getProperty<sal_Int32>(xFrame2, "Height"));
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 7c496d20e106..b52587a94e4d 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -875,10 +875,25 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( )
rAppendContext.pLastParagraphProperties->Geth() :
pStyleProperties->Geth() > 0 ? pStyleProperties->Geth() : DEFAULT_FRAME_MIN_HEIGHT));
- aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_SIZE_TYPE), sal_Int16(
+ sal_Int16 nhRule = sal_Int16(
rAppendContext.pLastParagraphProperties->GethRule() >= 0 ?
rAppendContext.pLastParagraphProperties->GethRule() :
- pStyleProperties->GethRule() >=0 ? pStyleProperties->GethRule() : text::SizeType::VARIABLE)));
+ pStyleProperties->GethRule());
+ if ( nhRule < 0 )
+ {
+ if ( rAppendContext.pLastParagraphProperties->Geth() >= 0 ||
+ pStyleProperties->GethRule() >= 0 )
+ {
+ // [MS-OE376] Word uses a default value of "atLeast" for
+ // this attribute when the value of the h attribute is not 0.
+ nhRule = text::SizeType::MIN;
+ }
+ else
+ {
+ nhRule = text::SizeType::VARIABLE;
+ }
+ }
+ aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_SIZE_TYPE), nhRule));
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_WIDTH_TYPE), bAutoWidth ? text::SizeType::MIN : text::SizeType::FIX));
@@ -970,10 +985,21 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( )
nWidth = DEFAULT_FRAME_MIN_WIDTH;
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_WIDTH), nWidth));
- aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_SIZE_TYPE), sal_Int16(
- rAppendContext.pLastParagraphProperties->GethRule() >= 0 ?
- rAppendContext.pLastParagraphProperties->GethRule() :
- text::SizeType::VARIABLE)));
+ sal_Int16 nhRule = sal_Int16(rAppendContext.pLastParagraphProperties->GethRule());
+ if ( nhRule < 0 )
+ {
+ if ( rAppendContext.pLastParagraphProperties->Geth() >= 0 )
+ {
+ // [MS-OE376] Word uses a default value of atLeast for
+ // this attribute when the value of the h attribute is not 0.
+ nhRule = text::SizeType::MIN;
+ }
+ else
+ {
+ nhRule = text::SizeType::VARIABLE;
+ }
+ }
+ aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_SIZE_TYPE), nhRule));
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_WIDTH_TYPE), bAutoWidth ? text::SizeType::MIN : text::SizeType::FIX));
More information about the Libreoffice-commits
mailing list