LibreOffice Module sd (master) 1
|
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::XPropertySet > | GetNodeProperties (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 |
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.
typedef ::std::function<void ( const ::std::vector<css::uno::Any>&) > sdext::presenter::PresenterConfigurationAccess::ItemProcessor |
Definition at line 127 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 130 of file PresenterConfigurationAccess.hxx.
Enumerator | |
---|---|
READ_WRITE | |
READ_ONLY |
Definition at line 51 of file PresenterConfigurationAccess.hxx.
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.
rsRootName | Name of the root. You can use msPresenterScreenRootName to access the configuration of the presenter screen. |
eMode | This 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.
sdext::presenter::PresenterConfigurationAccess::~PresenterConfigurationAccess | ( | ) |
Definition at line 70 of file PresenterConfigurationAccess.cxx.
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().
|
static |
Definition at line 219 of file PresenterConfigurationAccess.cxx.
References Any.
Referenced by sdext::presenter::PresenterButton::GetConfigurationProperties(), and GoToChild().
|
static |
Execute a functor for all elements of the given container.
rxContainer | The container is a XNameAccess to a list of the configuration. This can be a node returned by GetConfigurationNode(). |
rArguments | The functor is called with arguments that are children of each element of the container. The set of children is specified this list. |
rFunctor | The 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 |
|
static |
Return a configuration node below the given node.
rxNode | The node that acts as root to the given relative path. |
rsPathToNode | The relative path from the given node to the requested node. When this string is empty then rxNode is returned. |
Definition at line 132 of file PresenterConfigurationAccess.cxx.
References Any, Exception, and TOOLS_WARN_EXCEPTION.
Any sdext::presenter::PresenterConfigurationAccess::GetConfigurationNode | ( | const OUString & | rsPathToNode | ) |
Return a configuration node below the root of the called object.
rsPathToNode | The relative path from the root (as given the constructor) to the node. |
Definition at line 79 of file PresenterConfigurationAccess.cxx.
References Any, GetConfigurationNode(), and mxRoot.
Referenced by sdext::presenter::PresenterToolBar::CreateControls(), sdext::presenter::PresenterSlideSorter::CurrentSlideFrameRenderer::CurrentSlideFrameRenderer(), GetConfigurationNode(), sdext::presenter::PresenterButton::GetConfigurationProperties(), GetNodeProperties(), sdext::presenter::PresenterScreen::GetPresenterScreenNumber(), GoToChild(), sdext::presenter::PresenterScreen::isPresenterScreenEnabled(), sdext::presenter::PresenterScreen::isPresenterScreenFullScreen(), sdext::presenter::PresenterSlideShowView::LateInit(), sdext::presenter::PresenterBitmapContainer::LoadBitmap(), sdext::presenter::PresenterBitmapContainer::PresenterBitmapContainer(), sdext::presenter::PresenterScreen::ProcessLayout(), sdext::presenter::PresenterScreen::ProcessViewDescriptions(), sdext::presenter::PresenterTheme::Theme::Read(), sdext::presenter::PresenterHelpView::ReadHelpStrings(), sdext::presenter::PresenterWindowManager::RestoreViewMode(), and sdext::presenter::PresenterScreen::SetupConfiguration().
|
static |
Definition at line 154 of file PresenterConfigurationAccess.cxx.
References GetConfigurationNode().
|
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().
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().
bool sdext::presenter::PresenterConfigurationAccess::GoToChild | ( | const Predicate & | rPredicate | ) |
|
static |
Definition at line 239 of file PresenterConfigurationAccess.cxx.
References GetProperty().
Referenced by sdext::presenter::PresenterTheme::GetNodeForViewStyle().
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().
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().
|
private |
Definition at line 171 of file PresenterConfigurationAccess.hxx.
Referenced by GoToChild(), PresenterConfigurationAccess(), and SetProperty().
|
staticconstexpr |
Definition at line 55 of file PresenterConfigurationAccess.hxx.
Referenced by sdext::presenter::PresenterButton::GetConfigurationProperties(), and sdext::presenter::PresenterSlideShowView::LateInit().
|
private |
Definition at line 170 of file PresenterConfigurationAccess.hxx.
Referenced by CommitChanges(), GetConfigurationNode(), GoToChild(), IsValid(), and PresenterConfigurationAccess().