oox/source/shape/WpsContext.cxx | 14 +++++++++++++- sw/qa/extras/ooxmlexport/data/autofit.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 6 ++++++ sw/source/filter/ww8/docxattributeoutput.cxx | 6 +++++- 4 files changed, 24 insertions(+), 2 deletions(-)
New commits: commit 52263eb4ee841ff101fa54e7fb95d76d2070f91b Author: Miklos Vajna <[email protected]> Date: Mon Jan 6 15:15:15 2014 +0100 DOCX export: implement drawingML export of TextFrame AutoSize Change-Id: I180158bfa0bd36ed1360d10788e7921c2fa945a7 diff --git a/sw/qa/extras/ooxmlexport/data/autofit.docx b/sw/qa/extras/ooxmlexport/data/autofit.docx new file mode 100755 index 0000000..8932edf Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/autofit.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index dc8726c..fc7079a 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -2225,6 +2225,12 @@ DECLARE_OOXMLEXPORT_TEST(testGroupshapePicture, "groupshape-picture.docx") CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.GraphicObjectShape"), xShapeDescriptor->getShapeType()); } +DECLARE_OOXMLEXPORT_TEST(testAutofit, "autofit.docx") +{ + CPPUNIT_ASSERT_EQUAL(true, bool(getProperty<sal_Bool>(getShape(1), "FrameIsAutomaticHeight"))); + CPPUNIT_ASSERT_EQUAL(false, bool(getProperty<sal_Bool>(getShape(2), "FrameIsAutomaticHeight"))); +} + DECLARE_OOXMLEXPORT_TEST(testTrackChangesDeletedParagraphMark, "testTrackChangesDeletedParagraphMark.docx") { xmlDocPtr pXmlDoc = parseExport("word/document.xml"); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 0aa7e36..38a05c8 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -488,7 +488,11 @@ void DocxAttributeOutput::WriteDMLTextFrame(sw::Frame* pParentFrame) m_pSerializer->endElementNS( XML_wps, XML_txbx ); XFastAttributeListRef xBodyPrAttrList(m_pBodyPrAttrList); m_pBodyPrAttrList = NULL; - m_pSerializer->singleElementNS( XML_wps, XML_bodyPr, xBodyPrAttrList ); + m_pSerializer->startElementNS( XML_wps, XML_bodyPr, xBodyPrAttrList ); + // AutoSize of the Text Frame. + const SwFmtFrmSize& rSize = rFrmFmt.GetFrmSize(); + m_pSerializer->singleElementNS(XML_a, (rSize.GetHeightSizeType() == ATT_VAR_SIZE ? XML_spAutoFit : XML_noAutofit), FSEND); + m_pSerializer->endElementNS( XML_wps, XML_bodyPr ); m_pSerializer->endElementNS(XML_wps, XML_wsp); m_pSerializer->endElementNS(XML_a, XML_graphicData); commit e7e6a5f9850a36d72339799b3981369790113d12 Author: Miklos Vajna <[email protected]> Date: Mon Jan 6 13:02:57 2014 +0100 oox: handle a:noAutofit/spAutoFit in WpsContext Change-Id: I568e8d95f263b30579a2eec49abe8ae45f7f2e96 diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx index 44fc1e6..e2bbb0e 100644 --- a/oox/source/shape/WpsContext.cxx +++ b/oox/source/shape/WpsContext.cxx @@ -86,13 +86,25 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken for (size_t i = 0; i < SAL_N_ELEMENTS(aProps); ++i) if (oInsets[i]) xPropertySet->setPropertyValue(aProps[i], uno::makeAny(*oInsets[i])); + return this; } break; + case XML_noAutofit: + case XML_spAutoFit: + { + // We can't use oox::drawingml::TextBodyPropertiesContext here, as this + // is a child context of bodyPr, so the shape is already sent: we need + // to alter the XShape directly. + uno::Reference<beans::XPropertySet> xPropertySet(mxShape, uno::UNO_QUERY); + if (xPropertySet.is()) + xPropertySet->setPropertyValue("FrameIsAutomaticHeight", uno::makeAny(getBaseToken(nElementToken) == XML_spAutoFit)); + } + break; case XML_txbx: mpShape->setServiceName("com.sun.star.text.TextFrame"); break; default: - SAL_WARN("oox", "WpsContext::createFastChildContext: unhandled element:" << getBaseToken(nElementToken)); + SAL_WARN("oox", "WpsContext::createFastChildContext: unhandled element: " << getBaseToken(nElementToken)); break; } return 0; _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
