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 
27 
28 #include "XMLIndexBodyContext.hxx"
29 #include <xmloff/xmlictxt.hxx>
30 #include <xmloff/xmlimp.hxx>
31 #include <xmloff/txtimp.hxx>
32 #include <tools/debug.hxx>
33 #include <rtl/ustring.hxx>
34 
35 using ::rtl::OUString;
36 using ::com::sun::star::uno::Reference;
37 using ::com::sun::star::xml::sax::XAttributeList;
38 
39 
40 TYPEINIT1( XMLIndexBodyContext, SvXMLImportContext);
41 
XMLIndexBodyContext(SvXMLImport & rImport,sal_uInt16 nPrfx,const::rtl::OUString & rLocalName)42 XMLIndexBodyContext::XMLIndexBodyContext(
43 	SvXMLImport& rImport,
44 	sal_uInt16 nPrfx,
45 	const ::rtl::OUString& rLocalName ) :
46         SvXMLImportContext(rImport, nPrfx, rLocalName),
47         bHasContent(sal_False)
48 {
49 }
50 
~XMLIndexBodyContext()51 XMLIndexBodyContext::~XMLIndexBodyContext()
52 {
53 }
54 
CreateChildContext(sal_uInt16 nPrefix,const OUString & rLocalName,const Reference<XAttributeList> & xAttrList)55 SvXMLImportContext* XMLIndexBodyContext::CreateChildContext(
56 	sal_uInt16 nPrefix,
57 	const OUString& rLocalName,
58 	const Reference<XAttributeList> & xAttrList)
59 {
60 	SvXMLImportContext* pContext = NULL;
61 
62 	// return text content (if possible)
63 	pContext = GetImport().GetTextImport()->CreateTextChildContext(
64 		GetImport(), nPrefix, rLocalName, xAttrList, XML_TEXT_TYPE_SECTION );
65 	if (NULL == pContext)
66 	{
67 		pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
68 	}
69     else
70         bHasContent = sal_True;
71 
72 	return pContext;
73 }
74