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

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

#include <PresenterConfigurationAccess.hxx>

Public Types

enum  WriteMode {
  READ_WRITE ,
  READ_ONLY
}
 
typedef ::std::function< bool(const OUString &, const css::uno::Reference< css::beans::XPropertySet > &)> Predicate
 
typedef ::std::function< void(const ::std::vector< css::uno::Any > &) > ItemProcessor
 
typedef ::std::function< void(const OUString &, const css::uno::Reference< css::beans::XPropertySet > &) > PropertySetProcessor
 

Public Member Functions

 PresenterConfigurationAccess (const css::uno::Reference< css::uno::XComponentContext > &rxContext, const OUString &rsRootName, WriteMode eMode)
 Create a new object to access the configuration entries below the given root. More...
 
 ~PresenterConfigurationAccess ()
 
css::uno::Any GetConfigurationNode (const OUString &rsPathToNode)
 Return a configuration node below the root of the called object. More...
 
bool IsValid () const
 Return <TRUE> when opening the configuration (via creating a new PresenterConfigurationAccess object) or previous calls to GoToChild() left the called PresenterConfigurationAccess object in a valid state. More...
 
bool GoToChild (const OUString &rsPathToNode)
 Move the focused node to the (possibly indirect) child specified by the given path. More...
 
bool GoToChild (const Predicate &rPredicate)
 Move the focused node to the first direct child that fulfills the given predicate. More...
 
bool SetProperty (const OUString &rsPropertyName, const css::uno::Any &rValue)
 Modify the property child of the currently focused node. 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...
 
static css::uno::Reference< css::beans::XPropertySetGetNodeProperties (const css::uno::Reference< css::container::XHierarchicalNameAccess > &rxNode, const OUString &rsPathToNode)
 
static void ForAll (const css::uno::Reference< css::container::XNameAccess > &rxContainer, const ::std::vector< OUString > &rArguments, const ItemProcessor &rProcessor)
 Execute a functor for all elements of the given container. More...
 
static void ForAll (const css::uno::Reference< css::container::XNameAccess > &rxContainer, const PropertySetProcessor &rProcessor)
 
static css::uno::Any Find (const css::uno::Reference< css::container::XNameAccess > &rxContainer, const Predicate &rPredicate)
 
static bool IsStringPropertyEqual (std::u16string_view rsValue, const OUString &rsPropertyName, const css::uno::Reference< css::beans::XPropertySet > &rxNode)
 
static css::uno::Any GetProperty (const css::uno::Reference< css::beans::XPropertySet > &rxProperties, const OUString &rsKey)
 This method wraps a call to getPropertyValue() and returns an empty Any instead of throwing an exception when the property does not exist. More...
 

Static Public Attributes

static constexpr OUStringLiteral msPresenterScreenRootName
 

Private Attributes

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

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. From this one you can use this class in two ways.

In a stateless mode (with exception of the root node) you can use static methods for obtaining child nodes, get values from properties at leaf nodes and iterate over children of inner nodes.

In a stateful mode use non-static methods like GoToChild() to navigate to children.

Note to call CommitChanges() after making changes to PresenterConfigurationAccess object that was opened in READ_WRITE mode.

Definition at line 48 of file PresenterConfigurationAccess.hxx.

Member Typedef Documentation

◆ ItemProcessor

typedef ::std::function<void ( const ::std::vector<css::uno::Any>&) > sdext::presenter::PresenterConfigurationAccess::ItemProcessor

Definition at line 127 of file PresenterConfigurationAccess.hxx.

◆ Predicate

typedef ::std::function<bool ( const OUString&, const css::uno::Reference<css::beans::XPropertySet>&)> sdext::presenter::PresenterConfigurationAccess::Predicate

Definition at line 54 of file PresenterConfigurationAccess.hxx.

◆ PropertySetProcessor

typedef ::std::function<void ( const OUString&, const css::uno::Reference<css::beans::XPropertySet>&) > sdext::presenter::PresenterConfigurationAccess::PropertySetProcessor

Definition at line 130 of file PresenterConfigurationAccess.hxx.

Member Enumeration Documentation

◆ WriteMode

Enumerator
READ_WRITE 
READ_ONLY 

Definition at line 51 of file PresenterConfigurationAccess.hxx.

Constructor & Destructor Documentation

◆ PresenterConfigurationAccess()

sdext::presenter::PresenterConfigurationAccess::PresenterConfigurationAccess ( const css::uno::Reference< css::uno::XComponentContext > &  rxContext,
const OUString &  rsRootName,
WriteMode  eMode 
)

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

Parameters
rsRootNameName of the root. You can use msPresenterScreenRootName to access the configuration of the presenter screen.
eModeThis flag specifies whether to give read-write or read-only access.

Definition at line 36 of file PresenterConfigurationAccess.cxx.

References DBG_UNHANDLED_EXCEPTION, eMode, Exception, comphelper::InitAnyPropertySequence(), maNode, mxRoot, and READ_ONLY.

◆ ~PresenterConfigurationAccess()

sdext::presenter::PresenterConfigurationAccess::~PresenterConfigurationAccess ( )

Definition at line 70 of file PresenterConfigurationAccess.cxx.

Member Function Documentation

◆ CommitChanges()

void sdext::presenter::PresenterConfigurationAccess::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 161 of file PresenterConfigurationAccess.cxx.

References mxRoot.

Referenced by sdext::presenter::PresenterWindowManager::StoreViewMode().

◆ Find()

