LibreOffice Module filter (master) 1
XmlFilterAdaptor.hxx
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 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#pragma once
21
22
23#include <com/sun/star/document/XFilter.hpp>
24#include <com/sun/star/document/XExporter.hpp>
25#include <com/sun/star/document/XImporter.hpp>
26#include <com/sun/star/lang/XInitialization.hpp>
27#include <com/sun/star/lang/XServiceInfo.hpp>
28#include <com/sun/star/uno/XComponentContext.hpp>
30#include <utility>
31
32
34{
37};
38
39/* This component will be instantiated for both import or export. Whether it calls
40 * setSourceDocument or setTargetDocument determines which Impl function the filter
41 * member calls */
42
43class XmlFilterAdaptor final : public cppu::WeakImplHelper
44<
45 css::document::XFilter,
46 css::document::XExporter,
47 css::document::XImporter,
48 css::lang::XInitialization,
49 css::lang::XServiceInfo
50>
51{
52 css::uno::Reference< css::uno::XComponentContext > mxContext;
53 css::uno::Reference< css::lang::XComponent > mxDoc;
54 OUString msFilterName;
55 css::uno::Sequence< OUString > msUserData;
58
60 bool exportImpl( const css::uno::Sequence< css::beans::PropertyValue >& aDescriptor );
61
63 bool importImpl( const css::uno::Sequence< css::beans::PropertyValue >& aDescriptor );
64
65
66public:
67
68 explicit XmlFilterAdaptor( css::uno::Reference< css::uno::XComponentContext > xContext)
69 : mxContext(std::move(xContext))
71 {
72 }
73
74 // XFilter
75
76 virtual sal_Bool SAL_CALL filter( const css::uno::Sequence< css::beans::PropertyValue >& aDescriptor ) override;
77
78 virtual void SAL_CALL cancel( ) override;
79
80
81 // XExporter
82
83 virtual void SAL_CALL setSourceDocument( const css::uno::Reference< css::lang::XComponent >& xDoc ) override;
84
85
86 // XImporter
87
88 virtual void SAL_CALL setTargetDocument( const css::uno::Reference< css::lang::XComponent >& xDoc ) override;
89
90
91 // XInitialization
92
93 virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
94
95
96 // XServiceInfo
97
98 virtual OUString SAL_CALL getImplementationName( ) override;
99
100 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
101
102 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
103
104};
105
106/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
FilterType
@ FILTER_IMPORT
@ FILTER_EXPORT
virtual void SAL_CALL cancel() override
bool exportImpl(const css::uno::Sequence< css::beans::PropertyValue > &aDescriptor)
bool importImpl(const css::uno::Sequence< css::beans::PropertyValue > &aDescriptor)
virtual sal_Bool SAL_CALL filter(const css::uno::Sequence< css::beans::PropertyValue > &aDescriptor) override
virtual void SAL_CALL setTargetDocument(const css::uno::Reference< css::lang::XComponent > &xDoc) override
css::uno::Reference< css::lang::XComponent > mxDoc
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
XmlFilterAdaptor(css::uno::Reference< css::uno::XComponentContext > xContext)
css::uno::Reference< css::uno::XComponentContext > mxContext
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual OUString SAL_CALL getImplementationName() override
css::uno::Sequence< OUString > msUserData
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
virtual void SAL_CALL setSourceDocument(const css::uno::Reference< css::lang::XComponent > &xDoc) override
unsigned char sal_Bool