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