summaryrefslogtreecommitdiff
path: root/xmloff/source/draw/ximpshap.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'xmloff/source/draw/ximpshap.cxx')
-rw-r--r--xmloff/source/draw/ximpshap.cxx53
1 files changed, 34 insertions, 19 deletions
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index 0a0dbb98ff..504ba5d34c 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -372,31 +372,46 @@ void SdXMLShapeContext::EndElement()
if( msHyperlink.getLength() != 0 ) try
{
- Reference< XEventsSupplier > xEventsSupplier( mxShape, UNO_QUERY_THROW );
- Reference< XNameReplace > xEvents( xEventsSupplier->getEvents(), UNO_QUERY_THROW );
+ const OUString sBookmark( RTL_CONSTASCII_USTRINGPARAM( "Bookmark" ) );
- uno::Sequence< beans::PropertyValue > aProperties( 3 );
- aProperties[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "EventType" ) );
- aProperties[0].Handle = -1;
- aProperties[0].Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM("Presentation") );
- aProperties[0].State = beans::PropertyState_DIRECT_VALUE;
+ Reference< XEventsSupplier > xEventsSupplier( mxShape, UNO_QUERY );
+ if( xEventsSupplier.is() )
+ {
+ const OUString sEventType( RTL_CONSTASCII_USTRINGPARAM( "EventType" ) );
+ const OUString sClickAction( RTL_CONSTASCII_USTRINGPARAM( "ClickAction" ) );
+
+ Reference< XNameReplace > xEvents( xEventsSupplier->getEvents(), UNO_QUERY_THROW );
- aProperties[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "ClickAction" ) );
- aProperties[1].Handle = -1;
- aProperties[1].Value <<= ::com::sun::star::presentation::ClickAction_DOCUMENT;
- aProperties[1].State = beans::PropertyState_DIRECT_VALUE;
+ uno::Sequence< beans::PropertyValue > aProperties( 3 );
+ aProperties[0].Name = sEventType;
+ aProperties[0].Handle = -1;
+ aProperties[0].Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM("Presentation") );
+ aProperties[0].State = beans::PropertyState_DIRECT_VALUE;
- aProperties[2].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Bookmark" ) );
- aProperties[2].Handle = -1;
- aProperties[2].Value <<= msHyperlink;
- aProperties[2].State = beans::PropertyState_DIRECT_VALUE;
+ aProperties[1].Name = sClickAction;
+ aProperties[1].Handle = -1;
+ aProperties[1].Value <<= ::com::sun::star::presentation::ClickAction_DOCUMENT;
+ aProperties[1].State = beans::PropertyState_DIRECT_VALUE;
- const OUString sAPIEventName( RTL_CONSTASCII_USTRINGPARAM( "OnClick" ) );
- xEvents->replaceByName( sAPIEventName, Any( aProperties ) );
+ aProperties[2].Name = sBookmark;
+ aProperties[2].Handle = -1;
+ aProperties[2].Value <<= msHyperlink;
+ aProperties[2].State = beans::PropertyState_DIRECT_VALUE;
+
+ const OUString sAPIEventName( RTL_CONSTASCII_USTRINGPARAM( "OnClick" ) );
+ xEvents->replaceByName( sAPIEventName, Any( aProperties ) );
+ }
+ else
+ {
+ // in draw use the Bookmark property
+ Reference< beans::XPropertySet > xSet( mxShape, UNO_QUERY_THROW );
+ xSet->setPropertyValue( sBookmark, Any( msHyperlink ) );
+ xSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "OnClick" ) ), Any( ::com::sun::star::presentation::ClickAction_DOCUMENT ) );
+ }
}
catch( Exception& )
{
- DBG_ERROR("xmloff::SdXMLShapeContext::EndElement(), exception caught!");
+ DBG_ERROR("xmloff::SdXMLShapeContext::EndElement(), exception caught while setting hyperlink!");
}
if( mxLockable.is() )
@@ -3668,7 +3683,7 @@ void SdXMLTableShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::
SvXMLImportContext* SdXMLTableShapeContext::CreateChildContext( USHORT nPrefix, const ::rtl::OUString& rLocalName, const uno::Reference<xml::sax::XAttributeList>& xAttrList )
{
- if( mxTableImportContext.Is() )
+ if( mxTableImportContext.Is() && (nPrefix == XML_NAMESPACE_TABLE) )
return mxTableImportContext->CreateChildContext(nPrefix, rLocalName, xAttrList);
else
return SdXMLShapeContext::CreateChildContext(nPrefix, rLocalName, xAttrList);