LibreOffice Module sw (master) 1
IndexingExportFilter.cxx
Go to the documentation of this file.
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
11#include <IndexingExport.hxx>
12
13#include <unotxdoc.hxx>
14#include <docsh.hxx>
15
18
19#include <com/sun/star/io/XOutputStream.hpp>
20#include <svl/outstrm.hxx>
21
22using namespace css;
23
24namespace sw
25{
26sal_Bool IndexingExportFilter::filter(const uno::Sequence<beans::PropertyValue>& aDescriptor)
27{
28 bool bReturn = false;
29
30 utl::MediaDescriptor aMediaDesc = aDescriptor;
31
32 // Actually get the SwRootFrame to call dumpAsXml
33 auto pXTextDocument = comphelper::getFromUnoTunnel<SwXTextDocument>(m_xSourceDocument);
34 if (pXTextDocument)
35 {
36 uno::Reference<io::XOutputStream> xOutputStream = aMediaDesc.getUnpackedValueOrDefault(
37 utl::MediaDescriptor::PROP_OUTPUTSTREAM, uno::Reference<io::XOutputStream>());
38
39 std::unique_ptr<SvStream> pStream(new SvOutputStream(xOutputStream));
40 SwDocShell* pShell = pXTextDocument->GetDocShell();
41 SwDoc* pDoc = pShell->GetDoc();
42 if (pDoc)
43 {
44 IndexingExport aIndexingExport(*pStream, pDoc);
45 bReturn = aIndexingExport.runExport();
46 }
47 }
48
49 return bReturn;
50}
51
52} // end namespace sw
53
54extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
56 css::uno::XComponentContext*, css::uno::Sequence<css::uno::Any> const&)
57{
58 return cppu::acquire(new sw::IndexingExportFilter());
59}
60
61/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_Writer_IndexingExportFilter_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
SwDoc * GetDoc()
returns Doc. But be careful!
Definition: docsh.hxx:204
Definition: doc.hxx:188
virtual sal_Bool SAL_CALL filter(const css::uno::Sequence< css::beans::PropertyValue > &aDescriptor) override
css::uno::Reference< css::lang::XComponent > m_xSourceDocument
static constexpr OUStringLiteral PROP_OUTPUTSTREAM
Dialog to specify the properties of date form field.
unsigned char sal_Bool