10#ifndef INCLUDED_COMPHELPER_CONFIGURATION_HXX
11#define INCLUDED_COMPHELPER_CONFIGURATION_HXX
15#include <com/sun/star/uno/Any.hxx>
16#include <com/sun/star/uno/Reference.h>
24#include <unordered_map>
27 namespace configuration {
class XReadWriteAccess; }
29 class XHierarchicalNameAccess;
30 class XHierarchicalNameReplace;
34 namespace uno {
class XComponentContext; }
36 class XChangesListener;
37 class XChangesNotifier;
43namespace detail {
class ConfigurationWrapper; }
54 static std::shared_ptr<ConfigurationChanges>
create();
65 css::uno::Reference< css::uno::XComponentContext >
69 OUString
const & path, css::uno::Any
const & value)
72 SAL_DLLPRIVATE css::uno::Reference<
73 css::container::XHierarchicalNameReplace >
74 getGroup(OUString
const & path)
const;
77 css::uno::Reference< css::container::XNameContainer >
78 getSet(OUString
const & path)
const;
81 css::configuration::XReadWriteAccess >
access_;
88class ConfigurationChangesListener;
96 bool isReadOnly(OUString
const & path)
const;
101 std::shared_ptr< ConfigurationChanges >
const & batch,
102 OUString
const & path, css::uno::Any
const & value);
104 css::uno::Any getLocalizedPropertyValue(
105 std::u16string_view path)
const;
107 static void setLocalizedPropertyValue(
108 std::shared_ptr< ConfigurationChanges >
const & batch,
109 OUString
const & path, css::uno::Any
const & value);
112 css::container::XHierarchicalNameAccess >
113 getGroupReadOnly(OUString
const & path)
const;
115 static css::uno::Reference<
116 css::container::XHierarchicalNameReplace >
118 std::shared_ptr< ConfigurationChanges >
const & batch,
119 OUString
const & path);
121 css::uno::Reference< css::container::XNameAccess >
122 getSetReadOnly(OUString
const & path)
const;
124 static css::uno::Reference< css::container::XNameContainer >
126 std::shared_ptr< ConfigurationChanges >
const & batch,
127 OUString
const & path);
129 std::shared_ptr< ConfigurationChanges > createChanges()
const;
139 css::uno::Reference< css::uno::XComponentContext >
context_;
141 css::uno::Reference< css::configuration::XReadWriteAccess >
access_;
150 css::uno::Reference< css::util::XChangesNotifier >
maNotifier;
151 css::uno::Reference< css::util::XChangesListener >
maListener;
156 static css::uno::Any
toAny(T
const & value)
157 {
return css::uno::Any(
value); }
160 {
return value.get< T >(); }
173 static css::uno::Any
toAny(std::optional< T >
const & value) {
175 ? css::uno::Any(*
value)
179 static std::optional< T >
fromAny(css::uno::Any
const & value)
181 return value.hasValue()
182 ? std::optional< T >(
value.get< T >()) : std::optional< T >();
228 std::shared_ptr< ConfigurationChanges >
const & batch)
260 getLocalizedPropertyValue(T::path()));
272 std::shared_ptr< ConfigurationChanges >
const & batch)
293 static css::uno::Reference<
294 css::container::XHierarchicalNameAccess >
303 static css::uno::Reference<
304 css::container::XHierarchicalNameReplace >
305 get(std::shared_ptr< ConfigurationChanges >
const & batch)
327 css::uno::Reference< css::container::XNameAccess >
337 css::uno::Reference< css::container::XNameContainer >
338 get(std::shared_ptr< ConfigurationChanges >
const & batch)
A batch of configuration changes that is committed as a whole.
css::uno::Reference< css::configuration::XReadWriteAccess > access_
ConfigurationChanges(const ConfigurationChanges &)=delete
ConfigurationChanges & operator=(const ConfigurationChanges &)=delete
ConfigurationWrapper(const ConfigurationWrapper &)=delete
css::uno::Reference< css::container::XHierarchicalNameAccess > getGroupReadOnly(OUString const &path) const
bool isReadOnly(OUString const &path) const
ConfigurationWrapper & operator=(const ConfigurationWrapper &)=delete
css::uno::Reference< css::configuration::XReadWriteAccess > access_
static void setPropertyValue(std::shared_ptr< ConfigurationChanges > const &batch, OUString const &path, css::uno::Any const &value)
css::uno::Reference< css::util::XChangesListener > maListener
css::uno::Reference< css::util::XChangesNotifier > maNotifier
css::uno::Reference< css::uno::XComponentContext > context_
static void setLocalizedPropertyValue(std::shared_ptr< ConfigurationChanges > const &batch, OUString const &path, css::uno::Any const &value)
std::unordered_map< OUString, css::uno::Any > maPropertyCache
css::uno::Reference< css::container::XNameAccess > getSetReadOnly(OUString const &path) const
static css::uno::Reference< css::container::XNameContainer > getSetReadWrite(std::shared_ptr< ConfigurationChanges > const &batch, OUString const &path)
static ConfigurationWrapper const & get()
static css::uno::Reference< css::container::XHierarchicalNameReplace > getGroupReadWrite(std::shared_ptr< ConfigurationChanges > const &batch, OUString const &path)
#define COMPHELPER_DLLPUBLIC
css::uno::Reference< css::deployment::XPackageRegistry > create(css::uno::Reference< css::deployment::XPackageRegistry > const &xRootRegistry, OUString const &context, OUString const &cachePath, css::uno::Reference< css::uno::XComponentContext > const &xComponentContext)
VBAHELPER_DLLPUBLIC bool setPropertyValue(css::uno::Sequence< css::beans::PropertyValue > &aProp, const OUString &aName, const css::uno::Any &aValue)
bool getPropertyValue(ValueType &rValue, css::uno::Reference< css::beans::XPropertySet > const &xPropSet, OUString const &propName)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
A type-safe wrapper around a configuration group.
static css::uno::Reference< css::container::XHierarchicalNameAccess > get()
Get read-only access to the given configuration group.
ConfigurationGroup()=delete
ConfigurationGroup & operator=(const ConfigurationGroup &)=delete
~ConfigurationGroup()=delete
static css::uno::Reference< css::container::XHierarchicalNameReplace > get(std::shared_ptr< ConfigurationChanges > const &batch)
Get read/write access to the given configuration group, storing any modifications via the given chang...
ConfigurationGroup(const ConfigurationGroup &)=delete
A type-safe wrapper around a localized configuration property.
ConfigurationLocalizedProperty & operator=(const ConfigurationLocalizedProperty &)=delete
~ConfigurationLocalizedProperty()=delete
ConfigurationLocalizedProperty(const ConfigurationLocalizedProperty &)=delete
static U get()
Get the value of the given localized configuration property, for the locale currently set at the com....
static void set(U const &value, std::shared_ptr< ConfigurationChanges > const &batch)
Set the value of the given localized configuration property, for the locale currently set at the com....
ConfigurationLocalizedProperty()=delete
A type-safe wrapper around a (non-localized) configuration property.
ConfigurationProperty & operator=(const ConfigurationProperty &)=delete
static U get()
Get the value of the given (non-localized) configuration property.
~ConfigurationProperty()=delete
static bool isReadOnly()
Get the read-only status of the given (non-localized) configuration property.
static void set(U const &value, std::shared_ptr< ConfigurationChanges > const &batch)
Set the value of the given (non-localized) configuration property, via a given changes batch.
ConfigurationProperty(const ConfigurationProperty &)=delete
ConfigurationProperty()=delete
A type-safe wrapper around a configuration set.
ConfigurationSet & operator=(const ConfigurationSet &)=delete
ConfigurationSet(const ConfigurationSet &)=delete
static css::uno::Reference< css::container::XNameAccess > get()
Get read-only access to the given configuration set.
static css::uno::Reference< css::container::XNameContainer > get(std::shared_ptr< ConfigurationChanges > const &batch)
Get read/write access to the given configuration set, storing any modifications via the given changes...
ConfigurationSet()=delete
~ConfigurationSet()=delete
Convert & operator=(const Convert &)=delete
static css::uno::Any toAny(std::optional< T > const &value)
static std::optional< T > fromAny(css::uno::Any const &value)
Convert(const Convert &)=delete
Convert(const Convert &)=delete
static css::uno::Any toAny(T const &value)
static T fromAny(css::uno::Any const &value)
Convert & operator=(const Convert &)=delete