summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorSzabolcs Toth <szabolcs450@gmail.com>2020-06-18 15:58:32 +0200
committerLászló Németh <nemeth@numbertext.org>2020-07-15 13:11:29 +0200
commit6479096dc2bd40215ff80273b4d27cadb2688cb1 (patch)
tree4e16dcb12546cb3519712d19860d3694a64c631d /writerfilter
parenta7350a3759fd651c3cae1b7ed67cea0d55725ce2 (diff)
tdf#120760 DOCX shape import: fix Z-order with behindDoc
DrawingML attribute relativeHeight contains z-indices for shape Z-order, but this depends on behindDoc, too. We can use z-index = relativeHeight - MAX_INT32 on shapes with behindDoc=true, as a simple workaround to get correct Z-order, because unsigned relativeHeight values stored in sal_Int32, and MIN_INT32 <= -MAX_INT32, and the temporary negative z-indices will converted by GraphicZOrderHelper. Note: this commit doesn't fix the old writerfilter implementation problem, that DOCX relativeHeight is an unsignedInt value according to W3C XML Schema, i.e. its maximal value is 4294967295 (MAX_UINT32), not 2147483647 (MAX_INT32). Co-authored-by: Balázs Regényi Change-Id: I54a72a95bc69b307b2835636fff376b0aa9bc45c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96614 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/GraphicImport.cxx17
1 files changed, 13 insertions, 4 deletions
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index 6c8523ab9bff..cf27a30c49f3 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -208,6 +208,7 @@ public:
bool bLayoutInCell;
bool bAllowOverlap = true;
bool bOpaque;
+ bool bBehindDoc;
bool bContour;
bool bContourOutside;
WrapPolygon::Pointer_t mpWrapPolygon;
@@ -273,6 +274,7 @@ public:
,nWrap(text::WrapTextMode_NONE)
,bLayoutInCell(true)
,bOpaque( !rDMapper.IsInHeaderFooter() )
+ ,bBehindDoc(false)
,bContour(false)
,bContourOutside(true)
,nLeftMargin(319)
@@ -371,10 +373,15 @@ public:
{
if (zOrder >= 0)
{
+ // tdf#120760 Send objects with behinddoc=true to the back.
+ sal_Int32 nZOrder = zOrder;
+ if (bBehindDoc && rDomainMapper.IsInHeaderFooter())
+ nZOrder -= SAL_MAX_INT32;
GraphicZOrderHelper* pZOrderHelper = rDomainMapper.graphicZOrderHelper();
bool bOldStyle = eGraphicImportType == GraphicImportType::IMPORT_AS_DETECTED_INLINE;
- xGraphicObjectProperties->setPropertyValue(getPropertyName(PROP_Z_ORDER), uno::makeAny(pZOrderHelper->findZOrder(zOrder, bOldStyle)));
- pZOrderHelper->addItem(xGraphicObjectProperties, zOrder);
+ xGraphicObjectProperties->setPropertyValue(getPropertyName(PROP_Z_ORDER),
+ uno::makeAny(pZOrderHelper->findZOrder(nZOrder, bOldStyle)));
+ pZOrderHelper->addItem(xGraphicObjectProperties, nZOrder);
}
}
@@ -609,8 +616,11 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue)
m_pImpl->zOrder = nIntValue;
break;
case NS_ooxml::LN_CT_Anchor_behindDoc: // 90989; - in background
- if( nIntValue > 0 )
+ if (nIntValue > 0)
+ {
m_pImpl->bOpaque = false;
+ m_pImpl->bBehindDoc = true;
+ }
break;
case NS_ooxml::LN_CT_Anchor_locked: // 90990; - ignored
break;
@@ -1414,7 +1424,6 @@ uno::Reference<text::XTextContent> GraphicImport::createGraphicObject(uno::Refer
xGraphicObjectProperties->setPropertyValue(getPropertyName( PROP_BACK_COLOR ),
uno::makeAny( GraphicImport_Impl::nFillColor ));
-
m_pImpl->applyZOrder(xGraphicObjectProperties);
//there seems to be no way to detect the original size via _real_ API