1*05236b1aSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*05236b1aSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*05236b1aSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*05236b1aSAndrew Rist * distributed with this work for additional information 6*05236b1aSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*05236b1aSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*05236b1aSAndrew Rist * "License"); you may not use this file except in compliance 9*05236b1aSAndrew Rist * with the License. You may obtain a copy of the License at 10*05236b1aSAndrew Rist * 11*05236b1aSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*05236b1aSAndrew Rist * 13*05236b1aSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*05236b1aSAndrew Rist * software distributed under the License is distributed on an 15*05236b1aSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*05236b1aSAndrew Rist * KIND, either express or implied. See the License for the 17*05236b1aSAndrew Rist * specific language governing permissions and limitations 18*05236b1aSAndrew Rist * under the License. 19*05236b1aSAndrew Rist * 20*05236b1aSAndrew Rist *************************************************************/ 21*05236b1aSAndrew Rist 22*05236b1aSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #include <xmlscript/xmlmod_imexp.hxx> 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx> 27cdf0e10cSrcweir #include <rtl/ustrbuf.hxx> 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 30cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp> 31cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 32cdf0e10cSrcweir 33cdf0e10cSrcweir #include <com/sun/star/awt/XControlModel.hpp> 34cdf0e10cSrcweir #include <com/sun/star/awt/FontDescriptor.hpp> 35cdf0e10cSrcweir 36cdf0e10cSrcweir #include <com/sun/star/xml/input/XRoot.hpp> 37cdf0e10cSrcweir 38cdf0e10cSrcweir #include <vector> 39cdf0e10cSrcweir 40cdf0e10cSrcweir #define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) ) 41cdf0e10cSrcweir 42cdf0e10cSrcweir 43cdf0e10cSrcweir using namespace ::rtl; 44cdf0e10cSrcweir using namespace ::std; 45cdf0e10cSrcweir using namespace ::com::sun::star; 46cdf0e10cSrcweir using namespace ::com::sun::star::uno; 47cdf0e10cSrcweir 48cdf0e10cSrcweir namespace xmlscript 49cdf0e10cSrcweir { 50cdf0e10cSrcweir 51cdf0e10cSrcweir //================================================================================================== 52cdf0e10cSrcweir // Script module import 53cdf0e10cSrcweir 54cdf0e10cSrcweir //================================================================================================== 55cdf0e10cSrcweir struct ModuleImport 56cdf0e10cSrcweir : public ::cppu::WeakImplHelper1< xml::input::XRoot > 57cdf0e10cSrcweir { 58cdf0e10cSrcweir friend class ModuleElement; 59cdf0e10cSrcweir 60cdf0e10cSrcweir ModuleDescriptor& mrModuleDesc; 61cdf0e10cSrcweir 62cdf0e10cSrcweir sal_Int32 XMLNS_SCRIPT_UID; 63cdf0e10cSrcweir sal_Int32 XMLNS_LIBRARY_UID; 64cdf0e10cSrcweir sal_Int32 XMLNS_XLINK_UID; 65cdf0e10cSrcweir 66cdf0e10cSrcweir public: 67cdf0e10cSrcweir inline ModuleImport( ModuleDescriptor& rModuleDesc ) 68cdf0e10cSrcweir SAL_THROW( () ) 69cdf0e10cSrcweir : mrModuleDesc( rModuleDesc ) {} 70cdf0e10cSrcweir virtual ~ModuleImport() 71cdf0e10cSrcweir SAL_THROW( () ); 72cdf0e10cSrcweir 73cdf0e10cSrcweir // XRoot 74cdf0e10cSrcweir virtual void SAL_CALL startDocument( 75cdf0e10cSrcweir Reference< xml::input::XNamespaceMapping > const & xNamespaceMapping ) 76cdf0e10cSrcweir throw (xml::sax::SAXException, RuntimeException); 77cdf0e10cSrcweir virtual void SAL_CALL endDocument() 78cdf0e10cSrcweir throw (xml::sax::SAXException, RuntimeException); 79cdf0e10cSrcweir virtual void SAL_CALL processingInstruction( 80cdf0e10cSrcweir OUString const & rTarget, OUString const & rData ) 81cdf0e10cSrcweir throw (xml::sax::SAXException, RuntimeException); 82cdf0e10cSrcweir virtual void SAL_CALL setDocumentLocator( 83cdf0e10cSrcweir Reference< xml::sax::XLocator > const & xLocator ) 84cdf0e10cSrcweir throw (xml::sax::SAXException, RuntimeException); 85cdf0e10cSrcweir virtual Reference< xml::input::XElement > SAL_CALL startRootElement( 86cdf0e10cSrcweir sal_Int32 nUid, OUString const & rLocalName, 87cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes ) 88cdf0e10cSrcweir throw (xml::sax::SAXException, RuntimeException); 89cdf0e10cSrcweir }; 90cdf0e10cSrcweir 91cdf0e10cSrcweir //================================================================================================== 92cdf0e10cSrcweir class ModuleElement 93cdf0e10cSrcweir : public ::cppu::WeakImplHelper1< xml::input::XElement > 94cdf0e10cSrcweir { 95cdf0e10cSrcweir protected: 96cdf0e10cSrcweir ModuleImport * _pImport; 97cdf0e10cSrcweir ModuleElement * _pParent; 98cdf0e10cSrcweir 99cdf0e10cSrcweir OUString _aLocalName; 100cdf0e10cSrcweir Reference< xml::input::XAttributes > _xAttributes; 101cdf0e10cSrcweir ::rtl::OUStringBuffer _StrBuffer; 102cdf0e10cSrcweir 103cdf0e10cSrcweir public: 104cdf0e10cSrcweir ModuleElement( 105cdf0e10cSrcweir OUString const & rLocalName, 106cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes, 107cdf0e10cSrcweir ModuleElement * pParent, ModuleImport * pImport ) 108cdf0e10cSrcweir SAL_THROW( () ); 109cdf0e10cSrcweir virtual ~ModuleElement() 110cdf0e10cSrcweir SAL_THROW( () ); 111cdf0e10cSrcweir 112cdf0e10cSrcweir // XElement 113cdf0e10cSrcweir virtual Reference< xml::input::XElement > SAL_CALL getParent() 114cdf0e10cSrcweir throw (RuntimeException); 115cdf0e10cSrcweir virtual OUString SAL_CALL getLocalName() 116cdf0e10cSrcweir throw (RuntimeException); 117cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getUid() 118cdf0e10cSrcweir throw (RuntimeException); 119cdf0e10cSrcweir virtual Reference< xml::input::XAttributes > SAL_CALL getAttributes() 120cdf0e10cSrcweir throw (RuntimeException); 121cdf0e10cSrcweir virtual void SAL_CALL ignorableWhitespace( 122cdf0e10cSrcweir OUString const & rWhitespaces ) 123cdf0e10cSrcweir throw (xml::sax::SAXException, RuntimeException); 124cdf0e10cSrcweir virtual void SAL_CALL characters( OUString const & rChars ) 125cdf0e10cSrcweir throw (xml::sax::SAXException, RuntimeException); 126cdf0e10cSrcweir virtual void SAL_CALL processingInstruction( 127cdf0e10cSrcweir OUString const & rTarget, OUString const & rData ) 128cdf0e10cSrcweir throw (xml::sax::SAXException, RuntimeException); 129cdf0e10cSrcweir virtual void SAL_CALL endElement() 130cdf0e10cSrcweir throw (xml::sax::SAXException, RuntimeException); 131cdf0e10cSrcweir virtual Reference< xml::input::XElement > SAL_CALL startChildElement( 132cdf0e10cSrcweir sal_Int32 nUid, OUString const & rLocalName, 133cdf0e10cSrcweir Reference< xml::input::XAttributes > const & xAttributes ) 134cdf0e10cSrcweir throw (xml::sax::SAXException, RuntimeException); 135cdf0e10cSrcweir }; 136cdf0e10cSrcweir 137cdf0e10cSrcweir //================================================================================================== 138cdf0e10cSrcweir 139cdf0e10cSrcweir } 140