1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #include <xmlscript/xmlmod_imexp.hxx> 29 30 #include <cppuhelper/implbase1.hxx> 31 #include <rtl/ustrbuf.hxx> 32 33 #include <com/sun/star/lang/XMultiServiceFactory.hpp> 34 #include <com/sun/star/container/XNameContainer.hpp> 35 #include <com/sun/star/beans/XPropertySet.hpp> 36 37 #include <com/sun/star/awt/XControlModel.hpp> 38 #include <com/sun/star/awt/FontDescriptor.hpp> 39 40 #include <com/sun/star/xml/input/XRoot.hpp> 41 42 #include <vector> 43 44 #define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) ) 45 46 47 using namespace ::rtl; 48 using namespace ::std; 49 using namespace ::com::sun::star; 50 using namespace ::com::sun::star::uno; 51 52 namespace xmlscript 53 { 54 55 //================================================================================================== 56 // Script module import 57 58 //================================================================================================== 59 struct ModuleImport 60 : public ::cppu::WeakImplHelper1< xml::input::XRoot > 61 { 62 friend class ModuleElement; 63 64 ModuleDescriptor& mrModuleDesc; 65 66 sal_Int32 XMLNS_SCRIPT_UID; 67 sal_Int32 XMLNS_LIBRARY_UID; 68 sal_Int32 XMLNS_XLINK_UID; 69 70 public: 71 inline ModuleImport( ModuleDescriptor& rModuleDesc ) 72 SAL_THROW( () ) 73 : mrModuleDesc( rModuleDesc ) {} 74 virtual ~ModuleImport() 75 SAL_THROW( () ); 76 77 // XRoot 78 virtual void SAL_CALL startDocument( 79 Reference< xml::input::XNamespaceMapping > const & xNamespaceMapping ) 80 throw (xml::sax::SAXException, RuntimeException); 81 virtual void SAL_CALL endDocument() 82 throw (xml::sax::SAXException, RuntimeException); 83 virtual void SAL_CALL processingInstruction( 84 OUString const & rTarget, OUString const & rData ) 85 throw (xml::sax::SAXException, RuntimeException); 86 virtual void SAL_CALL setDocumentLocator( 87 Reference< xml::sax::XLocator > const & xLocator ) 88 throw (xml::sax::SAXException, RuntimeException); 89 virtual Reference< xml::input::XElement > SAL_CALL startRootElement( 90 sal_Int32 nUid, OUString const & rLocalName, 91 Reference< xml::input::XAttributes > const & xAttributes ) 92 throw (xml::sax::SAXException, RuntimeException); 93 }; 94 95 //================================================================================================== 96 class ModuleElement 97 : public ::cppu::WeakImplHelper1< xml::input::XElement > 98 { 99 protected: 100 ModuleImport * _pImport; 101 ModuleElement * _pParent; 102 103 OUString _aLocalName; 104 Reference< xml::input::XAttributes > _xAttributes; 105 ::rtl::OUStringBuffer _StrBuffer; 106 107 public: 108 ModuleElement( 109 OUString const & rLocalName, 110 Reference< xml::input::XAttributes > const & xAttributes, 111 ModuleElement * pParent, ModuleImport * pImport ) 112 SAL_THROW( () ); 113 virtual ~ModuleElement() 114 SAL_THROW( () ); 115 116 // XElement 117 virtual Reference< xml::input::XElement > SAL_CALL getParent() 118 throw (RuntimeException); 119 virtual OUString SAL_CALL getLocalName() 120 throw (RuntimeException); 121 virtual sal_Int32 SAL_CALL getUid() 122 throw (RuntimeException); 123 virtual Reference< xml::input::XAttributes > SAL_CALL getAttributes() 124 throw (RuntimeException); 125 virtual void SAL_CALL ignorableWhitespace( 126 OUString const & rWhitespaces ) 127 throw (xml::sax::SAXException, RuntimeException); 128 virtual void SAL_CALL characters( OUString const & rChars ) 129 throw (xml::sax::SAXException, RuntimeException); 130 virtual void SAL_CALL processingInstruction( 131 OUString const & rTarget, OUString const & rData ) 132 throw (xml::sax::SAXException, RuntimeException); 133 virtual void SAL_CALL endElement() 134 throw (xml::sax::SAXException, RuntimeException); 135 virtual Reference< xml::input::XElement > SAL_CALL startChildElement( 136 sal_Int32 nUid, OUString const & rLocalName, 137 Reference< xml::input::XAttributes > const & xAttributes ) 138 throw (xml::sax::SAXException, RuntimeException); 139 }; 140 141 //================================================================================================== 142 143 } 144