LibreOffice Module sd (master) 1
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
sd::tools::ConfigurationAccess Class Reference

This class gives access to the configuration. More...

#include <ConfigurationAccess.hxx>

Public Types

enum  WriteMode {
  READ_WRITE ,
  READ_ONLY
}
 
typedef ::std::function< void(const OUString &, const std::vector< css::uno::Any > &) > Functor
 This functor is typically called for every item in a set. More...
 

Public Member Functions

 ConfigurationAccess (const OUString &rsRootName, const WriteMode eMode)
 Create a new object to access the configuration entries below the given root. More...
 
css::uno::Any GetConfigurationNode (const OUString &rsPathToNode)
 Return a configuration node below the root of the called object. More...
 
void CommitChanges ()
 Write any changes that have been made back to the configuration. More...
 

Static Public Member Functions

static css::uno::Any GetConfigurationNode (const css::uno::Reference< css::container::XHierarchicalNameAccess > &rxNode, const OUString &rsPathToNode)
 Return a configuration node below the given node. More...
 

Private Member Functions

void Initialize (const css::uno::Reference< css::lang::XMultiServiceFactory > &rxProvider, const OUString &rsRootName, const WriteMode eMode)
 

Private Attributes

css::uno::Reference< css::uno::XInterface > mxRoot
 

Detailed Description

This class gives access to the configuration.

Create an object of this class for one node of the configuration. This will be the root node. Its children are then accessible through the new ConfigurationAccess object.

Definition at line 40 of file ConfigurationAccess.hxx.

Member Typedef Documentation

◆ Functor

typedef ::std::function<void ( const OUString&, const std::vector<css::uno::Any>&) > sd::tools::ConfigurationAccess::Functor

This functor is typically called for every item in a set.

Its two parameters are the name of key item (often of no further interest) and the value of the item.

Definition at line 93 of file ConfigurationAccess.hxx.

Member Enumeration Documentation

◆ WriteMode

Enumerator
READ_WRITE 
READ_ONLY 

Definition at line 43 of file ConfigurationAccess.hxx.

Constructor & Destructor Documentation

◆ ConfigurationAccess()

ConfigurationAccess::ConfigurationAccess ( const OUString &  rsRootName,
const WriteMode  eMode 
)

Create a new object to access the configuration entries below the given root.

Parameters
rsRootNameName of the root.
eModeThis flag specifies whether to give read-write or read-only access.

Definition at line 36 of file ConfigurationAccess.cxx.

References eMode, and Initialize().

Member Function Documentation

◆ CommitChanges()

void ConfigurationAccess::CommitChanges ( )

Write any changes that have been made back to the configuration.

This call is ignored when the called ConfigurationAccess object was not create with read-write mode.

Definition at line 104 of file ConfigurationAccess.cxx.

References mxRoot.

Referenced by sd::sidebar::RecentlyUsedMasterPages::SavePersistentValues().

◆ GetConfigurationNode() [1/2]

Any ConfigurationAccess::GetConfigurationNode ( const css::uno::Reference< css::container::XHierarchicalNameAccess > &  rxNode,
const OUString &  rsPathToNode 
)
static

Return a configuration node below the given node.

Parameters
rxNodeThe node that acts as root to the given relative path.
rsPathToNodeThe relative path from the given node to the requested node.
Returns
The type of the returned node varies with the requested node. It is empty when the node was not found.

Definition at line 82 of file ConfigurationAccess.cxx.

References Any, Exception, and TOOLS_WARN_EXCEPTION.

◆ GetConfigurationNode() [2/2]

Any ConfigurationAccess::GetConfigurationNode ( const OUString &  rsPathToNode)

Return a configuration node below the root of the called object.

Parameters
rsPathToNodeThe relative path from the root (as given the constructor) to the node.
Returns
The type of the returned node varies with the requested node. It is empty when the node was not found.

Definition at line 74 of file ConfigurationAccess.cxx.

References Any, GetConfigurationNode(), and mxRoot.

Referenced by GetConfigurationNode(), sd::sidebar::RecentlyUsedMasterPages::LoadPersistentValues(), and sd::sidebar::RecentlyUsedMasterPages::SavePersistentValues().

◆ Initialize()

void ConfigurationAccess::Initialize ( const css::uno::Reference< css::lang::XMultiServiceFactory > &  rxProvider,
const OUString &  rsRootName,
const WriteMode  eMode 
)
private

Member Data Documentation

◆ mxRoot

css::uno::Reference<css::uno::XInterface> sd::tools::ConfigurationAccess::mxRoot
private

Definition at line 96 of file ConfigurationAccess.hxx.

Referenced by CommitChanges(), GetConfigurationNode(), and Initialize().


The documentation for this class was generated from the following files: