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 throw( 92 ::com::sun::star::uno::Exception, 93 ::com::sun::star::uno::RuntimeException); 94 95 protected: 96 97 /// export the events off all autotexts 98 virtual sal_uInt32 exportDoc( 99 enum ::xmloff::token::XMLTokenEnum eClass = xmloff::token::XML_TOKEN_INVALID ); 100 101 /// does the document have any events ? 102 sal_Bool hasEvents(); 103 104 /// export the events element 105 void exportEvents(); 106 107 108 /// add the namespaces used by events 109 /// (to be called for the document element) 110 void addNamespaces(); 111 112 113 // methods without content: 114 virtual void _ExportMeta(); 115 virtual void _ExportScripts(); 116 virtual void _ExportFontDecls(); 117 virtual void _ExportStyles( sal_Bool bUsed ) ; 118 virtual void _ExportAutoStyles(); 119 virtual void _ExportMasterStyles(); 120 virtual void _ExportChangeTracking(); 121 virtual void _ExportContent(); 122 }; 123 124 125 126 // global functions to support the component 127 128 ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL 129 XMLAutoTextEventExport_getSupportedServiceNames() 130 throw(); 131 132 ::rtl::OUString SAL_CALL XMLAutoTextEventExport_getImplementationName() 133 throw(); 134 135 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL 136 XMLAutoTextEventExportOOO_createInstance( 137 const ::com::sun::star::uno::Reference< 138 ::com::sun::star::lang::XMultiServiceFactory > & ) 139 throw( ::com::sun::star::uno::Exception ); 140 141 ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL 142 XMLAutoTextEventExportOOO_getSupportedServiceNames() 143 throw(); 144 145 ::rtl::OUString SAL_CALL XMLAutoTextEventExportOOO_getImplementationName() 146 throw(); 147 148 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL 149 XMLAutoTextEventExportOOO_createInstance( 150 const ::com::sun::star::uno::Reference< 151 ::com::sun::star::lang::XMultiServiceFactory > & ) 152 throw( ::com::sun::star::uno::Exception ); 153 154 #endif 155 156