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 <xmloff/xmlimp.hxx>
27
28
29 #include <xmloff/xmlprcon.hxx>
30
31 using ::rtl::OUString;
32 using ::rtl::OUStringBuffer;
33
34 using namespace ::com::sun::star;
35 using namespace ::std;
36
SvXMLPropertySetContext(SvXMLImport & rImp,sal_uInt16 nPrfx,const OUString & rLName,const uno::Reference<xml::sax::XAttributeList> & xAttrList,sal_uInt32 nFam,vector<XMLPropertyState> & rProps,const UniReference<SvXMLImportPropertyMapper> & rMap,sal_Int32 nSIdx,sal_Int32 nEIdx)37 SvXMLPropertySetContext::SvXMLPropertySetContext(
38 SvXMLImport& rImp, sal_uInt16 nPrfx,
39 const OUString& rLName,
40 const uno::Reference< xml::sax::XAttributeList >& xAttrList,
41 sal_uInt32 nFam,
42 vector< XMLPropertyState > &rProps,
43 const UniReference < SvXMLImportPropertyMapper > &rMap,
44 sal_Int32 nSIdx, sal_Int32 nEIdx )
45 : SvXMLImportContext( rImp, nPrfx, rLName )
46 , mnStartIdx( nSIdx )
47 , mnEndIdx( nEIdx )
48 , mnFamily( nFam )
49 , mrProperties( rProps )
50 , mxMapper( rMap )
51 {
52 mxMapper->importXML( mrProperties, xAttrList,
53 GetImport().GetMM100UnitConverter(),
54 GetImport().GetNamespaceMap(), mnFamily,
55 mnStartIdx, mnEndIdx );
56 }
57
~SvXMLPropertySetContext()58 SvXMLPropertySetContext::~SvXMLPropertySetContext()
59 {
60 }
61
CreateChildContext(sal_uInt16 nPrefix,const OUString & rLocalName,const uno::Reference<xml::sax::XAttributeList> & xAttrList)62 SvXMLImportContext *SvXMLPropertySetContext::CreateChildContext(
63 sal_uInt16 nPrefix,
64 const OUString& rLocalName,
65 const uno::Reference< xml::sax::XAttributeList >& xAttrList )
66 {
67 UniReference< XMLPropertySetMapper > aSetMapper(
68 mxMapper->getPropertySetMapper() );
69 sal_Int32 nEntryIndex = aSetMapper->GetEntryIndex( nPrefix, rLocalName,
70 mnFamily, mnStartIdx );
71
72 if( ( nEntryIndex != -1 ) && (-1 == mnEndIdx || nEntryIndex < mnEndIdx ) &&
73 ( 0 != ( aSetMapper->GetEntryFlags( nEntryIndex )
74 & MID_FLAG_ELEMENT_ITEM_IMPORT ) ) )
75 {
76 XMLPropertyState aProp( nEntryIndex );
77 return CreateChildContext( nPrefix, rLocalName, xAttrList,
78 mrProperties, aProp );
79 }
80 else
81 {
82 return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
83 }
84 }
85
86 /** This method is called from this instance implementation of
87 CreateChildContext if the element matches an entry in the
88 SvXMLImportItemMapper with the mid flag MID_FLAG_ELEMENT
89 */
CreateChildContext(sal_uInt16 nPrefix,const rtl::OUString & rLocalName,const uno::Reference<xml::sax::XAttributeList> &,::std::vector<XMLPropertyState> &,const XMLPropertyState &)90 SvXMLImportContext *SvXMLPropertySetContext::CreateChildContext(
91 sal_uInt16 nPrefix,
92 const rtl::OUString& rLocalName,
93 const uno::Reference< xml::sax::XAttributeList >&,
94 ::std::vector< XMLPropertyState > &,
95 const XMLPropertyState& )
96 {
97 return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
98 }
99
100
101