10 #ifndef INCLUDED_COMPHELPER_CONFIGURATION_HXX
11 #define INCLUDED_COMPHELPER_CONFIGURATION_HXX
16 #include <string_view>
18 #include <com/sun/star/uno/Any.hxx>
19 #include <com/sun/star/uno/Reference.h>
28 class XHierarchicalNameAccess;
29 class XHierarchicalNameReplace;
33 namespace uno {
class XComponentContext; }
38 namespace detail {
class ConfigurationWrapper; }
49 static std::shared_ptr<ConfigurationChanges>
create();
60 css::uno::Reference< css::uno::XComponentContext >
64 OUString
const & path, css::uno::Any
const &
value)
67 SAL_DLLPRIVATE css::uno::Reference<
68 css::container::XHierarchicalNameReplace >
69 getGroup(OUString
const & path)
const;
72 css::uno::Reference< css::container::XNameContainer >
73 getSet(OUString
const & path)
const;
76 css::configuration::XReadWriteAccess >
access_;
88 bool isReadOnly(OUString
const & path)
const;
93 std::shared_ptr< ConfigurationChanges >
const & batch,
94 OUString
const & path, css::uno::Any
const &
value);
96 css::uno::Any getLocalizedPropertyValue(
97 std::u16string_view path)
const;
99 static void setLocalizedPropertyValue(
100 std::shared_ptr< ConfigurationChanges >
const & batch,
101 OUString
const & path, css::uno::Any
const & value);
104 css::container::XHierarchicalNameAccess >
105 getGroupReadOnly(OUString
const & path)
const;
107 static css::uno::Reference<
108 css::container::XHierarchicalNameReplace >
110 std::shared_ptr< ConfigurationChanges >
const & batch,
111 OUString
const & path);
113 css::uno::Reference< css::container::XNameAccess >
114 getSetReadOnly(OUString
const & path)
const;
116 static css::uno::Reference< css::container::XNameContainer >
118 std::shared_ptr< ConfigurationChanges >
const & batch,
119 OUString
const & path);
121 std::shared_ptr< ConfigurationChanges > createChanges()
const;
126 SAL_DLLPRIVATE ~ConfigurationWrapper();
128 ConfigurationWrapper(
const ConfigurationWrapper&) =
delete;
129 ConfigurationWrapper& operator=(
const ConfigurationWrapper&) =
delete;
131 css::uno::Reference< css::uno::XComponentContext >
context_;
133 css::uno::Reference< css::configuration::XReadWriteAccess >
access_;
142 static css::uno::Any
toAny(T
const & value)
143 {
return css::uno::Any(value); }
146 {
return value.get< T >(); }
159 static css::uno::Any
toAny(std::optional< T >
const & value) {
161 ? css::uno::Any(*value)
165 static std::optional< T >
fromAny(css::uno::Any
const & value)
167 return value.hasValue()
168 ? std::optional< T >(value.get< T >()) : std::optional< T >();
214 std::shared_ptr< ConfigurationChanges >
const & batch)
246 getLocalizedPropertyValue(T::path()));
258 std::shared_ptr< ConfigurationChanges >
const & batch)
279 static css::uno::Reference<
280 css::container::XHierarchicalNameAccess >
289 static css::uno::Reference<
290 css::container::XHierarchicalNameReplace >
291 get(std::shared_ptr< ConfigurationChanges >
const & batch)
313 css::uno::Reference< css::container::XNameAccess >
323 css::uno::Reference< css::container::XNameContainer >
324 get(std::shared_ptr< ConfigurationChanges >
const & batch)
A type-safe wrapper around a localized configuration property.
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 & operator=(const ConfigurationLocalizedProperty &)=delete
static void setPropertyValue(std::shared_ptr< ConfigurationChanges > const &batch, OUString const &path, css::uno::Any const &value)
A type-safe wrapper around a configuration set.
static css::uno::Reference< css::container::XHierarchicalNameReplace > getGroupReadWrite(std::shared_ptr< ConfigurationChanges > const &batch, OUString const &path)
ConfigurationLocalizedProperty()=delete
Convert & operator=(const Convert &)=delete
~ConfigurationSet()=delete
ConfigurationProperty & operator=(const ConfigurationProperty &)=delete
A type-safe wrapper around a configuration group.
static T fromAny(css::uno::Any const &value)
exports com.sun.star. container
css::uno::Reference< css::configuration::XReadWriteAccess > access_
~ConfigurationProperty()=delete
bool getPropertyValue(ValueType &rValue, css::uno::Reference< css::beans::XPropertySet > const &xPropSet, OUString const &propName)
static ConfigurationWrapper const & get()
static css::uno::Any toAny(T const &value)
css::uno::Reference< css::configuration::XReadWriteAccess > access_
Reference< deployment::XPackageRegistry > create(Reference< deployment::XPackageRegistry > const &xRootRegistry, OUString const &context, OUString const &cachePath, Reference< XComponentContext > const &xComponentContext)
A type-safe wrapper around a (non-localized) configuration property.
~ConfigurationGroup()=delete
css::uno::Reference< css::container::XNameAccess > getSetReadOnly(OUString const &path) const
static css::uno::Any toAny(std::optional< T > const &value)
ConfigurationGroup & operator=(const ConfigurationGroup &)=delete
ConfigurationGroup()=delete
bool setPropertyValue(uno::Sequence< beans::PropertyValue > &aProp, const OUString &aName, const uno::Any &aValue)
ConfigurationProperty()=delete
static void setLocalizedPropertyValue(std::shared_ptr< ConfigurationChanges > const &batch, OUString const &path, css::uno::Any const &value)
exports com.sun.star. configuration
A batch of configuration changes that is committed as a whole.
css::uno::Reference< css::uno::XComponentContext > context_
ConfigurationSet()=delete
bool isReadOnly(OUString const &path) const
static std::optional< T > fromAny(css::uno::Any const &value)
ConfigurationSet & operator=(const ConfigurationSet &)=delete
#define COMPHELPER_DLLPUBLIC
static css::uno::Reference< css::container::XNameContainer > getSetReadWrite(std::shared_ptr< ConfigurationChanges > const &batch, OUString const &path)
~ConfigurationLocalizedProperty()=delete
css::uno::Reference< css::container::XHierarchicalNameAccess > getGroupReadOnly(OUString const &path) const
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...