32#include <com/sun/star/xml/sax/Parser.hpp>
33#include <com/sun/star/xml/sax/InputSource.hpp>
34#include <com/sun/star/xml/sax/Writer.hpp>
35#include <com/sun/star/io/IOException.hpp>
36#include <com/sun/star/embed/ElementModes.hpp>
37#include <com/sun/star/io/XSeekable.hpp>
38#include <com/sun/star/io/XTruncate.hpp>
41#include <com/sun/star/container/XNamed.hpp>
42#include <com/sun/star/container/XNameContainer.hpp>
43#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
44#include <com/sun/star/awt/KeyEvent.hpp>
45#include <com/sun/star/awt/KeyModifier.hpp>
46#include <com/sun/star/lang/XSingleServiceFactory.hpp>
49#include <officecfg/Setup.hxx>
53#include <rtl/ustrbuf.hxx>
66 const sal_Int32 nBeginIndex = 4;
67 OUString sKey(
KeyMapping::get().mapCodeToIdentifier(aKeyEvent.KeyCode));
68 if (sKey.getLength() < nBeginIndex)
70 OUStringBuffer sKeyBuffer(sKey.subView(nBeginIndex));
72 if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::SHIFT) == css::awt::KeyModifier::SHIFT )
73 sKeyBuffer.append(
"_SHIFT");
74 if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::MOD1 ) == css::awt::KeyModifier::MOD1 )
75 sKeyBuffer.append(
"_MOD1");
76 if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::MOD2 ) == css::awt::KeyModifier::MOD2 )
77 sKeyBuffer.append(
"_MOD2");
78 if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::MOD3 ) == css::awt::KeyModifier::MOD3 )
79 sKeyBuffer.append(
"_MOD3");
81 return sKeyBuffer.makeStringAndClear();
86 , m_aPresetHandler(xContext )
92 SAL_WARN_IF(
m_pWriteCache,
"fwk.accelerators",
"XMLBasedAcceleratorConfiguration::~XMLBasedAcceleratorConfiguration(): Changes not flushed. Ignore it ...");
107 if (!rCache.
hasKey(aKeyEvent))
108 throw css::container::NoSuchElementException(
115 const OUString& sCommand )
118 (aKeyEvent.KeyCode == 0) &&
119 (aKeyEvent.KeyChar == 0) &&
120 (aKeyEvent.KeyFunc == 0) &&
121 (aKeyEvent.Modifiers == 0)
123 throw css::lang::IllegalArgumentException(
124 "Such key event seems not to be supported by any operating system.",
128 if (sCommand.isEmpty())
129 throw css::lang::IllegalArgumentException(
130 "Empty command strings are not allowed here.",
143 if (!rCache.
hasKey(aKeyEvent))
144 throw css::container::NoSuchElementException(
152 if (sCommand.isEmpty())
153 throw css::lang::IllegalArgumentException(
154 "Empty command strings are not allowed here.",
161 throw css::container::NoSuchElementException(
174 sal_Int32 c = lCommandList.getLength();
175 css::uno::Sequence< css::uno::Any > lPreferredOnes (c);
178 auto lPreferredOnesRange = asNonConstRange(lPreferredOnes);
181 const OUString& rCommand = lCommandList[
i];
182 if (rCommand.isEmpty())
183 throw css::lang::IllegalArgumentException(
184 "Empty command strings are not allowed here.",
186 static_cast<sal_Int16
>(
i));
195 css::uno::Any& rAny = lPreferredOnesRange[
i];
196 rAny <<= *(lKeys.begin());
199 return lPreferredOnes;
204 if (sCommand.isEmpty())
205 throw css::lang::IllegalArgumentException(
206 "Empty command strings are not allowed here.",
213 throw css::container::NoSuchElementException(
214 "Command does not exists inside this container.",
221 css::uno::Reference< css::io::XStream >
xStream;
222 css::uno::Reference< css::io::XStream > xStreamNoLang;
226 css::embed::ElementModes::READ);
231 catch(
const css::io::IOException&) {}
234 css::uno::Reference< css::io::XInputStream > xIn;
236 xIn =
xStream->getInputStream();
238 throw css::io::IOException(
239 "Could not open accelerator configuration for reading.",
252 if (xStreamNoLang.is())
254 xIn = xStreamNoLang->getInputStream();
262 css::uno::Reference< css::io::XStream >
xStream;
266 css::embed::ElementModes::READWRITE);
269 css::uno::Reference< css::io::XOutputStream > xOut;
271 xOut =
xStream->getOutputStream();
274 throw css::io::IOException(
275 "Could not open accelerator configuration for saving.",
289 css::uno::Reference< css::io::XStream >
xStream = xStorage->openStreamElement(
TARGET_CURRENT, css::embed::ElementModes::READWRITE);
291 css::uno::Reference< css::io::XOutputStream > xOut;
293 xOut =
xStream->getOutputStream();
296 throw css::io::IOException(
297 "Could not open accelerator configuration for saving.",
313 css::uno::Reference< css::io::XStream >
xStream;
317 css::embed::ElementModes::READWRITE);
320 css::uno::Reference< css::io::XOutputStream > xOut;
322 xOut =
xStream->getOutputStream();
328 SAL_INFO(
"fwk.accelerators",
"XMLBasedAcceleratorConfiguration::setStorage(): implement this HACK .-)");
333 SAL_INFO(
"fwk.accelerators",
"XMLBasedAcceleratorConfiguration::hasStorage(): implement this HACK .-)");
339 SAL_INFO(
"fwk.accelerators",
"XMLBasedAcceleratorConfiguration::addConfigurationListener(): implement me");
344 SAL_INFO(
"fwk.accelerators",
"XMLBasedAcceleratorConfiguration::removeConfigurationListener(): implement me");
359 SAL_INFO(
"fwk.accelerators",
"XMLBasedAcceleratorConfiguration::addResetListener(): implement me");
364 SAL_INFO(
"fwk.accelerators",
"XMLBasedAcceleratorConfiguration::removeResetListener(): implement me");
375 css::uno::Reference< css::uno::XComponentContext > xContext;
382 css::uno::Reference< css::io::XSeekable > xSeek(
xStream, css::uno::UNO_QUERY);
396 css::uno::Reference< css::xml::sax::XParser > xParser = css::xml::sax::Parser::create(xContext);
397 xParser->setDocumentHandler(pFilter);
399 css::xml::sax::InputSource aSource;
400 aSource.aInputStream =
xStream;
403 xParser->parseStream(aSource);
410 css::uno::Reference< css::uno::XComponentContext > xContext;
421 css::uno::Reference< css::io::XTruncate > xClearable(
xStream, css::uno::UNO_QUERY_THROW);
422 xClearable->truncate();
425 css::uno::Reference< css::io::XSeekable > xSeek(
xStream, css::uno::UNO_QUERY);
430 css::uno::Reference< css::xml::sax::XWriter > xWriter = css::xml::sax::Writer::create(xContext);
431 xWriter->setOutputStream(
xStream);
434 css::uno::Reference< css::xml::sax::XDocumentHandler > xHandler(xWriter, css::uno::UNO_QUERY_THROW);
469 OUString sISOLocale = officecfg::Setup::L10N::ooLocale::get();
471 if (sISOLocale.isEmpty())
487 css::uno::UNO_QUERY );
501 lKeys.reserve(lKeys.size()+lSecondaryKeys.size());
502 for (
auto const& secondaryKey : lSecondaryKeys)
503 lKeys.push_back(secondaryKey);
515 if (!rPrimaryCache.
hasKey(aKeyEvent) && !rSecondaryCache.
hasKey(aKeyEvent))
516 throw css::container::NoSuchElementException(
520 if (rPrimaryCache.
hasKey(aKeyEvent))
527 const OUString& sCommand )
529 SAL_INFO(
"fwk.accelerators",
"XCUBasedAcceleratorConfiguration::setKeyEvent" );
532 (aKeyEvent.KeyCode == 0) &&
533 (aKeyEvent.KeyChar == 0) &&
534 (aKeyEvent.KeyFunc == 0) &&
535 (aKeyEvent.Modifiers == 0)
537 throw css::lang::IllegalArgumentException(
538 "Such key event seems not to be supported by any operating system.",
542 if (sCommand.isEmpty())
543 throw css::lang::IllegalArgumentException(
544 "Empty command strings are not allowed here.",
553 if ( rPrimaryCache.
hasKey(aKeyEvent) )
556 if ( sCommand != sOriginalCommand )
558 if (rSecondaryCache.
hasCommand(sOriginalCommand))
561 rSecondaryCache.
removeKey(lSecondaryKeys[0]);
568 rPrimaryCache.
removeKey(lPrimaryKeys[0]);
576 else if ( rSecondaryCache.
hasKey(aKeyEvent) )
578 OUString sOriginalCommand = rSecondaryCache.
getCommandByKey(aKeyEvent);
579 if (sCommand != sOriginalCommand)
584 rPrimaryCache.
removeKey(lPrimaryKeys[0]);
598 rPrimaryCache.
removeKey(lPrimaryKeys[0]);
613 if (!rPrimaryCache.
hasKey(aKeyEvent) && !rSecondaryCache.
hasKey(aKeyEvent))
614 throw css::container::NoSuchElementException(
618 if (rPrimaryCache.
hasKey(aKeyEvent))
621 if (!sOriginalCommand.isEmpty())
623 if (rSecondaryCache.
hasCommand(sOriginalCommand))
626 rSecondaryCache.
removeKey(lSecondaryKeys[0]);
637 if (!sDelCommand.isEmpty())
644 if (sCommand.isEmpty())
645 throw css::lang::IllegalArgumentException(
646 "Empty command strings are not allowed here.",
656 throw css::container::NoSuchElementException(
663 for (
auto const& secondaryKey : lSecondaryKeys)
664 lKeys.push_back(secondaryKey);
671 return std::find_if(lKeys.begin(), lKeys.end(), [](
const css::awt::KeyEvent& rAWTKey) {
672 return !::svt::AcceleratorExecute::st_AWTKey2VCLKey(rAWTKey).GetName().isEmpty(); });
680 sal_Int32 c = lCommandList.getLength();
681 css::uno::Sequence< css::uno::Any > lPreferredOnes (c);
684 auto lPreferredOnesRange = asNonConstRange(lPreferredOnes);
687 const OUString& rCommand = lCommandList[
i];
688 if (rCommand.isEmpty())
689 throw css::lang::IllegalArgumentException(
690 "Empty command strings are not allowed here.",
692 static_cast<sal_Int16
>(
i));
702 if (pPreferredKey != lKeys.end ())
704 css::uno::Any& rAny = lPreferredOnesRange[
i];
705 rAny <<= *pPreferredKey;
709 return lPreferredOnes;
714 if (sCommand.isEmpty())
715 throw css::lang::IllegalArgumentException(
716 "Empty command strings are not allowed here.",
726 throw css::container::NoSuchElementException(
727 "Command does not exists inside this container.",
738 SAL_INFO(
"fwk.accelerators",
"XCUBasedAcceleratorConfiguration::reload()" );
743 css::uno::Reference< css::container::XNameAccess > xAccess;
760 SAL_INFO(
"fwk.accelerators",
"XCUBasedAcceleratorConfiguration::store()" );
783 tools::Long nOpenModes = css::embed::ElementModes::READWRITE;
784 css::uno::Reference< css::embed::XStorage > xAcceleratorTypeStorage = xStorage->openStorageElement(
"accelerator", nOpenModes);
785 if (!xAcceleratorTypeStorage.is())
788 css::uno::Reference< css::io::XStream >
xStream = xAcceleratorTypeStorage->openStreamElement(
"current", nOpenModes);
789 css::uno::Reference< css::io::XOutputStream > xOut;
791 xOut =
xStream->getOutputStream();
793 throw css::io::IOException(
794 "Could not open accelerator configuration for saving.",
812 for (
auto const& lKey : lKeys)
818 for (
auto const& lKey : lKeys)
823 css::uno::Reference< css::io::XTruncate > xClearable(xOut, css::uno::UNO_QUERY_THROW);
824 xClearable->truncate();
825 css::uno::Reference< css::io::XSeekable > xSeek(xOut, css::uno::UNO_QUERY);
829 css::uno::Reference< css::xml::sax::XWriter > xWriter = css::xml::sax::Writer::create(
m_xContext);
830 xWriter->setOutputStream(xOut);
833 css::uno::Reference< css::xml::sax::XDocumentHandler > xHandler(xWriter, css::uno::UNO_QUERY_THROW);
850 SAL_INFO(
"fwk.accelerators",
"XCUBasedAcceleratorConfiguration::setStorage(): implement this HACK .-)");
855 SAL_INFO(
"fwk.accelerators",
"XCUBasedAcceleratorConfiguration::hasStorage(): implement this HACK .-)");
861 SAL_INFO(
"fwk.accelerators",
"XCUBasedAcceleratorConfiguration::addConfigurationListener(): implement me");
866 SAL_INFO(
"fwk.accelerators",
"XCUBasedAcceleratorConfiguration::removeConfigurationListener(): implement me");
871 css::uno::Reference< css::container::XNamed > xNamed(
m_xCfg, css::uno::UNO_QUERY);
872 OUString sConfig = xNamed->getName();
873 if ( sConfig ==
"Global" )
877 css::uno::UNO_QUERY );
880 else if ( sConfig ==
"Modules" )
884 css::uno::UNO_QUERY );
891 SAL_INFO(
"fwk.accelerators",
"XCUBasedAcceleratorConfiguration::addResetListener(): implement me");
896 SAL_INFO(
"fwk.accelerators",
"XCUBasedAcceleratorConfiguration::removeResetListener(): implement me");
901 SAL_INFO(
"fwk.accelerators",
"XCUBasedAcceleratorConfiguration::changesOccurred()" );
903 css::uno::Reference< css::container::XHierarchicalNameAccess > xHAccess;
905 if (! xHAccess.is ())
908 css::util::ChangesEvent aReceivedEvents(
aEvent );
909 const sal_Int32 c = aReceivedEvents.Changes.getLength();
910 for (sal_Int32
i=0;
i<c; ++
i)
912 const css::util::ElementChange& aChange = aReceivedEvents.Changes[
i];
923 aChange.Accessor >>= sOrgPath;
925 OUString sPrimarySecondary = ::utl::extractFirstFromConfigurationPath(sPath, &sPath);
926 OUString sGlobalModules = ::utl::extractFirstFromConfigurationPath(sPath, &sPath);
930 sKey = ::utl::extractFirstFromConfigurationPath(sPath, &sPath);
931 if ( !sKey.isEmpty() && !sPath.isEmpty() )
932 reloadChanged(sPrimarySecondary, sGlobalModules, OUString(), sKey);
936 OUString sModule = ::utl::extractFirstFromConfigurationPath(sPath, &sPath);
937 sKey = ::utl::extractFirstFromConfigurationPath(sPath, &sPath);
939 if ( !sKey.isEmpty() && !sPath.isEmpty() )
941 reloadChanged(sPrimarySecondary, sGlobalModules, sModule, sKey);
954 css::uno::Reference< css::container::XNameAccess > xAccess;
959 css::uno::Reference< css::container::XNameAccess > xModules;
965 static constexpr OUStringLiteral sDefaultLocale(
u"en-US");
967 css::uno::Reference< css::container::XNameAccess > xKey;
968 css::uno::Reference< css::container::XNameAccess > xCommand;
971 css::uno::Sequence< OUString > lKeys = xAccess->getElementNames();
972 sal_Int32 nKeys = lKeys.getLength();
973 for ( sal_Int32
i=0;
i<nKeys; ++
i )
975 OUString sKey = lKeys[
i];
976 xAccess->getByName(sKey) >>= xKey;
979 const css::uno::Sequence< OUString > lLocales = xCommand->getElementNames();
980 ::std::vector< OUString > aLocales { lLocales.begin(), lLocales.end() };
983 for (
auto const& locale : aLocales)
985 if ( locale == sIsoLang )
992 if (sLocale.isEmpty())
994 for (
auto const& locale : aLocales)
996 if ( locale == sDefaultLocale )
1003 if (sLocale.isEmpty())
1008 xCommand->getByName(sLocale) >>= sCommand;
1009 if (sCommand.isEmpty())
1012 css::awt::KeyEvent aKeyEvent;
1018 const sal_Int32
nToken = 4;
1021 for (k = 0; k <
nToken; ++k)
1033 if ( sToken ==
u"SHIFT" )
1034 aKeyEvent.Modifiers |= css::awt::KeyModifier::SHIFT;
1035 else if ( sToken ==
u"MOD1" )
1036 aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD1;
1037 else if ( sToken ==
u"MOD2" )
1038 aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD2;
1039 else if ( sToken ==
u"MOD3" )
1040 aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD3;
1048 if ( !aReadCache.
hasKey(aKeyEvent) && bValid && k<
nToken)
1066 for (
auto const& primaryReadKey : lPrimaryReadKeys)
1072 for (
auto const& primaryWriteKey : lPrimaryWriteKeys)
1082 if (sReadCommand != sCommand)
1102 for (
auto const& secondaryReadKey : lSecondaryReadKeys)
1108 for (
auto const& secondaryWriteKey : lSecondaryWriteKeys)
1118 if (sReadCommand != sCommand)
1138 css::uno::Reference< css::container::XNameAccess > xAccess;
1139 css::uno::Reference< css::container::XNameContainer > xContainer;
1140 css::uno::Reference< css::lang::XSingleServiceFactory > xFac;
1141 css::uno::Reference< css::uno::XInterface > xInst;
1152 css::uno::Reference< css::container::XNameContainer > xModules;
1156 xFac.set(xModules, css::uno::UNO_QUERY);
1157 xInst = xFac->createInstance();
1158 xModules->insertByName(
m_sModuleCFG, css::uno::Any(xInst));
1164 css::uno::Reference< css::container::XNameAccess > xKey;
1165 css::uno::Reference< css::container::XNameContainer > xCommand;
1166 if ( !xContainer->hasByName(sKey) )
1168 xFac.set(xContainer, css::uno::UNO_QUERY);
1169 xInst = xFac->createInstance();
1170 xContainer->insertByName(sKey, css::uno::Any(xInst));
1172 xContainer->getByName(sKey) >>= xKey;
1176 if ( !xCommand->hasByName(sLocale) )
1177 xCommand->insertByName(sLocale, css::uno::Any(sCommand));
1179 xCommand->replaceByName(sLocale, css::uno::Any(sCommand));
1184 css::uno::Reference< css::container::XNameAccess > xAccess;
1185 css::uno::Reference< css::container::XNameContainer > xContainer;
1196 css::uno::Reference< css::container::XNameAccess > xModules;
1204 xContainer->removeByName(sKey);
1209 css::uno::Reference< css::container::XNameAccess > xAccess;
1210 css::uno::Reference< css::container::XNameContainer > xContainer;
1212 m_xCfg->getByName(sPrimarySecondary) >>= xAccess;
1217 css::uno::Reference< css::container::XNameAccess > xModules;
1219 if ( !xModules->hasByName(sModule) )
1221 xModules->getByName(sModule) >>= xContainer;
1224 css::awt::KeyEvent aKeyEvent;
1237 if ( sToken ==
u"SHIFT" )
1238 aKeyEvent.Modifiers |= css::awt::KeyModifier::SHIFT;
1239 else if ( sToken ==
u"MOD1" )
1240 aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD1;
1241 else if ( sToken ==
u"MOD2" )
1242 aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD2;
1243 else if ( sToken ==
u"MOD3" )
1244 aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD3;
1247 css::uno::Reference< css::container::XNameAccess > xKey;
1248 css::uno::Reference< css::container::XNameAccess > xCommand;
1251 if (xContainer->hasByName(sKey))
1254 xContainer->getByName(sKey) >>= xKey;
1256 xCommand->getByName(sLocale) >>= sCommand;
1261 if (sCommand.isEmpty())
1268 if (sCommand.isEmpty())
1316 OUString sISOLocale = officecfg::Setup::L10N::ooLocale::get();
1318 if (sISOLocale.isEmpty())
constexpr OUStringLiteral TARGET_CURRENT
constexpr OUStringLiteral PRESET_DEFAULT
static css::uno::Reference< css::uno::XInterface > openConfig(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const OUString &sPackage, EConfigurationModes eMode)
static void flush(const css::uno::Reference< css::uno::XInterface > &xCFG)
implements a cache for any accelerator configuration.
TKeyList getAllKeys() const
TKeyList getKeysByCommand(const OUString &sCommand) const
returns the list of keys, which are registered for this command.
void setKeyCommandPair(const css::awt::KeyEvent &aKey, const OUString &sCommand)
add a new or change an existing key-command pair of this container.
::std::vector< css::awt::KeyEvent > TKeyList
commands -> keys
void removeCommand(const OUString &sCommand)
bool hasCommand(const OUString &sCommand) const
OUString getCommandByKey(const css::awt::KeyEvent &aKey) const
void removeKey(const css::awt::KeyEvent &aKey)
bool hasKey(const css::awt::KeyEvent &aKey) const
checks if the specified key exists.
static KeyMapping & get()
sal_uInt16 mapIdentifierToCode(const OUString &sIdentifier)
return a suitable key code for the specified key identifier.
css::uno::Reference< css::io::XStream > openPreset(std::u16string_view sPreset)
open the specified preset as stream object and return it.
void commitUserChanges()
do anything which is necessary to flush all changes back to disk.
void copyPresetToTarget(std::u16string_view sPreset, std::u16string_view sTarget)
try to copy the specified preset from the share layer to the user layer and establish it as the speci...
css::uno::Reference< css::io::XStream > openTarget(std::u16string_view sTarget, sal_Int32 nMode)
open the specified target as stream object and return it.
virtual OUString SAL_CALL getCommandByKeyEvent(const css::awt::KeyEvent &aKeyEvent) override
virtual ~XCUBasedAcceleratorConfiguration() override
OUString m_sGlobalOrModules
AcceleratorCache m_aPrimaryReadCache
virtual void SAL_CALL reload() override
virtual void SAL_CALL removeConfigurationListener(const css::uno::Reference< css::ui::XUIConfigurationListener > &xListener) override
void reloadChanged(const OUString &sPrimarySecondary, std::u16string_view sGlobalModules, const OUString &sModule, const OUString &sKey)
virtual void SAL_CALL removeKeyEvent(const css::awt::KeyEvent &aKeyEvent) override
virtual void SAL_CALL addConfigurationListener(const css::uno::Reference< css::ui::XUIConfigurationListener > &xListener) override
virtual void SAL_CALL removeCommandFromAllKeyEvents(const OUString &sCommand) override
virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPreferredKeyEventsForCommandList(const css::uno::Sequence< OUString > &lCommandList) override
virtual sal_Bool SAL_CALL isModified() override
virtual css::uno::Sequence< css::awt::KeyEvent > SAL_CALL getAllKeyEvents() override
virtual void SAL_CALL removeResetListener(const css::uno::Reference< css::form::XResetListener > &xListener) override
virtual css::uno::Sequence< css::awt::KeyEvent > SAL_CALL getKeyEventsByCommand(const OUString &sCommand) override
css::uno::Reference< css::container::XNameAccess > m_xCfg
virtual void SAL_CALL storeToStorage(const css::uno::Reference< css::embed::XStorage > &xStorage) override
std::unique_ptr< AcceleratorCache > m_pSecondaryWriteCache
void insertKeyToConfiguration(const css::awt::KeyEvent &aKeyEvent, const OUString &sCommand, const bool bPreferred)
virtual sal_Bool SAL_CALL hasStorage() override
AcceleratorCache m_aSecondaryReadCache
virtual void SAL_CALL setKeyEvent(const css::awt::KeyEvent &aKeyEvent, const OUString &sCommand) override
void removeKeyFromConfiguration(const css::awt::KeyEvent &aKeyEvent, const bool bPreferred)
std::unique_ptr< AcceleratorCache > m_pPrimaryWriteCache
virtual void SAL_CALL disposing(const css::lang::EventObject &aEvent) override
css::uno::Reference< css::uno::XComponentContext > m_xContext
the global uno service manager.
AcceleratorCache & impl_getCFG(bool bPreferred, bool bWriteAccessRequested=false)
XCUBasedAcceleratorConfiguration(css::uno::Reference< css::uno::XComponentContext > xContext)
void impl_ts_save(bool bPreferred)
virtual void SAL_CALL addResetListener(const css::uno::Reference< css::form::XResetListener > &xListener) override
virtual sal_Bool SAL_CALL isReadOnly() override
virtual void SAL_CALL changesOccurred(const css::util::ChangesEvent &aEvent) override
virtual void SAL_CALL reset() override
OUString impl_ts_getLocale() const
return the current office locale.
virtual void SAL_CALL store() override
void impl_ts_load(bool bPreferred, const css::uno::Reference< css::container::XNameAccess > &xCfg)
virtual void SAL_CALL setStorage(const css::uno::Reference< css::embed::XStorage > &xStorage) override
virtual void SAL_CALL removeCommandFromAllKeyEvents(const OUString &sCommand) override
virtual void SAL_CALL setStorage(const css::uno::Reference< css::embed::XStorage > &xStorage) override
virtual sal_Bool SAL_CALL isModified() override
virtual void SAL_CALL store() override
std::unique_ptr< AcceleratorCache > m_pWriteCache
used to implement the copy on write pattern!
virtual void SAL_CALL removeResetListener(const css::uno::Reference< css::form::XResetListener > &xListener) override
virtual void SAL_CALL reset() override
virtual void SAL_CALL setKeyEvent(const css::awt::KeyEvent &aKeyEvent, const OUString &sCommand) override
virtual void SAL_CALL removeConfigurationListener(const css::uno::Reference< css::ui::XUIConfigurationListener > &xListener) override
virtual css::uno::Sequence< css::awt::KeyEvent > SAL_CALL getKeyEventsByCommand(const OUString &sCommand) override
AcceleratorCache & impl_getCFG(bool bWriteAccessRequested=false)
returns a reference to one of our internal cache members.
virtual ~XMLBasedAcceleratorConfiguration() override
virtual void SAL_CALL addConfigurationListener(const css::uno::Reference< css::ui::XUIConfigurationListener > &xListener) override
virtual void SAL_CALL reload() override
PresetHandler m_aPresetHandler
used to: i ) copy configuration files from the share to the user layer ii ) provide access to these c...
virtual sal_Bool SAL_CALL hasStorage() override
virtual void SAL_CALL addResetListener(const css::uno::Reference< css::form::XResetListener > &xListener) override
OUString impl_ts_getLocale() const
return the current office locale.
void impl_ts_save(const css::uno::Reference< css::io::XOutputStream > &xStream)
save a configuration set, using the given stream.
XMLBasedAcceleratorConfiguration(const css::uno::Reference< css::uno::XComponentContext > &xContext)
css::uno::Reference< css::uno::XComponentContext > m_xContext
the global uno service manager.
virtual sal_Bool SAL_CALL isReadOnly() override
virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPreferredKeyEventsForCommandList(const css::uno::Sequence< OUString > &lCommandList) override
virtual void SAL_CALL removeKeyEvent(const css::awt::KeyEvent &aKeyEvent) override
void impl_ts_load(const css::uno::Reference< css::io::XInputStream > &xStream)
load a configuration set, using the given stream.
virtual void SAL_CALL storeToStorage(const css::uno::Reference< css::embed::XStorage > &xStorage) override
AcceleratorCache m_aReadCache
contains the cached configuration data
virtual css::uno::Sequence< css::awt::KeyEvent > SAL_CALL getAllKeyEvents() override
virtual OUString SAL_CALL getCommandByKeyEvent(const css::awt::KeyEvent &aKeyEvent) override
css::uno::Reference< css::uno::XComponentContext > m_xContext
#define SAL_WARN_IF(condition, area, stream)
#define SAL_INFO(area, stream)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
constexpr OUStringLiteral CFG_PROP_COMMAND
static OUString lcl_getKeyString(const css::awt::KeyEvent &aKeyEvent)
constexpr OUStringLiteral CFG_ENTRY_GLOBAL
static AcceleratorCache::TKeyList::const_iterator lcl_getPreferredKey(const AcceleratorCache::TKeyList &lKeys)
constexpr OUStringLiteral CFG_ENTRY_MODULES
constexpr OUStringLiteral CFG_ENTRY_PRIMARY
constexpr OUStringLiteral CFG_ENTRY_SECONDARY
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)