1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xmlprcon.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_xmloff.hxx"
33 #include <xmloff/xmlimp.hxx>
36 #include <xmloff/xmlprcon.hxx>
38 using ::rtl::OUString
;
39 using ::rtl::OUStringBuffer
;
41 using namespace ::com::sun::star
;
42 using namespace ::std
;
44 SvXMLPropertySetContext::SvXMLPropertySetContext(
45 SvXMLImport
& rImp
, USHORT nPrfx
,
46 const OUString
& rLName
,
47 const uno::Reference
< xml::sax::XAttributeList
>& xAttrList
,
49 vector
< XMLPropertyState
> &rProps
,
50 const UniReference
< SvXMLImportPropertyMapper
> &rMap
,
51 sal_Int32 nSIdx
, sal_Int32 nEIdx
)
52 : SvXMLImportContext( rImp
, nPrfx
, rLName
)
56 , mrProperties( rProps
)
59 mxMapper
->importXML( mrProperties
, xAttrList
,
60 GetImport().GetMM100UnitConverter(),
61 GetImport().GetNamespaceMap(), mnFamily
,
62 mnStartIdx
, mnEndIdx
);
65 SvXMLPropertySetContext::~SvXMLPropertySetContext()
69 SvXMLImportContext
*SvXMLPropertySetContext::CreateChildContext(
71 const OUString
& rLocalName
,
72 const uno::Reference
< xml::sax::XAttributeList
>& xAttrList
)
74 UniReference
< XMLPropertySetMapper
> aSetMapper(
75 mxMapper
->getPropertySetMapper() );
76 sal_Int32 nEntryIndex
= aSetMapper
->GetEntryIndex( nPrefix
, rLocalName
,
77 mnFamily
, mnStartIdx
);
79 if( ( nEntryIndex
!= -1 ) && (-1 == mnEndIdx
|| nEntryIndex
< mnEndIdx
) &&
80 ( 0 != ( aSetMapper
->GetEntryFlags( nEntryIndex
)
81 & MID_FLAG_ELEMENT_ITEM_IMPORT
) ) )
83 XMLPropertyState
aProp( nEntryIndex
);
84 return CreateChildContext( nPrefix
, rLocalName
, xAttrList
,
85 mrProperties
, aProp
);
89 return new SvXMLImportContext( GetImport(), nPrefix
, rLocalName
);
93 /** This method is called from this instance implementation of
94 CreateChildContext if the element matches an entry in the
95 SvXMLImportItemMapper with the mid flag MID_FLAG_ELEMENT
97 SvXMLImportContext
*SvXMLPropertySetContext::CreateChildContext(
99 const rtl::OUString
& rLocalName
,
100 const uno::Reference
< xml::sax::XAttributeList
>&,
101 ::std::vector
< XMLPropertyState
> &,
102 const XMLPropertyState
& )
104 return new SvXMLImportContext( GetImport(), nPrefix
, rLocalName
);