summaryrefslogtreecommitdiff
path: root/sw/qa/extras/ooxmlexport
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-12-14 13:41:57 +0100
committerMichael Stahl <mstahl@redhat.com>2015-12-15 17:44:36 +0100
commitb0fc09daf1086423a9bd457d9a2c043e7ff41451 (patch)
treeef5870338c359bb8b733588c2d1ef979afda89c7 /sw/qa/extras/ooxmlexport
parent7dfa45a62b3b942823af5ccd59897364788589c8 (diff)
fix missing BaseURL when loading embedded objects
When the object is edited in the UI, the m_xClient is set to a SfxInPlaceClient and the DocumentBaseURL is retrieved from it. But if the object is not edited, it will be loaded during export via the API and without a m_xClient; in this case the DocumentBaseURL must have been set previously to be available during import. There appears to be no way to get the URL of the document via the API while it is being imported; SfxBaseModel's m_sURL is unfortunately only initialized from SfxObjectShell::FinishedLoading(). During ODF import, the SvXMLEmbeddedObjectHelper creates the embedded object, so let's make it pass in the parent's BaseURL. The "DefaultParentBaseURL" parameter already exists but was unused previously. Change-Id: I3d1ed29b3a2c0e77ec606a1d09f7bc07e7860733
Diffstat (limited to 'sw/qa/extras/ooxmlexport')
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport2.cxx30
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport4.cxx4
2 files changed, 28 insertions, 6 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
index f4fad502544f..a850c811fb21 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
@@ -475,10 +475,32 @@ DECLARE_OOXMLEXPORT_TEST(testTableBorders, "table-borders.docx")
DECLARE_OOXMLEXPORT_TEST(testFdo51550, "fdo51550.odt")
{
- // The problem was that we lacked the fallback to export the replacement graphic for OLE objects.
- uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
- uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
- CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws->getCount());
+ // The problem was that we lacked the fallback to export the replacement
+ // graphic for OLE objects. But we can actually export the OLE itself now,
+ // so check that instead.
+ uno::Reference<text::XTextEmbeddedObjectsSupplier> xTextEmbeddedObjectsSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xEmbeddedObjects(xTextEmbeddedObjectsSupplier->getEmbeddedObjects(), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xEmbeddedObjects->getCount());
+
+ xmlDocPtr pXmlDocCT = parseExport("[Content_Types].xml");
+
+ if (!pXmlDocCT)
+ return; // initial import
+
+ assertXPath(pXmlDocCT, "/ContentType:Types/ContentType:Override[@PartName='/word/embeddings/oleObject1.xlsx']", "ContentType", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+
+ // check the rels too
+ xmlDocPtr pXmlDocRels = parseExport("word/_rels/document.xml.rels");
+ assertXPath(pXmlDocRels,
+ "/rels:Relationships/rels:Relationship[@Target='embeddings/oleObject1.xlsx']",
+ "Type",
+ "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package");
+ // check the content too
+ xmlDocPtr pXmlDocContent = parseExport("word/document.xml");
+ assertXPath(pXmlDocContent,
+ "/w:document/w:body/w:p/w:r/w:object/o:OLEObject",
+ "ProgID",
+ "Excel.Sheet.12");
}
/*
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index 041e54b3e85a..a4503a3ecf9d 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -828,13 +828,13 @@ DECLARE_OOXMLEXPORT_TEST(testContentTypeXLSM, "fdo76098.docx")
assertXPath(pXmlDoc, "/ContentType:Types/ContentType:Override[@PartName='/word/embeddings/Microsoft_Excel_Macro-Enabled_Worksheet1.xlsm']", "ContentType", "application/vnd.ms-excel.sheet.macroEnabled.12");
// check the rels too
- xmlDocPtr pXmlDocRels = parseExport("word/charts/_rels/chart1.xml.rels");
+ xmlDocPtr pXmlDocRels = parseExport("word/charts/_rels/chart2.xml.rels");
assertXPath(pXmlDocRels,
"/rels:Relationships/rels:Relationship[@Target='../embeddings/Microsoft_Excel_Macro-Enabled_Worksheet1.xlsm']",
"Type",
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package");
// check the content too
- xmlDocPtr pXmlDocChart1 = parseExport("word/charts/chart1.xml");
+ xmlDocPtr pXmlDocChart1 = parseExport("word/charts/chart2.xml");
assertXPath(pXmlDocChart1,
"/c:chartSpace/c:externalData",
"id",