Kaydet (Commit) ce351d94 authored tarafından Miklos Vajna's avatar Miklos Vajna Kaydeden (comit) Andras Timar

tdf#90153 DOCX import: fix default sw TextFrame roundtrip

The AnchorType of the shape was at-paragraph, which does not allow
line-level VertOrientRelation (which is correct, it would be undefined,
what line of the paragraph should be the used).

Fix this by changing the AnchorType to at-character in the line-level
case, which brings the filter in sync with the DOC one.

With this, import of a DOCX file that was created by inserting a
TextFrame into an empty document is roundtripped without shifting the
shape up considerably.

(cherry-picked from commit 358666e4)

Conflicts:
	sw/qa/extras/ooxmlimport/ooxmlimport.cxx

Change-Id: I6d85c38be859d6e730584f2349c857b87496a1d4
Reviewed-on: https://gerrit.libreoffice.org/19099Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
(cherry picked from commit f98d09c8)
üst 73a30a30
...@@ -2795,6 +2795,12 @@ DECLARE_OOXMLIMPORT_TEST(testTdf92124, "tdf92124.docx") ...@@ -2795,6 +2795,12 @@ DECLARE_OOXMLIMPORT_TEST(testTdf92124, "tdf92124.docx")
CPPUNIT_ASSERT(aSuffix.isEmpty()); CPPUNIT_ASSERT(aSuffix.isEmpty());
} }
DECLARE_OOXMLIMPORT_TEST(testTdf90153, "tdf90153.docx")
{
// This was at-para, so the line-level VertOrientRelation was lost, resulting in an incorrect vertical position.
CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType"));
}
#endif #endif
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
......
...@@ -823,8 +823,12 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue) ...@@ -823,8 +823,12 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue)
// If we are here, this is a drawingML shape. For those, only dmapper (and not oox) knows the anchoring infos (just like for Writer pictures). // If we are here, this is a drawingML shape. For those, only dmapper (and not oox) knows the anchoring infos (just like for Writer pictures).
// But they aren't Writer pictures, either (which are already handled above). // But they aren't Writer pictures, either (which are already handled above).
uno::Reference< beans::XPropertySet > xShapeProps(m_xShape, uno::UNO_QUERY_THROW); uno::Reference< beans::XPropertySet > xShapeProps(m_xShape, uno::UNO_QUERY_THROW);
// This needs to be AT_PARAGRAPH and not AT_CHARACTER, otherwise shape will move when the user inserts a new paragraph.
xShapeProps->setPropertyValue("AnchorType", uno::makeAny(text::TextContentAnchorType_AT_PARAGRAPH)); // This needs to be AT_PARAGRAPH by default and not AT_CHARACTER, otherwise shape will move when the user inserts a new paragraph.
text::TextContentAnchorType eAnchorType = text::TextContentAnchorType_AT_PARAGRAPH;
if (m_pImpl->nVertRelation == text::RelOrientation::TEXT_LINE)
eAnchorType = text::TextContentAnchorType_AT_CHARACTER;
xShapeProps->setPropertyValue("AnchorType", uno::makeAny(eAnchorType));
//only the position orientation is handled in applyPosition() //only the position orientation is handled in applyPosition()
m_pImpl->applyPosition(xShapeProps); m_pImpl->applyPosition(xShapeProps);
......
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