[Libreoffice-commits] core.git: sw/qa writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Mon Feb 3 03:36:32 PST 2014
sw/qa/extras/ooxmlimport/data/line-rotation.docx |binary
sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 10 +++++++++-
writerfilter/source/dmapper/GraphicImport.cxx | 13 +++++++++++++
3 files changed, 22 insertions(+), 1 deletion(-)
New commits:
commit e034fa4607dfc732eaa82261755193fd781a2aad
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Feb 3 11:44:21 2014 +0100
DOCX import: make sure rotation is not changed when we alter size
Change-Id: I5dd344fe06a0b700cebccfece44b622d00adfb5f
diff --git a/sw/qa/extras/ooxmlimport/data/line-rotation.docx b/sw/qa/extras/ooxmlimport/data/line-rotation.docx
new file mode 100644
index 0000000..a2450c0
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/line-rotation.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 8af52d6..6bfe06a 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1567,7 +1567,15 @@ DECLARE_OOXMLIMPORT_TEST(lineWpsOnly, "line-wps-only.docx")
{
uno::Reference<drawing::XShape> xShape = getShape(1);
// Check position, it was -7223 as it was set after the CustomShapeGeometry property.
- CPPUNIT_ASSERT_EQUAL(sal_Int32(210), xShape->getPosition().X);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(208), xShape->getPosition().X);
+}
+
+DECLARE_OOXMLIMPORT_TEST(lineRotation, "line-rotation.docx")
+{
+ uno::Reference<drawing::XShape> xShape = getShape(3);
+ // This was 5096: the line was shifted towards the bottom, so the end of
+ // the 3 different lines wasn't at the same point.
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(4808), xShape->getPosition().Y);
}
DECLARE_OOXMLIMPORT_TEST(textboxWpsOnly, "textbox-wps-only.docx")
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index e615ddf..41d9c7b 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -671,11 +671,19 @@ void GraphicImport::lcl_attribute(Id nName, Value & val)
(text::TextContentAnchorType_AS_CHARACTER));
uno::Reference<lang::XServiceInfo> xServiceInfo(m_xShape, uno::UNO_QUERY_THROW);
+
+ // TextFrames can't be rotated. But for anything else,
+ // make sure that setting size doesn't affect rotation,
+ // that would not match Word's definition of rotation.
+ bool bKeepRotation = false;
if (!xServiceInfo->supportsService("com.sun.star.text.TextFrame"))
+ {
+ bKeepRotation = true;
xShapeProps->setPropertyValue
(rPropNameSupplier.GetName(PROP_TEXT_RANGE),
uno::makeAny
(m_pImpl->rDomainMapper.GetCurrentTextRange()));
+ }
awt::Size aSize(m_xShape->getSize());
@@ -684,7 +692,12 @@ void GraphicImport::lcl_attribute(Id nName, Value & val)
if (m_pImpl->isYSizeValis())
aSize.Height = m_pImpl->getYSize();
+ uno::Any aRotation;
+ if (bKeepRotation)
+ aRotation = xShapeProps->getPropertyValue("RotateAngle");
m_xShape->setSize(aSize);
+ if (bKeepRotation)
+ xShapeProps->setPropertyValue("RotateAngle", aRotation);
m_pImpl->bIsGraphic = true;
}
More information about the Libreoffice-commits
mailing list