[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - sw/qa sw/source
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Tue Aug 31 05:12:18 UTC 2021
sw/qa/extras/indexing/IndexingExportTest.cxx | 20 ++++++++++++++++++++
sw/qa/extras/indexing/data/IndexingExport_OLE.odt |binary
sw/source/filter/indexing/IndexingExport.cxx | 17 ++++++++++++++++-
3 files changed, 36 insertions(+), 1 deletion(-)
New commits:
commit c400d1dcacb315e22abb5ca784bb9c63ae1302ca
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Tue Jun 15 14:12:26 2021 +0900
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Tue Aug 31 07:11:44 2021 +0200
indexing: indexing OLE objects for the IndexingExport
Adds handling of OLE objects to the IndexingExport with exporting
the alt text and the name to the indexing xml.
Change-Id: Ie357f55195cda864ee12d6b120babd106eff6179
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117358
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
(cherry picked from commit 37cd5bd4fdf2317709882c933844c4cc67e4cee4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121101
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
diff --git a/sw/qa/extras/indexing/IndexingExportTest.cxx b/sw/qa/extras/indexing/IndexingExportTest.cxx
index f76850c1a803..807f84ab6934 100644
--- a/sw/qa/extras/indexing/IndexingExportTest.cxx
+++ b/sw/qa/extras/indexing/IndexingExportTest.cxx
@@ -28,10 +28,12 @@ private:
public:
void testIndexingExport_Paragraphs();
void testIndexingExport_Images();
+ void testIndexingExport_OLE();
CPPUNIT_TEST_SUITE(IndexingExportTest);
CPPUNIT_TEST(testIndexingExport_Paragraphs);
CPPUNIT_TEST(testIndexingExport_Images);
+ CPPUNIT_TEST(testIndexingExport_OLE);
CPPUNIT_TEST_SUITE_END();
};
@@ -100,6 +102,24 @@ void IndexingExportTest::testIndexingExport_Images()
assertXPath(pXmlDoc, "/indexing/graphic[2]", "name", "Image_InCaption");
}
+void IndexingExportTest::testIndexingExport_OLE()
+{
+ SwDoc* pDoc = createDoc("IndexingExport_OLE.odt");
+ CPPUNIT_ASSERT(pDoc);
+
+ SvMemoryStream aMemoryStream;
+ sw::IndexingExport aIndexingExport(aMemoryStream, pDoc);
+ aIndexingExport.runExport();
+ aMemoryStream.Seek(0);
+
+ xmlDocUniquePtr pXmlDoc = parseXmlStream(&aMemoryStream);
+ CPPUNIT_ASSERT(pXmlDoc);
+
+ assertXPath(pXmlDoc, "/indexing");
+ assertXPath(pXmlDoc, "/indexing/ole[1]", "name", "Object - Chart");
+ assertXPath(pXmlDoc, "/indexing/ole[1]", "alt", "Alt Text");
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(IndexingExportTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/qa/extras/indexing/data/IndexingExport_OLE.odt b/sw/qa/extras/indexing/data/IndexingExport_OLE.odt
new file mode 100644
index 000000000000..3da225368bd4
Binary files /dev/null and b/sw/qa/extras/indexing/data/IndexingExport_OLE.odt differ
diff --git a/sw/source/filter/indexing/IndexingExport.cxx b/sw/source/filter/indexing/IndexingExport.cxx
index 8d6e96fd262c..601d67ed1b21 100644
--- a/sw/source/filter/indexing/IndexingExport.cxx
+++ b/sw/source/filter/indexing/IndexingExport.cxx
@@ -12,6 +12,8 @@
#include <node.hxx>
#include <ndtxt.hxx>
+#include <ndole.hxx>
+#include <ndnotxt.hxx>
#include <ndgrf.hxx>
namespace sw
@@ -31,7 +33,11 @@ public:
void handleNode(SwNode* pNode) override
{
- if (pNode->IsGrfNode())
+ if (pNode->IsOLENode())
+ {
+ handleOLENode(pNode->GetOLENode());
+ }
+ else if (pNode->IsGrfNode())
{
handleGraphicNode(pNode->GetGrfNode());
}
@@ -41,6 +47,15 @@ public:
}
}
+ void handleOLENode(SwOLENode* pOleNode)
+ {
+ auto pFrameFormat = pOleNode->GetFlyFormat();
+ m_rXmlWriter.startElement("ole");
+ m_rXmlWriter.attribute("alt", pOleNode->GetTitle());
+ m_rXmlWriter.attribute("name", pFrameFormat->GetName());
+ m_rXmlWriter.endElement();
+ }
+
void handleGraphicNode(SwGrfNode* pGraphicNode)
{
auto pFrameFormat = pGraphicNode->GetFlyFormat();
More information about the Libreoffice-commits
mailing list