23#include <com/sun/star/lang/XServiceInfo.hpp>
42typedef ::cppu::ImplInheritanceHelper<
44 css::lang::XServiceInfo> DocumentAcceleratorConfiguration_BASE;
46class DocumentAcceleratorConfiguration :
public DocumentAcceleratorConfiguration_BASE
52 css::uno::Reference< css::embed::XStorage > m_xDocumentRoot;
61 DocumentAcceleratorConfiguration(
62 const css::uno::Reference< css::uno::XComponentContext >& xContext,
63 const css::uno::Sequence< css::uno::Any >& lArguments);
65 virtual ~DocumentAcceleratorConfiguration()
override;
69 return "com.sun.star.comp.framework.DocumentAcceleratorConfiguration";
79 return {
"com.sun.star.ui.DocumentAcceleratorConfiguration"};
83 virtual void SAL_CALL setStorage(
const css::uno::Reference< css::embed::XStorage >& xStorage)
override;
85 virtual sal_Bool SAL_CALL hasStorage()
override;
91DocumentAcceleratorConfiguration::DocumentAcceleratorConfiguration(
92 const css::uno::Reference< css::uno::XComponentContext >& xContext,
93 const css::uno::Sequence< css::uno::Any >& lArguments)
94 : DocumentAcceleratorConfiguration_BASE(xContext)
97 css::uno::Reference<css::embed::XStorage> xRoot;
98 if (lArguments.getLength() == 1 && (lArguments[0] >>= xRoot))
100 m_xDocumentRoot = xRoot;
107 css::uno::Reference< css::embed::XStorage >());
111DocumentAcceleratorConfiguration::~DocumentAcceleratorConfiguration()
113 m_aPresetHandler.removeStorageListener(
this);
116void SAL_CALL DocumentAcceleratorConfiguration::setStorage(
const css::uno::Reference< css::embed::XStorage >& xStorage)
120 bool bForgetOldStorages;
123 bForgetOldStorages = m_xDocumentRoot.is();
124 m_xDocumentRoot = xStorage;
127 if (bForgetOldStorages)
129 m_aPresetHandler.forgetCachedStorages();
135sal_Bool SAL_CALL DocumentAcceleratorConfiguration::hasStorage()
138 return m_xDocumentRoot.is();
141void DocumentAcceleratorConfiguration::fillCache()
143 css::uno::Reference< css::embed::XStorage > xDocumentRoot;
146 xDocumentRoot = m_xDocumentRoot;
151 if (!xDocumentRoot.is())
167 m_aPresetHandler.connectToResource(
168 PresetHandler::E_DOCUMENT,
174 DocumentAcceleratorConfiguration::reload();
175 m_aPresetHandler.addStorageListener(
this);
177 catch(
const css::uno::Exception&)
183extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
185 css::uno::XComponentContext *context,
186 css::uno::Sequence<css::uno::Any>
const &arguments)
189 css::uno::XInterface *acquired_inst = cppu::acquire(inst.get());
193 return acquired_inst;
TValueType getUnpackedValueOrDefault(const OUString &sKey, const TValueType &aDefault) const
implements a read/write access to the accelerator configuration.
constexpr OUStringLiteral RESOURCETYPE_ACCELERATOR
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_framework_DocumentAcceleratorConfiguration_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &arguments)
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)