LibreOffice Module xmloff (master) 1
Public Member Functions | Private Member Functions | Private Attributes | List of all members
XMLEventExport Class Reference

Export instances of EventsSupplier services. More...

#include <XMLEventExport.hxx>

Collaboration diagram for XMLEventExport:
[legend]

Public Member Functions

 XMLEventExport (SvXMLExport &rExport)
 
 ~XMLEventExport ()
 
XMLEventExportoperator= (XMLEventExport const &)=delete
 
 XMLEventExport (XMLEventExport const &)=delete
 
void AddHandler (const OUString &rName, std::unique_ptr< XMLEventExportHandler > pHandler)
 register an EventExportHandler for a particular script type More...
 
void AddTranslationTable (const XMLEventNameTranslation *pTransTable)
 register additional event names More...
 
void Export (css::uno::Reference< css::document::XEventsSupplier > const &xAccess, bool bUseWhitespace=true)
 export the events (calls EventExport::Export(Reference<XNameAccess>) ) More...
 
void Export (css::uno::Reference< css::container::XNameReplace > const &xAccess, bool bUseWhitespace=true)
 export the events (calls EventExport::Export(Reference<XNameAccess>) ) More...
 
void Export (css::uno::Reference< css::container::XNameAccess > const &xAccess, bool bUseWhitespace=true)
 export the events (writes <office:events> element) More...
 
void ExportExt (css::uno::Reference< css::container::XNameAccess > const &xAccess)
 export the events, but write <officeooo:events> element (for new file format additions) More...
 
void ExportSingleEvent (const css::uno::Sequence< css::beans::PropertyValue > &rEventValues, const OUString &rApiEventName, bool bUseWhitespace=true)
 export a single event (writes <office:events> element) More...
 

Private Member Functions

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) More...
 
SAL_DLLPRIVATE void StartElement (bool bUseWhitespace)
 export the start element More...
 
SAL_DLLPRIVATE void EndElement (bool bUseWhitespace)
 export the end element More...
 

Private Attributes

SvXMLExportm_rExport
 
HandlerMap m_aHandlerMap
 
NameMap m_aNameTranslationMap
 
bool m_bExtNamespace
 

Detailed Description

Export instances of EventsSupplier services.

To use this class you must fulfill two conditions:

1) provide a translation from the API event names to XML event names 2) Register XMLEventExportHandler instances for all script types that you would like to export.

The Export()-Methods all have a bUseWhitespace parameter that causes the exported elements to be surrounded by whitespace, which in turn causes the elements to be indented properly. By default, whitespace is used, but it may not be called for in all cases (e.g events attached to hyperlink within a paragraph.)

Definition at line 61 of file XMLEventExport.hxx.

Constructor & Destructor Documentation

◆ XMLEventExport() [1/2]

XMLEventExport::XMLEventExport ( SvXMLExport rExport)

Definition at line 45 of file XMLEventExport.cxx.

◆ ~XMLEventExport()

XMLEventExport::~XMLEventExport ( )

Definition at line 51 of file XMLEventExport.cxx.

References m_aHandlerMap.

◆ XMLEventExport() [2/2]

XMLEventExport::XMLEventExport ( XMLEventExport const &  )
delete

Member Function Documentation

◆ AddHandler()

void XMLEventExport::AddHandler ( const OUString &  rName,
std::unique_ptr< XMLEventExportHandler pHandler 
)

register an EventExportHandler for a particular script type

The handlers will be deleted when the object is destroyed, hence no pointers to a handler registered with AddHandler() should be held by anyone.

Definition at line 57 of file XMLEventExport.cxx.

References m_aHandlerMap.

◆ AddTranslationTable()

void XMLEventExport::AddTranslationTable ( const XMLEventNameTranslation pTransTable)

register additional event names

Definition at line 64 of file XMLEventExport.cxx.

References m_aNameTranslationMap, and XMLEventNameTranslation::sAPIName.

Referenced by xmloff::OFormLayerXMLExport_Impl::OFormLayerXMLExport_Impl().

◆ EndElement()

void XMLEventExport::EndElement ( bool  bUseWhitespace)
private

◆ Export() [1/3]

void XMLEventExport::Export ( css::uno::Reference< css::container::XNameAccess > const &  xAccess,
bool  bUseWhitespace = true 
)

export the events (writes <office:events> element)

◆ Export() [2/3]

void XMLEventExport::Export ( css::uno::Reference< css::container::XNameReplace > const &  xAccess,
bool  bUseWhitespace = true 
)

export the events (calls EventExport::Export(Reference<XNameAccess>) )

◆ Export() [3/3]

void XMLEventExport::Export ( css::uno::Reference< css::document::XEventsSupplier > const &  xAccess,
bool  bUseWhitespace = true 
)

◆ ExportEvent()

void XMLEventExport::ExportEvent ( const css::uno::Sequence< css::beans::PropertyValue > &  rEventValues,
const XMLEventName rXmlEventName,
bool  bUseWhitespace,
bool &  rExported 
)
private

export one event (start container-element if necessary)

export a single event

Definition at line 182 of file XMLEventExport.cxx.

References SvXMLExport::GetNamespaceMap(), SvXMLNamespaceMap::GetQNameByKey(), m_aHandlerMap, XMLEventName::m_aName, XMLEventName::m_nPrefix, m_rExport, StartElement(), and sType.

Referenced by ExportSingleEvent().

◆ ExportExt()

void XMLEventExport::ExportExt ( css::uno::Reference< css::container::XNameAccess > const &  xAccess)

export the events, but write <officeooo:events> element (for new file format additions)

Definition at line 142 of file XMLEventExport.cxx.

References Export(), and m_bExtNamespace.

◆ ExportSingleEvent()

void XMLEventExport::ExportSingleEvent ( const css::uno::Sequence< css::beans::PropertyValue > &  rEventValues,
const OUString &  rApiEventName,
bool  bUseWhitespace = true 
)

export a single event (writes <office:events> element)

export a singular event and write <office:events> container

Definition at line 152 of file XMLEventExport.cxx.

References EndElement(), ExportEvent(), m_aNameTranslationMap, and SAL_WARN.

Referenced by XMLTextFieldExport::ExportMacro().

◆ operator=()

XMLEventExport & XMLEventExport::operator= ( XMLEventExport const &  )
delete

◆ StartElement()

void XMLEventExport::StartElement ( bool  bUseWhitespace)
private

Member Data Documentation

◆ m_aHandlerMap

HandlerMap XMLEventExport::m_aHandlerMap
private

Definition at line 65 of file XMLEventExport.hxx.

Referenced by AddHandler(), ExportEvent(), and ~XMLEventExport().

◆ m_aNameTranslationMap

NameMap XMLEventExport::m_aNameTranslationMap
private

Definition at line 66 of file XMLEventExport.hxx.

Referenced by AddTranslationTable(), and ExportSingleEvent().

◆ m_bExtNamespace

bool XMLEventExport::m_bExtNamespace
private

Definition at line 68 of file XMLEventExport.hxx.

Referenced by EndElement(), ExportExt(), and StartElement().

◆ m_rExport

SvXMLExport& XMLEventExport::m_rExport
private

Definition at line 63 of file XMLEventExport.hxx.

Referenced by EndElement(), ExportEvent(), and StartElement().


The documentation for this class was generated from the following files: