sw/qa/extras/ooxmlimport/data/bnc780044_spacing.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 13 +++++++++++++ writerfilter/source/dmapper/DomainMapper_Impl.cxx | 9 +++++++++ 3 files changed, 22 insertions(+)
New commits: commit 3f0c3e5fc0e19f1d322f6e22b97b48816738361b Author: LuboÅ¡ LuÅák <l.lu...@suse.cz> Date: Wed Aug 14 15:10:34 2013 +0200 w:spacing in a paragraph should also apply to as-char objects (bnc#780044) Otherwise global w:spacing will be used even if overriden locally. Conflicts: sw/qa/extras/ooxmlimport/ooxmlimport.cxx writerfilter/source/dmapper/DomainMapper_Impl.cxx Change-Id: I01f0a3a323566f6e29faf73bf9d2ba874565eb42 diff --git a/sw/qa/extras/ooxmlimport/data/bnc780044_spacing.docx b/sw/qa/extras/ooxmlimport/data/bnc780044_spacing.docx new file mode 100644 index 0000000..927d4d3 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/bnc780044_spacing.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 0518809..3463541 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -129,6 +129,7 @@ public: void testN820788(); void testTableAutoColumnFixedSize(); void testFdo66474(); + void testBnc780044Spacing(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -207,6 +208,7 @@ void Test::run() {"n820788.docx", &Test::testN820788}, {"table-auto-column-fixed-size.docx", &Test::testTableAutoColumnFixedSize}, {"fdo66474.docx", &Test::testFdo66474}, + {"bnc780044_spacing.docx", &Test::testBnc780044Spacing}, }; for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) { @@ -1293,6 +1295,17 @@ void Test::testFdo66474() CPPUNIT_ASSERT_EQUAL(sal_Int16(100), getProperty<sal_Int16>(xTables->getByIndex(0), "RelativeWidth")); } +void Test::testBnc780044Spacing() +{ + // The document has global w:spacing in styles.xml , and local w:spacing in w:pPr, which however + // only applied to text runs, not to as-character pictures. So the picture made the line higher. + uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); + uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY); + uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY); + xCursor->jumpToLastPage(); + CPPUNIT_ASSERT_EQUAL(sal_Int16(1), xCursor->getPage()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 92f6f10..57e2aed 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1714,6 +1714,15 @@ void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape { xProps->setPropertyValue( rPropNameSupplier.GetName( PROP_ANCHOR_TYPE ), bIsGraphic ? uno::makeAny( text::TextContentAnchorType_AS_CHARACTER ) : uno::makeAny( text::TextContentAnchorType_AT_PARAGRAPH ) ); } + else + { + // Fix spacing for as-character objects. If the paragraph has CT_Spacing_after set, + // it needs to be set on the object too, as that's what object placement code uses. + PropertyMapPtr paragraphContext = GetTopContextOfType( CONTEXT_PARAGRAPH ); + PropertyMap::const_iterator pos = paragraphContext->find( PropertyDefinition( PROP_PARA_BOTTOM_MARGIN, false )); + if( pos != paragraphContext->end()) + xProps->setPropertyValue( rPropNameSupplier.GetName( PROP_BOTTOM_MARGIN ), (*pos).second ); + } } } catch ( const uno::Exception& e )
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits