[Libreoffice-commits] core.git: oox/source sw/qa
Miklos Vajna
vmiklos at collabora.co.uk
Wed Jun 11 10:03:57 PDT 2014
oox/source/export/drawingml.cxx | 9 ++++++++-
oox/source/shape/WpsContext.cxx | 9 +++++++--
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 15 +++++++++++++--
3 files changed, 28 insertions(+), 5 deletions(-)
New commits:
commit e9261e8b413bc76ca2770df30495fec1979cfca1
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Wed Jun 11 18:55:10 2014 +0200
DOCX drawingML filter: handle TextAutoGrowHeight for shapes having textboxes
Change-Id: I0cdc7edf851915f7fbc772eb42edd6ec08b09025
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 6340b6e..f7fcf43 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1751,7 +1751,7 @@ void DrawingML::WriteText( Reference< XInterface > rXIface, bool bBodyPr, bool b
if (xServiceInfo.is() && xServiceInfo->supportsService("com.sun.star.drawing.TextShape"))
pWrap = "square";
}
- mpFS->singleElementNS( (nXmlNamespace ? nXmlNamespace : XML_a), XML_bodyPr,
+ mpFS->startElementNS( (nXmlNamespace ? nXmlNamespace : XML_a), XML_bodyPr,
XML_wrap, pWrap,
XML_lIns, (nLeft != DEFLRINS) ? IS( MM100toEMU( nLeft ) ) : NULL,
XML_rIns, (nRight != DEFLRINS) ? IS( MM100toEMU( nRight ) ) : NULL,
@@ -1761,6 +1761,13 @@ void DrawingML::WriteText( Reference< XInterface > rXIface, bool bBodyPr, bool b
XML_anchorCtr, bHorizontalCenter ? "1" : NULL,
XML_vert, sWritingMode,
FSEND );
+ if (GetDocumentType() == DOCUMENT_DOCX)
+ {
+ sal_Bool bTextAutoGrowHeight = sal_False;
+ GET(bTextAutoGrowHeight, TextAutoGrowHeight);
+ mpFS->singleElementNS(XML_a, (bTextAutoGrowHeight ? XML_spAutoFit : XML_noAutofit), FSEND);
+ }
+ mpFS->endElementNS((nXmlNamespace ? nXmlNamespace : XML_a), XML_bodyPr);
}
Reference< XEnumerationAccess > access( xXText, UNO_QUERY );
diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx
index 0163a50..63a5f7c 100644
--- a/oox/source/shape/WpsContext.cxx
+++ b/oox/source/shape/WpsContext.cxx
@@ -114,8 +114,13 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken
// 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() && xServiceInfo->supportsService("com.sun.star.text.TextFrame"))
- xPropertySet->setPropertyValue("FrameIsAutomaticHeight", uno::makeAny(getBaseToken(nElementToken) == XML_spAutoFit));
+ if (xPropertySet.is())
+ {
+ if (xServiceInfo->supportsService("com.sun.star.text.TextFrame"))
+ xPropertySet->setPropertyValue("FrameIsAutomaticHeight", uno::makeAny(getBaseToken(nElementToken) == XML_spAutoFit));
+ else
+ xPropertySet->setPropertyValue("TextAutoGrowHeight", uno::makeAny(getBaseToken(nElementToken) == XML_spAutoFit));
+ }
}
break;
case XML_txbx:
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 250f52d..747e5b4 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2166,8 +2166,19 @@ DECLARE_OOXMLEXPORT_TEST(testGroupshapePicture, "groupshape-picture.docx")
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")));
+ uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
+ if (xIndexAccess->getCount())
+ {
+ // TODO TextBox: remove this when TextBox is enabled by default
+ CPPUNIT_ASSERT_EQUAL(true, bool(getProperty<sal_Bool>(getShape(1), "FrameIsAutomaticHeight")));
+ CPPUNIT_ASSERT_EQUAL(false, bool(getProperty<sal_Bool>(getShape(2), "FrameIsAutomaticHeight")));
+ }
+ else
+ {
+ CPPUNIT_ASSERT_EQUAL(true, bool(getProperty<sal_Bool>(getShape(1), "TextAutoGrowHeight")));
+ CPPUNIT_ASSERT_EQUAL(false, bool(getProperty<sal_Bool>(getShape(2), "TextAutoGrowHeight")));
+ }
}
DECLARE_OOXMLEXPORT_TEST(testTrackChangesDeletedParagraphMark, "testTrackChangesDeletedParagraphMark.docx")
More information about the Libreoffice-commits
mailing list