summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/oox/core/xmlfilterbase.hxx6
-rw-r--r--oox/source/core/xmlfilterbase.cxx2
-rw-r--r--sc/qa/unit/subsequent_export-test.cxx4
-rw-r--r--sc/source/filter/excel/excdoc.cxx3
-rw-r--r--sd/qa/unit/export-tests-ooxml1.cxx4
-rw-r--r--sd/source/filter/eppt/pptx-epptooxml.cxx6
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport3.cxx11
7 files changed, 27 insertions, 9 deletions
diff --git a/include/oox/core/xmlfilterbase.hxx b/include/oox/core/xmlfilterbase.hxx
index 53c80057ba60..be6366c31859 100644
--- a/include/oox/core/xmlfilterbase.hxx
+++ b/include/oox/core/xmlfilterbase.hxx
@@ -227,7 +227,12 @@ public:
*/
void exportDocumentProperties( const css::uno::Reference< css::document::XDocumentProperties >& xProperties );
+ /** Write the customXml entries we are preserving (xlsx and pptx only). */
+ void exportCustomFragments();
+
+ /** Read the document properties and also the customXml entries (xlsx and pptx only). */
void importDocumentProperties();
+
static void putPropertiesToDocumentGrabBag(const css::uno::Reference<css::lang::XComponent>& xDstDoc,
const comphelper::SequenceAsHashMap& rProperties);
@@ -258,7 +263,6 @@ private:
const css::uno::Reference< css::io::XStream >& rxOutStream ) const override;
void importCustomFragments(css::uno::Reference<css::embed::XStorage>& xDocumentStorage);
- void exportCustomFragments();
private:
::std::unique_ptr< XmlFilterBaseImpl > mxImpl;
diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index 491d83a5770c..7caf551c1836 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -854,8 +854,6 @@ void XmlFilterBase::exportDocumentProperties( const Reference< XDocumentProperti
writeAppProperties( *this, xProperties );
writeCustomProperties( *this, xProperties );
}
-
- exportCustomFragments();
}
// protected ------------------------------------------------------------------
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index c013d836fb8b..793b239d510d 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -3030,6 +3030,10 @@ void ScExportTest::testCustomXml()
xmlDocPtr pRelsDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "customXml/_rels/item1.xml.rels");
CPPUNIT_ASSERT(pRelsDoc);
+ // Check there is a relation to itemProps1.xml.
+ assertXPath(pRelsDoc, "/r:Relationships/r:Relationship", 1);
+ assertXPath(pRelsDoc, "/r:Relationships/r:Relationship[@Id='rId1']", "Target", "itemProps1.xml");
+
std::shared_ptr<SvStream> pStream = XPathHelper::parseExportStream(pXPathFile, m_xSFactory, "ddp/ddpfile.xen");
CPPUNIT_ASSERT(pStream);
}
diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx
index 70e4d4e68b28..f9ff9a891b55 100644
--- a/sc/source/filter/excel/excdoc.cxx
+++ b/sc/source/filter/excel/excdoc.cxx
@@ -853,7 +853,8 @@ void ExcDocument::WriteXml( XclExpXmlStream& rStrm )
uno::Reference<document::XDocumentPropertiesSupplier> xDPS( pDocShell->GetModel(), uno::UNO_QUERY_THROW );
uno::Reference<document::XDocumentProperties> xDocProps = xDPS->getDocumentProperties();
- rStrm.exportDocumentProperties( xDocProps );
+ rStrm.exportDocumentProperties(xDocProps);
+ rStrm.exportCustomFragments();
sax_fastparser::FSHelperPtr& rWorkbook = rStrm.GetCurrentStream();
rWorkbook->startElement( XML_workbook,
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx
index 9147c662c634..64d2443f37bf 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -822,8 +822,8 @@ void SdOOXMLExportTest1::testCustomXml()
CPPUNIT_ASSERT(pRelsDoc);
// Check there is a relation to itemProps1.xml.
- const OUString sXmlPath = "/rels:Relationships/rels:Relationship[@Id='rId1']";
- assertXPath(pRelsDoc, OUStringToOString(sXmlPath, RTL_TEXTENCODING_UTF8), "Target", "itemProps1.xml");
+ assertXPath(pRelsDoc, "/rels:Relationships/rels:Relationship", 1);
+ assertXPath(pRelsDoc, "/rels:Relationships/rels:Relationship[@Id='rId1']", "Target", "itemProps1.xml");
std::shared_ptr<SvStream> pStream = parseExportStream(tempFile, "ddp/ddpfile.xen");
CPPUNIT_ASSERT(pStream);
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 9d6f3066b7e9..c977471aaaa8 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -349,9 +349,9 @@ void PowerPointExport::writeDocumentProperties()
uno::Reference<document::XDocumentProperties> xDocProps = xDPS->getDocumentProperties();
if (xDocProps.is())
- {
- exportDocumentProperties( xDocProps );
- }
+ exportDocumentProperties(xDocProps);
+
+ exportCustomFragments();
}
bool PowerPointExport::importDocument() throw()
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
index bb33e40c003a..656e0a999ec9 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
@@ -536,6 +536,17 @@ DECLARE_OOXMLEXPORT_TEST(testCustomXmlGrabBag, "customxml.docx")
CPPUNIT_ASSERT(CustomXml); // Grab Bag has all the expected elements
}
+DECLARE_OOXMLEXPORT_TEST(testCustomXmlRelationships, "customxml.docx")
+{
+ xmlDocPtr pXmlDoc = parseExport("customXml/_rels/item1.xml.rels");
+ if(!pXmlDoc)
+ return;
+
+ // Check there is a relation to itemProps1.xml.
+ assertXPath(pXmlDoc, "/rels:Relationships/rels:Relationship", 1);
+ assertXPath(pXmlDoc, "/rels:Relationships/rels:Relationship[@Id='rId1']", "Target", "itemProps1.xml");
+}
+
DECLARE_OOXMLEXPORT_TEST(testFdo69644, "fdo69644.docx")
{
// The problem was that the exporter exported the table definition