summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2020-03-13 17:08:34 +0100
committerLászló Németh <nemeth@numbertext.org>2020-03-16 22:23:32 +0100
commit2be656908e9f30d0b0f795cc67096f0d673a3a21 (patch)
tree05f2c97af66c997d3bd316d3c465b94e41a07d21 /writerfilter
parentbc6eb8e096416d42d2308a529d5c0d81778dca60 (diff)
tdf#128646 DOCX import: don't hide shape of hidden paragraph
if the shape is not hidden, but it's anchored to an empty table cell paragraph. Change-Id: I97e42431d083d3c70ff67981676e322ca8e7f89d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90568 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx30
1 files changed, 28 insertions, 2 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 3e87fcb0a2b5..cc4311d0aaff 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1751,10 +1751,11 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
css::uno::Reference<css::beans::XPropertySet> xParaProps(xTextRange, uno::UNO_QUERY);
- // table style has got bigger precedence than docDefault style
- // collect these pending paragraph properties to process in endTable()
+ // table style precedence and not hidden shapes anchored to hidden empty table paragraphs
if (xParaProps && m_nTableDepth > 0)
{
+ // table style has got bigger precedence than docDefault style
+ // collect these pending paragraph properties to process in endTable()
uno::Reference<text::XTextCursor> xCur = xTextRange->getText( )->createTextCursor( );
xCur->gotoEnd(false);
xCur->goLeft(1, false);
@@ -1763,6 +1764,31 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
xParaCursor->gotoStartOfParagraph(false);
TableParagraph aPending{xParaCursor, xCur, pParaContext, xParaProps};
m_aParagraphsToEndTable.push_back(aPending);
+
+ // hidden empty paragraph with a not hidden shape, set as not hidden
+ o3tl::optional<PropertyMap::Property> pHidden;
+ if ( !m_aAnchoredObjectAnchors.empty() && (pHidden = pParaContext->getProperty(PROP_CHAR_HIDDEN)) )
+ {
+ bool bIsHidden;
+ pHidden->second >>= bIsHidden;
+ if (bIsHidden)
+ {
+ bIsHidden = false;
+ pHidden = GetTopContext()->getProperty(PROP_CHAR_HIDDEN);
+ if (pHidden)
+ pHidden->second >>= bIsHidden;
+ if (!bIsHidden)
+ {
+ uno::Reference<text::XTextCursor> xCur3 = xTextRange->getText()->createTextCursorByRange(xParaCursor);
+ xCur3->goRight(1, true);
+ if (xCur3->getString() == SAL_NEWLINE_STRING)
+ {
+ uno::Reference< beans::XPropertySet > xProp( xCur3, uno::UNO_QUERY );
+ xProp->setPropertyValue(getPropertyName(PROP_CHAR_HIDDEN), uno::makeAny(false));
+ }
+ }
+ }
+ }
}
// tdf#118521 set paragraph top or bottom margin based on the paragraph style