summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2013-11-19 11:55:29 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2013-11-19 17:07:02 +0100
commitcc8f8ae55f681755f5da3bf64e4c30bb713f0383 (patch)
treee5df935b163030d74a21329457033f2255d25841
parenta5d7813de1d2e9c3234c5c0c32987c137bdf3ca1 (diff)
DOCX drawingML shape import: wp:anchor's behindDoc attribute
Also, adapt anchoring to what we have in VML import as well: when the paragraph moves, the shape should stay at the same place. (This is a bit odd, as ideally Word does not support at-paragraph anchoring, but this change results in the behavior what Word does at the end.) Change-Id: I3b849b2898d303e48920e6056c472f08fbb43af1
-rw-r--r--sw/qa/extras/ooxmlimport/data/wps-only.docxbin13141 -> 13196 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx7
-rw-r--r--writerfilter/source/dmapper/GraphicImport.cxx6
3 files changed, 11 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/wps-only.docx b/sw/qa/extras/ooxmlimport/data/wps-only.docx
index 5b563b040aa1..d45aa3ed75f8 100644
--- a/sw/qa/extras/ooxmlimport/data/wps-only.docx
+++ b/sw/qa/extras/ooxmlimport/data/wps-only.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 14c8ba548e41..d8ca06f9cafa 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1510,7 +1510,7 @@ DECLARE_OOXMLIMPORT_TEST(testWpsOnly, "wps-only.docx")
// Document has wp:anchor, not wp:inline, so handle it accordingly.
uno::Reference<drawing::XShape> xShape = getShape(1);
text::TextContentAnchorType eValue = getProperty<text::TextContentAnchorType>(xShape, "AnchorType");
- CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, eValue);
+ CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_PARAGRAPH, eValue);
// Check position, it was 0. This is a shape, so use getPosition(), not a property.
CPPUNIT_ASSERT_EQUAL(sal_Int32(EMU_TO_MM100(671830)), xShape->getPosition().X);
@@ -1519,6 +1519,11 @@ DECLARE_OOXMLIMPORT_TEST(testWpsOnly, "wps-only.docx")
CPPUNIT_ASSERT_EQUAL(sal_Int32(318), getProperty<sal_Int32>(xShape, "LeftMargin"));
// Wrap type was PARALLEL.
CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_THROUGHT, getProperty<text::WrapTextMode>(xShape, "Surround"));
+
+ // This should be in front of text.
+ CPPUNIT_ASSERT_EQUAL(true, bool(getProperty<sal_Bool>(xShape, "Opaque")));
+ // And this should be behind the document.
+ CPPUNIT_ASSERT_EQUAL(false, bool(getProperty<sal_Bool>(getShape(2), "Opaque")));
}
DECLARE_OOXMLIMPORT_TEST(testFdo70457, "fdo70457.docx")
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index da957ce0e4d8..7c3de0075137 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -997,10 +997,14 @@ void GraphicImport::lcl_attribute(Id nName, Value & val)
// 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).
uno::Reference< beans::XPropertySet > xShapeProps(m_xShape, uno::UNO_QUERY_THROW);
- xShapeProps->setPropertyValue("AnchorType", uno::makeAny(text::TextContentAnchorType_AT_CHARACTER));
+ // 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));
m_xShape->setPosition(awt::Point(m_pImpl->nLeftPosition, m_pImpl->nTopPosition));
m_pImpl->applyMargins(xShapeProps);
+ bool bOpaque = m_pImpl->bOpaque && !m_pImpl->rDomainMapper.IsInHeaderFooter();
+ if (!bOpaque)
+ xShapeProps->setPropertyValue("Opaque", uno::makeAny(bOpaque));
xShapeProps->setPropertyValue("Surround", uno::makeAny(m_pImpl->nWrap));
}
}