22#include <com/sun/star/beans/PropertyValue.hpp>
24#include <com/sun/star/document/XEventsSupplier.hpp>
26#include <com/sun/star/container/XNameReplace.hpp>
28#include <osl/diagnose.h>
37using ::com::sun::star::beans::PropertyValue;
38using ::com::sun::star::document::XEventsSupplier;
39using ::com::sun::star::container::XNameReplace;
40using ::com::sun::star::container::XNameAccess;
47 m_bExtNamespace(false)
58 std::unique_ptr<XMLEventExportHandler> pHandler )
67 if (
nullptr != pTransTable)
86 Export(rSupplier->getEvents(), bWhitespace);
94 Reference<XNameAccess> xAccess(rReplace);
95 Export(xAccess, bWhitespace);
108 bool bStarted =
false;
111 const Sequence<OUString> aNames = rAccess->getElementNames();
112 for(
const auto& rName : aNames)
121 Any aAny = rAccess->getByName( rName );
122 Sequence<PropertyValue> aValues;
126 ExportEvent( aValues, rXmlName, bWhitespace, bStarted );
131 SAL_WARN(
"xmloff",
"Unknown event name:" << rName );
153 const Sequence<PropertyValue>& rEventValues,
154 const OUString& rApiEventName,
155 bool bUseWhitespace )
164 bool bStarted =
false;
165 ExportEvent( rEventValues, rXmlName, bUseWhitespace, bStarted );
176 SAL_WARN(
"xmloff",
"Unknown event name:" << rApiEventName );
183 const Sequence<PropertyValue>& rEventValues,
189 const PropertyValue* pValue = std::find_if(rEventValues.begin(), rEventValues.end(),
190 [](
const PropertyValue& rValue) { return gsEventType == rValue.Name; });
192 if (pValue == rEventValues.end())
197 pValue->Value >>=
sType;
209 OUString aEventQName(
215 rEventValues, bUseWhitespace);
219 if (
sType !=
"None" )
221 OSL_FAIL(
"unknown event type returned by API");
317 {
nullptr, 0,
nullptr }
const XMLEventNameTranslation aStandardEventTable[]
a translation table for the events defined in the XEventsSupplier service (implemented in XMLEventExp...
constexpr OUStringLiteral gsEventType(u"EventType")
const SvXMLNamespaceMap & GetNamespaceMap() const
void StartElement(sal_uInt16 nPrefix, enum ::xmloff::token::XMLTokenEnum eName, bool bIgnWSOutside)
void IgnorableWhitespace()
void EndElement(sal_uInt16 nPrefix, enum ::xmloff::token::XMLTokenEnum eName, bool bIgnWSInside)
OUString GetQNameByKey(sal_uInt16 nKey, const OUString &rLocalName, bool bCache=true) const
NameMap m_aNameTranslationMap
XMLEventExport(SvXMLExport &rExport)
SAL_DLLPRIVATE void StartElement(bool bUseWhitespace)
export the start element
void ExportExt(css::uno::Reference< css::container::XNameAccess > const &xAccess)
export the events, but write <officeooo:events> element (for new file format additions)
void Export(css::uno::Reference< css::document::XEventsSupplier > const &xAccess, bool bUseWhitespace=true)
export the events (calls EventExport::Export(Reference<XNameAccess>) )
SAL_DLLPRIVATE void ExportEvent(const css::uno::Sequence< css::beans::PropertyValue > &rEventValues, const XMLEventName &rXmlEventName, bool bUseWhitespace, bool &rExported)
export one event (start container-element if necessary)
SAL_DLLPRIVATE void EndElement(bool bUseWhitespace)
export the end element
void ExportSingleEvent(const css::uno::Sequence< css::beans::PropertyValue > &rEventValues, const OUString &rApiEventName, bool bUseWhitespace=true)
export a single event (writes <office:events> element)
void AddHandler(const OUString &rName, std::unique_ptr< XMLEventExportHandler > pHandler)
register an EventExportHandler for a particular script type
void AddTranslationTable(const XMLEventNameTranslation *pTransTable)
register additional event names
#define SAL_WARN(area, stream)
OReadStatusBarDocumentHandler::StatusBar_XML_Namespace nNamespace
XMLEventNameTranslation: define tables that translate between event names as used in the XML file for...
constexpr sal_uInt16 XML_NAMESPACE_OFFICE_EXT
constexpr sal_uInt16 XML_NAMESPACE_DOM
constexpr sal_uInt16 XML_NAMESPACE_OFFICE