[Libreoffice-commits] core.git: sw/qa writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Thu Jan 30 05:58:44 PST 2014
sw/qa/extras/ooxmlimport/data/pagerelsize.docx |binary
sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 14 +++++++++++++-
writerfilter/source/dmapper/GraphicImport.cxx | 22 ++++++++++++++++++++++
3 files changed, 35 insertions(+), 1 deletion(-)
New commits:
commit da5b9bc95c32bd233595a28bd276f8ed1f4fc859
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Jan 30 14:33:44 2014 +0100
DOCX import of wp14:sizeRelH/V relativeFrom="page"
Change-Id: Idd9dcc60f415081cb7a727b46a89d45af04465d0
diff --git a/sw/qa/extras/ooxmlimport/data/pagerelsize.docx b/sw/qa/extras/ooxmlimport/data/pagerelsize.docx
new file mode 100755
index 0000000..3b6c1ff
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/pagerelsize.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index ab69ced..bfcaa26 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1734,9 +1734,21 @@ DECLARE_OOXMLIMPORT_TEST(testDMLGroupshapeSdt, "dml-groupshape-sdt.docx")
// The text in the groupshape was missing due to the w:sdt and w:sdtContent wrapper around it.
CPPUNIT_ASSERT_EQUAL(OUString("sdt and sdtContent inside groupshape"), uno::Reference<text::XTextRange>(xGroupShape->getByIndex(1), uno::UNO_QUERY)->getString());
}
-#endif
+DECLARE_OOXMLIMPORT_TEST(testPageRelSize, "pagerelsize.docx")
+{
+ // First textframe: width is relative from page, but not height.
+ uno::Reference<drawing::XShape> xTextFrame = getShape(1);
+ CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xTextFrame, "RelativeWidthRelation"));
+ CPPUNIT_ASSERT_EQUAL(text::RelOrientation::FRAME, getProperty<sal_Int16>(xTextFrame, "RelativeHeightRelation"));
+ // Second textframe: height is relative from page, but not height.
+ xTextFrame = getShape(2);
+ CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xTextFrame, "RelativeHeightRelation"));
+ CPPUNIT_ASSERT_EQUAL(text::RelOrientation::FRAME, getProperty<sal_Int16>(xTextFrame, "RelativeWidthRelation"));
+}
+
+#endif
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index 7f2079a..2f7cfd0 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -739,6 +739,17 @@ void GraphicImport::lcl_attribute(Id nName, Value & val)
{
case NS_ooxml::LN_ST_SizeRelFromH_margin:
break;
+ case NS_ooxml::LN_ST_SizeRelFromH_page:
+ if (m_xShape.is())
+ {
+ uno::Reference<lang::XServiceInfo> xServiceInfo(m_xShape, uno::UNO_QUERY_THROW);
+ if (xServiceInfo->supportsService("com.sun.star.text.TextFrame"))
+ {
+ uno::Reference<beans::XPropertySet> xPropertySet(m_xShape, uno::UNO_QUERY);
+ xPropertySet->setPropertyValue("RelativeWidthRelation", uno::makeAny(text::RelOrientation::PAGE_FRAME));
+ }
+ }
+ break;
default:
SAL_WARN("writerfilter", "GraphicImport::lcl_attribute: unhandled NS_ooxml::LN_CT_SizeRelH_relativeFrom value: " << nIntValue);
break;
@@ -751,6 +762,17 @@ void GraphicImport::lcl_attribute(Id nName, Value & val)
{
case NS_ooxml::LN_ST_SizeRelFromV_margin:
break;
+ case NS_ooxml::LN_ST_SizeRelFromV_page:
+ if (m_xShape.is())
+ {
+ uno::Reference<lang::XServiceInfo> xServiceInfo(m_xShape, uno::UNO_QUERY_THROW);
+ if (xServiceInfo->supportsService("com.sun.star.text.TextFrame"))
+ {
+ uno::Reference<beans::XPropertySet> xPropertySet(m_xShape, uno::UNO_QUERY);
+ xPropertySet->setPropertyValue("RelativeHeightRelation", uno::makeAny(text::RelOrientation::PAGE_FRAME));
+ }
+ }
+ break;
default:
SAL_WARN("writerfilter", "GraphicImport::lcl_attribute: unhandled NS_ooxml::LN_CT_SizeRelV_relativeFrom value: " << nIntValue);
break;
More information about the Libreoffice-commits
mailing list