summaryrefslogtreecommitdiff
path: root/xmloff/source/draw
diff options
context:
space:
mode:
Diffstat (limited to 'xmloff/source/draw')
-rw-r--r--xmloff/source/draw/eventimp.cxx46
-rw-r--r--xmloff/source/draw/shapeexport.cxx5
-rw-r--r--xmloff/source/draw/shapeexport2.cxx48
-rw-r--r--xmloff/source/draw/ximpshap.cxx17
4 files changed, 15 insertions, 101 deletions
diff --git a/xmloff/source/draw/eventimp.cxx b/xmloff/source/draw/eventimp.cxx
index ad559bc0bf45..3a346d070af9 100644
--- a/xmloff/source/draw/eventimp.cxx
+++ b/xmloff/source/draw/eventimp.cxx
@@ -101,9 +101,6 @@ public:
sal_Bool mbValid;
sal_Bool mbScript;
-#ifdef ISSUE66550_HLINK_FOR_SHAPES
- sal_Bool mbActionEvent;
-#endif
ClickAction meClickAction;
XMLEffect meEffect;
XMLEffectDirection meDirection;
@@ -115,9 +112,6 @@ public:
OUString msMacroName;
OUString msBookmark;
OUString msLanguage;
-#ifdef ISSUE66550_HLINK_FOR_SHAPES
- OUString msHyperURL;
-#endif
};
///////////////////////////////////////////////////////////////////////
@@ -176,18 +170,11 @@ TYPEINIT1( SdXMLEventContext, SvXMLImportContext );
SdXMLEventContext::SdXMLEventContext( SvXMLImport& rImp, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, const Reference< XShape >& rxShape )
: SvXMLImportContext(rImp, nPrfx, rLocalName),
-#ifdef ISSUE66550_HLINK_FOR_SHAPES
- mxShape( rxShape ), mbScript( sal_False ), mbActionEvent( sal_False ), meClickAction( ClickAction_NONE ),
-#else
mxShape( rxShape ), mbScript( sal_False ), meClickAction( ClickAction_NONE ),
-#endif
meEffect( EK_none ), meDirection( ED_none ), mnStartScale( 100 ),
meSpeed( AnimationSpeed_MEDIUM ), mnVerb(0), mbPlayFull( sal_False )
{
static const OUString sXMLClickName( RTL_CONSTASCII_USTRINGPARAM( "click" ) );
-#ifdef ISSUE66550_HLINK_FOR_SHAPES
- static const OUString sXMLActionName( RTL_CONSTASCII_USTRINGPARAM( "action" ) );
-#endif
if( nPrfx == XML_NAMESPACE_PRESENTATION && IsXMLToken( rLocalName, XML_EVENT_LISTENER ) )
{
@@ -258,12 +245,7 @@ SdXMLEventContext::SdXMLEventContext( SvXMLImport& rImp, sal_uInt16 nPrfx, cons
sEventName = sValue;
sal_uInt16 nScriptPrefix =
GetImport().GetNamespaceMap().GetKeyByAttrName( sValue, &sEventName );
-#ifdef ISSUE66550_HLINK_FOR_SHAPES
- mbValid = XML_NAMESPACE_DOM == nScriptPrefix && ( sEventName == sXMLClickName || sEventName == sXMLActionName );
- mbActionEvent = mbValid && (sEventName == sXMLActionName);
-#else
mbValid = XML_NAMESPACE_DOM == nScriptPrefix && sEventName == sXMLClickName;
-#endif
}
else if( IsXMLToken( aAttrLocalName, XML_LANGUAGE ) )
{
@@ -292,12 +274,6 @@ SdXMLEventContext::SdXMLEventContext( SvXMLImport& rImp, sal_uInt16 nPrfx, cons
{
msMacroName = sValue;
}
-#ifdef ISSUE66550_HLINK_FOR_SHAPES
- else if ( mbActionEvent )
- {
- msHyperURL = sValue;
- }
-#endif
else
{
const rtl::OUString &rTmp =
@@ -343,26 +319,6 @@ void SdXMLEventContext::EndElement()
OUString sAPIEventName;
uno::Sequence< beans::PropertyValue > aProperties;
-#ifdef ISSUE66550_HLINK_FOR_SHAPES
- if( mbActionEvent )
- {
- sAPIEventName = OUString( RTL_CONSTASCII_USTRINGPARAM( "OnAction" ) );
- aProperties.realloc( 2 );
- beans::PropertyValue* pProperty = aProperties.getArray();
-
- pProperty->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "EventType" ) );
- pProperty->Handle = -1;
- pProperty->Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "Action" ) );
- pProperty->State = beans::PropertyState_DIRECT_VALUE;
- ++pProperty;
- pProperty->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
- pProperty->Handle = -1;
- pProperty->Value <<= msHyperURL;
- pProperty->State = beans::PropertyState_DIRECT_VALUE;
- }
- else
-#endif
- {
sAPIEventName = OUString( RTL_CONSTASCII_USTRINGPARAM( "OnClick" ) );
if( mbScript )
@@ -547,8 +503,6 @@ void SdXMLEventContext::EndElement()
break;
}
}
- }
-
xEvents->replaceByName( sAPIEventName, uno::Any( aProperties ) );
} while(0);
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx
index d3dd99967ae9..099a396b11b9 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -90,11 +90,6 @@ XMLShapeExport::XMLShapeExport(SvXMLExport& rExp,
msStartShape( RTL_CONSTASCII_USTRINGPARAM("StartShape") ),
msEndShape( RTL_CONSTASCII_USTRINGPARAM("EndShape") ),
msOnClick( RTL_CONSTASCII_USTRINGPARAM("OnClick") ),
-#ifdef ISSUE66550_HLINK_FOR_SHAPES
- msOnAction( RTL_CONSTASCII_USTRINGPARAM("OnAction") ),
- msAction( RTL_CONSTASCII_USTRINGPARAM("Action") ),
- msURL( RTL_CONSTASCII_USTRINGPARAM("URL") ),
-#endif
msEventType( RTL_CONSTASCII_USTRINGPARAM("EventType") ),
msPresentation( RTL_CONSTASCII_USTRINGPARAM("Presentation") ),
msMacroName( RTL_CONSTASCII_USTRINGPARAM("MacroName") ),
diff --git a/xmloff/source/draw/shapeexport2.cxx b/xmloff/source/draw/shapeexport2.cxx
index 8920d5ca9183..fc01094fc024 100644
--- a/xmloff/source/draw/shapeexport2.cxx
+++ b/xmloff/source/draw/shapeexport2.cxx
@@ -291,9 +291,6 @@ const sal_Int32 FOUND_CLICKEVENTTYPE = 0x00000080;
const sal_Int32 FOUND_MACRO = 0x00000100;
const sal_Int32 FOUND_LIBRARY = 0x00000200;
const sal_Int32 FOUND_ACTIONEVENTTYPE = 0x00000400;
-#ifdef ISSUE66550_HLINK_FOR_SHAPES
-const sal_Int32 FOUND_URL = 0x00000800;
-#endif
} // namespace
@@ -383,33 +380,6 @@ void XMLShapeExport::ImpExportEvents( const uno::Reference< drawing::XShape >& x
}
}
-#ifdef ISSUE66550_HLINK_FOR_SHAPES
- // extract properties from "OnAction" event -------------------------------
-
- OUString aActionEventType;
- OUString aHyperURL;
-
- uno::Sequence< beans::PropertyValue > aActionProperties;
- if( xEvents->hasByName( msOnAction ) && (xEvents->getByName( msOnAction ) >>= aActionProperties) )
- {
- const beans::PropertyValue* pProperty = aActionProperties.getConstArray();
- const beans::PropertyValue* pPropertyEnd = pProperty + aActionProperties.getLength();
- for( ; pProperty != pPropertyEnd; ++pProperty )
- {
- if( ( ( nFound & FOUND_ACTIONEVENTTYPE ) == 0 ) && pProperty->Name == msEventType )
- {
- if( pProperty->Value >>= aActionEventType )
- nFound |= FOUND_ACTIONEVENTTYPE;
- }
- else if( ( ( nFound & FOUND_URL ) == 0 ) && ( pProperty->Name == msURL ) )
- {
- if( pProperty->Value >>= aHyperURL )
- nFound |= FOUND_URL;
- }
- }
- }
-#endif
-
// create the XML elements
if( aClickEventType == msPresentation )
@@ -561,15 +531,9 @@ void XMLShapeExport::ImpExportEvents( const uno::Reference< drawing::XShape >& x
SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SCRIPT, XML_EVENT_LISTENER, sal_True, sal_True);
}
}
-#ifdef ISSUE66550_HLINK_FOR_SHAPES
- else if( aClickEventType == msScript || aActionEventType == msAction )
- {
- if( nFound & ( FOUND_MACRO | FOUND_URL ) )
-#else
else if( aClickEventType == msScript )
{
if( nFound & FOUND_MACRO )
-#endif
{
SvXMLElementExport aEventsElemt(mrExport, XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS, sal_True, sal_True);
if ( nFound & FOUND_MACRO )
@@ -584,18 +548,6 @@ void XMLShapeExport::ImpExportEvents( const uno::Reference< drawing::XShape >& x
SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SCRIPT, XML_EVENT_LISTENER, sal_True, sal_True);
}
-#ifdef ISSUE66550_HLINK_FOR_SHAPES
- if ( nFound & FOUND_URL )
- {
- OUString aEventQName(
- mrExport.GetNamespaceMap().GetQNameByKey(
- XML_NAMESPACE_DOM, OUString( RTL_CONSTASCII_USTRINGPARAM( "action" ) ) ) );
- mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_EVENT_NAME, aEventQName );
- mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, aHyperURL );
-
- SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_PRESENTATION, XML_EVENT_LISTENER, sal_True, sal_True);
- }
-#endif
}
}
}
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index b073e1e28d40..19ad2e9acc32 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -374,9 +374,15 @@ void SdXMLShapeContext::EndElement()
if( msHyperlink.getLength() != 0 ) try
{
+ uno::Reference< beans::XPropertySet > xProp( mxShape, uno::UNO_QUERY );
+
+ rtl::OUString sLink( RTL_CONSTASCII_USTRINGPARAM( "Hyperlink" ) );
+ if ( xProp.is() && xProp->getPropertySetInfo()->hasPropertyByName( sLink ) )
+ xProp->setPropertyValue( sLink, uno::Any( msHyperlink ) );
+ Reference< XEventsSupplier > xEventsSupplier( mxShape, UNO_QUERY_THROW );
+ Reference< XNameReplace > xEvents( xEventsSupplier->getEvents(), UNO_QUERY_THROW );
const OUString sBookmark( RTL_CONSTASCII_USTRINGPARAM( "Bookmark" ) );
- Reference< XEventsSupplier > xEventsSupplier( mxShape, UNO_QUERY );
if( xEventsSupplier.is() )
{
const OUString sEventType( RTL_CONSTASCII_USTRINGPARAM( "EventType" ) );
@@ -3306,9 +3312,16 @@ SvXMLImportContext *SdXMLFrameShapeContext::CreateChildContext( USHORT nPrefix,
if( !mxImplContext.Is() )
{
- pContext = GetImport().GetShapeImport()->CreateFrameChildContext(
+
+ SvXMLShapeContext* pShapeContext= GetImport().GetShapeImport()->CreateFrameChildContext(
GetImport(), nPrefix, rLocalName, xAttrList, mxShapes, mxAttrList );
+ pContext = pShapeContext;
+
+ // propagate the hyperlink to child context
+ if ( msHyperlink.getLength() > 0 )
+ pShapeContext->setHyperlink( msHyperlink );
+
mxImplContext = pContext;
mbSupportsReplacement = IsXMLToken( rLocalName, XML_OBJECT ) ||
IsXMLToken( rLocalName, XML_OBJECT_OLE );