1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
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: */