chart2/source/model/filter/XMLFilter.cxx | 1 dbaccess/source/core/dataaccess/databasedocument.cxx | 1 reportdesign/source/filter/xml/xmlfilter.cxx | 1 sc/source/filter/xml/xmlwrap.cxx | 1 sd/source/filter/xml/sdxmlwrp.cxx | 4 starmath/source/mathmlimport.cxx | 8 - sw/qa/extras/ooxmlexport/ooxmlexport5.cxx | 104 +++++++++++++++++++ sw/source/filter/xml/swxml.cxx | 2 8 files changed, 117 insertions(+), 5 deletions(-)
New commits: commit 988f1c71214870cb0a3df7d156eefd64e096bf0b Author: Michael Stahl <mst...@redhat.com> Date: Wed Dec 16 20:25:04 2015 +0100 sw: extend some more OOXML export test to check embedded objects Change-Id: Ie1047a2a213632f05b0ae091a3a7e4118a271082 diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx index c0979db..65203a6 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx @@ -382,6 +382,19 @@ DECLARE_OOXMLEXPORT_TEST(testContentTypeOLE, "fdo77759.docx") "/ContentType:Types/ContentType:Override[@ContentType='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']", "PartName", "/word/embeddings/oleObject1.xlsx"); + + // 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[1]/w:r/w:object/o:OLEObject", + "ProgID", + "Excel.Sheet.12"); } DECLARE_OOXMLEXPORT_TEST(testfdo78420, "fdo78420.docx") @@ -587,6 +600,19 @@ DECLARE_OOXMLEXPORT_TEST(testfdo79968_sldx, "fdo79968.docx") "/ContentType:Types/ContentType:Override[@ContentType='application/vnd.openxmlformats-officedocument.presentationml.slide']", "PartName", "/word/embeddings/oleObject1.sldx"); + + // check the rels too + xmlDocPtr pXmlDocRels = parseExport("word/_rels/document.xml.rels"); + assertXPath(pXmlDocRels, + "/rels:Relationships/rels:Relationship[@Target='embeddings/oleObject1.sldx']", + "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[1]/w:r/w:object/o:OLEObject", + "ProgID", + "PowerPoint.Slide.12"); } DECLARE_OOXMLEXPORT_TEST(testfdo79969_xlsb, "fdo79969_xlsb.docx") @@ -601,6 +627,19 @@ DECLARE_OOXMLEXPORT_TEST(testfdo79969_xlsb, "fdo79969_xlsb.docx") "/ContentType:Types/ContentType:Override[@ContentType='application/vnd.ms-excel.sheet.binary.macroEnabled.12']", "PartName", "/word/embeddings/oleObject1.xlsb"); + + // check the rels too + xmlDocPtr pXmlDocRels = parseExport("word/_rels/document.xml.rels"); + assertXPath(pXmlDocRels, + "/rels:Relationships/rels:Relationship[@Target='embeddings/oleObject1.xlsb']", + "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[1]/w:r/w:object/o:OLEObject", + "ProgID", + "Excel.SheetBinaryMacroEnabled.12"); } DECLARE_OOXMLEXPORT_TEST(testfdo80097, "fdo80097.docx") @@ -678,6 +717,19 @@ DECLARE_OOXMLEXPORT_TEST(testfdo79969_xlsm, "fdo79969_xlsm.docx") "/ContentType:Types/ContentType:Override[@ContentType='application/vnd.ms-excel.sheet.macroEnabled.12']", "PartName", "/word/embeddings/oleObject1.xlsm"); + + // check the rels too + xmlDocPtr pXmlDocRels = parseExport("word/_rels/document.xml.rels"); + assertXPath(pXmlDocRels, + "/rels:Relationships/rels:Relationship[@Target='embeddings/oleObject1.xlsm']", + "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[1]/w:r/w:object/o:OLEObject", + "ProgID", + "Excel.SheetMacroEnabled.12"); } DECLARE_OOXMLEXPORT_TEST(testfdo80522,"fdo80522.docx") @@ -691,6 +743,19 @@ DECLARE_OOXMLEXPORT_TEST(testfdo80522,"fdo80522.docx") "/ContentType:Types/ContentType:Override[@ContentType='application/vnd.ms-word.document.macroEnabled.12']", "PartName", "/word/embeddings/oleObject1.docm"); + + // check the rels too + xmlDocPtr pXmlDocRels = parseExport("word/_rels/document.xml.rels"); + assertXPath(pXmlDocRels, + "/rels:Relationships/rels:Relationship[@Target='embeddings/oleObject1.docm']", + "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[1]/w:r/w:object/o:OLEObject", + "ProgID", + "Word.DocumentMacroEnabled.12"); } DECLARE_OOXMLEXPORT_TEST(testfdo80523_pptm,"fdo80523_pptm.docx") @@ -704,6 +769,19 @@ DECLARE_OOXMLEXPORT_TEST(testfdo80523_pptm,"fdo80523_pptm.docx") "/ContentType:Types/ContentType:Override[@ContentType='application/vnd.ms-powerpoint.presentation.macroEnabled.12']", "PartName", "/word/embeddings/oleObject1.pptm"); + + // check the rels too + xmlDocPtr pXmlDocRels = parseExport("word/_rels/document.xml.rels"); + assertXPath(pXmlDocRels, + "/rels:Relationships/rels:Relationship[@Target='embeddings/oleObject1.pptm']", + "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[1]/w:r/w:object/o:OLEObject", + "ProgID", + "PowerPoint.ShowMacroEnabled.12"); } DECLARE_OOXMLEXPORT_TEST(testfdo80523_sldm,"fdo80523_sldm.docx") @@ -717,6 +795,19 @@ DECLARE_OOXMLEXPORT_TEST(testfdo80523_sldm,"fdo80523_sldm.docx") "/ContentType:Types/ContentType:Override[@ContentType='application/vnd.ms-powerpoint.slide.macroEnabled.12']", "PartName", "/word/embeddings/oleObject1.sldm"); + + // check the rels too + xmlDocPtr pXmlDocRels = parseExport("word/_rels/document.xml.rels"); + assertXPath(pXmlDocRels, + "/rels:Relationships/rels:Relationship[@Target='embeddings/oleObject1.sldm']", + "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[1]/w:r/w:object/o:OLEObject", + "ProgID", + "PowerPoint.SlideMacroEnabled.12"); } DECLARE_OOXMLEXPORT_TEST(testfdo80898, "fdo80898.docx") @@ -731,6 +822,19 @@ DECLARE_OOXMLEXPORT_TEST(testfdo80898, "fdo80898.docx") "/ContentType:Types/ContentType:Override[@ContentType='application/msword']", "PartName", "/word/embeddings/oleObject1.doc"); + + // check the rels too + xmlDocPtr pXmlDocRels = parseExport("word/_rels/document.xml.rels"); + assertXPath(pXmlDocRels, + "/rels:Relationships/rels:Relationship[@Target='embeddings/oleObject1.doc']", + "Type", + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"); + // check the content too + xmlDocPtr pXmlDocContent = parseExport("word/document.xml"); + assertXPath(pXmlDocContent, + "/w:document/w:body/w:p[1]/w:r/w:object/o:OLEObject", + "ProgID", + "Word.Document.8"); } DECLARE_OOXMLEXPORT_TEST(testTableCellWithDirectFormatting, "fdo80800.docx") commit 291f55edf3d5c1d443cbd9a06bc6f7fd773884e5 Author: Michael Stahl <mst...@redhat.com> Date: Tue Dec 15 17:37:08 2015 +0100 assert that no ODF import happens without a BaseURL Change-Id: I4520a9d0350349cb083ed627a19264a3a97e090f diff --git a/chart2/source/model/filter/XMLFilter.cxx b/chart2/source/model/filter/XMLFilter.cxx index 2ffe00d..dc49724 100644 --- a/chart2/source/model/filter/XMLFilter.cxx +++ b/chart2/source/model/filter/XMLFilter.cxx @@ -383,6 +383,7 @@ sal_Int32 XMLFilter::impl_Import( } } + assert(!aBaseUri.isEmpty()); // needed for relative URLs if( !aBaseUri.isEmpty() ) xImportInfo->setPropertyValue( "BaseURI", uno::makeAny( aBaseUri ) ); diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index e25b714..777b779 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -485,6 +485,7 @@ void ODatabaseDocument::impl_import_nolck_throw( const Reference< XComponentCont OUString sBaseURI = _rResource.getOrDefault("BaseURI", OUString()); if (sBaseURI.isEmpty()) sBaseURI = _rResource.getOrDefault("URL",OUString()); + assert(!sBaseURI.isEmpty()); // needed for relative URLs xInfoSet->setPropertyValue("BaseURI", uno::makeAny(sBaseURI)); xInfoSet->setPropertyValue("StreamName", uno::makeAny(OUString("content.xml"))); diff --git a/reportdesign/source/filter/xml/xmlfilter.cxx b/reportdesign/source/filter/xml/xmlfilter.cxx index 27cd7b8..529fdd6 100644 --- a/reportdesign/source/filter/xml/xmlfilter.cxx +++ b/reportdesign/source/filter/xml/xmlfilter.cxx @@ -512,6 +512,7 @@ bool ORptFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) utl::MediaDescriptor aDescriptor(rDescriptor); uno::Reference<beans::XPropertySet> xProp = comphelper::GenericPropertySet_CreateInstance(new comphelper::PropertySetInfo(pMap)); const OUString sVal( aDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_DOCUMENTBASEURL(),OUString()) ); + assert(!sVal.isEmpty()); // needed for relative URLs xProp->setPropertyValue("BaseURI", uno::makeAny(sVal)); const OUString sHierarchicalDocumentName( aDescriptor.getUnpackedValueOrDefault("HierarchicalDocumentName",OUString()) ); xProp->setPropertyValue("StreamRelPath", uno::makeAny(sHierarchicalDocumentName)); diff --git a/sc/source/filter/xml/xmlwrap.cxx b/sc/source/filter/xml/xmlwrap.cxx index a365584..b63e140 100644 --- a/sc/source/filter/xml/xmlwrap.cxx +++ b/sc/source/filter/xml/xmlwrap.cxx @@ -379,6 +379,7 @@ bool ScXMLImportWrapper::Import( sal_uInt8 nMode, ErrCode& rError ) // Set base URI OSL_ENSURE( pMedium, "There is no medium to get MediaDescriptor from!\n" ); OUString aBaseURL = pMedium ? pMedium->GetBaseURL() : OUString(); + assert(!aBaseURL.isEmpty()); // needed for relative URLs OUString sPropName("BaseURI"); xInfoSet->setPropertyValue( sPropName, uno::makeAny( aBaseURL ) ); diff --git a/sd/source/filter/xml/sdxmlwrp.cxx b/sd/source/filter/xml/sdxmlwrp.cxx index 8848b8f..5e522ef 100644 --- a/sd/source/filter/xml/sdxmlwrp.cxx +++ b/sd/source/filter/xml/sdxmlwrp.cxx @@ -587,7 +587,9 @@ bool SdXMLFilter::Import( ErrCode& nError ) } // Set base URI - xInfoSet->setPropertyValue( "BaseURI" , makeAny( mrMedium.GetBaseURL() ) ); + OUString const baseURI(mrMedium.GetBaseURL()); + assert(!baseURI.isEmpty()); // needed for relative URLs + xInfoSet->setPropertyValue("BaseURI", makeAny(baseURI)); if( 0 == nRet && SfxObjectCreateMode::EMBEDDED == mrDocShell.GetCreateMode() ) { diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx index 48c0d48..5ba3826 100644 --- a/starmath/source/mathmlimport.cxx +++ b/starmath/source/mathmlimport.cxx @@ -141,8 +141,9 @@ sal_uLong SmXMLImportWrapper::Import(SfxMedium &rMedium) new comphelper::PropertySetInfo( aInfoMap ) ) ); // Set base URI - OUString sPropName( "BaseURI" ); - xInfoSet->setPropertyValue( sPropName, makeAny( rMedium.GetBaseURL() ) ); + OUString const baseURI(rMedium.GetBaseURL()); + assert(!baseURI.isEmpty()); // needed for relative URLs + xInfoSet->setPropertyValue("BaseURI", makeAny(baseURI)); sal_Int32 nSteps=3; if ( !(rMedium.IsStorage())) @@ -174,8 +175,7 @@ sal_uLong SmXMLImportWrapper::Import(SfxMedium &rMedium) if ( !aName.isEmpty() ) { - sPropName = "StreamRelPath"; - xInfoSet->setPropertyValue( sPropName, makeAny( aName ) ); + xInfoSet->setPropertyValue("StreamRelPath", makeAny(aName)); } } diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx index 63be8a3..cae28ea 100644 --- a/sw/source/filter/xml/swxml.cxx +++ b/sw/source/filter/xml/swxml.cxx @@ -492,6 +492,8 @@ static void lcl_ConvertSdrOle2ObjsToSdrGrafObjs(SwDoc& _rDoc) sal_uLong XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, const OUString & rName ) { + // TODO: sadly SwXMLTextBlocks doesn't set this? assert(!rBaseURL.isEmpty()); // needed for relative URLs + // Get service factory uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits