bump product version to 5.0.4.1
[LibreOffice.git] / sc / qa / unit / helper / xpath.cxx
blobc90b7c0b74b1066df1737c6a4b1d3440b4fbbde6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include "xpath.hxx"
12 #include <cppunit/TestAssert.h>
13 #include "qahelper.hxx"
15 #include <unotools/tempfile.hxx>
16 #include <unotools/ucbstreamhelper.hxx>
18 #include <test/xmltesttools.hxx>
20 #include <com/sun/star/packages/zip/ZipFileAccess.hpp>
22 xmlDocPtr XPathHelper::parseExport(ScDocShell* pShell, uno::Reference<lang::XMultiServiceFactory> xSFactory, const OUString& rFile, sal_Int32 nFormat)
24 boost::shared_ptr<utl::TempFile> pTempFile = ScBootstrapFixture::exportTo(pShell, nFormat);
26 // Read the XML stream we're interested in.
27 uno::Reference<packages::zip::XZipFileAccess2> xNameAccess = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(xSFactory), pTempFile->GetURL());
28 uno::Reference<io::XInputStream> xInputStream(xNameAccess->getByName(rFile), uno::UNO_QUERY);
29 CPPUNIT_ASSERT(xInputStream.is());
30 boost::shared_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true));
32 return XmlTestTools::parseXmlStream(pStream.get());
35 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */