20#include <com/sun/star/document/XEventsSupplier.hpp>
21#include <com/sun/star/container/XNameReplace.hpp>
22#include <com/sun/star/presentation/AnimationSpeed.hpp>
23#include <com/sun/star/beans/XPropertySet.hpp>
25#include <osl/diagnose.h>
38using namespace ::
cppu;
59 {
XML_STOP, ClickAction_STOPPRESENTATION },
72 , meClickAction(ClickAction_NONE), meEffect(
EK_none)
73 , meDirection(
ED_none), mnStartScale(100), meSpeed(AnimationSpeed_MEDIUM)
74 , mnVerb(0), mbPlayFull(false)
87 SdXMLEventContext( SvXMLImport& rImport, sal_Int32 nElement,
const Reference< XFastAttributeList>& xAttrList,
const Reference< XShape >& rxShape );
91 const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList )
override;
99 XMLEventSoundContext( SvXMLImport& rImport,
const Reference< XFastAttributeList >& xAttrList, SdXMLEventContext* pParent );
104XMLEventSoundContext::XMLEventSoundContext( SvXMLImport& rImp,
const Reference< XFastAttributeList >& xAttrList, SdXMLEventContext* pParent )
109 switch( aIter.getToken() )
123SdXMLEventContext::SdXMLEventContext( SvXMLImport& rImp,
125 const Reference< XFastAttributeList >& xAttrList,
const Reference< XShape >& rxShape )
147 switch( aIter.getToken() )
162 maData.mnStartScale =
static_cast<sal_Int16
>(nScale);
173 sEventName = aIter.toString();
174 sal_uInt16 nScriptPrefix =
175 GetImport().GetNamespaceMap().GetKeyByAttrValueQName(sEventName, &sEventName);
182 OUString aScriptLanguage;
183 maData.msLanguage = aIter.toString();
184 sal_uInt16 nScriptPrefix = rImp.GetNamespaceMap().
185 GetKeyByAttrValueQName(
maData.msLanguage, &aScriptLanguage);
187 maData.msLanguage = aScriptLanguage;
197 maData.msMacroName = aIter.toString();
201 const OUString &rTmp =
202 rImp.GetAbsoluteReference(aIter.toString());
212 maData.mbValid = !sEventName.isEmpty();
215css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLEventContext::createFastChildContext(
217 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
220 return new XMLEventSoundContext( GetImport(), xAttrList,
this );
226void SdXMLEventContext::endFastElement(sal_Int32 )
228 GetImport().GetShapeImport()->addShapeEvents(maData);
238 Reference< XEventsSupplier > xEventsSupplier(
mxShape, UNO_QUERY );
239 if( !xEventsSupplier.is() )
242 Reference< XNameReplace > xEvents( xEventsSupplier->getEvents() );
243 SAL_WARN_IF( !xEvents.is(),
"xmloff",
"XEventsSupplier::getEvents() returned NULL" );
247 OUString sAPIEventName;
250 sAPIEventName =
"OnClick";
255 sal_Int32 nPropertyCount = 2;
258 case ClickAction_NONE:
259 case ClickAction_PREVPAGE:
260 case ClickAction_NEXTPAGE:
261 case ClickAction_FIRSTPAGE:
262 case ClickAction_LASTPAGE:
263 case ClickAction_INVISIBLE:
264 case ClickAction_STOPPRESENTATION:
266 case ClickAction_PROGRAM:
267 case ClickAction_VERB:
268 case ClickAction_BOOKMARK:
269 case ClickAction_DOCUMENT:
272 case ClickAction_MACRO:
273 if (
msLanguage.equalsIgnoreAsciiCase(
"starbasic") )
277 case ClickAction_SOUND:
281 case ClickAction_VANISH:
289 beans::PropertyValue* pProperties =
aProperties.getArray();
293 if (
msLanguage.equalsIgnoreAsciiCase(
"starbasic") )
298 if(
msMacroName.getLength() > rApp.getLength()+1 &&
305 else if(
msMacroName.getLength() > rDoc.getLength()+1 &&
313 pProperties->Name =
"EventType";
314 pProperties->Handle = -1;
315 pProperties->Value <<= OUString(
"StarBasic" );
316 pProperties->State = beans::PropertyState_DIRECT_VALUE;
319 pProperties->Name =
"MacroName";
320 pProperties->Handle = -1;
322 pProperties->State = beans::PropertyState_DIRECT_VALUE;
325 pProperties->Name =
"Library";
326 pProperties->Handle = -1;
328 pProperties->State = beans::PropertyState_DIRECT_VALUE;
332 pProperties->Name =
"EventType";
333 pProperties->Handle = -1;
334 pProperties->Value <<= OUString(
"Script" );
335 pProperties->State = beans::PropertyState_DIRECT_VALUE;
338 pProperties->Name =
"Script";
339 pProperties->Handle = -1;
341 pProperties->State = beans::PropertyState_DIRECT_VALUE;
346 pProperties->Name =
"EventType";
347 pProperties->Handle = -1;
348 pProperties->Value <<= OUString(
"Presentation" );
349 pProperties->State = beans::PropertyState_DIRECT_VALUE;
360 pProperties->Name =
"ClickAction";
361 pProperties->Handle = -1;
363 pProperties->State = beans::PropertyState_DIRECT_VALUE;
368 case ClickAction_NONE:
369 case ClickAction_PREVPAGE:
370 case ClickAction_NEXTPAGE:
371 case ClickAction_FIRSTPAGE:
372 case ClickAction_LASTPAGE:
373 case ClickAction_INVISIBLE:
374 case ClickAction_STOPPRESENTATION:
377 case ClickAction_BOOKMARK:
382 case ClickAction_DOCUMENT:
383 case ClickAction_PROGRAM:
384 pProperties->Name =
"Bookmark";
385 pProperties->Handle = -1;
387 pProperties->State = beans::PropertyState_DIRECT_VALUE;
390 case ClickAction_VANISH:
391 pProperties->Name =
"Effect";
392 pProperties->Handle = -1;
394 pProperties->State = beans::PropertyState_DIRECT_VALUE;
397 pProperties->Name =
"Speed";
398 pProperties->Handle = -1;
399 pProperties->Value <<=
meSpeed;
400 pProperties->State = beans::PropertyState_DIRECT_VALUE;
405 case ClickAction_SOUND:
406 pProperties->Name =
"SoundURL";
407 pProperties->Handle = -1;
409 pProperties->State = beans::PropertyState_DIRECT_VALUE;
412 pProperties->Name =
"PlayFull";
413 pProperties->Handle = -1;
415 pProperties->State = beans::PropertyState_DIRECT_VALUE;
418 case ClickAction_VERB:
419 pProperties->Name =
"Verb";
420 pProperties->Handle = -1;
421 pProperties->Value <<=
mnVerb;
422 pProperties->State = beans::PropertyState_DIRECT_VALUE;
424 case ClickAction_MACRO:
425 OSL_FAIL(
"xmloff::SdXMLEventContext::EndElement(), ClickAction_MACRO must be handled in different if case");
448 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
PropertiesInfo aProperties
AnimationEffect ImplSdXMLgetEffect(XMLEffect eKind, XMLEffectDirection eDirection, sal_Int16 nStartScale, bool)
const SvXMLEnumMapEntry< XMLEffectDirection > aXML_AnimationDirection_EnumMap[]
const SvXMLEnumMapEntry< AnimationSpeed > aXML_AnimationSpeed_EnumMap[]
const SvXMLEnumMapEntry< XMLEffect > aXML_AnimationEffect_EnumMap[]
static bool translateToInternal(std::u16string_view rTheExtURIRef, OUString &rTheIntURIRef, DecodeMechanism eDecodeMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
SdXMLEventsContext(SvXMLImport &rImport, const css::uno::Reference< css::drawing::XShape > &rxShape)
virtual ~SdXMLEventsContext() override
css::uno::Reference< css::drawing::XShape > mxShape
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
This class deliberately does not support XWeak, to improve performance when loading large documents.
virtual void SAL_CALL endFastElement(sal_Int32 Element) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
SvXMLImport & GetImport()
virtual css::uno::Reference< XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > &Attribs) override
the SvXMLTypeConverter converts values of various types from their internal representation to the tex...
static bool convertPercent(sal_Int32 &rValue, std::u16string_view rString)
SvXMLEnumMapEntry< ClickAction > const aXML_EventActions_EnumMap[]
#define SAL_WARN_IF(condition, area, stream)
std::vector< sal_Int8, boost::noinit_adaptor< std::allocator< sal_Int8 > > > maData
bool equalsIgnoreAsciiCase(std::u16string_view s1, std::u16string_view s2)
FastAttributeList & castToFastAttributeList(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
OUString toString(OptionInfo const *info)
Handling of tokens in XML:
bool IsXMLToken(std::u16string_view rString, enum XMLTokenEnum eToken)
compare eToken to the string
const OUString & GetXMLToken(enum XMLTokenEnum eToken)
return the OUString representation for eToken
uno::Reference< drawing::XShape > const mxShape
css::presentation::AnimationSpeed meSpeed
SdXMLEventContextData(const css::uno::Reference< css::drawing::XShape > &rxShape)
XMLEffectDirection meDirection
css::presentation::ClickAction meClickAction
css::uno::Reference< css::drawing::XShape > mxShape
constexpr OUStringLiteral sLibrary
#define XMLOFF_WARN_UNKNOWN_ELEMENT(area, token)
#define XMLOFF_WARN_UNKNOWN(area, rIter)
#define XML_ELEMENT(prefix, name)
constexpr sal_uInt16 XML_NAMESPACE_DOM
constexpr sal_uInt16 XML_NAMESPACE_OOO