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 186fc4c434384e07c18ff2dd2bd0e00a49bf17a7 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. 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 50b6945..f9d3416 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -127,6 +127,7 @@ public: void testFdo65632(); void testFdo66474(); void testGroupshapeRotation(); + void testBnc780044Spacing(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -219,6 +220,7 @@ void Test::run() {"fdo65632.docx", &Test::testFdo65632}, {"fdo66474.docx", &Test::testFdo66474}, {"groupshape-rotation.docx", &Test::testGroupshapeRotation}, + {"bnc780044_spacing.docx", &Test::testBnc780044Spacing}, }; header(); for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) @@ -1537,6 +1539,17 @@ void Test::testGroupshapeRotation() CPPUNIT_ASSERT_EQUAL(sal_Int32(315 * 100), getProperty<sal_Int32>(xDraws->getByIndex(0), "RotateAngle")); } +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 56c4765..6f2a31e 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1758,6 +1758,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 )); + 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