Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <xmlscript/xmlmod_imexp.hxx>
21 :
22 : #include <cppuhelper/implbase1.hxx>
23 : #include <rtl/ustrbuf.hxx>
24 :
25 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
26 : #include <com/sun/star/container/XNameContainer.hpp>
27 : #include <com/sun/star/beans/XPropertySet.hpp>
28 :
29 : #include <com/sun/star/awt/XControlModel.hpp>
30 : #include <com/sun/star/awt/FontDescriptor.hpp>
31 :
32 : #include <com/sun/star/xml/input/XRoot.hpp>
33 :
34 : #include <vector>
35 :
36 : using namespace ::rtl;
37 : using namespace ::std;
38 : using namespace ::com::sun::star;
39 : using namespace ::com::sun::star::uno;
40 :
41 : namespace xmlscript
42 : {
43 :
44 : // Script module import
45 :
46 : struct ModuleImport
47 : : public ::cppu::WeakImplHelper1< xml::input::XRoot >
48 : {
49 : friend class ModuleElement;
50 :
51 : ModuleDescriptor& mrModuleDesc;
52 :
53 : sal_Int32 XMLNS_SCRIPT_UID;
54 : sal_Int32 XMLNS_LIBRARY_UID;
55 : sal_Int32 XMLNS_XLINK_UID;
56 :
57 : public:
58 0 : ModuleImport(ModuleDescriptor& rModuleDesc) SAL_THROW(())
59 : : mrModuleDesc(rModuleDesc)
60 : , XMLNS_SCRIPT_UID(0)
61 : , XMLNS_LIBRARY_UID(0)
62 0 : , XMLNS_XLINK_UID(0)
63 : {
64 0 : }
65 :
66 : virtual ~ModuleImport() SAL_THROW(());
67 :
68 : // XRoot
69 : virtual void SAL_CALL startDocument(
70 : Reference< xml::input::XNamespaceMapping > const & xNamespaceMapping )
71 : throw (xml::sax::SAXException, RuntimeException, std::exception) SAL_OVERRIDE;
72 : virtual void SAL_CALL endDocument()
73 : throw (xml::sax::SAXException, RuntimeException, std::exception) SAL_OVERRIDE;
74 : virtual void SAL_CALL processingInstruction(
75 : OUString const & rTarget, OUString const & rData )
76 : throw (xml::sax::SAXException, RuntimeException, std::exception) SAL_OVERRIDE;
77 : virtual void SAL_CALL setDocumentLocator(
78 : Reference< xml::sax::XLocator > const & xLocator )
79 : throw (xml::sax::SAXException, RuntimeException, std::exception) SAL_OVERRIDE;
80 : virtual Reference< xml::input::XElement > SAL_CALL startRootElement(
81 : sal_Int32 nUid, OUString const & rLocalName,
82 : Reference< xml::input::XAttributes > const & xAttributes )
83 : throw (xml::sax::SAXException, RuntimeException, std::exception) SAL_OVERRIDE;
84 : };
85 :
86 : class ModuleElement
87 : : public ::cppu::WeakImplHelper1< xml::input::XElement >
88 : {
89 : protected:
90 : ModuleImport * _pImport;
91 : ModuleElement * _pParent;
92 :
93 : OUString _aLocalName;
94 : Reference< xml::input::XAttributes > _xAttributes;
95 : OUStringBuffer _StrBuffer;
96 :
97 : public:
98 : ModuleElement(
99 : OUString const & rLocalName,
100 : Reference< xml::input::XAttributes > const & xAttributes,
101 : ModuleElement * pParent, ModuleImport * pImport )
102 : SAL_THROW(());
103 : virtual ~ModuleElement()
104 : SAL_THROW(());
105 :
106 : // XElement
107 : virtual Reference< xml::input::XElement > SAL_CALL getParent()
108 : throw (RuntimeException, std::exception) SAL_OVERRIDE;
109 : virtual OUString SAL_CALL getLocalName()
110 : throw (RuntimeException, std::exception) SAL_OVERRIDE;
111 : virtual sal_Int32 SAL_CALL getUid()
112 : throw (RuntimeException, std::exception) SAL_OVERRIDE;
113 : virtual Reference< xml::input::XAttributes > SAL_CALL getAttributes()
114 : throw (RuntimeException, std::exception) SAL_OVERRIDE;
115 : virtual void SAL_CALL ignorableWhitespace(
116 : OUString const & rWhitespaces )
117 : throw (xml::sax::SAXException, RuntimeException, std::exception) SAL_OVERRIDE;
118 : virtual void SAL_CALL characters( OUString const & rChars )
119 : throw (xml::sax::SAXException, RuntimeException, std::exception) SAL_OVERRIDE;
120 : virtual void SAL_CALL processingInstruction(
121 : OUString const & rTarget, OUString const & rData )
122 : throw (xml::sax::SAXException, RuntimeException, std::exception) SAL_OVERRIDE;
123 : virtual void SAL_CALL endElement()
124 : throw (xml::sax::SAXException, RuntimeException, std::exception) SAL_OVERRIDE;
125 : virtual Reference< xml::input::XElement > SAL_CALL startChildElement(
126 : sal_Int32 nUid, OUString const & rLocalName,
127 : Reference< xml::input::XAttributes > const & xAttributes )
128 : throw (xml::sax::SAXException, RuntimeException, std::exception) SAL_OVERRIDE;
129 : };
130 :
131 : }
132 :
133 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|