[Libreoffice-commits] core.git: oox/source sw/qa sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Tue Jun 10 08:50:05 PDT 2014
oox/source/export/shapes.cxx | 1 +
oox/source/shape/WpsContext.cxx | 3 +++
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 23 ++++++++++++++++++-----
sw/source/filter/ww8/docxsdrexport.cxx | 12 ++++++------
4 files changed, 28 insertions(+), 11 deletions(-)
New commits:
commit 2b076a0d91ade62e678d42eb61153bf4de4531a2
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Jun 10 17:00:49 2014 +0200
DOCX drawingML export of textboxes: write <wps:bodyPr> in oox
It's possible to write this tag in oox (so it represents the properties
of the shape) or in sw (so it represents the properties of the shape's
textbox). Do the previous, as the textbox is really just a container in
this use case, nothing more.
If we are at it, also fix the default value of <wps:bodyPr>'s l/r/t/bIns
attributes.
Change-Id: I0571b9d8ea7dc0acd5c61f3e28e18400d305eab3
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 7c3627e..02b005b 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -822,6 +822,7 @@ ShapeExport& ShapeExport::WriteTextBox( Reference< XInterface > xIface, sal_Int3
if (xPropertySetInfo->hasPropertyByName("TextBox") && xPropertySet->getPropertyValue("TextBox").get<bool>())
{
GetTextExport()->WriteTextBox(uno::Reference<drawing::XShape>(xIface, uno::UNO_QUERY_THROW));
+ WriteText( xIface, /*bBodyPr=*/true, /*bText=*/false, /*nXmlNamespace=*/nXmlNamespace );
return *this;
}
}
diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx
index 90628b2..0163a50 100644
--- a/oox/source/shape/WpsContext.cxx
+++ b/oox/source/shape/WpsContext.cxx
@@ -86,6 +86,9 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken
OptValue<OUString> oValue = rAttribs.getString(aInsets[i]);
if (oValue.has())
oInsets[i] = oox::drawingml::GetCoordinate(oValue.get());
+ else
+ // Defaults from the spec: left/right: 91440 EMU, top/bottom: 45720 EMU
+ oInsets[i] = (aInsets[i] == XML_lIns || aInsets[i] == XML_rIns) ? 254 : 127;
}
OUString aProps[] = { OUString("LeftBorderDistance"), OUString("TopBorderDistance"), OUString("RightBorderDistance"), OUString("BottomBorderDistance") };
OUString aShapeProps[] = { OUString("TextLeftDistance"), OUString("TextUpperDistance"), OUString("TextRightDistance"), OUString("TextLowerDistance") };
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 33556d1..c106f3c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -900,11 +900,24 @@ DECLARE_OOXMLEXPORT_TEST(testFdo66929, "fdo66929.docx")
// This is wrong because the original node denotes a specific 'left' inset, and a default 'top','right','bottom' inset
uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
- uno::Reference<beans::XPropertySet> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
- CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ) , getProperty< sal_Int32 >( xFrame, "LeftBorderDistance" ) );
- CPPUNIT_ASSERT_EQUAL( sal_Int32( 127 ), getProperty< sal_Int32 >( xFrame, "TopBorderDistance" ) );
- CPPUNIT_ASSERT_EQUAL( sal_Int32( 254 ), getProperty< sal_Int32 >( xFrame, "RightBorderDistance" ) );
- CPPUNIT_ASSERT_EQUAL( sal_Int32( 127 ), getProperty< sal_Int32 >( xFrame, "BottomBorderDistance" ) );
+ if (xIndexAccess->getCount())
+ {
+ // VML import -> TextFrame
+ uno::Reference<beans::XPropertySet> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ) , getProperty< sal_Int32 >( xFrame, "LeftBorderDistance" ) );
+ CPPUNIT_ASSERT_EQUAL( sal_Int32( 127 ), getProperty< sal_Int32 >( xFrame, "TopBorderDistance" ) );
+ CPPUNIT_ASSERT_EQUAL( sal_Int32( 254 ), getProperty< sal_Int32 >( xFrame, "RightBorderDistance" ) );
+ CPPUNIT_ASSERT_EQUAL( sal_Int32( 127 ), getProperty< sal_Int32 >( xFrame, "BottomBorderDistance" ) );
+ }
+ else
+ {
+ // drawingML import -> shape with TextBox
+ uno::Reference<beans::XPropertySet> xShape(getShape(1), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xShape, "TextLeftDistance"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(127), getProperty<sal_Int32>(xShape, "TextUpperDistance"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(254), getProperty<sal_Int32>(xShape, "TextRightDistance"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(127), getProperty<sal_Int32>(xShape, "TextLowerDistance"));
+ }
}
DECLARE_OOXMLEXPORT_TEST(testPageBorderSpacingExportCase2, "page-borders-export-case-2.docx")
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index ac69745..50d0734 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -1367,14 +1367,14 @@ void DocxSdrExport::writeDMLTextFrame(sw::Frame* pParentFrame, int nAnchorId, bo
}
sax_fastparser::XFastAttributeListRef xBodyPrAttrList(m_pImpl->m_pBodyPrAttrList);
m_pImpl->m_pBodyPrAttrList = NULL;
- pFS->startElementNS(XML_wps, XML_bodyPr, xBodyPrAttrList);
- // AutoSize of the Text Frame.
- const SwFmtFrmSize& rSize = rFrmFmt.GetFrmSize();
- pFS->singleElementNS(XML_a, (rSize.GetHeightSizeType() == ATT_VAR_SIZE ? XML_spAutoFit : XML_noAutofit), FSEND);
- pFS->endElementNS(XML_wps, XML_bodyPr);
-
if (!bTextBoxOnly)
{
+ pFS->startElementNS(XML_wps, XML_bodyPr, xBodyPrAttrList);
+ // AutoSize of the Text Frame.
+ const SwFmtFrmSize& rSize = rFrmFmt.GetFrmSize();
+ pFS->singleElementNS(XML_a, (rSize.GetHeightSizeType() == ATT_VAR_SIZE ? XML_spAutoFit : XML_noAutofit), FSEND);
+ pFS->endElementNS(XML_wps, XML_bodyPr);
+
pFS->endElementNS(XML_wps, XML_wsp);
pFS->endElementNS(XML_a, XML_graphicData);
pFS->endElementNS(XML_a, XML_graphic);
More information about the Libreoffice-commits
mailing list