summaryrefslogtreecommitdiff
path: root/sw/source/filter/xml
diff options
context:
space:
mode:
authorMichael Brauer <mib@openoffice.org>2001-11-13 17:24:21 +0000
committerMichael Brauer <mib@openoffice.org>2001-11-13 17:24:21 +0000
commitd3ddd58b55ea1f83a145f220581b375903ae8012 (patch)
tree73f5555208580656bc53be7f0285e417fa91945e /sw/source/filter/xml
parent7f8d96deaa79dc271ec36212c74d0b23715ff7c6 (diff)
#94498#: keep unknown attributes from own namespaces
Diffstat (limited to 'sw/source/filter/xml')
-rw-r--r--sw/source/filter/xml/xmlexp.cxx79
-rw-r--r--sw/source/filter/xml/xmlimpit.cxx18
2 files changed, 39 insertions, 58 deletions
diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx
index 3cee02a28030..746e487f4a1d 100644
--- a/sw/source/filter/xml/xmlexp.cxx
+++ b/sw/source/filter/xml/xmlexp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlexp.cxx,v $
*
- * $Revision: 1.65 $
+ * $Revision: 1.66 $
*
- * last change: $Author: dvo $ $Date: 2001-11-08 19:06:46 $
+ * last change: $Author: mib $ $Date: 2001-11-13 18:24:21 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -111,6 +111,12 @@
#ifndef _XMLEOHLP_HXX
#include <svx/xmleohlp.hxx>
#endif
+#ifndef _EEITEM_HXX
+#include <svx/eeitem.hxx>
+#endif
+#ifndef _SVDDEF_HXX
+#include <svx/svddef.hxx>
+#endif
#ifndef _XMLOFF_NMSPMAP_HXX
#include <xmloff/nmspmap.hxx>
@@ -322,59 +328,38 @@ sal_uInt32 SwXMLExport::exportDoc( enum XMLTokenEnum eClass )
const SfxPoolItem* pItem;
const SfxItemPool& rPool = pDoc->GetAttrPool();
- sal_uInt16 i=0, nItems = rPool.GetItemCount( RES_UNKNOWNATR_CONTAINER );
- for( i = 0; i < nItems; ++i )
- {
- if( 0 != (pItem = rPool.GetItem( RES_UNKNOWNATR_CONTAINER, i ) ) )
- {
- const SvXMLAttrContainerItem *pUnknown =
- (const SvXMLAttrContainerItem *)pItem;
- if( (pUnknown->GetAttrCount() > 0) )
- {
- sal_uInt16 nIdx = pUnknown->GetFirstNamespaceIndex();
- while( USHRT_MAX != nIdx )
- {
- if( (XML_NAMESPACE_UNKNOWN_FLAG & nIdx) != 0 )
- {
- const OUString& rPrefix = pUnknown->GetPrefix( nIdx );
- // Add namespace declaration for unknown attributes if
- // there aren't existing ones for the prefix used by the
- // attibutes
- _GetNamespaceMap().Add( rPrefix,
- pUnknown->GetNamespace( nIdx ),
- XML_NAMESPACE_UNKNOWN );
- }
- nIdx = pUnknown->GetNextNamespaceIndex( nIdx );
- }
- bExtended = sal_True;
- }
- }
- }
- nItems = rPool.GetItemCount( RES_TXTATR_UNKNOWN_CONTAINER );
- for( i = 0; i < nItems; ++i )
+ sal_uInt16 aWhichIds[5] = { RES_UNKNOWNATR_CONTAINER,
+ RES_TXTATR_UNKNOWN_CONTAINER,
+ SDRATTR_XMLATTRIBUTES,
+ EE_PARA_XMLATTRIBS,
+ EE_CHAR_XMLATTRIBS };
+
+ sal_uInt16 nWhichIds = rPool.GetSecondaryPool() ? 5 : 2;
+ for( sal_uInt16 j=0; j < nWhichIds; j++ )
{
- if( 0 != (pItem = rPool.GetItem( RES_TXTATR_UNKNOWN_CONTAINER, i ) ) )
+ sal_uInt16 nWhichId = aWhichIds[j];
+ sal_uInt16 i=0, nItems = rPool.GetItemCount( nWhichId );
+ for( i = 0; i < nItems; ++i )
{
- const SvXMLAttrContainerItem *pUnknown =
- (const SvXMLAttrContainerItem *)pItem;
- if( (pUnknown->GetAttrCount() > 0) )
+ if( 0 != (pItem = rPool.GetItem( nWhichId , i ) ) )
{
- sal_uInt16 nIdx = pUnknown->GetFirstNamespaceIndex();
- while( USHRT_MAX != nIdx )
+ const SvXMLAttrContainerItem *pUnknown =
+ PTR_CAST( SvXMLAttrContainerItem, pItem );
+ ASSERT( pUnknown, "illegal attribute container item" );
+ if( pUnknown && (pUnknown->GetAttrCount() > 0) )
{
- if( (XML_NAMESPACE_UNKNOWN_FLAG & nIdx) != 0 )
+ sal_uInt16 nIdx = pUnknown->GetFirstNamespaceIndex();
+ while( USHRT_MAX != nIdx )
{
- const OUString& rPrefix = pUnknown->GetPrefix( nIdx );
- // Add namespace declaration for unknown attributes if
- // there aren't existing ones for the prefix used by the
- // attibutes
+ const OUString& rPrefix =
+ pUnknown->GetPrefix( nIdx );
_GetNamespaceMap().Add( rPrefix,
- pUnknown->GetNamespace( nIdx ),
- XML_NAMESPACE_UNKNOWN );
+ pUnknown->GetNamespace( nIdx ),
+ XML_NAMESPACE_UNKNOWN );
+ nIdx = pUnknown->GetNextNamespaceIndex( nIdx );
}
- nIdx = pUnknown->GetNextNamespaceIndex( nIdx );
+ bExtended = sal_True;
}
- bExtended = sal_True;
}
}
}
diff --git a/sw/source/filter/xml/xmlimpit.cxx b/sw/source/filter/xml/xmlimpit.cxx
index 5b3c250b0a4e..ec739da6fd78 100644
--- a/sw/source/filter/xml/xmlimpit.cxx
+++ b/sw/source/filter/xml/xmlimpit.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlimpit.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: dvo $ $Date: 2001-10-30 15:53:20 $
+ * last change: $Author: mib $ $Date: 2001-11-13 18:24:21 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -198,10 +198,10 @@ void SvXMLImportItemMapper::importXML( SfxItemSet& rSet,
if( pEntry )
{
- // we have a valid map entry here, so lets use it...
- if( 0 == (pEntry->nMemberId & (MID_FLAG_NO_ITEM_IMPORT|
- MID_FLAG_ELEMENT_ITEM_IMPORT)) )
- {
+ // we have a valid map entry here, so lets use it...
+ if( 0 == (pEntry->nMemberId & (MID_FLAG_NO_ITEM_IMPORT|
+ MID_FLAG_ELEMENT_ITEM_IMPORT)) )
+ {
// first get item from itemset
const SfxPoolItem* pItem = 0;
SfxItemState eState = rSet.GetItemState( pEntry->nWhichId, TRUE,
@@ -250,11 +250,7 @@ void SvXMLImportItemMapper::importXML( SfxItemSet& rSet,
rNamespaceMap );
}
}
- else if( USHRT_MAX != nUnknownWhich &&
- // TODO: PI
- (XML_NAMESPACE_NONE == nPrefix ||
- XML_NAMESPACE_UNKNOWN == nPrefix ||
- (XML_NAMESPACE_UNKNOWN_FLAG & nPrefix) != 0) )
+ else if( USHRT_MAX != nUnknownWhich )
{
if( !pUnknownItem )
{