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