LibreOffice Module sdext (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 (const OUString &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 const OUString 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

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

Definition at line 126 of file PresenterConfigurationAccess.hxx.

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.

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

Definition at line 129 of file PresenterConfigurationAccess.hxx.

Member Enumeration Documentation

Enumerator
READ_WRITE 
READ_ONLY 

Definition at line 51 of file PresenterConfigurationAccess.hxx.

Constructor & Destructor Documentation

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 39 of file PresenterConfigurationAccess.cxx.

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

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

Definition at line 75 of file PresenterConfigurationAccess.cxx.

Member Function Documentation

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 166 of file PresenterConfigurationAccess.cxx.

References mxRoot.

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

Any sdext::presenter::PresenterConfigurationAccess::Find ( const css::uno::Reference< css::container::XNameAccess > &  rxContainer,
const Predicate rPredicate 
)
static
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().

static void sdext::presenter::PresenterConfigurationAccess::ForAll ( const css::uno::Reference< css::container::XNameAccess > &  rxContainer,
const PropertySetProcessor rProcessor 
)
static
Any sdext::presenter::PresenterConfigurationAccess::GetConfigurationNode ( const OUString &  rsPathToNode)
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 137 of file PresenterConfigurationAccess.cxx.

References Any, Exception, and TOOLS_WARN_EXCEPTION.

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

Definition at line 159 of file PresenterConfigurationAccess.cxx.

References GetConfigurationNode().

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 256 of file PresenterConfigurationAccess.cxx.

References Any.

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

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 91 of file PresenterConfigurationAccess.cxx.

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

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

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 110 of file PresenterConfigurationAccess.cxx.

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

bool sdext::presenter::PresenterConfigurationAccess::IsStringPropertyEqual ( const OUString &  rsValue,
const OUString &  rsPropertyName,
const css::uno::Reference< css::beans::XPropertySet > &  rxNode 
)
static
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 79 of file PresenterConfigurationAccess.cxx.

References mxRoot.

Referenced by GoToChild().

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 123 of file PresenterConfigurationAccess.cxx.

References maNode.

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

Member Data Documentation

css::uno::Any sdext::presenter::PresenterConfigurationAccess::maNode
private
const OUString sdext::presenter::PresenterConfigurationAccess::msPresenterScreenRootName
static
Initial value:
=
"/org.openoffice.Office.PresenterScreen/"

Definition at line 55 of file PresenterConfigurationAccess.hxx.

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

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

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