summaryrefslogtreecommitdiff
path: root/xmloff/source/style
diff options
context:
space:
mode:
authorRüdiger Timm <rt@openoffice.org>2008-06-06 10:50:34 +0000
committerRüdiger Timm <rt@openoffice.org>2008-06-06 10:50:34 +0000
commitee3d41d4ad455a2b4370236ac2542fedaec412e6 (patch)
tree87ef48f3fedd9e24d7fbb0b4b863b6e7a55b2c33 /xmloff/source/style
parentc49ffb919f9a500d27059684b4c22491aa85d6cf (diff)
INTEGRATION: CWS impressodf12 (1.42.20); FILE MERGED
2008/05/15 13:16:19 cl 1.42.20.1: #i35937# add property flag to import attributes to alien attribute container
Diffstat (limited to 'xmloff/source/style')
-rw-r--r--xmloff/source/style/xmlimppr.cxx142
1 files changed, 78 insertions, 64 deletions
diff --git a/xmloff/source/style/xmlimppr.cxx b/xmloff/source/style/xmlimppr.cxx
index 77efa105ff3a..71ac9c5aac4c 100644
--- a/xmloff/source/style/xmlimppr.cxx
+++ b/xmloff/source/style/xmlimppr.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: xmlimppr.cxx,v $
- * $Revision: 1.42 $
+ * $Revision: 1.43 $
*
* This file is part of OpenOffice.org.
*
@@ -50,6 +50,8 @@
#include "xmlerror.hxx"
#include <tools/debug.hxx>
+#include "xmloff/contextid.hxx"
+
// STL includes
#include <algorithm>
#include <functional>
@@ -168,6 +170,7 @@ void SvXMLImportPropertyMapper::importXML(
// for better error reporting: this should be set true if no
// warning is needed
sal_Bool bNoWarning = sal_False;
+ bool bAlienImport = false;
do
{
@@ -180,89 +183,100 @@ void SvXMLImportPropertyMapper::importXML(
// create a XMLPropertyState with an empty value
nFlags = maPropMapper->GetEntryFlags( nIndex );
- if( ( nFlags & MID_FLAG_ELEMENT_ITEM_IMPORT ) == 0 )
+ if( (( nFlags & MID_FLAG_NO_PROPERTY ) == MID_FLAG_NO_PROPERTY) && (maPropMapper->GetEntryContextId( nIndex ) == CTF_ALIEN_ATTRIBUTE_IMPORT) )
{
- XMLPropertyState aNewProperty( nIndex );
- sal_Int32 nReference = -1;
-
- // if this is a multi attribute check if another attribute already set
- // this any. If so use this as a initial value
- if( ( nFlags & MID_FLAG_MERGE_PROPERTY ) != 0 )
+ bAlienImport = true;
+ nIndex = -1;
+ }
+ else
+ {
+ if( ( nFlags & MID_FLAG_ELEMENT_ITEM_IMPORT ) == 0 )
{
- const OUString aAPIName( maPropMapper->GetEntryAPIName( nIndex ) );
- const sal_Int32 nSize = rProperties.size();
- for( nReference = 0; nReference < nSize; nReference++ )
+ XMLPropertyState aNewProperty( nIndex );
+ sal_Int32 nReference = -1;
+
+ // if this is a multi attribute check if another attribute already set
+ // this any. If so use this as a initial value
+ if( ( nFlags & MID_FLAG_MERGE_PROPERTY ) != 0 )
{
- sal_Int32 nRefIdx = rProperties[nReference].mnIndex;
- if( (nRefIdx != -1) && (nIndex != nRefIdx) &&
- (maPropMapper->GetEntryAPIName( nRefIdx ) == aAPIName ))
+ const OUString aAPIName( maPropMapper->GetEntryAPIName( nIndex ) );
+ const sal_Int32 nSize = rProperties.size();
+ for( nReference = 0; nReference < nSize; nReference++ )
{
- aNewProperty = rProperties[nReference];
- aNewProperty.mnIndex = nIndex;
- break;
+ sal_Int32 nRefIdx = rProperties[nReference].mnIndex;
+ if( (nRefIdx != -1) && (nIndex != nRefIdx) &&
+ (maPropMapper->GetEntryAPIName( nRefIdx ) == aAPIName ))
+ {
+ aNewProperty = rProperties[nReference];
+ aNewProperty.mnIndex = nIndex;
+ break;
+ }
}
- }
- if( nReference == nSize )
- nReference = -1;
- }
+ if( nReference == nSize )
+ nReference = -1;
+ }
- sal_Bool bSet = sal_False;
- if( ( nFlags & MID_FLAG_SPECIAL_ITEM_IMPORT ) == 0 )
- {
- // let the XMLPropertySetMapper decide how to import the value
- bSet = maPropMapper->importXML( rValue, aNewProperty,
- rUnitConverter );
- }
- else
- {
- sal_uInt32 nOldSize = rProperties.size();
+ sal_Bool bSet = sal_False;
+ if( ( nFlags & MID_FLAG_SPECIAL_ITEM_IMPORT ) == 0 )
+ {
+ // let the XMLPropertySetMapper decide how to import the value
+ bSet = maPropMapper->importXML( rValue, aNewProperty,
+ rUnitConverter );
+ }
+ else
+ {
+ sal_uInt32 nOldSize = rProperties.size();
- bSet = handleSpecialItem( aNewProperty, rProperties,
- rValue, rUnitConverter,
- rNamespaceMap );
+ bSet = handleSpecialItem( aNewProperty, rProperties,
+ rValue, rUnitConverter,
+ rNamespaceMap );
- // no warning if handleSpecialItem added properties
- bNoWarning |= ( nOldSize != rProperties.size() );
- }
+ // no warning if handleSpecialItem added properties
+ bNoWarning |= ( nOldSize != rProperties.size() );
+ }
- // no warning if we found could set the item. This
- // 'remembers' bSet across multi properties.
- bNoWarning |= bSet;
+ // no warning if we found could set the item. This
+ // 'remembers' bSet across multi properties.
+ bNoWarning |= bSet;
- // store the property in the given vector
- if( bSet )
- {
- if( nReference == -1 )
- rProperties.push_back( aNewProperty );
+ // store the property in the given vector
+ if( bSet )
+ {
+ if( nReference == -1 )
+ rProperties.push_back( aNewProperty );
+ else
+ rProperties[nReference] = aNewProperty;
+ }
else
- rProperties[nReference] = aNewProperty;
- }
- else
- {
- // warn about unknown value. Unless it's a
- // multi property: Then we get another chance
- // to set the value.
- if( !bNoWarning &&
- ((nFlags & MID_FLAG_MULTI_PROPERTY) == 0) )
{
- Sequence<OUString> aSeq(2);
- aSeq[0] = rAttrName;
- aSeq[1] = rValue;
- rImport.SetError( XMLERROR_FLAG_WARNING |
- XMLERROR_STYLE_ATTR_VALUE,
- aSeq );
+ // warn about unknown value. Unless it's a
+ // multi property: Then we get another chance
+ // to set the value.
+ if( !bNoWarning &&
+ ((nFlags & MID_FLAG_MULTI_PROPERTY) == 0) )
+ {
+ Sequence<OUString> aSeq(2);
+ aSeq[0] = rAttrName;
+ aSeq[1] = rValue;
+ rImport.SetError( XMLERROR_FLAG_WARNING |
+ XMLERROR_STYLE_ATTR_VALUE,
+ aSeq );
+ }
}
}
+ bFound = sal_True;
+ continue;
}
- bFound = sal_True;
}
- else if( !bFound )
+
+ if( !bFound )
{
- if( (XML_NAMESPACE_UNKNOWN_FLAG & nPrefix) || (XML_NAMESPACE_NONE == nPrefix) )
+ if( (XML_NAMESPACE_UNKNOWN_FLAG & nPrefix) || (XML_NAMESPACE_NONE == nPrefix) || bAlienImport )
{
OSL_ENSURE( XML_NAMESPACE_NONE == nPrefix ||
- (XML_NAMESPACE_UNKNOWN_FLAG & nPrefix),
+ (XML_NAMESPACE_UNKNOWN_FLAG & nPrefix) ||
+ bAlienImport,
"unknown attribute - might be a new feature?" );
if( !xAttrContainer.is() )
{