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 : #ifndef INCLUDED_XMLSCRIPT_SOURCE_XMLMOD_IMEXP_IMP_SHARE_HXX
21 : #define INCLUDED_XMLSCRIPT_SOURCE_XMLMOD_IMEXP_IMP_SHARE_HXX
22 :
23 : #include <xmlscript/xmlmod_imexp.hxx>
24 :
25 : #include <cppuhelper/implbase1.hxx>
26 : #include <rtl/ustrbuf.hxx>
27 :
28 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
29 : #include <com/sun/star/container/XNameContainer.hpp>
30 : #include <com/sun/star/beans/XPropertySet.hpp>
31 :
32 : #include <com/sun/star/awt/XControlModel.hpp>
33 : #include <com/sun/star/awt/FontDescriptor.hpp>
34 :
35 : #include <com/sun/star/xml/input/XRoot.hpp>
36 :
37 : #include <vector>
38 :
39 : namespace xmlscript
40 : {
41 :
42 : // Script module import
43 :
44 : struct ModuleImport
45 : : public ::cppu::WeakImplHelper1< css::xml::input::XRoot >
46 : {
47 : friend class ModuleElement;
48 :
49 : ModuleDescriptor& mrModuleDesc;
50 :
51 : sal_Int32 XMLNS_SCRIPT_UID;
52 : sal_Int32 XMLNS_LIBRARY_UID;
53 : sal_Int32 XMLNS_XLINK_UID;
54 :
55 : public:
56 78 : ModuleImport(ModuleDescriptor& rModuleDesc)
57 : : mrModuleDesc(rModuleDesc)
58 : , XMLNS_SCRIPT_UID(0)
59 : , XMLNS_LIBRARY_UID(0)
60 78 : , XMLNS_XLINK_UID(0)
61 : {
62 78 : }
63 :
64 : virtual ~ModuleImport();
65 :
66 : // XRoot
67 : virtual void SAL_CALL startDocument(
68 : css::uno::Reference< css::xml::input::XNamespaceMapping > const & xNamespaceMapping )
69 : throw (css::xml::sax::SAXException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
70 : virtual void SAL_CALL endDocument()
71 : throw (css::xml::sax::SAXException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
72 : virtual void SAL_CALL processingInstruction(
73 : OUString const & rTarget, OUString const & rData )
74 : throw (css::xml::sax::SAXException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
75 : virtual void SAL_CALL setDocumentLocator(
76 : css::uno::Reference< css::xml::sax::XLocator > const & xLocator )
77 : throw (css::xml::sax::SAXException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
78 : virtual css::uno::Reference< css::xml::input::XElement > SAL_CALL startRootElement(
79 : sal_Int32 nUid, OUString const & rLocalName,
80 : css::uno::Reference< css::xml::input::XAttributes > const & xAttributes )
81 : throw (css::xml::sax::SAXException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
82 : };
83 :
84 : class ModuleElement
85 : : public ::cppu::WeakImplHelper1< css::xml::input::XElement >
86 : {
87 : protected:
88 : ModuleImport * _pImport;
89 : ModuleElement * _pParent;
90 :
91 : OUString _aLocalName;
92 : css::uno::Reference< css::xml::input::XAttributes > _xAttributes;
93 : OUStringBuffer _StrBuffer;
94 :
95 : public:
96 : ModuleElement(
97 : OUString const & rLocalName,
98 : css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
99 : ModuleElement * pParent, ModuleImport * pImport );
100 : virtual ~ModuleElement();
101 :
102 : // XElement
103 : virtual css::uno::Reference< css::xml::input::XElement > SAL_CALL getParent()
104 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
105 : virtual OUString SAL_CALL getLocalName()
106 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
107 : virtual sal_Int32 SAL_CALL getUid()
108 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
109 : virtual css::uno::Reference< css::xml::input::XAttributes > SAL_CALL getAttributes()
110 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
111 : virtual void SAL_CALL ignorableWhitespace(
112 : OUString const & rWhitespaces )
113 : throw (css::xml::sax::SAXException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
114 : virtual void SAL_CALL characters( OUString const & rChars )
115 : throw (css::xml::sax::SAXException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
116 : virtual void SAL_CALL processingInstruction(
117 : OUString const & rTarget, OUString const & rData )
118 : throw (css::xml::sax::SAXException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
119 : virtual void SAL_CALL endElement()
120 : throw (css::xml::sax::SAXException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
121 : virtual css::uno::Reference< css::xml::input::XElement > SAL_CALL startChildElement(
122 : sal_Int32 nUid, OUString const & rLocalName,
123 : css::uno::Reference< css::xml::input::XAttributes > const & xAttributes )
124 : throw (css::xml::sax::SAXException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
125 : };
126 :
127 : }
128 :
129 : #endif // INCLUDED_XMLSCRIPT_SOURCE_XMLMOD_IMEXP_IMP_SHARE_HXX
130 :
131 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|