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