22#include <com/sun/star/container/XChild.hpp>
23#include <com/sun/star/task/InteractionHandler.hpp>
24#include <com/sun/star/ucb/ContentCreationException.hpp>
25#include <com/sun/star/ucb/ContentInfo.hpp>
26#include <com/sun/star/ucb/ContentInfoAttribute.hpp>
27#include <com/sun/star/ucb/XContent.hpp>
49 :m_eState( NOT_BOUND )
55 :m_eState( NOT_BOUND )
79 Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
80 Reference< XInteractionHandler > xGlobalInteractionHandler(
81 InteractionHandler::createWithParent(xContext,
nullptr), UNO_QUERY_THROW );
83 m_xOwnInteraction = new ::svt::OFilePickerInteractionHandler(xGlobalInteractionHandler);
94 Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
95 Reference< XInteractionHandler > xGlobalInteractionHandler(
96 InteractionHandler::createWithParent(xContext,
nullptr), UNO_QUERY_THROW );
146 catch(
const ContentCreationException& )
180 assert(
m_oContent &&
"SmartContent::implIs: inconsistence!" );
212 m_oContent->getPropertyValue(
"Title") >>= sTitle;
218 catch(
const css::uno::Exception& )
234 Reference< XChild > xChild(
m_oContent->get(), UNO_QUERY );
237 Reference< XContent > xParent( xChild->getParent(), UNO_QUERY );
240 const OUString aParentURL( xParent->getIdentifier()->getContentIdentifier() );
241 bRet = ( !aParentURL.isEmpty() && aParentURL !=
m_oContent->getURL() );
265 const css::uno::Sequence<css::ucb::ContentInfo> aContentsInfo =
m_oContent->queryCreatableContentsInfo();
266 for (
auto const& rInfo : aContentsInfo )
269 if ( rInfo.Attributes & ContentInfoAttribute::KIND_FOLDER )
289 OUString aCreatedUrl;
292 OUString sFolderType;
294 const css::uno::Sequence<css::ucb::ContentInfo> aContentsInfo =
m_oContent->queryCreatableContentsInfo();
295 for (
auto const& rInfo : aContentsInfo )
298 if ( rInfo.Attributes & ContentInfoAttribute::KIND_FOLDER )
300 sFolderType = rInfo.Type;
305 if ( !sFolderType.isEmpty() )
308 Sequence< OUString > aNames {
"Title" };
309 Sequence< Any > aValues {
Any(_rTitle) };
310 m_oContent->insertNewContent( sFolderType, aNames, aValues, aCreated );
312 aCreatedUrl = aCreated.
getURL();
an InteractionHandler implementation which extends another handler with some customizability
EInterceptedInteractions
flags, which indicates special handled interactions These values will be used combined as flags - so ...
InteractionHandlerType
describes different types of interaction handlers
std::optional<::ucbhelper::Content > m_oContent
::svt::OFilePickerInteractionHandler * getOwnInteractionHandler() const
return the internal used interaction handler object ... Because this pointer will be valid only,...
bool isBound() const
checks if the content is bound
void getTitle(OUString &_rTitle)
retrieves the title of the content @precond the content is bound and not invalid
void enableDefaultInteractionHandler()
disable the specialized interaction handler and use the global UI interaction handler only.
void disableInteractionHandler()
disable internal used interaction handler object ...
bool hasParentFolder()
checks if the content has a parent folder @precond the content is bound and not invalid
void bindTo(const OUString &_rURL)
(re)creates the content for the given URL
void enableOwnInteractionHandler(::svt::OFilePickerInteractionHandler::EInterceptedInteractions eInterceptions)
create and set a specialized interaction handler at the internal used command environment.
css::uno::Reference< css::ucb::XCommandEnvironment > m_xCmdEnv
bool canCreateFolder()
checks if sub folders below the content can be created @precond the content is bound and not invalid
OUString const & getURL() const
returns the URL of the content
OUString createFolder(const OUString &_rTitle)
creates a new folder with the given title and return the corresponding URL.
InteractionHandlerType queryCurrentInteractionHandler() const
return the type of the internal used interaction handler object ...
bool isInvalid() const
checks if the content is valid
bool implIs(const OUString &_rURL, Type _eType)
checks if the currently bound content is a folder or document
rtl::Reference<::svt::OFilePickerInteractionHandler > m_xOwnInteraction
const OUString & getURL() const
#define TOOLS_WARN_EXCEPTION(area, stream)
Reference< XComponentContext > getProcessComponentContext()