26#include <com/sun/star/xml/sax/SAXException.hpp>
27#include <com/sun/star/awt/KeyModifier.hpp>
28#include <com/sun/star/awt/KeyEvent.hpp>
42#define THROW_PARSEEXCEPTION(COMMENT) \
44 throw css::xml::sax::SAXException( \
45 implts_getErrorLineString() + COMMENT, \
46 static_cast< css::xml::sax::XDocumentHandler* >(this), \
51 : m_rContainer (rContainer )
52 , m_bInsideAcceleratorList(false )
53 , m_bInsideAcceleratorItem(false )
77 const css::uno::Reference< css::xml::sax::XAttributeList >& xAttributeList)
94 sal_Int16 c = xAttributeList->getLength();
98 OUString sAttribute = xAttributeList->getNameByIndex(
i);
99 OUString sValue = xAttributeList->getValueByIndex(
i);
112 aEvent.Modifiers |= css::awt::KeyModifier::SHIFT;
116 aEvent.Modifiers |= css::awt::KeyModifier::MOD1;
120 aEvent.Modifiers |= css::awt::KeyModifier::MOD2;
124 aEvent.Modifiers |= css::awt::KeyModifier::MOD3;
130 sCommand.isEmpty() ||
147 "AcceleratorConfigurationReader::startElement(): Double registration detected. Command=\"" <<
208 if (sElement ==
u"http://openoffice.org/2001/accel^acceleratorlist")
210 else if (sElement ==
u"http://openoffice.org/2001/accel^item")
213 throw css::uno::RuntimeException(
214 "Unknown XML element detected!",
215 css::uno::Reference< css::xml::sax::XDocumentHandler >());
224 if (sAttribute ==
u"http://openoffice.org/2001/accel^code")
226 else if (sAttribute ==
u"http://openoffice.org/2001/accel^shift")
228 else if (sAttribute ==
u"http://openoffice.org/2001/accel^mod1")
230 else if (sAttribute ==
u"http://openoffice.org/2001/accel^mod2")
232 else if (sAttribute ==
u"http://openoffice.org/2001/accel^mod3")
234 else if (sAttribute ==
u"http://www.w3.org/1999/xlink^href")
237 throw css::uno::RuntimeException(
238 "Unknown XML attribute detected!",
239 css::uno::Reference< css::xml::sax::XDocumentHandler >());
247 return "Error during parsing XML. (No further info available ...)";
249 return "Error during parsing XML in\nline = " +
250 OUString::number(
m_xLocator->getLineNumber()) +
252 OUString::number(
m_xLocator->getColumnNumber()) +
#define THROW_PARSEEXCEPTION(COMMENT)
implements a cache for any accelerator configuration.
void setKeyCommandPair(const css::awt::KeyEvent &aKey, const OUString &sCommand)
add a new or change an existing key-command pair of this container.
bool hasKey(const css::awt::KeyEvent &aKey) const
checks if the specified key exists.
virtual void SAL_CALL setDocumentLocator(const css::uno::Reference< css::xml::sax::XLocator > &xLocator) override
css::uno::Reference< css::xml::sax::XLocator > m_xLocator
provide information about the parsing state.
static EXMLElement implst_classifyElement(std::u16string_view sElement)
TODO document me.
virtual void SAL_CALL endDocument() override
virtual ~AcceleratorConfigurationReader() override
does nothing real ...
AcceleratorConfigurationReader(AcceleratorCache &rContainer)
connect this new reader/writer instance to an outside container, which should be used flushed to the ...
EXMLAttribute
classification of XML attributes.
virtual void SAL_CALL ignorableWhitespace(const OUString &sWhitespaces) override
virtual void SAL_CALL startDocument() override
bool m_bInsideAcceleratorList
used to detect if an accelerator list occurs recursive inside xml.
virtual void SAL_CALL characters(const OUString &sChars) override
AcceleratorCache & m_rContainer
reference to the outside container, where this reader/writer must work on.
static EXMLAttribute implst_classifyAttribute(std::u16string_view sAttribute)
TODO document me.
OUString implts_getErrorLineString()
TODO document me.
bool m_bInsideAcceleratorItem
used to detect if an accelerator item occurs recursive inside xml.
EXMLElement
classification of XML elements.
@ E_ELEMENT_ACCELERATORLIST
virtual void SAL_CALL startElement(const OUString &sElement, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttributeList) override
virtual void SAL_CALL endElement(const OUString &sElement) override
virtual void SAL_CALL processingInstruction(const OUString &sTarget, const OUString &sData) override
static KeyMapping & get()
sal_uInt16 mapIdentifierToCode(const OUString &sIdentifier)
return a suitable key code for the specified key identifier.
#define SAL_INFO(area, stream)