xref: /aoo4110/main/sw/source/filter/xml/xmlitem.cxx (revision b1cdbd2c)
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_sw.hxx"
26 #include <tools/debug.hxx>
27 #include <xmloff/xmlimp.hxx>
28 #include "xmlimpit.hxx"
29 #include "xmlitem.hxx"
30 
31 using ::rtl::OUString;
32 using namespace ::com::sun::star;
33 
SvXMLItemSetContext(SvXMLImport & rImp,sal_uInt16 nPrfx,const OUString & rLName,const uno::Reference<xml::sax::XAttributeList> & xAttrList,SfxItemSet & rISet,SvXMLImportItemMapper & rIMap,const SvXMLUnitConverter & rUnitConverter)34 SvXMLItemSetContext::SvXMLItemSetContext( SvXMLImport& rImp, sal_uInt16 nPrfx,
35 										  const OUString& rLName,
36 										  const uno::Reference< xml::sax::XAttributeList >& xAttrList,
37 										  SfxItemSet& rISet,
38                                           SvXMLImportItemMapper& rIMap,
39 										  const SvXMLUnitConverter& rUnitConverter ):
40 	SvXMLImportContext( rImp, nPrfx, rLName ),
41 	rItemSet( rISet ),
42 	rIMapper( rIMap ),
43 	rUnitConv( rUnitConverter )
44 {
45     rIMap.importXML( rItemSet, xAttrList, rUnitConv,
46 			   			GetImport().GetNamespaceMap() );
47 }
48 
~SvXMLItemSetContext()49 SvXMLItemSetContext::~SvXMLItemSetContext()
50 {
51 }
52 
CreateChildContext(sal_uInt16 nPrefix,const OUString & rLocalName,const uno::Reference<xml::sax::XAttributeList> & xAttrList)53 SvXMLImportContext *SvXMLItemSetContext::CreateChildContext( sal_uInt16 nPrefix,
54 											const OUString& rLocalName,
55 											const uno::Reference< xml::sax::XAttributeList >& xAttrList )
56 {
57 	SvXMLItemMapEntriesRef xMapEntries = rIMapper.getMapEntries();
58 	SvXMLItemMapEntry* pEntry = xMapEntries->getByName( nPrefix, rLocalName );
59 
60 	if( pEntry && 0 != (pEntry->nMemberId & MID_SW_FLAG_ELEMENT_ITEM_IMPORT) )
61 	{
62 		return CreateChildContext( nPrefix, rLocalName, xAttrList,
63 								   rItemSet, *pEntry, rUnitConv );
64 	}
65 
66 	return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
67 }
68 
69 /** This method is called from this instance implementation of
70 	CreateChildContext if the element matches an entry in the
71 	SvXMLImportItemMapper with the mid flag MID_SW_FLAG_ELEMENT
72 */
CreateChildContext(sal_uInt16 nPrefix,const rtl::OUString & rLocalName,const uno::Reference<xml::sax::XAttributeList> &,SfxItemSet &,const SvXMLItemMapEntry &,const SvXMLUnitConverter &)73 SvXMLImportContext *SvXMLItemSetContext::CreateChildContext( sal_uInt16 nPrefix,
74 								   const rtl::OUString& rLocalName,
75 								   const uno::Reference< xml::sax::XAttributeList >& /*xAttrList*/,
76 						 		   SfxItemSet&  /*rItemSet*/,
77 								   const SvXMLItemMapEntry& /*rEntry*/,
78 								   const SvXMLUnitConverter& /*rUnitConv*/ )
79 {
80 	return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
81 }
82 
83 
84