1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 #include <rtl/ustring.hxx>
23 #include <com/sun/star/uno/XInterface.hpp>
28 namespace com::sun::star::container
{ class XHierarchicalNameAccess
; }
29 namespace com::sun::star::container
{ class XNameAccess
; }
30 namespace com::sun::star::lang
{ class XMultiServiceFactory
; }
31 namespace com::sun::star::uno
{ class XComponentContext
; }
35 /** This class gives access to the configuration. Create an object of this
36 class for one node of the configuration. This will be the root node.
37 Its children are then accessible through the new ConfigurationAccess
40 class ConfigurationAccess
43 enum WriteMode
{ READ_WRITE
, READ_ONLY
};
45 /** Create a new object to access the configuration entries below the
50 This flag specifies whether to give read-write or read-only
54 const OUString
& rsRootName
,
55 const WriteMode eMode
);
57 /** Return a configuration node below the root of the called object.
59 The relative path from the root (as given the constructor) to
62 The type of the returned node varies with the requested node.
63 It is empty when the node was not found.
65 css::uno::Any
GetConfigurationNode (
66 const OUString
& rsPathToNode
);
68 /** Return a configuration node below the given node.
70 The node that acts as root to the given relative path.
72 The relative path from the given node to the requested node.
74 The type of the returned node varies with the requested node.
75 It is empty when the node was not found.
77 static css::uno::Any
GetConfigurationNode (
78 const css::uno::Reference
<css::container::XHierarchicalNameAccess
>& rxNode
,
79 const OUString
& rsPathToNode
);
81 /** Write any changes that have been made back to the configuration.
82 This call is ignored when the called ConfigurationAccess object was
83 not create with read-write mode.
87 /** This functor is typically called for every item in a set. Its two
88 parameters are the name of key item (often of no further interest)
89 and the value of the item.
91 typedef ::std::function
<void (
93 const std::vector
<css::uno::Any
>&) > Functor
;
96 css::uno::Reference
<css::uno::XInterface
> mxRoot
;
99 const css::uno::Reference
<css::lang::XMultiServiceFactory
>& rxProvider
,
100 const OUString
& rsRootName
,
101 const WriteMode eMode
);
104 } // end of namespace sd::tools
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */