diff options
author | Michael Brauer <mib@openoffice.org> | 2000-10-25 10:46:38 +0000 |
---|---|---|
committer | Michael Brauer <mib@openoffice.org> | 2000-10-25 10:46:38 +0000 |
commit | 9082e058fa2df018e819feb180b49437dd4b0e60 (patch) | |
tree | 160c995af94e5905e16025b2bffaa08a45c8599c /xmloff | |
parent | 853dc374b05206ed62c6c63321f84bae50b68e08 (diff) |
start and end indices for property maps
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/style/xmlimppr.cxx | 25 | ||||
-rw-r--r-- | xmloff/source/style/xmlprcon.cxx | 57 |
2 files changed, 52 insertions, 30 deletions
diff --git a/xmloff/source/style/xmlimppr.cxx b/xmloff/source/style/xmlimppr.cxx index b1be1e61b4b2..72d11fa320d4 100644 --- a/xmloff/source/style/xmlimppr.cxx +++ b/xmloff/source/style/xmlimppr.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlimppr.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: cl $ $Date: 2000-10-20 14:53:32 $ + * last change: $Author: mib $ $Date: 2000-10-25 11:46:38 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -102,17 +102,32 @@ SvXMLImportPropertyMapper::~SvXMLImportPropertyMapper() { } -/** fills the given itemset with the attributes in the given list */ void SvXMLImportPropertyMapper::importXML( vector< XMLPropertyState >& rProperties, Reference< XAttributeList > xAttrList, const SvXMLUnitConverter& rUnitConverter, const SvXMLNamespaceMap& rNamespaceMap ) const { + importXML( rProperties, xAttrList, rUnitConverter, rNamespaceMap, -1, -1 ); +} + +/** fills the given itemset with the attributes in the given list */ +void SvXMLImportPropertyMapper::importXML( + vector< XMLPropertyState >& rProperties, + Reference< XAttributeList > xAttrList, + const SvXMLUnitConverter& rUnitConverter, + const SvXMLNamespaceMap& rNamespaceMap, + sal_Int32 nStartIdx, + sal_Int32 nEndIdx ) const +{ INT16 nAttr = xAttrList->getLength(); Reference< XNameContainer > xAttrContainer; + if( -1 == nStartIdx ) + nStartIdx = 0; + if( -1 == nEndIdx ) + nEndIdx = maPropMapper->GetEntryCount(); for( INT16 i=0; i < nAttr; i++ ) { const OUString& rAttrName = xAttrList->getNameByIndex( i ); @@ -125,14 +140,14 @@ void SvXMLImportPropertyMapper::importXML( const OUString& rValue = xAttrList->getValueByIndex( i ); - sal_Int32 nIndex = -1; // index of actual property map entry + sal_Int32 nIndex = nStartIdx; // index of actual property map entry sal_uInt32 nFlags = 0; // flags of actual property map entry do { // find an entry for this attribute nIndex = maPropMapper->GetEntryIndex( nPrefix, aLocalName, nIndex ); - if( nIndex > -1 ) + if( nIndex > -1 && nIndex < nEndIdx ) { // create a XMLPropertyState with an empty value diff --git a/xmloff/source/style/xmlprcon.cxx b/xmloff/source/style/xmlprcon.cxx index 22603d56b684..526728eed511 100644 --- a/xmloff/source/style/xmlprcon.cxx +++ b/xmloff/source/style/xmlprcon.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlprcon.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 17:07:06 $ + * last change: $Author: mib $ $Date: 2000-10-25 11:46:38 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -72,38 +72,45 @@ using namespace ::rtl; using namespace ::com::sun::star; using namespace ::std; -SvXMLPropertySetContext::SvXMLPropertySetContext( SvXMLImport& rImp, USHORT nPrfx, - const OUString& rLName, - const uno::Reference< xml::sax::XAttributeList >& xAttrList, - vector< XMLPropertyState > &rProps, - const UniReference < SvXMLImportPropertyMapper > &rMap ): +SvXMLPropertySetContext::SvXMLPropertySetContext( + SvXMLImport& rImp, USHORT nPrfx, + const OUString& rLName, + const uno::Reference< xml::sax::XAttributeList >& xAttrList, + vector< XMLPropertyState > &rProps, + const UniReference < SvXMLImportPropertyMapper > &rMap, + sal_Int32 nSIdx, sal_Int32 nEIdx ): SvXMLImportContext( rImp, nPrfx, rLName ), rProperties( rProps ), - xMapper ( rMap ) - + xMapper ( rMap ), + nStartIdx( nSIdx ), + nEndIdx( nEIdx ) { xMapper->importXML( rProperties, xAttrList, GetImport().GetMM100UnitConverter(), - GetImport().GetNamespaceMap() ); + GetImport().GetNamespaceMap(), nStartIdx, nEndIdx ); } SvXMLPropertySetContext::~SvXMLPropertySetContext() { } -SvXMLImportContext *SvXMLPropertySetContext::CreateChildContext( USHORT nPrefix, - const OUString& rLocalName, - const uno::Reference< xml::sax::XAttributeList >& xAttrList ) +SvXMLImportContext *SvXMLPropertySetContext::CreateChildContext( + USHORT nPrefix, + const OUString& rLocalName, + const uno::Reference< xml::sax::XAttributeList >& xAttrList ) { - UniReference< XMLPropertySetMapper > aSetMapper( xMapper->getPropertySetMapper() ); - sal_Int32 nEntryIndex = aSetMapper->GetEntryIndex( nPrefix, rLocalName ); + UniReference< XMLPropertySetMapper > aSetMapper( + xMapper->getPropertySetMapper() ); + sal_Int32 nEntryIndex = aSetMapper->GetEntryIndex( nPrefix, rLocalName, + nStartIdx ); - if( ( nEntryIndex != -1 ) && - ( 0 != ( aSetMapper->GetEntryFlags( nEntryIndex ) & MID_FLAG_ELEMENT_ITEM_IMPORT ) ) ) + if( ( nEntryIndex != -1 ) && (-1 == nEndIdx || nEntryIndex < nEndIdx ) && + ( 0 != ( aSetMapper->GetEntryFlags( nEntryIndex ) + & MID_FLAG_ELEMENT_ITEM_IMPORT ) ) ) { - XMLPropertyState aProp( nEntryIndex ); // See comment in the body of CreateChildContext + XMLPropertyState aProp( nEntryIndex ); return CreateChildContext( nPrefix, rLocalName, xAttrList, - rProperties, aProp /*rItemSet, *pEntry*/ ); + rProperties, aProp ); } else { @@ -115,12 +122,12 @@ SvXMLImportContext *SvXMLPropertySetContext::CreateChildContext( USHORT nPrefix, CreateChildContext if the element matches an entry in the SvXMLImportItemMapper with the mid flag MID_FLAG_ELEMENT */ -SvXMLImportContext *SvXMLPropertySetContext::CreateChildContext( USHORT nPrefix, - const NAMESPACE_RTL(OUString)& rLocalName, - const uno::Reference< xml::sax::XAttributeList >& xAttrList, - ::std::vector< XMLPropertyState > &rProperties, - const XMLPropertyState& rProp ) // instead of a SvXMLItemMapEntry I use now a XMLPropertyState. Is that reasonable, I'm not sure ???? - //const SvXMLItemMapEntry& rEntry, +SvXMLImportContext *SvXMLPropertySetContext::CreateChildContext( + USHORT nPrefix, + const NAMESPACE_RTL(OUString)& rLocalName, + const uno::Reference< xml::sax::XAttributeList >& xAttrList, + ::std::vector< XMLPropertyState > &rProperties, + const XMLPropertyState& rProp ) { return new SvXMLImportContext( GetImport(), nPrefix, rLocalName ); } |