xref: /AOO41X/main/xmloff/source/text/XMLAutoTextContainerEventImport.cxx (revision 63bba73cc51e0afb45f8a8d578158724bb5afee8)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_xmloff.hxx"
26 #include "XMLAutoTextContainerEventImport.hxx"
27 #include <com/sun/star/uno/Reference.hxx>
28 #include <com/sun/star/xml/sax/XAttributeList.hpp>
29 #include <com/sun/star/container/XNameReplace.hpp>
30 #include <xmloff/xmlimp.hxx>
31 #include "xmloff/xmlnmspe.hxx"
32 #include <xmloff/nmspmap.hxx>
33 #include <xmloff/xmltoken.hxx>
34 #include <xmloff/XMLEventsImportContext.hxx>
35 
36 
37 using namespace ::com::sun::star;
38 
39 using ::rtl::OUString;
40 using ::com::sun::star::uno::Any;
41 using ::com::sun::star::uno::Reference;
42 using ::com::sun::star::xml::sax::XAttributeList;
43 using ::com::sun::star::container::XNameReplace;
44 using ::xmloff::token::IsXMLToken;
45 using ::xmloff::token::XML_EVENT_LISTENERS;
46 
47 
48 TYPEINIT1(XMLAutoTextContainerEventImport, SvXMLImportContext);
49 
50 
XMLAutoTextContainerEventImport(SvXMLImport & rImport,sal_uInt16 nPrfx,const OUString & rLName,const Reference<XNameReplace> & rEvnts)51 XMLAutoTextContainerEventImport::XMLAutoTextContainerEventImport(
52     SvXMLImport& rImport,
53     sal_uInt16 nPrfx,
54     const OUString& rLName,
55     const Reference<XNameReplace> & rEvnts ) :
56         SvXMLImportContext(rImport, nPrfx, rLName),
57         rEvents(rEvnts)
58 {
59 }
60 
~XMLAutoTextContainerEventImport()61 XMLAutoTextContainerEventImport::~XMLAutoTextContainerEventImport()
62 {
63 }
64 
CreateChildContext(sal_uInt16 nPrefix,const OUString & rLocalName,const Reference<XAttributeList> &)65 SvXMLImportContext* XMLAutoTextContainerEventImport::CreateChildContext(
66     sal_uInt16 nPrefix,
67     const OUString& rLocalName,
68     const Reference<XAttributeList> & )
69 {
70     if ( (XML_NAMESPACE_OFFICE == nPrefix) &&
71          IsXMLToken( rLocalName, XML_EVENT_LISTENERS)   )
72     {
73         return new XMLEventsImportContext(GetImport(), nPrefix, rLocalName,
74                                           rEvents);
75     }
76     else
77         return new SvXMLImportContext(GetImport(), nPrefix, rLocalName);
78 }
79