1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _XMLOFF_XMLAUTOTEXTEVENTEXPORT_HXX 25 #define _XMLOFF_XMLAUTOTEXTEVENTEXPORT_HXX 26 27 #include <xmloff/xmlexp.hxx> 28 29 #include <set> 30 31 32 namespace rtl { class OUString; } 33 namespace com { namespace sun { namespace star { 34 namespace container { class XNameAccess; } 35 namespace frame { class XModel; } 36 namespace lang { class XMultiServiceFactory; } 37 namespace uno { template<class X> class Reference; } 38 namespace uno { template<class X> class Sequence; } 39 namespace uno { class XInterface; } 40 namespace uno { class Exception; } 41 namespace xml { namespace sax { class XDocumentHandler; } } 42 } } } 43 44 45 /** 46 * Component for the export of events attached to autotext blocks. 47 * Via the XInitialization interface it expects up to two strings, the 48 * first giving the file name (URL) of the autotext group, and the second 49 * identifying the autotext. If one of the strings is not given, it 50 * will export the whole group / all groups. 51 */ 52 class XMLAutoTextEventExport : public SvXMLExport 53 { 54 ::com::sun::star::uno::Reference< 55 ::com::sun::star::container::XNameAccess> xEvents; 56 57 const ::rtl::OUString sEventType; 58 const ::rtl::OUString sNone; 59 60 61 public: 62 63 // #110680# 64 //XMLAutoTextEventExport(); 65 XMLAutoTextEventExport( 66 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, sal_uInt16 nFlags 67 ); 68 69 // #110680# 70 //XMLAutoTextEventExport( 71 // const ::rtl::OUString& rFileName, 72 // const ::com::sun::star::uno::Reference< 73 // ::com::sun::star::xml::sax::XDocumentHandler > & rHandler, 74 // const ::com::sun::star::uno::Reference< 75 // ::com::sun::star::frame::XModel > & rModel, 76 // const ::com::sun::star::uno::Reference< 77 // ::com::sun::star::container::XNameAccess > & rEvents); 78 XMLAutoTextEventExport( 79 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, 80 const ::rtl::OUString& rFileName, 81 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler, 82 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & rModel, 83 const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > & rEvents, sal_uInt16 nFlags); 84 85 ~XMLAutoTextEventExport(); 86 87 // XInitialization 88 virtual void SAL_CALL initialize( 89 const ::com::sun::star::uno::Sequence< 90 ::com::sun::star::uno::Any> & rArguments ); 91 92 protected: 93 94 /// export the events off all autotexts 95 virtual sal_uInt32 exportDoc( 96 enum ::xmloff::token::XMLTokenEnum eClass = xmloff::token::XML_TOKEN_INVALID ); 97 98 /// does the document have any events ? 99 sal_Bool hasEvents(); 100 101 /// export the events element 102 void exportEvents(); 103 104 105 /// add the namespaces used by events 106 /// (to be called for the document element) 107 void addNamespaces(); 108 109 110 // methods without content: 111 virtual void _ExportMeta(); 112 virtual void _ExportScripts(); 113 virtual void _ExportFontDecls(); 114 virtual void _ExportStyles( sal_Bool bUsed ) ; 115 virtual void _ExportAutoStyles(); 116 virtual void _ExportMasterStyles(); 117 virtual void _ExportChangeTracking(); 118 virtual void _ExportContent(); 119 }; 120 121 122 123 // global functions to support the component 124 125 ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL 126 XMLAutoTextEventExport_getSupportedServiceNames() 127 throw(); 128 129 ::rtl::OUString SAL_CALL XMLAutoTextEventExport_getImplementationName() 130 throw(); 131 132 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL 133 XMLAutoTextEventExportOOO_createInstance( 134 const ::com::sun::star::uno::Reference< 135 ::com::sun::star::lang::XMultiServiceFactory > & ); 136 137 ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL 138 XMLAutoTextEventExportOOO_getSupportedServiceNames() 139 throw(); 140 141 ::rtl::OUString SAL_CALL XMLAutoTextEventExportOOO_getImplementationName() 142 throw(); 143 144 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL 145 XMLAutoTextEventExportOOO_createInstance( 146 const ::com::sun::star::uno::Reference< 147 ::com::sun::star::lang::XMultiServiceFactory > & ); 148 149 #endif 150