summaryrefslogtreecommitdiff
path: root/xmloff/source/draw
diff options
context:
space:
mode:
authorMichael Stahl <mst@openoffice.org>2010-04-19 18:27:16 +0200
committerMichael Stahl <mst@openoffice.org>2010-04-19 18:27:16 +0200
commit80fcc2da523bfae04094b105e67493f9d7679f8f (patch)
treec04d34f6a8144861efbaa11bf66cf6d185c1d7cb /xmloff/source/draw
parentc72e885c09d39d03bf35f27614342f7660e9f357 (diff)
sw33bf03: #i110691#: import/export xml:id and {anim,draw,form,text}:id:
in ODF 1.2, the ID attributes on many elements are deprecated, and must be used only in conjunction with xml:id. new method SvXMLExport::AddAttributeIdLegacy() should fix the export.
Diffstat (limited to 'xmloff/source/draw')
-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
8 files changed, 56 insertions, 44 deletions
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;
}
}
}