Any sdext::presenter::PresenterConfigurationAccess::Find ( const css::uno::Reference< css::container::XNameAccess > &  rxContainer,
const Predicate rPredicate 
)
static

◆ ForAll() [1/2]

static void sdext::presenter::PresenterConfigurationAccess::ForAll ( const css::uno::Reference< css::container::XNameAccess > &  rxContainer,
const ::std::vector< OUString > &  rArguments,
const ItemProcessor rProcessor 
)
static

Execute a functor for all elements of the given container.

Parameters
rxContainerThe container is a XNameAccess to a list of the configuration. This can be a node returned by GetConfigurationNode().
rArgumentsThe functor is called with arguments that are children of each element of the container. The set of children is specified this list.
rFunctorThe functor to be executed for some or all of the elements in the given container.

Referenced by sdext::presenter::PresenterBitmapContainer::LoadBitmaps(), sdext::presenter::PresenterScreen::ProcessLayout(), sdext::presenter::PresenterScreen::ProcessViewDescriptions(), sdext::presenter::PresenterTheme::Theme::Read(), and sdext::presenter::PresenterHelpView::ReadHelpStrings().

◆ ForAll() [2/2]

static void sdext::presenter::PresenterConfigurationAccess::ForAll ( const css::uno::Reference< css::container::XNameAccess > &  rxContainer,
const PropertySetProcessor rProcessor 
)
static

◆ GetConfigurationNode() [1/2]

Any sdext::presenter::PresenterConfigurationAccess::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. When this string is empty then rxNode is returned.
Returns
The type of the returned node varies with the requested node. It is empty when the node was not found.

Definition at line 132 of file PresenterConfigurationAccess.cxx.

References Any, Exception, and TOOLS_WARN_EXCEPTION.

◆ GetConfigurationNode() [2/2]

Any sdext::presenter::PresenterConfigurationAccess::GetConfigurationNode ( const OUString &  rsPathToNode)

◆ GetNodeProperties()

Reference< beans::XPropertySet > sdext::presenter::PresenterConfigurationAccess::GetNodeProperties ( const css::uno::Reference< css::container::XHierarchicalNameAccess > &  rxNode,
const OUString &  rsPathToNode 
)
static

Definition at line 154 of file PresenterConfigurationAccess.cxx.

References GetConfigurationNode().

◆ GetProperty()

Any sdext::presenter::PresenterConfigurationAccess::GetProperty ( const css::uno::Reference< css::beans::XPropertySet > &  rxProperties,
const OUString &  rsKey 
)
static

This method wraps a call to getPropertyValue() and returns an empty Any instead of throwing an exception when the property does not exist.

Definition at line 251 of file PresenterConfigurationAccess.cxx.

References Any.

Referenced by sdext::presenter::PresenterButton::Create(), IsStringPropertyEqual(), sdext::presenter::PresenterBitmapContainer::ProcessBitmap(), and sdext::presenter::PresenterHelpView::ProcessString().

◆ GoToChild() [1/2]

bool sdext::presenter::PresenterConfigurationAccess::GoToChild ( const OUString &  rsPathToNode)

Move the focused node to the (possibly indirect) child specified by the given path.

Definition at line 86 of file PresenterConfigurationAccess.cxx.

References GetConfigurationNode(), IsValid(), maNode, and mxRoot.

Referenced by sdext::presenter::PresenterWindowManager::StoreViewMode().

◆ GoToChild() [2/2]

bool sdext::presenter::PresenterConfigurationAccess::GoToChild ( const Predicate rPredicate)

Move the focused node to the first direct child that fulfills the given predicate.

Definition at line 105 of file PresenterConfigurationAccess.cxx.

References Find(), IsValid(), maNode, and mxRoot.

◆ IsStringPropertyEqual()

bool sdext::presenter::PresenterConfigurationAccess::IsStringPropertyEqual ( std::u16string_view  rsValue,
const OUString &  rsPropertyName,
const css::uno::Reference< css::beans::XPropertySet > &  rxNode 
)
static

◆ IsValid()

bool sdext::presenter::PresenterConfigurationAccess::IsValid ( ) const

Return <TRUE> when opening the configuration (via creating a new PresenterConfigurationAccess object) or previous calls to GoToChild() left the called PresenterConfigurationAccess object in a valid state.

Definition at line 74 of file PresenterConfigurationAccess.cxx.

References mxRoot.

Referenced by GoToChild().

◆ SetProperty()

bool sdext::presenter::PresenterConfigurationAccess::SetProperty ( const OUString &  rsPropertyName,
const css::uno::Any &  rValue 
)

Modify the property child of the currently focused node.

Keep in mind to call CommitChanges() to write the change back to the configuration.

Definition at line 118 of file PresenterConfigurationAccess.cxx.

References maNode.

Referenced by sdext::presenter::PresenterWindowManager::StoreViewMode().

Member Data Documentation

◆ maNode

css::uno::Any sdext::presenter::PresenterConfigurationAccess::maNode
private

◆ msPresenterScreenRootName

constexpr OUStringLiteral sdext::presenter::PresenterConfigurationAccess::msPresenterScreenRootName
staticconstexpr
Initial value:
=
u"/org.openoffice.Office.PresenterScreen/"
float u

Definition at line 55 of file PresenterConfigurationAccess.hxx.

Referenced by sdext::presenter::PresenterButton::GetConfigurationProperties(), and sdext::presenter::PresenterSlideShowView::LateInit().

◆ mxRoot

css::uno::Reference<css::uno::XInterface> sdext::presenter::PresenterConfigurationAccess::mxRoot
private

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