NFC prepwork for tdf#159158: flatten writerfilter applyZOrder

limit code shuffle in the fix itself

Change-Id: Ic506ac700403fa434dd6410e9ea566c6d0e19676
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164154
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
This commit is contained in:
Justin Luth 2024-02-29 08:42:07 -05:00 committed by Justin Luth
parent 0daeee1a7d
commit 027632ec97
4 changed files with 22 additions and 21 deletions

View file

@ -4908,11 +4908,11 @@ SettingsTablePtr const & DomainMapper::GetSettingsTable()
return m_pImpl->GetSettingsTable();
}
GraphicZOrderHelper* DomainMapper::graphicZOrderHelper()
GraphicZOrderHelper& DomainMapper::graphicZOrderHelper()
{
if (m_zOrderHelper == nullptr)
m_zOrderHelper.reset( new GraphicZOrderHelper );
return m_zOrderHelper.get();
return *m_zOrderHelper;
}
uno::Reference<drawing::XShape> DomainMapper::PopPendingShape()

View file

@ -107,7 +107,7 @@ public:
OUString getOrCreateCharStyle( PropertyValueVector_t& rCharProperties, bool bAlwaysCreate );
StyleSheetTablePtr const & GetStyleSheetTable( );
SettingsTablePtr const & GetSettingsTable();
GraphicZOrderHelper* graphicZOrderHelper();
GraphicZOrderHelper& graphicZOrderHelper();
/// Return the first from the pending (not inserted to the document) shapes, if there are any.
css::uno::Reference<css::drawing::XShape> PopPendingShape();

View file

@ -4762,12 +4762,12 @@ void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape
{
if (rProp.Name == "VML-Z-ORDER")
{
GraphicZOrderHelper* pZOrderHelper = m_rDMapper.graphicZOrderHelper();
GraphicZOrderHelper& rZOrderHelper = m_rDMapper.graphicZOrderHelper();
sal_Int32 zOrder(0);
rProp.Value >>= zOrder;
xShapePropertySet->setPropertyValue("ZOrder",
uno::Any(pZOrderHelper->findZOrder(zOrder, /*LastDuplicateWins*/true)));
pZOrderHelper->addItem(xShapePropertySet, zOrder);
uno::Any(rZOrderHelper.findZOrder(zOrder, /*LastDuplicateWins*/true)));
rZOrderHelper.addItem(xShapePropertySet, zOrder);
xShapePropertySet->setPropertyValue(getPropertyName( PROP_OPAQUE ), uno::Any( zOrder >= 0 ) );
checkZOrderStatus = true;
}
@ -4807,12 +4807,12 @@ void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape
{
if (rProp.Name == "VML-Z-ORDER")
{
GraphicZOrderHelper* pZOrderHelper = m_rDMapper.graphicZOrderHelper();
GraphicZOrderHelper& rZOrderHelper = m_rDMapper.graphicZOrderHelper();
sal_Int32 zOrder(0);
rProp.Value >>= zOrder;
xShapePropertySet->setPropertyValue("ZOrder",
uno::Any(pZOrderHelper->findZOrder(zOrder, /*LastDuplicateWins*/true)));
pZOrderHelper->addItem(xShapePropertySet, zOrder);
uno::Any(rZOrderHelper.findZOrder(zOrder, /*LastDuplicateWins*/true)));
rZOrderHelper.addItem(xShapePropertySet, zOrder);
xShapePropertySet->setPropertyValue(getPropertyName( PROP_OPAQUE ), uno::Any( zOrder >= 0 ) );
checkZOrderStatus = true;
}

View file

@ -391,14 +391,14 @@ public:
void applyZOrder(uno::Reference<beans::XPropertySet> const & xGraphicObjectProperties) const
{
std::optional<sal_Int32> oZOrder = m_oZOrder;
bool bBehindText = m_bBehindDoc && !m_bOpaque;
if (m_rGraphicImportType == GraphicImportType::IMPORT_AS_DETECTED_INLINE
&& !m_rDomainMapper.IsInShape())
{
oZOrder = SAL_MIN_INT32;
bBehindText = false;
}
if (oZOrder)
else if (!oZOrder)
return;
else
{
// tdf#120760 Send objects with behinddoc=true to the back.
@ -417,18 +417,19 @@ public:
// (especially needed for IsInHeaderFooter, as EVERYTHING is forced to the background).
//
// relativeHeight already removed 0x1E00 0000, so can subtract another 0x6200 0000
const bool bBehindText = m_bBehindDoc && !m_bOpaque;
if (bBehindText)
oZOrder = *oZOrder - 0x62000000;
// TODO: it is possible that RTF has been wrong all along as well. Always true here?
const bool bLastDuplicateWins(!m_rDomainMapper.IsRTFImport()
|| m_rGraphicImportType == GraphicImportType::IMPORT_AS_DETECTED_INLINE);
GraphicZOrderHelper* pZOrderHelper = m_rDomainMapper.graphicZOrderHelper();
xGraphicObjectProperties->setPropertyValue(getPropertyName(PROP_Z_ORDER),
uno::Any(pZOrderHelper->findZOrder(*oZOrder, bLastDuplicateWins)));
pZOrderHelper->addItem(xGraphicObjectProperties, *oZOrder);
}
// TODO: it is possible that RTF has been wrong all along as well. Always true here?
const bool bLastDuplicateWins(!m_rDomainMapper.IsRTFImport()
|| m_rGraphicImportType == GraphicImportType::IMPORT_AS_DETECTED_INLINE);
GraphicZOrderHelper& rZOrderHelper = m_rDomainMapper.graphicZOrderHelper();
xGraphicObjectProperties->setPropertyValue(getPropertyName(PROP_Z_ORDER),
uno::Any(rZOrderHelper.findZOrder(*oZOrder, bLastDuplicateWins)));
rZOrderHelper.addItem(xGraphicObjectProperties, *oZOrder);
}
void applyName(uno::Reference<beans::XPropertySet> const & xGraphicObjectProperties) const