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.cxx94
1 files changed, 70 insertions, 24 deletions
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index 0a0dbb98ff..90b098a32a 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 );
+
+ 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[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;
+ aProperties[1].Name = sClickAction;
+ aProperties[1].Handle = -1;
+ aProperties[1].Value <<= ::com::sun::star::presentation::ClickAction_DOCUMENT;
+ aProperties[1].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[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 ) );
+ 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() )
@@ -761,6 +776,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 ) )
@@ -769,7 +785,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 ) )
{
@@ -862,6 +878,7 @@ void SdXMLShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUStr
if( IsXMLToken( rLocalName, XML_ID ) )
{
maShapeId = rValue;
+ bHaveXmlId = true;
}
}
}
@@ -2548,7 +2565,7 @@ void SdXMLObjectShapeContext::StartElement( const ::com::sun::star::uno::Referen
}
else if( IsXMLToken( maPresentationClass, XML_PRESENTATION_TABLE ) )
{
- pService = "com.sun.star.presentation.TableShape";
+ pService = "com.sun.star.presentation.CalcShape";
}
else if( IsXMLToken( maPresentationClass, XML_PRESENTATION_OBJECT ) )
{
@@ -2905,8 +2922,21 @@ void SdXMLPluginShapeContext::StartElement( const ::com::sun::star::uno::Referen
const char* pService;
+ sal_Bool bIsPresShape = sal_False;
+
if( mbMedia )
+ {
pService = "com.sun.star.drawing.MediaShape";
+
+ bIsPresShape = maPresentationClass.getLength() && GetImport().GetShapeImport()->IsPresentationShapesSupported();
+ if( bIsPresShape )
+ {
+ if( IsXMLToken( maPresentationClass, XML_PRESENTATION_OBJECT ) )
+ {
+ pService = "com.sun.star.presentation.MediaShape";
+ }
+ }
+ }
else
pService = "com.sun.star.drawing.PluginShape";
@@ -2916,6 +2946,23 @@ void SdXMLPluginShapeContext::StartElement( const ::com::sun::star::uno::Referen
{
SetLayer();
+ if(bIsPresShape)
+ {
+ uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY );
+ if(xProps.is())
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() );
+ if( xPropsInfo.is() )
+ {
+ if( !mbIsPlaceholder && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") )))
+ xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ), ::cppu::bool2any( sal_False ) );
+
+ if( mbIsUserTransformed && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") )))
+ xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") ), ::cppu::bool2any( sal_False ) );
+ }
+ }
+ }
+
// set pos, size, shear and rotate
SetTransformation();
GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes );
@@ -3539,8 +3586,7 @@ void SdXMLTableShapeContext::StartElement( const ::com::sun::star::uno::Referenc
{
const char* pService = "com.sun.star.drawing.TableShape";
- sal_Bool bIsPresShape = sal_False; //maPresentationClass.getLength() && GetImport().GetShapeImport()->IsPresentationShapesSupported();
-/*
+ sal_Bool bIsPresShape = maPresentationClass.getLength() && GetImport().GetShapeImport()->IsPresentationShapesSupported();
if( bIsPresShape )
{
if( IsXMLToken( maPresentationClass, XML_PRESENTATION_TABLE ) )
@@ -3548,7 +3594,7 @@ void SdXMLTableShapeContext::StartElement( const ::com::sun::star::uno::Referenc
pService = "com.sun.star.presentation.TableShape";
}
}
-*/
+
AddShape( pService );
if( mxShape.is() )
@@ -3668,7 +3714,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);