summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmloff/inc/xmloff/txtimp.hxx2
-rw-r--r--xmloff/inc/xmloff/xmlexp.hxx6
-rw-r--r--xmloff/source/chart/SchXMLExport.cxx21
-rw-r--r--xmloff/source/chart/SchXMLParagraphContext.cxx18
-rw-r--r--xmloff/source/core/xmlexp.cxx16
-rw-r--r--xmloff/source/draw/animationexport.cxx22
-rw-r--r--xmloff/source/draw/animationimport.cxx34
-rw-r--r--xmloff/source/draw/sdxmlexp.cxx4
-rw-r--r--xmloff/source/draw/sdxmlimp.cxx4
-rw-r--r--xmloff/source/draw/sdxmlimp_impl.hxx3
-rw-r--r--xmloff/source/draw/shapeexport.cxx6
-rw-r--r--xmloff/source/draw/ximpbody.cxx23
-rw-r--r--xmloff/source/draw/ximpshap.cxx4
-rw-r--r--xmloff/source/forms/elementexport.cxx6
-rw-r--r--xmloff/source/forms/elementimport.cxx15
-rw-r--r--xmloff/source/forms/formattributes.cxx2
-rw-r--r--xmloff/source/text/XMLChangedRegionImportContext.cxx13
-rw-r--r--xmloff/source/text/XMLRedlineExport.cxx2
-rw-r--r--xmloff/source/text/txtimp.cxx2
-rw-r--r--xmloff/source/text/txtparae.cxx13
-rw-r--r--xmloff/source/text/txtparai.cxx15
-rw-r--r--xmloff/source/text/txtparai.hxx1
22 files changed, 157 insertions, 75 deletions
diff --git a/xmloff/inc/xmloff/txtimp.hxx b/xmloff/inc/xmloff/txtimp.hxx
index 7e041d0bdc91..697c535d79fd 100644
--- a/xmloff/inc/xmloff/txtimp.hxx
+++ b/xmloff/inc/xmloff/txtimp.hxx
@@ -257,11 +257,11 @@ enum XMLTextPAttrTokens
XML_TOK_TEXT_P_PROPERTY,
XML_TOK_TEXT_P_CONTENT,
XML_TOK_TEXT_P_DATATYPE,
+ XML_TOK_TEXT_P_TEXTID,
XML_TOK_TEXT_P_STYLE_NAME,
XML_TOK_TEXT_P_COND_STYLE_NAME,
XML_TOK_TEXT_P_LEVEL,
XML_TOK_TEXT_P_CLASS_NAMES,
- XML_TOK_TEXT_P_ID,
XML_TOK_TEXT_P_IS_LIST_HEADER,
XML_TOK_TEXT_P_RESTART_NUMBERING,
XML_TOK_TEXT_P_START_VALUE,
diff --git a/xmloff/inc/xmloff/xmlexp.hxx b/xmloff/inc/xmloff/xmlexp.hxx
index 2133a108da78..7b6054c37b55 100644
--- a/xmloff/inc/xmloff/xmlexp.hxx
+++ b/xmloff/inc/xmloff/xmlexp.hxx
@@ -593,6 +593,12 @@ public:
/// name of stream in package, e.g., "content.xml"
::rtl::OUString GetStreamName() const;
+ // FIXME: this is only for legacy stuff that has not yet been adapted
+ // to implement XMetadatable; this can write duplicate IDs!
+ /// add xml:id and legacy namespace id
+ void SAL_DLLPRIVATE AddAttributeIdLegacy(
+ sal_uInt16 const nLegacyPrefix, ::rtl::OUString const& rValue);
+
/// add xml:id attribute (for RDF metadata)
void AddAttributeXmlId(::com::sun::star::uno::Reference<
::com::sun::star::uno::XInterface> const & i_xIfc);
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index f7cf82abe974..43ab0b458ab5 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -44,9 +44,7 @@
#include <tools/globname.hxx>
#include <sot/clsids.hxx>
-#ifndef _SVTOOLS_NMSPMAP_HXX
#include <xmloff/nmspmap.hxx>
-#endif
#include "xmlnmspe.hxx"
#include <xmloff/xmltoken.hxx>
#include <xmloff/families.hxx>
@@ -1536,8 +1534,11 @@ void SchXMLExportHelper::exportTable()
// to allow a correct re-association when copying via clipboard
if( !bHasOwnData && aFirstRowRangeIter != aFirstRowRangeEndIter )
{
- if( (*aFirstRowRangeIter).getLength())
- mrExport.AddAttribute( XML_NAMESPACE_TEXT, XML_ID, *aFirstRowRangeIter );
+ if ((*aFirstRowRangeIter).getLength())
+ {
+ mrExport.AddAttributeIdLegacy(XML_NAMESPACE_TEXT,
+ *aFirstRowRangeIter);
+ }
++aFirstRowRangeIter;
}
exportText( *aIt );
@@ -1561,7 +1562,10 @@ void SchXMLExportHelper::exportTable()
// write the original range name as id into the local table
// to allow a correct re-association when copying via clipboard
if( !bHasOwnData && aFirstColumnRangeIter != aFirstColumnRangeEndIter )
- mrExport.AddAttribute( XML_NAMESPACE_TEXT, XML_ID, *aFirstColumnRangeIter++ );
+ {
+ mrExport.AddAttributeIdLegacy(XML_NAMESPACE_TEXT,
+ *aFirstColumnRangeIter++);
+ }
exportText( *aFirstColIt );
++aFirstColIt;
}
@@ -1579,8 +1583,11 @@ void SchXMLExportHelper::exportTable()
if( ( !bHasOwnData && aDataRangeIter != aDataRangeEndIter ) &&
( mbRowSourceColumns || (aInnerIt == aColIt->begin())) )
{
- if( (*aDataRangeIter).getLength())
- mrExport.AddAttribute( XML_NAMESPACE_TEXT, XML_ID, *aDataRangeIter );
+ if ((*aDataRangeIter).getLength())
+ {
+ mrExport.AddAttributeIdLegacy(XML_NAMESPACE_TEXT,
+ *aDataRangeIter);
+ }
++aDataRangeIter;
}
exportText( msString, false ); // do not convert tabs and lfs
diff --git a/xmloff/source/chart/SchXMLParagraphContext.cxx b/xmloff/source/chart/SchXMLParagraphContext.cxx
index 1d8a4e16bb8c..9e19c02437b8 100644
--- a/xmloff/source/chart/SchXMLParagraphContext.cxx
+++ b/xmloff/source/chart/SchXMLParagraphContext.cxx
@@ -63,6 +63,7 @@ void SchXMLParagraphContext::StartElement( const uno::Reference< xml::sax::XAttr
{
sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
rtl::OUString aValue;
+ bool bHaveXmlId( false );
for( sal_Int16 i = 0; i < nAttrCount; i++ )
{
@@ -70,11 +71,20 @@ void SchXMLParagraphContext::StartElement( const uno::Reference< xml::sax::XAttr
rtl::OUString aLocalName;
USHORT nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
- if( nPrefix == XML_NAMESPACE_TEXT &&
- IsXMLToken( aLocalName, XML_ID ) )
+ if (IsXMLToken(aLocalName, XML_ID))
{
- (*mpId) = xAttrList->getValueByIndex( i );
- break; // we only need this attribute
+ if (nPrefix == XML_NAMESPACE_XML)
+ {
+ (*mpId) = xAttrList->getValueByIndex( i );
+ bHaveXmlId = true;
+ }
+ if (nPrefix == XML_NAMESPACE_TEXT)
+ { // text:id shall be ignored if xml:id exists
+ if (!bHaveXmlId)
+ {
+ (*mpId) = xAttrList->getValueByIndex( i );
+ }
+ }
}
}
}
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index e96759c3e470..ab91e2e19ab6 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -2455,6 +2455,22 @@ SvtSaveOptions::ODFDefaultVersion SvXMLExport::getDefaultVersion() const
}
void
+SvXMLExport::AddAttributeIdLegacy(
+ sal_uInt16 const nLegacyPrefix, ::rtl::OUString const& rValue)
+{
+ switch (getDefaultVersion()) {
+ case SvtSaveOptions::ODFVER_011: // fall thru
+ case SvtSaveOptions::ODFVER_010: break;
+ default: // ODF 1.2: xml:id
+ AddAttribute(XML_NAMESPACE_XML, XML_ID, rValue);
+ }
+ // in ODF 1.1 this was form:id, anim:id, draw:id, or text:id
+ // backward compatibility: in ODF 1.2 write _both_ id attrs
+ AddAttribute(nLegacyPrefix, XML_ID, rValue);
+ // FIXME: this function simply assumes that rValue is unique
+}
+
+void
SvXMLExport::AddAttributeXmlId(uno::Reference<uno::XInterface> const & i_xIfc)
{
// check version >= 1.2
diff --git a/xmloff/source/draw/animationexport.cxx b/xmloff/source/draw/animationexport.cxx
index 4d7a8af1a1e9..03bda0108b5c 100644
--- a/xmloff/source/draw/animationexport.cxx
+++ b/xmloff/source/draw/animationexport.cxx
@@ -31,24 +31,14 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_xmloff.hxx"
-#ifndef _COM_SUN_STAR_ANIMATIONS_XAnimateColor_HPP_
#include <com/sun/star/animations/XAnimateColor.hpp>
-#endif
-#ifndef _COM_SUN_STAR_ANIMATIONS_XAnimateSet_HPP_
#include <com/sun/star/animations/XAnimateSet.hpp>
-#endif
#include <com/sun/star/animations/XCommand.hpp>
#include <com/sun/star/animations/Timing.hpp>
#include <com/sun/star/animations/Event.hpp>
-#ifndef _COM_SUN_STAR_ANIMATIONS_XAnimateMotion_HPP_
#include <com/sun/star/animations/XAnimateMotion.hpp>
-#endif
-#ifndef _COM_SUN_STAR_ANIMATIONS_XAnimateTransform_HPP_
#include <com/sun/star/animations/XAnimateTransform.hpp>
-#endif
-#ifndef _COM_SUN_STAR_ANIMATIONS_XTransitionFilter_HPP_
#include <com/sun/star/animations/XTransitionFilter.hpp>
-#endif
#include <com/sun/star/animations/XIterateContainer.hpp>
#include <com/sun/star/animations/XAudio.hpp>
#include <com/sun/star/animations/AnimationColorSpace.hpp>
@@ -67,19 +57,12 @@
#include <com/sun/star/container/XEnumerationAccess.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/presentation/EffectNodeType.hpp>
-#ifndef _COM_SUN_STAR_PRESENTATION_EffectPresetClass_HPP_
#include <com/sun/star/presentation/EffectPresetClass.hpp>
-#endif
-#ifndef _COM_SUN_STAR_PRESENTATION_ParagraphTarget_HPP_
#include <com/sun/star/presentation/ParagraphTarget.hpp>
-#endif
#include <com/sun/star/presentation/TextAnimationType.hpp>
#include <com/sun/star/presentation/ShapeAnimationSubType.hpp>
#include <com/sun/star/presentation/EffectCommands.hpp>
-
-#ifndef _COM_SUN_STAR_DRAWING_XShape_HPP_
#include <com/sun/star/drawing/XShape.hpp>
-#endif
#include <tools/debug.hxx>
#include <tools/time.hxx>
@@ -783,7 +766,10 @@ void AnimationsExporterImpl::exportNode( const Reference< XAnimationNode >& xNod
const OUString& rExportIdentifier = mrExport.getInterfaceToIdentifierMapper().getIdentifier( xNode );
if( rExportIdentifier.getLength() )
- mrExport.AddAttribute( XML_NAMESPACE_ANIMATION, XML_ID, rExportIdentifier );
+ {
+ mrExport.AddAttributeIdLegacy(
+ XML_NAMESPACE_ANIMATION, rExportIdentifier);
+ }
Any aTemp( xNode->getBegin() );
if( aTemp.hasValue() )
diff --git a/xmloff/source/draw/animationimport.cxx b/xmloff/source/draw/animationimport.cxx
index 6569c9d5408d..e151d2752358 100644
--- a/xmloff/source/draw/animationimport.cxx
+++ b/xmloff/source/draw/animationimport.cxx
@@ -50,18 +50,14 @@
#include <com/sun/star/animations/XAudio.hpp>
#include <com/sun/star/animations/ValuePair.hpp>
#include <com/sun/star/animations/AnimationColorSpace.hpp>
-#ifndef _COM_SUN_STAR_PRESENTATION_EffectPresetClass_HPP_
#include <com/sun/star/presentation/EffectPresetClass.hpp>
-#endif
#include <com/sun/star/animations/Timing.hpp>
#include <com/sun/star/animations/Event.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/xml/sax/XAttributeList.hpp>
#include <com/sun/star/text/XTextCursor.hpp>
#include <com/sun/star/text/XTextRangeCompare.hpp>
-#ifndef _COM_SUN_STAR_PRESENTATION_ParagraphTarget_HPP_
#include <com/sun/star/presentation/ParagraphTarget.hpp>
-#endif
#include <com/sun/star/container/XEnumerationAccess.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/animations/EventTrigger.hpp>
@@ -240,7 +236,8 @@ enum AnimationNodeAttributes
ANA_IterateType,
ANA_IterateInterval,
ANA_Formula,
- ANA_ID,
+ ANA_ANIMID,
+ ANA_XMLID,
ANA_Group_Id,
ANA_Command,
ANA_Volume
@@ -297,8 +294,8 @@ const SvXMLTokenMap& AnimationsImportHelperImpl::getAnimationNodeAttributeTokenM
{ XML_NAMESPACE_ANIMATION, XML_ITERATE_TYPE, (sal_uInt16)ANA_IterateType },
{ XML_NAMESPACE_ANIMATION, XML_ITERATE_INTERVAL, (sal_uInt16)ANA_IterateInterval },
{ XML_NAMESPACE_ANIMATION, XML_FORMULA, (sal_uInt16)ANA_Formula },
- { XML_NAMESPACE_ANIMATION, XML_ID, (sal_uInt16)ANA_ID },
- { XML_NAMESPACE_XML, XML_ID, (sal_uInt16)ANA_ID },
+ { XML_NAMESPACE_ANIMATION, XML_ID, (sal_uInt16)ANA_ANIMID },
+ { XML_NAMESPACE_XML, XML_ID, (sal_uInt16)ANA_XMLID },
{ XML_NAMESPACE_PRESENTATION, XML_GROUP_ID, (sal_uInt16)ANA_Group_Id },
{ XML_NAMESPACE_ANIMATION, XML_AUDIO_LEVEL, (sal_uInt16)ANA_Volume },
{ XML_NAMESPACE_ANIMATION, XML_COMMAND, (sal_uInt16)ANA_Command },
@@ -811,6 +808,8 @@ void AnimationNodeContext::init_node( const ::com::sun::star::uno::Reference< :
std::list< NamedValue > aUserData;
XMLTokenEnum meAttributeName = XML_TOKEN_INVALID;
OUString aFrom, aBy, aTo, aValues;
+ bool bHaveXmlId( false );
+ OUString sXmlId;
const sal_Int16 nCount = xAttrList.is() ? xAttrList->getLength() : 0;
sal_uInt16 nEnum;
@@ -1057,13 +1056,15 @@ void AnimationNodeContext::init_node( const ::com::sun::star::uno::Reference< :
}
break;
- case ANA_ID:
+ case ANA_ANIMID:
{
- if( rValue.getLength() )
- {
- Reference< XInterface > xRef( mxNode, UNO_QUERY );
- GetImport().getInterfaceToIdentifierMapper().registerReference( rValue, xRef );
- }
+ if (!bHaveXmlId) { sXmlId = rValue; }
+ }
+ break;
+ case ANA_XMLID:
+ {
+ sXmlId = rValue;
+ bHaveXmlId = true;
}
break;
@@ -1254,6 +1255,13 @@ void AnimationNodeContext::init_node( const ::com::sun::star::uno::Reference< :
}
}
+ if (sXmlId.getLength())
+ {
+ Reference< XInterface > const xRef( mxNode, UNO_QUERY );
+ GetImport().getInterfaceToIdentifierMapper().registerReference(
+ sXmlId, xRef );
+ }
+
sal_Int32 nUserDataCount = aUserData.size();
if( nUserDataCount )
{
diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx
index 1d7414d4ca23..c9e8ec821f82 100644
--- a/xmloff/source/draw/sdxmlexp.cxx
+++ b/xmloff/source/draw/sdxmlexp.cxx
@@ -2014,7 +2014,9 @@ void SdXMLExport::_ExportContent()
// write draw:id
const OUString aPageId = getInterfaceToIdentifierMapper().getIdentifier( xDrawPage );
if( aPageId.getLength() != 0 )
- AddAttribute ( XML_NAMESPACE_DRAW, XML_ID, aPageId );
+ {
+ AddAttributeIdLegacy(XML_NAMESPACE_DRAW, aPageId);
+ }
// write page
SvXMLElementExport aDPG(*this, XML_NAMESPACE_DRAW, XML_PAGE, sal_True, sal_True);
diff --git a/xmloff/source/draw/sdxmlimp.cxx b/xmloff/source/draw/sdxmlimp.cxx
index 47e1e0f5810b..7f85a69fa5ed 100644
--- a/xmloff/source/draw/sdxmlimp.cxx
+++ b/xmloff/source/draw/sdxmlimp.cxx
@@ -668,8 +668,8 @@ const SvXMLTokenMap& SdXMLImport::GetDrawPageAttrTokenMap()
{ XML_NAMESPACE_DRAW, XML_STYLE_NAME, XML_TOK_DRAWPAGE_STYLE_NAME },
{ XML_NAMESPACE_DRAW, XML_MASTER_PAGE_NAME, XML_TOK_DRAWPAGE_MASTER_PAGE_NAME },
{ XML_NAMESPACE_PRESENTATION, XML_PRESENTATION_PAGE_LAYOUT_NAME, XML_TOK_DRAWPAGE_PAGE_LAYOUT_NAME },
- { XML_NAMESPACE_DRAW, XML_ID, XML_TOK_DRAWPAGE_ID },
- { XML_NAMESPACE_XML, XML_ID, XML_TOK_DRAWPAGE_ID },
+ { XML_NAMESPACE_DRAW, XML_ID, XML_TOK_DRAWPAGE_DRAWID },
+ { XML_NAMESPACE_XML, XML_ID, XML_TOK_DRAWPAGE_XMLID },
{ XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_DRAWPAGE_HREF },
{ XML_NAMESPACE_PRESENTATION, XML_USE_HEADER_NAME, XML_TOK_DRAWPAGE_USE_HEADER_NAME },
{ XML_NAMESPACE_PRESENTATION, XML_USE_FOOTER_NAME, XML_TOK_DRAWPAGE_USE_FOOTER_NAME },
diff --git a/xmloff/source/draw/sdxmlimp_impl.hxx b/xmloff/source/draw/sdxmlimp_impl.hxx
index 11b618cae126..825936d4caa0 100644
--- a/xmloff/source/draw/sdxmlimp_impl.hxx
+++ b/xmloff/source/draw/sdxmlimp_impl.hxx
@@ -133,7 +133,8 @@ enum SdXMLDrawPageAttrTokenMap
XML_TOK_DRAWPAGE_STYLE_NAME,
XML_TOK_DRAWPAGE_MASTER_PAGE_NAME,
XML_TOK_DRAWPAGE_PAGE_LAYOUT_NAME,
- XML_TOK_DRAWPAGE_ID,
+ XML_TOK_DRAWPAGE_DRAWID,
+ XML_TOK_DRAWPAGE_XMLID,
XML_TOK_DRAWPAGE_HREF,
XML_TOK_DRAWPAGE_USE_HEADER_NAME,
XML_TOK_DRAWPAGE_USE_FOOTER_NAME,
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx
index 3a0e01631f28..9f971de54ab2 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -46,9 +46,7 @@
#include <xmloff/xmluconv.hxx>
#include "PropertySetMerger.hxx"
-#ifndef _XMLOFF_SHAPEEXPORT_HXX
#include <xmloff/shapeexport.hxx>
-#endif
#include "sdpropls.hxx"
#include "sdxmlexp_impl.hxx"
#include <xmloff/families.hxx>
@@ -642,7 +640,9 @@ void XMLShapeExport::exportShape(const uno::Reference< drawing::XShape >& xShape
uno::Reference< uno::XInterface > xRef( xShape, uno::UNO_QUERY );
const OUString& rShapeId = mrExport.getInterfaceToIdentifierMapper().getIdentifier( xRef );
if( rShapeId.getLength() )
- mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_ID, rShapeId );
+ {
+ mrExport.AddAttributeIdLegacy(XML_NAMESPACE_DRAW, rShapeId);
+ }
}
// --------------------------
diff --git a/xmloff/source/draw/ximpbody.cxx b/xmloff/source/draw/ximpbody.cxx
index 8a226a008251..9909c3d113ce 100644
--- a/xmloff/source/draw/ximpbody.cxx
+++ b/xmloff/source/draw/ximpbody.cxx
@@ -65,6 +65,9 @@ SdXMLDrawPageContext::SdXMLDrawPageContext( SdXMLImport& rImport,
: SdXMLGenericPageContext( rImport, nPrfx, rLocalName, xAttrList, rShapes )
, mbHadSMILNodes( false )
{
+ bool bHaveXmlId( false );
+ OUString sXmlId;
+
sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
for(sal_Int16 i=0; i < nAttrCount; i++)
@@ -112,13 +115,17 @@ SdXMLDrawPageContext::SdXMLDrawPageContext( SdXMLImport& rImport,
maUseDateTimeDeclName = sValue;
break;
}
-
- case XML_TOK_DRAWPAGE_ID:
+ case XML_TOK_DRAWPAGE_DRAWID:
{
- uno::Reference< uno::XInterface > xRef( rShapes.get() );
- GetImport().getInterfaceToIdentifierMapper().registerReference( sValue, xRef );
- break;
+ if (!bHaveXmlId) { sXmlId = sValue; }
}
+ break;
+ case XML_TOK_DRAWPAGE_XMLID:
+ {
+ sXmlId = sValue;
+ bHaveXmlId = true;
+ }
+ break;
case XML_TOK_DRAWPAGE_HREF:
{
maHREF = sValue;
@@ -127,6 +134,12 @@ SdXMLDrawPageContext::SdXMLDrawPageContext( SdXMLImport& rImport,
}
}
+ if (sXmlId.getLength())
+ {
+ uno::Reference< uno::XInterface > const xRef( rShapes.get() );
+ GetImport().getInterfaceToIdentifierMapper().registerReference(
+ sXmlId, xRef );
+ }
GetImport().GetShapeImport()->startPage( rShapes );
uno::Reference< drawing::XDrawPage > xShapeDrawPage(rShapes, uno::UNO_QUERY);
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index c4c86abb7eef..0c78d0d58e4b 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -764,6 +764,7 @@ void SdXMLShapeContext::SetThumbnail()
// this is called from the parent group for each unparsed attribute in the attribute list
void SdXMLShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue )
{
+ bool bHaveXmlId( false );
if( XML_NAMESPACE_DRAW == nPrefix )
{
if( IsXMLToken( rLocalName, XML_ZINDEX ) )
@@ -772,7 +773,7 @@ void SdXMLShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUStr
}
else if( IsXMLToken( rLocalName, XML_ID ) )
{
- maShapeId = rValue;
+ if (!bHaveXmlId) { maShapeId = rValue; };
}
else if( IsXMLToken( rLocalName, XML_NAME ) )
{
@@ -865,6 +866,7 @@ void SdXMLShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUStr
if( IsXMLToken( rLocalName, XML_ID ) )
{
maShapeId = rValue;
+ bHaveXmlId = true;
}
}
}
diff --git a/xmloff/source/forms/elementexport.cxx b/xmloff/source/forms/elementexport.cxx
index a17138654730..f28eab48e428 100644
--- a/xmloff/source/forms/elementexport.cxx
+++ b/xmloff/source/forms/elementexport.cxx
@@ -316,10 +316,8 @@ namespace xmloff
if (CCA_CONTROL_ID & m_nIncludeCommon)
{
OSL_ENSURE(m_sControlId.getLength(), "OControlExport::exportInnerAttributes: have no control id for the control!");
- AddAttribute(
- OAttributeMetaData::getCommonControlAttributeNamespace(CCA_CONTROL_ID),
- OAttributeMetaData::getCommonControlAttributeName(CCA_CONTROL_ID),
- m_sControlId);
+ m_rContext.getGlobalContext().AddAttributeIdLegacy(
+ XML_NAMESPACE_FORM, m_sControlId);
#if OSL_DEBUG_LEVEL > 0
// reset the bit for later checking
m_nIncludeCommon = m_nIncludeCommon & ~CCA_CONTROL_ID;
diff --git a/xmloff/source/forms/elementimport.cxx b/xmloff/source/forms/elementimport.cxx
index 7bdb61ff86fd..cb1388c47386 100644
--- a/xmloff/source/forms/elementimport.cxx
+++ b/xmloff/source/forms/elementimport.cxx
@@ -589,12 +589,21 @@ namespace xmloff
//---------------------------------------------------------------------
void OControlImport::handleAttribute(sal_uInt16 _nNamespaceKey, const ::rtl::OUString& _rLocalName, const ::rtl::OUString& _rValue)
{
- static const sal_Char* pControlIdAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCA_CONTROL_ID);
static const sal_Char* pLinkedCellAttributeName = OAttributeMetaData::getBindingAttributeName(BA_LINKED_CELL);
- if ( !m_sControlId.getLength() && _rLocalName.equalsAscii( pControlIdAttributeName ) )
+ if (IsXMLToken(_rLocalName, XML_ID))
{ // it's the control id
- m_sControlId = _rValue;
+ if (XML_NAMESPACE_XML == _nNamespaceKey)
+ {
+ m_sControlId = _rValue;
+ }
+ else if (XML_NAMESPACE_FORM == _nNamespaceKey)
+ {
+ if (!m_sControlId.getLength())
+ {
+ m_sControlId = _rValue;
+ }
+ }
}
else if ( _rLocalName.equalsAscii( pLinkedCellAttributeName ) )
{ // it's the address of a spreadsheet cell
diff --git a/xmloff/source/forms/formattributes.cxx b/xmloff/source/forms/formattributes.cxx
index 0c2431590b63..e21786e376d2 100644
--- a/xmloff/source/forms/formattributes.cxx
+++ b/xmloff/source/forms/formattributes.cxx
@@ -56,7 +56,7 @@ namespace xmloff
case CCA_NAME: return "name";
case CCA_SERVICE_NAME: return "control-implementation";
case CCA_BUTTON_TYPE: return "button-type";
- case CCA_CONTROL_ID: return "id";
+// disabled(AddAttributeIdLegacy) case CCA_CONTROL_ID: return "id";
case CCA_CURRENT_SELECTED: return "current-selected";
case CCA_CURRENT_VALUE: return "current-value";
case CCA_DISABLED: return "disabled";
diff --git a/xmloff/source/text/XMLChangedRegionImportContext.cxx b/xmloff/source/text/XMLChangedRegionImportContext.cxx
index 220f235d9ddd..347590a6e5b6 100644
--- a/xmloff/source/text/XMLChangedRegionImportContext.cxx
+++ b/xmloff/source/text/XMLChangedRegionImportContext.cxx
@@ -71,6 +71,7 @@ void XMLChangedRegionImportContext::StartElement(
const Reference<XAttributeList> & xAttrList)
{
// process attributes: id
+ bool bHaveXmlId( false );
sal_Int16 nLength = xAttrList->getLength();
for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++)
{
@@ -80,11 +81,19 @@ void XMLChangedRegionImportContext::StartElement(
&sLocalName );
const OUString sValue = xAttrList->getValueByIndex(nAttr);
- if ( XML_NAMESPACE_TEXT == nPrefix )
+ if (XML_NAMESPACE_XML == nPrefix)
{
- if( IsXMLToken( sLocalName, XML_ID ) )
+ if (IsXMLToken(sLocalName, XML_ID))
{
sID = sValue;
+ bHaveXmlId = true;
+ }
+ }
+ else if (XML_NAMESPACE_TEXT == nPrefix)
+ {
+ if (IsXMLToken(sLocalName, XML_ID))
+ {
+ if (!bHaveXmlId) { sID = sValue; }
}
else if( IsXMLToken( sLocalName, XML_MERGE_LAST_PARAGRAPH ) )
{
diff --git a/xmloff/source/text/XMLRedlineExport.cxx b/xmloff/source/text/XMLRedlineExport.cxx
index 2cb0f24eab2a..1ad405a27969 100644
--- a/xmloff/source/text/XMLRedlineExport.cxx
+++ b/xmloff/source/text/XMLRedlineExport.cxx
@@ -377,7 +377,7 @@ void XMLRedlineExport::ExportChangedRegion(
const Reference<XPropertySet> & rPropSet)
{
// Redline-ID
- rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_ID, GetRedlineID(rPropSet) );
+ rExport.AddAttributeIdLegacy(XML_NAMESPACE_TEXT, GetRedlineID(rPropSet));
// merge-last-paragraph
Any aAny = rPropSet->getPropertyValue(sMergeLastPara);
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index af20bfbb23dc..0fcc326982b8 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -332,11 +332,11 @@ static __FAR_DATA SvXMLTokenMapEntry aTextPAttrTokenMap[] =
{ XML_NAMESPACE_XHTML, XML_PROPERTY, XML_TOK_TEXT_P_PROPERTY },
{ XML_NAMESPACE_XHTML, XML_CONTENT, XML_TOK_TEXT_P_CONTENT },
{ XML_NAMESPACE_XHTML, XML_DATATYPE, XML_TOK_TEXT_P_DATATYPE },
+ { XML_NAMESPACE_TEXT, XML_ID, XML_TOK_TEXT_P_TEXTID },
{ XML_NAMESPACE_TEXT, XML_STYLE_NAME, XML_TOK_TEXT_P_STYLE_NAME },
{ XML_NAMESPACE_TEXT, XML_COND_STYLE_NAME,
XML_TOK_TEXT_P_COND_STYLE_NAME },
{ XML_NAMESPACE_TEXT, XML_OUTLINE_LEVEL,XML_TOK_TEXT_P_LEVEL },
- { XML_NAMESPACE_TEXT, XML_ID, XML_TOK_TEXT_P_ID },
{ XML_NAMESPACE_TEXT, XML_IS_LIST_HEADER,XML_TOK_TEXT_P_IS_LIST_HEADER },
{ XML_NAMESPACE_TEXT, XML_RESTART_NUMBERING,XML_TOK_TEXT_P_RESTART_NUMBERING },
{ XML_NAMESPACE_TEXT, XML_START_VALUE,XML_TOK_TEXT_P_START_VALUE },
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index f07d8a89c5ef..4e0702b94388 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -1937,7 +1937,18 @@ void XMLTextParagraphExport::exportParagraph(
{
const OUString& rIdentifier = GetExport().getInterfaceToIdentifierMapper().getIdentifier( xRef );
if( rIdentifier.getLength() )
- GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_ID, rIdentifier );
+ {
+ // FIXME: this is just temporary until EditEngine
+ // paragraphs implement XMetadatable.
+ // then that must be used and not the mapper, because
+ // when both can be used we get two xml:id!
+ uno::Reference<rdf::XMetadatable> const xMeta(xRef,
+ uno::UNO_QUERY);
+ OSL_ENSURE(!xMeta.is(), "paragraph that implements "
+ "XMetadatable used in interfaceToIdentifierMapper?");
+ GetExport().AddAttributeIdLegacy(XML_NAMESPACE_TEXT,
+ rIdentifier);
+ }
}
OUString sAutoStyle( sStyle );
diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx
index aaac42d14597..0d7661ac2c1c 100644
--- a/xmloff/source/text/txtparai.cxx
+++ b/xmloff/source/text/txtparai.cxx
@@ -1920,6 +1920,7 @@ XMLParaContext::XMLParaContext(
const SvXMLTokenMap& rTokenMap =
GetImport().GetTextImport()->GetTextPAttrTokenMap();
+ bool bHaveXmlId( false );
OUString aCondStyleName, sClassNames;
sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
@@ -1936,6 +1937,7 @@ XMLParaContext::XMLParaContext(
{
case XML_TOK_TEXT_P_XMLID:
m_sXmlId = rValue;
+ bHaveXmlId = true;
break;
case XML_TOK_TEXT_P_ABOUT:
m_sAbout = rValue;
@@ -1950,6 +1952,9 @@ XMLParaContext::XMLParaContext(
case XML_TOK_TEXT_P_DATATYPE:
m_sDatatype = rValue;
break;
+ case XML_TOK_TEXT_P_TEXTID:
+ if (!bHaveXmlId) { m_sXmlId = rValue; }
+ break;
case XML_TOK_TEXT_P_STYLE_NAME:
sStyleName = rValue;
break;
@@ -1982,9 +1987,6 @@ XMLParaContext::XMLParaContext(
}
}
break;
- case XML_TOK_TEXT_P_ID:
- sId = rValue;
- break;
case XML_TOK_TEXT_P_RESTART_NUMBERING:
{
sal_Bool bBool;
@@ -2023,14 +2025,17 @@ XMLParaContext::~XMLParaContext()
// if we have an id set for this paragraph, get a cursor for this
// paragraph and register it with the given identifier
- if( sId.getLength() )
+ // FIXME: this is just temporary, and should be removed when
+ // EditEngine paragraphs implement XMetadatable!
+ if (m_sXmlId.getLength())
{
Reference < XTextCursor > xIdCursor( xTxtImport->GetText()->createTextCursorByRange( xStart ) );
if( xIdCursor.is() )
{
xIdCursor->gotoRange( xEnd, sal_True );
Reference< XInterface > xRef( xIdCursor, UNO_QUERY );
- GetImport().getInterfaceToIdentifierMapper().registerReference( sId, xRef );
+ GetImport().getInterfaceToIdentifierMapper().registerReference(
+ m_sXmlId, xRef);
}
}
diff --git a/xmloff/source/text/txtparai.hxx b/xmloff/source/text/txtparai.hxx
index 6eaeeee1ee46..af8296fd1b07 100644
--- a/xmloff/source/text/txtparai.hxx
+++ b/xmloff/source/text/txtparai.hxx
@@ -49,7 +49,6 @@ class XMLParaContext : public SvXMLImportContext
::com::sun::star::uno::Reference <
::com::sun::star::text::XTextRange > xStart; // xub_StrLen nStart;
::rtl::OUString sStyleName;
- ::rtl::OUString sId;
::rtl::OUString m_sXmlId;
::rtl::OUString m_sAbout;
::rtl::OUString m_sProperty;