diff options
author | Attila Bakos <bakos.attilakaroly@nisz.hu> | 2020-03-19 14:40:36 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2020-04-07 12:44:17 +0200 |
commit | 27d04f6dbf38aa28fb7215590d578c4567db5770 (patch) | |
tree | 1243823be2e628f88b10492ba9f68836e6793af0 /writerfilter/source/dmapper/GraphicImport.cxx | |
parent | 9977fbeed1461a8f5cfa8029c02e914c099f3230 (diff) |
tdf#119038 DOCX: fix FollowTextFlow handling
This fix also a clean-up for the following commits:
ad8857dab30e099a0cf6ec18d184a6c836b33317
(tdf#130120 DOCX: export o:allowincell)
14ad64270e4fbca3c24da6f55f260b1fb229556a
(tdf#129888 DOCX shape import: handle o:allowincell)
10f29d8bf05d44ca8bc11d34d1294ec17f8ac0f1
(tdf#87569 tdf#109411 DOCX import: fix shape anchor in tables)
where these patches ignored the option "Follow text flow"
and there was no possibility to switch this setting on GUI.
Now this is handled on GUI as well by replacing the
grab-bag with UNO property "IsFollowingTextFlow".
The tdf#119038 bug also fixed.
Note: Unit tests for the commits mentioned above were
modified for testing the new property, so new tests were
not added.
Change-Id: Ie35c6e280f8b33d8535ca4cd9749f110f9d592ee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90753
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'writerfilter/source/dmapper/GraphicImport.cxx')
-rw-r--r-- | writerfilter/source/dmapper/GraphicImport.cxx | 33 |
1 files changed, 9 insertions, 24 deletions
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index 21570269db42..ce449a6251b2 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -270,7 +270,7 @@ public: ,nVertOrient( text::VertOrientation::NONE ) ,nVertRelation( text::RelOrientation::FRAME ) ,nWrap(text::WrapTextMode_NONE) - ,bLayoutInCell(false) + ,bLayoutInCell(true) ,bOpaque( !rDMapper.IsInHeaderFooter() ) ,bContour(false) ,bContourOutside(true) @@ -662,7 +662,6 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue) { uno::Reference< drawing::XShape> xShape; rValue.getAny( ) >>= xShape; - if ( xShape.is( ) ) { // Is it a graphic image @@ -847,7 +846,12 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue) eAnchorType = text::TextContentAnchorType_AT_CHARACTER; xShapeProps->setPropertyValue("AnchorType", uno::makeAny(eAnchorType)); - + if (m_pImpl->bLayoutInCell && bTextBox && m_pImpl->rDomainMapper.IsInTable() + && m_pImpl->nHoriRelation == text::RelOrientation::PAGE_FRAME) + m_pImpl->nHoriRelation = text::RelOrientation::FRAME; + if(m_pImpl->rDomainMapper.IsInTable()) + xShapeProps->setPropertyValue(getPropertyName(PROP_FOLLOW_TEXT_FLOW), + uno::makeAny(m_pImpl->bLayoutInCell)); //only the position orientation is handled in applyPosition() m_pImpl->applyPosition(xShapeProps); @@ -884,25 +888,6 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue) xShapeProps->setPropertyValue("RotateAngle", uno::makeAny(nRotation)); } - //tdf#109411 If anchored object is in table, Word calculates its position from cell border - //instead of page (what is set in the sample document) - if (xShapeProps) - { - uno::Sequence<beans::PropertyValue> aShapeGrabBag; - xShapeProps->getPropertyValue("InteropGrabBag") >>= aShapeGrabBag; - beans::PropertyValue aLayInCell; - aLayInCell.Name = "LayoutInCell"; - aLayInCell.Value <<= m_pImpl->bLayoutInCell; - aShapeGrabBag.realloc(1 + aShapeGrabBag.size()); - aShapeGrabBag[aShapeGrabBag.size() - 1] = aLayInCell; - xShapeProps->setPropertyValue("InteropGrabBag", - uno::makeAny(aShapeGrabBag)); - } - if (m_pImpl->rDomainMapper.IsInTable() && m_pImpl->bLayoutInCell && - m_pImpl->nHoriRelation == text::RelOrientation::PAGE_FRAME && IsGraphic()) - { - m_pImpl->nHoriRelation = text::RelOrientation::FRAME; - } m_pImpl->applyRelativePosition(xShapeProps, /*bRelativeOnly=*/true); @@ -1370,9 +1355,9 @@ uno::Reference<text::XTextContent> GraphicImport::createGraphicObject(uno::Refer } xGraphicObjectProperties->setPropertyValue(getPropertyName( PROP_SURROUND ), uno::makeAny(static_cast<sal_Int32>(m_pImpl->nWrap))); - if( m_pImpl->rDomainMapper.IsInTable() && m_pImpl->bLayoutInCell ) + if( m_pImpl->rDomainMapper.IsInTable()) xGraphicObjectProperties->setPropertyValue(getPropertyName( PROP_FOLLOW_TEXT_FLOW ), - uno::makeAny(true)); + uno::makeAny(m_pImpl->bLayoutInCell)); xGraphicObjectProperties->setPropertyValue(getPropertyName( PROP_SURROUND_CONTOUR ), uno::makeAny(m_pImpl->bContour)); |