[Libreoffice-commits] core.git: sw/qa sw/source
Justin Luth (via logerrit)
logerrit at kemper.freedesktop.org
Fri Apr 9 12:48:51 UTC 2021
sw/qa/extras/ww8import/data/tdf120768_zOrder.doc |binary
sw/qa/extras/ww8import/ww8import.cxx | 8 ++++++++
sw/source/filter/ww8/ww8graf.cxx | 3 +++
sw/source/filter/ww8/ww8graf.hxx | 6 +++++-
sw/source/filter/ww8/ww8graf2.cxx | 9 +++++++--
5 files changed, 23 insertions(+), 3 deletions(-)
New commits:
commit 32013f0dccde8407aa907112399dc2a9efb7f906
Author: Justin Luth <justin.luth at collabora.com>
AuthorDate: Fri Apr 9 11:06:13 2021 +0200
Commit: Justin Luth <justin_luth at sil.org>
CommitDate: Fri Apr 9 14:48:03 2021 +0200
tdf#120768 doc import: z-order background shapes behind others
Interestingly, there were NO ww8export examples
where a background item was attempting to insert
itself after a foreground one.
I think GENERALLY the order of shapes in a DOC
file format is from bottom to top - and so it
just worked by accident.
Change-Id: If5226b4ad071455d1e3c30e334676cc5932a1064
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113837
Tested-by: Justin Luth <justin_luth at sil.org>
Reviewed-by: Justin Luth <justin_luth at sil.org>
diff --git a/sw/qa/extras/ww8import/data/tdf120768_zOrder.doc b/sw/qa/extras/ww8import/data/tdf120768_zOrder.doc
new file mode 100644
index 000000000000..b70a7d840b6d
Binary files /dev/null and b/sw/qa/extras/ww8import/data/tdf120768_zOrder.doc differ
diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx
index a9b75588a1b3..ccae8638a2c3 100644
--- a/sw/qa/extras/ww8import/ww8import.cxx
+++ b/sw/qa/extras/ww8import/ww8import.cxx
@@ -262,6 +262,14 @@ DECLARE_WW8IMPORT_TEST(testTdf110987, "tdf110987")
CPPUNIT_ASSERT(sFilterName != "MS Word 97 Vorlage");
}
+DECLARE_WW8IMPORT_TEST(testTdf120768_zOrder, "tdf120768_zOrder.doc")
+{
+ //The blue shape was covering everything (highest zorder = 2) instead of the lowest(0)
+ uno::Reference<drawing::XShape> xShape(getShapeByName(u"Picture 2"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_uInt32(0), getProperty<sal_uInt32>(xShape, "ZOrder"));
+}
+
+
// tests should only be added to ww8IMPORT *if* they fail round-tripping in ww8EXPORT
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 89a3e8ac14f2..07ff4d41f730 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -2798,6 +2798,7 @@ SwFrameFormat* SwWW8ImplReader::Read_GrafLayer( tools::Long nGrafAnchorCp )
/* Need to make sure that the correct layer ordering is applied. */
// pass information, if object is in page header|footer to method.
m_xWWZOrder->InsertEscherObject( pObject, pF->nSpId,
+ pRecord->bDrawHell,
m_bIsHeader || m_bIsFooter );
}
else
@@ -3029,6 +3030,7 @@ SwFlyFrameFormat* SwWW8ImplReader::ConvertDrawTextToFly(SdrObject* &rpObject,
{
// pass information, if object is in page header|footer to method.
m_xWWZOrder->InsertEscherObject( rpOurNewObject, pF->nSpId,
+ pRecord->bDrawHell,
m_bIsHeader || m_bIsFooter );
}
}
@@ -3180,6 +3182,7 @@ SwFlyFrameFormat* SwWW8ImplReader::ImportReplaceableDrawables( SdrObject* &rpObj
{
// pass information, if object is in page header|footer to method.
m_xWWZOrder->InsertEscherObject( rpOurNewObject, pF->nSpId,
+ pRecord->bDrawHell,
m_bIsHeader || m_bIsFooter );
}
}
diff --git a/sw/source/filter/ww8/ww8graf.hxx b/sw/source/filter/ww8/ww8graf.hxx
index 3b05c53d2c5d..7058fd1af897 100644
--- a/sw/source/filter/ww8/ww8graf.hxx
+++ b/sw/source/filter/ww8/ww8graf.hxx
@@ -33,12 +33,14 @@ struct EscherShape
{
sal_uLong mnEscherShapeOrder;
sal_uLong mnNoInlines;
- // new member <mbInHeaderFooter>
+ bool mbInHellLayer;
bool mbInHeaderFooter;
EscherShape( sal_uLong nEscherShapeOrder,
+ bool bInHellLayer,
bool _bInHeaderFooter )
: mnEscherShapeOrder(nEscherShapeOrder),
mnNoInlines(0),
+ mbInHellLayer(bInHellLayer),
mbInHeaderFooter( _bInHeaderFooter )
{}
};
@@ -71,6 +73,7 @@ private:
// new parameter <_bInHeaderFooter>, indicating
// that object is in header or footer
sal_uLong GetEscherObjectPos( sal_uLong nSpId,
+ const bool bInHellLayer,
const bool _bInHeaderFooter );
sal_uLong GetDrawingObjectPos(short nWwHeight);
void InsertObject(SdrObject *pObject, sal_uLong nPos);
@@ -86,6 +89,7 @@ public:
// new parameter <_bInHeaderFooter>, indicating that object is in header or footer
void InsertEscherObject( SdrObject* pObject,
sal_uLong nSpId,
+ const bool bInHellLayer,
const bool _bInHeaderFooter );
void InsideEscher(sal_uLong nIndex);
void OutsideEscher();
diff --git a/sw/source/filter/ww8/ww8graf2.cxx b/sw/source/filter/ww8/ww8graf2.cxx
index 08ef81f6e397..13bf81c97c9f 100644
--- a/sw/source/filter/ww8/ww8graf2.cxx
+++ b/sw/source/filter/ww8/ww8graf2.cxx
@@ -69,9 +69,10 @@ void wwZOrderer::OutsideEscher()
// consider new parameter <_bInHeaderFooter>
void wwZOrderer::InsertEscherObject( SdrObject* pObject,
sal_uLong nSpId,
+ const bool bInHellLayer,
const bool _bInHeaderFooter )
{
- sal_uLong nInsertPos = GetEscherObjectPos( nSpId, _bInHeaderFooter );
+ sal_uLong nInsertPos = GetEscherObjectPos( nSpId, bInHellLayer, _bInHeaderFooter );
InsertObject(pObject, nInsertPos + mnNoInitialObjects + mnInlines);
}
@@ -100,6 +101,7 @@ sal_uInt16 wwZOrderer::GetEscherObjectIdx(sal_uLong nSpId)
// consider new parameter <_bInHeaderFooter>
sal_uLong wwZOrderer::GetEscherObjectPos( sal_uLong nSpId,
+ const bool bInHellLayer,
const bool _bInHeaderFooter )
{
/*
@@ -137,12 +139,15 @@ sal_uLong wwZOrderer::GetEscherObjectPos( sal_uLong nSpId,
{
break;
}
+ if ( bInHellLayer && !aIter->mbInHellLayer )
+ break;
+
if ( aIter->mnEscherShapeOrder > nFound )
break;
nRet += aIter->mnNoInlines+1;
++aIter;
}
- maEscherLayer.insert(aIter, EscherShape( nFound, _bInHeaderFooter ) );
+ maEscherLayer.insert(aIter, EscherShape( nFound, bInHellLayer, _bInHeaderFooter ) );
return nRet;
}
More information about the Libreoffice-commits
mailing list