Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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 : */
9 :
10 : #include "xpath.hxx"
11 :
12 : #include <cppunit/TestAssert.h>
13 : #include "qahelper.hxx"
14 :
15 : #include <unotools/tempfile.hxx>
16 : #include <unotools/ucbstreamhelper.hxx>
17 :
18 : #include <test/xmltesttools.hxx>
19 :
20 : #include <com/sun/star/packages/zip/ZipFileAccess.hpp>
21 :
22 9 : xmlDocPtr XPathHelper::parseExport(ScDocShell* pShell, uno::Reference<lang::XMultiServiceFactory> xSFactory, const OUString& rFile, sal_Int32 nFormat)
23 : {
24 9 : boost::shared_ptr<utl::TempFile> pTempFile = ScBootstrapFixture::exportTo(pShell, nFormat);
25 :
26 : // Read the XML stream we're interested in.
27 18 : uno::Reference<packages::zip::XZipFileAccess2> xNameAccess = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(xSFactory), pTempFile->GetURL());
28 18 : uno::Reference<io::XInputStream> xInputStream(xNameAccess->getByName(rFile), uno::UNO_QUERY);
29 9 : CPPUNIT_ASSERT(xInputStream.is());
30 18 : boost::shared_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true));
31 :
32 18 : return XmlTestTools::parseXmlStream(pStream.get());
33 30 : }
34 :
35 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|