LibreOffice Module fpicker (master) 1
|
a "smart content" which basically wraps a UCB content, but caches some information so that repeatedly recreating it may be faster More...
#include <fpsmartcontent.hxx>
Public Types | |
enum | State { NOT_BOUND , UNKNOWN , VALID , INVALID } |
enum | InteractionHandlerType { IHT_NONE , IHT_OWN , IHT_DEFAULT } |
describes different types of interaction handlers More... | |
Public Member Functions | |
SmartContent () | |
SmartContent (const OUString &_rInitialURL) | |
~SmartContent () | |
void | enableOwnInteractionHandler (::svt::OFilePickerInteractionHandler::EInterceptedInteractions eInterceptions) |
create and set a specialized interaction handler at the internal used command environment. More... | |
void | enableDefaultInteractionHandler () |
disable the specialized interaction handler and use the global UI interaction handler only. More... | |
::svt::OFilePickerInteractionHandler * | getOwnInteractionHandler () const |
return the internal used interaction handler object ... Because this pointer will be valid only, if the uno object is hold alive by its uno reference (and this reference is set on the command environment) we must return NULL, in case this environment does not exist! More... | |
InteractionHandlerType | queryCurrentInteractionHandler () const |
return the type of the internal used interaction handler object ... More... | |
void | disableInteractionHandler () |
disable internal used interaction handler object ... More... | |
State | getState () const |
returns the current state of the content More... | |
bool | isValid () const |
checks if the content is valid More... | |
bool | isInvalid () const |
checks if the content is valid More... | |
bool | isBound () const |
checks if the content is bound More... | |
OUString const & | getURL () const |
returns the URL of the content More... | |
void | bindTo (const OUString &_rURL) |
(re)creates the content for the given URL More... | |
void | getTitle (OUString &_rTitle) |
retrieves the title of the content @precond the content is bound and not invalid More... | |
bool | hasParentFolder () |
checks if the content has a parent folder @precond the content is bound and not invalid More... | |
bool | canCreateFolder () |
checks if sub folders below the content can be created @precond the content is bound and not invalid More... | |
OUString | createFolder (const OUString &_rTitle) |
creates a new folder with the given title and return the corresponding URL. More... | |
bool | isFolder (const OUString &_rURL) |
binds to the given URL, checks whether or not it refers to a folder More... | |
bool | is (const OUString &_rURL) |
checks if the content is existent (it is if and only if it is a document or a folder) More... | |
bool | isFolder () |
Private Types | |
enum | Type { Folder , Document } |
Private Member Functions | |
bool | implIs (const OUString &_rURL, Type _eType) |
checks if the currently bound content is a folder or document More... | |
SmartContent (const SmartContent &_rSource)=delete | |
SmartContent & | operator= (const SmartContent &_rSource)=delete |
Private Attributes | |
OUString | m_sURL |
std::optional<::ucbhelper::Content > | m_oContent |
State | m_eState |
css::uno::Reference< css::ucb::XCommandEnvironment > | m_xCmdEnv |
rtl::Reference<::svt::OFilePickerInteractionHandler > | m_xOwnInteraction |
a "smart content" which basically wraps a UCB content, but caches some information so that repeatedly recreating it may be faster
Definition at line 40 of file fpsmartcontent.hxx.
describes different types of interaction handlers
Enumerator | |
---|---|
IHT_NONE | |
IHT_OWN | |
IHT_DEFAULT |
Definition at line 94 of file fpsmartcontent.hxx.
Enumerator | |
---|---|
NOT_BOUND | |
UNKNOWN | |
VALID | |
INVALID |
Definition at line 43 of file fpsmartcontent.hxx.
|
private |
Enumerator | |
---|---|
Folder | |
Document |
Definition at line 59 of file fpsmartcontent.hxx.
|
privatedelete |
svt::SmartContent::SmartContent | ( | ) |
Definition at line 48 of file fpsmartcontent.cxx.
|
explicit |
Definition at line 54 of file fpsmartcontent.cxx.
References bindTo().
svt::SmartContent::~SmartContent | ( | ) |
Definition at line 61 of file fpsmartcontent.cxx.
void svt::SmartContent::bindTo | ( | const OUString & | _rURL | ) |
(re)creates the content for the given URL
Note that getState will return either UNKNOWN or INVALID after the call returns, but never VALID. The reason is that there are content providers which allow to construct content objects, even if the respective contents are not accessible. They tell about this only upon working with the content object (e.g. when asking for the IsFolder).
@postcond <member>getState</member> does not return NOT_BOUND after the call returns
Definition at line 126 of file fpsmartcontent.cxx.
References Exception, svt::OFilePickerInteractionHandler::forgetRequest(), getOwnInteractionHandler(), comphelper::getProcessComponentContext(), getURL(), INVALID, m_eState, m_oContent, m_sURL, m_xCmdEnv, NOT_BOUND, svt::OFilePickerInteractionHandler::resetUseState(), TOOLS_WARN_EXCEPTION, and UNKNOWN.
Referenced by SvtFileDialog::ContentCanMakeFolder(), SvtFileDialog::ContentGetTitle(), SvtFileDialog::ContentHasParentFolder(), SvtFileDialog::implGetInitialURL(), implIs(), SvtFileDialog::OpenHdl_Impl(), and SmartContent().
bool svt::SmartContent::canCreateFolder | ( | ) |
checks if sub folders below the content can be created @precond the content is bound and not invalid
Definition at line 257 of file fpsmartcontent.cxx.
References Exception, INVALID, isBound(), isInvalid(), m_eState, m_oContent, and VALID.
Referenced by SvtFileDialog::ContentCanMakeFolder().
OUString svt::SmartContent::createFolder | ( | const OUString & | _rTitle | ) |
creates a new folder with the given title and return the corresponding URL.
Definition at line 287 of file fpsmartcontent.cxx.
References Any, Exception, ucbhelper::Content::getURL(), and m_oContent.
void svt::SmartContent::disableInteractionHandler | ( | ) |
disable internal used interaction handler object ...
Definition at line 119 of file fpsmartcontent.cxx.
References m_xCmdEnv, and m_xOwnInteraction.
Referenced by SvtFileDialog::OpenHdl_Impl().
void svt::SmartContent::enableDefaultInteractionHandler | ( | ) |
disable the specialized interaction handler and use the global UI interaction handler only.
Definition at line 90 of file fpsmartcontent.cxx.
References m_xCmdEnv, and m_xOwnInteraction.
Referenced by SvtFileDialog::OpenHdl_Impl(), and SvtFileDialog::PrepareExecute().
void svt::SmartContent::enableOwnInteractionHandler | ( | ::svt::OFilePickerInteractionHandler::EInterceptedInteractions | eInterceptions | ) |
create and set a specialized interaction handler at the internal used command environment.
eInterceptions | will be directly forwarded to OFilePickerInteractionHandler::enableInterceptions() |
Definition at line 77 of file fpsmartcontent.cxx.
References m_xCmdEnv, and m_xOwnInteraction.
Referenced by SvtFileDialog::OpenHdl_Impl(), and SvtFileDialog::PrepareExecute().
svt::OFilePickerInteractionHandler * svt::SmartContent::getOwnInteractionHandler | ( | ) | const |
return the internal used interaction handler object ... Because this pointer will be valid only, if the uno object is hold alive by its uno reference (and this reference is set on the command environment) we must return NULL, in case this environment does not exist!
Definition at line 101 of file fpsmartcontent.cxx.
References m_xOwnInteraction.
Referenced by bindTo(), and SvtFileDialog::OpenHdl_Impl().
|
inline |
returns the current state of the content
@seealso State
Definition at line 115 of file fpsmartcontent.hxx.
References m_eState.
Referenced by isBound(), isInvalid(), and isValid().
void svt::SmartContent::getTitle | ( | OUString & | _rTitle | ) |
retrieves the title of the content @precond the content is bound and not invalid
Definition at line 204 of file fpsmartcontent.cxx.
References INVALID, isBound(), isInvalid(), m_eState, m_oContent, and VALID.
Referenced by SvtFileDialog::ContentGetTitle().
|
inline |
returns the URL of the content
Definition at line 133 of file fpsmartcontent.hxx.
References m_oContent, and m_sURL.
Referenced by bindTo(), and isFolder().
bool svt::SmartContent::hasParentFolder | ( | ) |
checks if the content has a parent folder @precond the content is bound and not invalid
Definition at line 226 of file fpsmartcontent.cxx.
References Exception, INVALID, isBound(), isInvalid(), m_eState, m_oContent, and VALID.
Referenced by SvtFileDialog::ContentHasParentFolder().
|
private |
checks if the currently bound content is a folder or document
Definition at line 171 of file fpsmartcontent.cxx.
References bindTo(), Exception, Folder, INVALID, isBound(), isInvalid(), m_eState, m_oContent, and VALID.
Referenced by is(), and isFolder().
|
inline |
checks if the content is existent (it is if and only if it is a document or a folder)
Definition at line 184 of file fpsmartcontent.hxx.
References Document, Folder, and implIs().
Referenced by SvtFileDialog::OpenHdl_Impl().
|
inline |
checks if the content is bound
Definition at line 129 of file fpsmartcontent.hxx.
References getState(), and NOT_BOUND.
Referenced by canCreateFolder(), getTitle(), hasParentFolder(), and implIs().
|
inline |
Definition at line 189 of file fpsmartcontent.hxx.
References getURL(), and isFolder().
Referenced by isFolder().
|
inline |
binds to the given URL, checks whether or not it refers to a folder
@postcond the content is not in the state UNKNOWN
Definition at line 177 of file fpsmartcontent.hxx.
References Folder, and implIs().
Referenced by SvtFileDialog::ContentIsFolder(), SvtFileDialog::implGetInitialURL(), SvtFileDialog::OpenHdl_Impl(), and SvtFileDialog::run().
|
inline |
checks if the content is valid
Note that "not (is invalid)" is not the same as "is valid"
Definition at line 125 of file fpsmartcontent.hxx.
References getState(), and INVALID.
Referenced by canCreateFolder(), SvtFileDialog::ContentCanMakeFolder(), SvtFileDialog::ContentGetTitle(), SvtFileDialog::ContentHasParentFolder(), getTitle(), hasParentFolder(), SvtFileDialog::implGetInitialURL(), implIs(), and SvtFileDialog::OpenHdl_Impl().
|
inline |
checks if the content is valid
Note that "not (is valid)" is not the same as "is invalid"
Definition at line 120 of file fpsmartcontent.hxx.
References getState(), and VALID.
Referenced by SvtFileDialog::ContentCanMakeFolder(), SvtFileDialog::ContentGetTitle(), SvtFileDialog::ContentHasParentFolder(), and SvtFileDialog::ContentIsFolder().
|
privatedelete |
SmartContent::InteractionHandlerType svt::SmartContent::queryCurrentInteractionHandler | ( | ) | const |
return the type of the internal used interaction handler object ...
@seealso InteractionHandlerType
Definition at line 107 of file fpsmartcontent.cxx.
References IHT_DEFAULT, IHT_NONE, IHT_OWN, m_xCmdEnv, and m_xOwnInteraction.
Referenced by SvtFileDialog::OpenHdl_Impl().
|
private |
Definition at line 54 of file fpsmartcontent.hxx.
Referenced by bindTo(), canCreateFolder(), getState(), getTitle(), hasParentFolder(), and implIs().
|
private |
Definition at line 53 of file fpsmartcontent.hxx.
Referenced by bindTo(), canCreateFolder(), createFolder(), getTitle(), getURL(), hasParentFolder(), and implIs().
|
private |
Definition at line 52 of file fpsmartcontent.hxx.
|
private |
Definition at line 55 of file fpsmartcontent.hxx.
Referenced by bindTo(), disableInteractionHandler(), enableDefaultInteractionHandler(), enableOwnInteractionHandler(), and queryCurrentInteractionHandler().
|
private |
Definition at line 56 of file fpsmartcontent.hxx.
Referenced by disableInteractionHandler(), enableDefaultInteractionHandler(), enableOwnInteractionHandler(), getOwnInteractionHandler(), and queryCurrentInteractionHandler().