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