Kaydet (Commit) dc16cc04 authored tarafından Michael Stahl's avatar Michael Stahl

tdf#115153 writerfilter: RTF import: fix vert orient of Word 6 shapes

The bugdoc is affected by the change of default vertical alignment;
apparently it's not even possible to set the vertical alignment of a
Word 6 drawing object (\do) so we have to set the Word default.

(regression from c79467ba)

Change-Id: I4084a7a7e2a55f864cb569e04632e034d59eefdb
üst 31531796
......@@ -699,6 +699,20 @@ DECLARE_RTFIMPORT_TEST(testGroupshapeRotation, "groupshape-rotation.rtf")
CPPUNIT_ASSERT_EQUAL(sal_Int32(315 * 100), getProperty<sal_Int32>(getShape(1), "RotateAngle"));
}
DECLARE_RTFIMPORT_TEST(testTdf115153, "tdf115153.rtf")
{
auto const xShape(getShape(1));
CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::NONE, getProperty<sal_Int16>(xShape, "HoriOrient"));
CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME,
getProperty<sal_Int16>(xShape, "HoriOrientRelation"));
CPPUNIT_ASSERT_EQUAL(sal_Int32(2533), getProperty<sal_Int32>(xShape, "HoriOrientPosition"));
// VertOrient was wrong
CPPUNIT_ASSERT_EQUAL(text::VertOrientation::NONE, getProperty<sal_Int16>(xShape, "VertOrient"));
CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME,
getProperty<sal_Int16>(xShape, "VertOrientRelation"));
CPPUNIT_ASSERT_EQUAL(sal_Int32(2131), getProperty<sal_Int32>(xShape, "VertOrientPosition"));
}
DECLARE_RTFIMPORT_TEST(testFdo68291, "fdo68291.odt")
{
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
......
......@@ -12,6 +12,7 @@
#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
#include <com/sun/star/drawing/XEnhancedCustomShapeDefaulter.hpp>
#include <com/sun/star/text/RelOrientation.hpp>
#include <com/sun/star/text/VertOrientation.hpp>
#include <filter/msfilter/escherex.hxx>
......@@ -965,12 +966,19 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
getModelFactory()->createInstance("com.sun.star.drawing.CustomShape"),
uno::UNO_QUERY);
uno::Reference<drawing::XDrawPageSupplier> xDrawSupplier(m_xDstDoc, uno::UNO_QUERY);
m_aStates.top().aDrawingObject.xPropertySet.set(m_aStates.top().aDrawingObject.xShape,
uno::UNO_QUERY);
if (xDrawSupplier.is())
{
uno::Reference<drawing::XShapes> xShapes(xDrawSupplier->getDrawPage(),
uno::UNO_QUERY);
if (xShapes.is() && nKeyword != RTF_DPTXBX)
{
// set default VertOrient before inserting
m_aStates.top().aDrawingObject.xPropertySet->setPropertyValue(
"VertOrient", uno::makeAny(text::VertOrientation::NONE));
xShapes->add(m_aStates.top().aDrawingObject.xShape);
}
}
if (nType)
{
......@@ -978,8 +986,6 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
m_aStates.top().aDrawingObject.xShape, uno::UNO_QUERY);
xDefaulter->createCustomShapeDefaults(OUString::number(nType));
}
m_aStates.top().aDrawingObject.xPropertySet.set(m_aStates.top().aDrawingObject.xShape,
uno::UNO_QUERY);
std::vector<beans::PropertyValue>& rPendingProperties
= m_aStates.top().aDrawingObject.aPendingProperties;
for (auto& rPendingProperty : rPendingProperties)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment