summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2020-03-17 13:42:10 +0100
committerLászló Németh <nemeth@numbertext.org>2020-03-17 15:37:49 +0100
commitab25bf4b2c51e5634bdfeaa1f84af4bb652f7a47 (patch)
tree0c598e57c6aeff6184bb12416393e80706036ea8 /writerfilter
parent84eacd97f0151076edf05ef0db69286476d222b9 (diff)
tdf#119800 DOCX import: fix vanished objects
Not hidden objects, for example shapes and tables were converted to hidden text, when they were anchored to empty hidden paragraphs (see w:vanish character property in OOXML). Note: now DOCX round-trip doesn't change the document layout (previously DOCX export hid the vanished object), but Writer shows also an extra empty paragraph with the fixed object, so the layout is still not the same here. Follow-up of commit 2be656908e9f30d0b0f795cc67096f0d673a3a21 (tdf#128646 DOCX import: don't hide shape of hidden paragraph), extending the fix also for not table paragraphs. Change-Id: I2af4ad42dd9e67f0daf4392fcc6875855eb4ba7c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90617 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 207e1493e09d..c8095f2fa689 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1753,7 +1753,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
css::uno::Reference<css::beans::XPropertySet> xParaProps(xTextRange, uno::UNO_QUERY);
// table style precedence and not hidden shapes anchored to hidden empty table paragraphs
- if (xParaProps && m_nTableDepth > 0)
+ if (xParaProps && (m_nTableDepth > 0 || !m_aAnchoredObjectAnchors.empty()) )
{
// table style has got bigger precedence than docDefault style
// collect these pending paragraph properties to process in endTable()
@@ -1763,8 +1763,11 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
uno::Reference<text::XTextCursor> xCur2 = xTextRange->getText()->createTextCursorByRange(xCur);
uno::Reference<text::XParagraphCursor> xParaCursor(xCur2, uno::UNO_QUERY_THROW);
xParaCursor->gotoStartOfParagraph(false);
- TableParagraph aPending{xParaCursor, xCur, pParaContext, xParaProps};
- m_aParagraphsToEndTable.push_back(aPending);
+ if (m_nTableDepth > 0)
+ {
+ TableParagraph aPending{xParaCursor, xCur, pParaContext, xParaProps};
+ m_aParagraphsToEndTable.push_back(aPending);
+ }
// hidden empty paragraph with a not hidden shape, set as not hidden
std::optional<PropertyMap::Property> pHidden;