28#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
29#include <com/sun/star/awt/KeyModifier.hpp>
37 css::uno::Reference< css::xml::sax::XDocumentHandler > xConfig )
38 : m_xConfig (
std::move(xConfig ))
39 , m_rContainer (rContainer )
49 css::uno::Reference< css::xml::sax::XExtendedDocumentHandler > xExtendedCFG(
m_xConfig, css::uno::UNO_QUERY_THROW);
54 pAttribs->AddAttribute(
56 "http://openoffice.org/2001/accel");
57 pAttribs->AddAttribute(
58 "xmlns:xlink",
"http://www.w3.org/1999/xlink");
61 xExtendedCFG->startDocument();
63 xExtendedCFG->unknown(
64 "<!DOCTYPE accel:acceleratorlist PUBLIC \"-//OpenOffice.org//DTD"
65 " OfficeDocument 1.0//EN\" \"accelerator.dtd\">");
66 xExtendedCFG->ignorableWhitespace(OUString());
69 xExtendedCFG->ignorableWhitespace(OUString());
73 for (
auto const& lKey : lKeys)
84 xExtendedCFG->ignorableWhitespace(OUString());
86 xExtendedCFG->ignorableWhitespace(OUString());
87 xExtendedCFG->endDocument();
91 const OUString& sCommand,
92 const css::uno::Reference< css::xml::sax::XDocumentHandler >& xConfig )
99 pAttribs->AddAttribute(
"accel:code", sKey );
100 pAttribs->AddAttribute(
"xlink:href", sCommand);
102 if ((aKey.Modifiers & css::awt::KeyModifier::SHIFT) == css::awt::KeyModifier::SHIFT)
103 pAttribs->AddAttribute(
"accel:shift",
"true");
105 if ((aKey.Modifiers & css::awt::KeyModifier::MOD1) == css::awt::KeyModifier::MOD1)
106 pAttribs->AddAttribute(
"accel:mod1",
"true");
108 if ((aKey.Modifiers & css::awt::KeyModifier::MOD2) == css::awt::KeyModifier::MOD2)
109 pAttribs->AddAttribute(
"accel:mod2",
"true");
111 if ((aKey.Modifiers & css::awt::KeyModifier::MOD3) == css::awt::KeyModifier::MOD3)
112 pAttribs->AddAttribute(
"accel:mod3",
"true");
114 xConfig->ignorableWhitespace(OUString());
116 xConfig->ignorableWhitespace(OUString());
118 xConfig->ignorableWhitespace(OUString());
implements a cache for any accelerator configuration.
TKeyList getAllKeys() const
::std::vector< css::awt::KeyEvent > TKeyList
commands -> keys
OUString getCommandByKey(const css::awt::KeyEvent &aKey) const
css::uno::Reference< css::xml::sax::XDocumentHandler > m_xConfig
needed to write the xml configuration.
AcceleratorConfigurationWriter(const AcceleratorCache &rContainer, css::uno::Reference< css::xml::sax::XDocumentHandler > xConfig)
connect this new writer instance to an outside container, which should be flushed to the underlying X...
void impl_ts_writeKeyCommandPair(const css::awt::KeyEvent &aKey, const OUString &sCommand, const css::uno::Reference< css::xml::sax::XDocumentHandler > &xConfig)
TODO.
~AcceleratorConfigurationWriter()
does nothing real ...
const AcceleratorCache & m_rContainer
reference to the outside container, where this writer must work on.
OUString mapCodeToIdentifier(sal_uInt16 nCode)
return a suitable key identifier for the specified key code.
static KeyMapping & get()
constexpr OUStringLiteral AL_ELEMENT_ITEM
constexpr OUStringLiteral AL_ELEMENT_ACCELERATORLIST