diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2013-08-14 15:10:34 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2013-10-22 16:00:53 +0200 |
commit | 44efea1a29446f44213fe2a02b934d94b17ac45e (patch) | |
tree | bee7e0155baf2c9eb8dd3941a023f18743ae2888 | |
parent | 613004417384005db286c2429bb3771b383e69ac (diff) |
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.
(cherry picked from commit 186fc4c434384e07c18ff2dd2bd0e00a49bf17a7)
Conflicts:
sw/qa/extras/ooxmlimport/ooxmlimport.cxx
[ Miklos: fix build. ]
Change-Id: I01f0a3a323566f6e29faf73bf9d2ba874565eb42
-rw-r--r-- | sw/qa/extras/ooxmlimport/data/bnc780044_spacing.docx | bin | 0 -> 7437 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 13 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 9 |
3 files changed, 22 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/bnc780044_spacing.docx b/sw/qa/extras/ooxmlimport/data/bnc780044_spacing.docx Binary files differnew file mode 100644 index 000000000000..927d4d37671a --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/bnc780044_spacing.docx diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index ef14f1512662..709431d96618 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -138,6 +138,7 @@ public: void testBnc779620(); void testDefaultSectBreakCols(); void testFdo66474(); + void testBnc780044Spacing(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -240,6 +241,7 @@ void Test::run() {"bnc779620.docx", &Test::testBnc779620}, {"default-sect-break-cols.docx", &Test::testDefaultSectBreakCols}, {"fdo66474.docx", &Test::testFdo66474}, + {"bnc780044_spacing.docx", &Test::testBnc780044Spacing}, }; header(); for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) @@ -1680,6 +1682,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 45cc5fe10a0c..b3eb0fef78b8 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1749,6 +1749,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, true )); + if( pos != paragraphContext->end()) + xProps->setPropertyValue( rPropNameSupplier.GetName( PROP_BOTTOM_MARGIN ), (*pos).second ); + } } } catch ( const uno::Exception& e ) |