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 #include <xmloff/xmlexp.hxx>
23 
24 
25 namespace com::sun::star {
26     namespace container { class XNameAccess; }
27     namespace frame { class XModel; }
28     namespace lang { class XMultiServiceFactory; }
29     namespace uno { template<class X> class Reference; }
30     namespace uno { template<class X> class Sequence; }
31     namespace uno { class XInterface; }
32     namespace uno { class Exception; }
33     namespace xml::sax { class XDocumentHandler; }
34 }
35 
36 
37 /**
38  * Component for the export of events attached to autotext blocks.
39  * Via the XInitialization interface it expects up to two strings, the
40  * first giving the file name (URL) of the autotext group, and the second
41  * identifying the autotext. If one of the strings is not given, it
42  * will export the whole group / all groups.
43  */
44 class XMLAutoTextEventExport : public SvXMLExport
45 {
46     css::uno::Reference<css::container::XNameAccess> xEvents;
47 
48 public:
49 
50     XMLAutoTextEventExport(
51         const css::uno::Reference< css::uno::XComponentContext >& xContext, OUString const & implementationName, SvXMLExportFlags nFlags
52         );
53 
54     virtual ~XMLAutoTextEventExport() override;
55 
56     // XInitialization
57     virtual void SAL_CALL initialize(
58         const css::uno::Sequence<css::uno::Any> & rArguments ) override;
59 
60 private:
61 
62     /// export the events off all autotexts
63     virtual ErrCode exportDoc(
64         enum ::xmloff::token::XMLTokenEnum eClass = xmloff::token::XML_TOKEN_INVALID ) override;
65 
66     /// does the document have any events ?
67     bool hasEvents() const;
68 
69     /// export the events element
70     void exportEvents();
71 
72 
73     /// add the namespaces used by events
74     /// (to be called for the document element)
75     void addNamespaces();
76 
77 
78     // methods without content:
79     virtual void ExportMeta_() override;
80     virtual void ExportScripts_() override;
81     virtual void ExportFontDecls_() override;
82     virtual void ExportStyles_( bool bUsed ) override ;
83     virtual void ExportAutoStyles_() override;
84     virtual void ExportMasterStyles_() override;
85     virtual void ExportContent_() override;
86 };
87 
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
89