LibreOffice Module ucbhelper (master) 1
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
ucbhelper::Content Class Referencefinal

This class simplifies access to UCB contents by providing a more convenient API for frequently used functionality then the "raw" UCB-API does. More...

#include <content.hxx>

Collaboration diagram for ucbhelper::Content:
[legend]

Public Member Functions

 Content ()
 Constructor. More...
 
 Content (const OUString &rURL, const css::uno::Reference< css::ucb::XCommandEnvironment > &rEnv, const css::uno::Reference< css::uno::XComponentContext > &rCtx)
 Constructor. More...
 
 Content (const css::uno::Reference< css::ucb::XContent > &rContent, const css::uno::Reference< css::ucb::XCommandEnvironment > &rEnv, const css::uno::Reference< css::uno::XComponentContext > &rCtx)
 Constructor. More...
 
 Content (const Content &rOther)
 Copy Constructor. More...
 
 Content (Content &&rOther) noexcept
 Move constructor. More...
 
 ~Content ()
 Destructor. More...
 
Contentoperator= (const Content &rOther)
 Assignment operator. More...
 
Contentoperator= (Content &&rOther) noexcept
 Move assignment operator. More...
 
css::uno::Reference< css::ucb::XContent > get () const
 This method provides access to the "native" UCB content interface(s). More...
 
const OUString & getURL () const
 This method returns the URL of the content. More...
 
const css::uno::Reference< css::ucb::XCommandEnvironment > & getCommandEnvironment () const
 This method returns the environment to use when executing commands. More...
 
void setCommandEnvironment (const css::uno::Reference< css::ucb::XCommandEnvironment > &xNewEnv)
 This method sets a new command environment. More...
 
css::uno::Reference< css::ucb::XCommandInfo > getCommands ()
 This methods provides access to meta data of the commands supported by this content. More...
 
css::uno::Reference< css::beans::XPropertySetInfo > getProperties ()
 This methods provides access to meta data of the properties supported by this content. More...
 
css::uno::Any getPropertyValue (const OUString &rPropertyName)
 This method can be used to read a single property value. More...
 
css::uno::Any setPropertyValue (const OUString &rPropertyName, const css::uno::Any &rValue)
 This method can be used to set a single property value. More...
 
css::uno::Sequence< css::uno::Any > getPropertyValues (const css::uno::Sequence< OUString > &rPropertyNames)
 This method can be used to read multiple property values. More...
 
css::uno::Reference< css::sdbc::XRow > getPropertyValuesInterface (const css::uno::Sequence< OUString > &rPropertyNames)
 This method can be used to read multiple property values. More...
 
css::uno::Sequence< css::uno::Any > setPropertyValues (const css::uno::Sequence< OUString > &rPropertyNames, const css::uno::Sequence< css::uno::Any > &rValues)
 This method can be used to set multiple property values. More...
 
css::uno::Any executeCommand (const OUString &rCommandName, const css::uno::Any &rCommandArgument)
 This method can be used to execute any command supported by the content. More...
 
css::uno::Reference< css::sdbc::XResultSet > createCursor (const css::uno::Sequence< OUString > &rPropertyNames, ResultSetInclude eMode=INCLUDE_FOLDERS_AND_DOCUMENTS)
 This methods gives access to the children of a folder content. More...
 
css::uno::Reference< css::ucb::XDynamicResultSet > createDynamicCursor (const css::uno::Sequence< OUString > &rPropertyNames, ResultSetInclude eMode=INCLUDE_FOLDERS_AND_DOCUMENTS)
 This methods gives access to the children of a folder content. More...
 
css::uno::Reference< css::sdbc::XResultSet > createSortedCursor (const css::uno::Sequence< OUString > &rPropertyNames, const css::uno::Sequence< css::ucb::NumberedSortingInfo > &rSortInfo, const css::uno::Reference< css::ucb::XAnyCompareFactory > &rAnyCompareFactory, ResultSetInclude eMode=INCLUDE_FOLDERS_AND_DOCUMENTS)
 
css::uno::Reference< css::io::XInputStream > openStream ()
 This methods gives read access to the content stream of a content (i.e the content of a file located at the local file system). More...
 
css::uno::Reference< css::io::XInputStream > openStreamNoLock ()
 This methods gives read access to the content stream of a content (i.e the content of a file located at the local file system). More...
 
css::uno::Reference< css::io::XStream > openWriteableStream ()
 This methods gives read/write access to the content stream of a content (i.e the content of a file located at the local file system). More...
 
css::uno::Reference< css::io::XStream > openWriteableStreamNoLock ()
 This methods gives read/write access to the content stream of a content (i.e the content of a file located at the local file system). More...
 
bool openStream (const css::uno::Reference< css::io::XActiveDataSink > &rSink)
 This methods gives read access to the content stream of a content (i.e the content of a file located at the local file system). More...
 
bool openStream (const css::uno::Reference< css::io::XOutputStream > &rStream)
 This methods gives read access to the content stream of a content (i.e the content of a file located at the local file system). More...
 
void writeStream (const css::uno::Reference< css::io::XInputStream > &rStream, bool bReplaceExisting)
 This methods gives write access to the content stream of a content (i.e the content of a file located at the local file system). More...
 
css::uno::Sequence< css::ucb::ContentInfo > queryCreatableContentsInfo ()
 This method returns the different types of contents this content can create. More...
 
bool insertNewContent (const OUString &rContentType, const css::uno::Sequence< OUString > &rPropertyNames, const css::uno::Sequence< css::uno::Any > &rPropertyValues, Content &rNewContent)
 This method creates, initializes and inserts ( commits ) a new content (i.e. More...
 
bool insertNewContent (const OUString &rContentType, const css::uno::Sequence< OUString > &rPropertyNames, const css::uno::Sequence< css::uno::Any > &rPropertyValues, const css::uno::Reference< css::io::XInputStream > &rStream, Content &rNewContent)
 This method creates, initializes and inserts (commits) a new content inside this (the target folder) content. More...
 
void transferContent (const Content &rSourceContent, InsertOperation eOperation, const OUString &rTitle, const sal_Int32 nNameClashAction, const OUString &rMimeType=OUString(), bool bMajorVersion=false, const OUString &rCommentVersion=OUString(), OUString *pResultURL=nullptr, const OUString &rDocumentId=OUString()) const
 This method transfers (copies/moves) a content. More...
 
void lock ()
 This method lock the resource. More...
 
void unlock ()
 This method unlock the resource. More...
 
bool isFolder ()
 This method returns the value of the content's property "IsFolder". More...
 
bool isDocument ()
 This method returns the value of the content's property "IsDocument". More...
 

Static Public Member Functions

static bool create (const OUString &rURL, const css::uno::Reference< css::ucb::XCommandEnvironment > &rEnv, const css::uno::Reference< css::uno::XComponentContext > &rCtx, Content &rContent)
 Constructor. More...
 

Private Member Functions

css::uno::Any createCursorAny (const css::uno::Sequence< OUString > &rPropertyNames, ResultSetInclude eMode)
 

Private Attributes

rtl::Reference< Content_Implm_xImpl
 

Detailed Description

This class simplifies access to UCB contents by providing a more convenient API for frequently used functionality then the "raw" UCB-API does.

Definition at line 98 of file content.hxx.

Constructor & Destructor Documentation

◆ Content() [1/5]

ucbhelper::Content::Content ( )

Constructor.

Definition at line 295 of file content.cxx.

◆ Content() [2/5]

ucbhelper::Content::Content ( const OUString &  rURL,
const css::uno::Reference< css::ucb::XCommandEnvironment > &  rEnv,
const css::uno::Reference< css::uno::XComponentContext > &  rCtx 
)

Constructor.

Parameters
rURLis the URL of the content to create.
rEnvis the environment to use for commands executed by the content. The command environment is used by the content implementation to interact with the client and to propagate errors.
Exceptions
css::ucb::ContentCreationException
css::uno::RuntimeException

◆ Content() [3/5]

ucbhelper::Content::Content ( const css::uno::Reference< css::ucb::XContent > &  rContent,
const css::uno::Reference< css::ucb::XCommandEnvironment > &  rEnv,
const css::uno::Reference< css::uno::XComponentContext > &  rCtx 
)

Constructor.

Parameters
rContentis the content object of the content to create.
rEnvis the environment to use for commands executed by the content. The command environment is used by the content implementation to interact with the client and to propagate errors.
Exceptions
css::ucb::ContentCreationException
css::uno::RuntimeException

◆ Content() [4/5]

ucbhelper::Content::Content ( const Content rOther)

Copy Constructor.

Parameters
rContentis the content this content shall be a copy of.

Definition at line 325 of file content.cxx.

References m_xImpl.

◆ Content() [5/5]

ucbhelper::Content::Content ( Content &&  rOther)
noexcept

Move constructor.

Definition at line 330 of file content.cxx.

◆ ~Content()

ucbhelper::Content::~Content ( )

Destructor.

Definition at line 360 of file content.cxx.

Member Function Documentation

◆ create()

static bool ucbhelper::Content::create ( const OUString &  rURL,
const css::uno::Reference< css::ucb::XCommandEnvironment > &  rEnv,
const css::uno::Reference< css::uno::XComponentContext > &  rCtx,
Content rContent 
)
static

Constructor.

This method should be used, if the exception thrown by the direct ctors of this class are to 'expensive' for your application

Parameters
rURLis the URL of the content to create.
rEnvis the environment to use for commands executed by the content. The command environment is used by the content implementation to interact with the client and to propagate errors.
rContentwill be filled by this method with the content created.
Returns
true, if the operation was successful - false, otherwise.

References get(), getPropertyValue(), and setPropertyValue().

◆ createCursor()

Reference< XResultSet > ucbhelper::Content::createCursor ( const css::uno::Sequence< OUString > &  rPropertyNames,
ResultSetInclude  eMode = INCLUDE_FOLDERS_AND_DOCUMENTS 
)

This methods gives access to the children of a folder content.

Additionally, the result set returned provides efficient access to preselected property values of the children. Internally it executes the command "open" at the content.

Parameters
rPropertyNamesis a sequence of names of properties for that the values should be accessible via the resultset returned by this method.
eModeis a very simple filter for the children contained in the resultset.
Returns
an implementation of the service com.cun.star.ucb.ContentResultSet, which can be used to get access to the children of a content.
Exceptions
css::ucb::CommandAbortedException
css::uno::RuntimeException
css::uno::Exception

Definition at line 598 of file content.cxx.

References Any, createCursorAny(), and eMode.

◆ createCursorAny()

Any ucbhelper::Content::createCursorAny ( const css::uno::Sequence< OUString > &  rPropertyNames,
ResultSetInclude  eMode 
)
private
Exceptions
css::ucb::CommandAbortedException
css::uno::RuntimeException

throws css::uno::Exception

Definition at line 566 of file content.cxx.

References aCommand, Any, Command, eMode, ucbhelper::INCLUDE_DOCUMENTS_ONLY, ucbhelper::INCLUDE_FOLDERS_ONLY, m_xImpl, n, nCount, and Property.

Referenced by createCursor(), createDynamicCursor(), and createSortedCursor().

◆ createDynamicCursor()

Reference< XDynamicResultSet > ucbhelper::Content::createDynamicCursor ( const css::uno::Sequence< OUString > &  rPropertyNames,
ResultSetInclude  eMode = INCLUDE_FOLDERS_AND_DOCUMENTS 
)

This methods gives access to the children of a folder content.

Additionally, the result set returned provides efficient access to preselected property values of the children. Internally it executes the command "open" at the content.

Parameters
rPropertyNamesis a sequence of names of properties for that the values should be accessible via the resultset returned by this method.
eModeis a very simple filter for the children contained in the resultset.
Returns
an implementation of the service com.cun.star.ucb.DynamicResultSet, which can be used to get access to the children of a content.
Exceptions
css::ucb::CommandAbortedException
css::uno::RuntimeException
css::uno::Exception

Definition at line 627 of file content.cxx.

References createCursorAny(), and eMode.

◆ createSortedCursor()

Reference< XResultSet > ucbhelper::Content::createSortedCursor ( const css::uno::Sequence< OUString > &  rPropertyNames,
const css::uno::Sequence< css::ucb::NumberedSortingInfo > &  rSortInfo,
const css::uno::Reference< css::ucb::XAnyCompareFactory > &  rAnyCompareFactory,
ResultSetInclude  eMode = INCLUDE_FOLDERS_AND_DOCUMENTS 
)
Exceptions
css::ucb::CommandAbortedException
css::uno::RuntimeException
css::uno::Exception

Definition at line 640 of file content.cxx.

References Any, createCursorAny(), eMode, and m_xImpl.

◆ executeCommand()

Any ucbhelper::Content::executeCommand ( const OUString &  rCommandName,
const css::uno::Any &  rCommandArgument 
)

This method can be used to execute any command supported by the content.

Parameters
rCommandNameis the name of the command to execute.
rCommandArgumentis the argument for the command. Type and values of this parameter must correspond to the command specification.
Returns
the result of the command according to its specification.
Exceptions
css::ucb::CommandAbortedException
css::uno::RuntimeException
css::uno::Exception

Definition at line 554 of file content.cxx.

References aCommand, Any, Command, and m_xImpl.

◆ get()

Reference< XContent > ucbhelper::Content::get ( ) const

This method provides access to the "native" UCB content interface(s).

This is useful in case the convenience methods provided by this class are insufficient for your needs. You may obtain all interfaces supported by the underlying UCB content by calling this method and after that doing a queryInterface call.

Returns
the XContent interface of the underlying UCB content.

Definition at line 377 of file content.cxx.

References m_xImpl.

Referenced by isDocument(), and isFolder().

◆ getCommandEnvironment()

const Reference< XCommandEnvironment > & ucbhelper::Content::getCommandEnvironment ( ) const

This method returns the environment to use when executing commands.

Returns
the command environment.

Definition at line 389 of file content.cxx.

References m_xImpl.

◆ getCommands()

Reference< XCommandInfo > ucbhelper::Content::getCommands ( )

This methods provides access to meta data of the commands supported by this content.

Returns
an XCommandInfo interface implementation, which can be used to obtain meta data of the commands supported by this content.
Exceptions
css::ucb::CommandAbortedException
css::uno::RuntimeException
css::uno::Exception

Definition at line 402 of file content.cxx.

References aCommand, Any, Command, and m_xImpl.

◆ getProperties()

Reference< XPropertySetInfo > ucbhelper::Content::getProperties ( )

This methods provides access to meta data of the properties supported by this content.

Returns
an XPropertSetInfo interface implementation, which can be used to obtain meta data of the properties supported by this content.
Exceptions
css::ucb::CommandAbortedException
css::uno::RuntimeException
css::uno::Exception

Definition at line 417 of file content.cxx.

References aCommand, Any, Command, m_xImpl, and u.

◆ getPropertyValue()

Any ucbhelper::Content::getPropertyValue ( const OUString &  rPropertyName)

This method can be used to read a single property value.

Parameters
rPropertyNameis the name of the property for that the value shall be obtained.
Returns
the property value.
Exceptions
css::ucb::CommandAbortedException
css::uno::RuntimeException
css::uno::Exception

Definition at line 433 of file content.cxx.

References Any, and getPropertyValues().

Referenced by isDocument(), isFolder(), and queryCreatableContentsInfo().

◆ getPropertyValues()

css::uno::Sequence< css::uno::Any > ucbhelper::Content::getPropertyValues ( const css::uno::Sequence< OUString > &  rPropertyNames)

This method can be used to read multiple property values.

Parameters
rPropertyNamesis a sequence of names of properties for that the values shall be obtained.
Returns
the property values.
Exceptions
css::ucb::CommandAbortedException
css::uno::RuntimeException
css::uno::Exception

Referenced by getPropertyValue().

◆ getPropertyValuesInterface()

Reference< XRow > ucbhelper::Content::getPropertyValuesInterface ( const css::uno::Sequence< OUString > &  rPropertyNames)

This method can be used to read multiple property values.

Parameters
rPropertyNamesis a sequence of names of properties for that the values shall be obtained.
Returns
the property values.
Exceptions
css::ucb::CommandAbortedException
css::uno::RuntimeException
css::uno::Exception

Definition at line 475 of file content.cxx.

References aCommand, Any, Command, m_xImpl, n, nCount, Property, and u.

◆ getURL()

const OUString & ucbhelper::Content::getURL ( ) const

This method returns the URL of the content.

Returns
the URL of the content.

Definition at line 383 of file content.cxx.

References m_xImpl.

Referenced by transferContent().

◆ insertNewContent() [1/2]

bool ucbhelper::Content::insertNewContent ( const OUString &  rContentType,
const css::uno::Sequence< OUString > &  rPropertyNames,
const css::uno::Sequence< css::uno::Any > &  rPropertyValues,
const css::uno::Reference< css::io::XInputStream > &  rStream,
Content rNewContent 
)

This method creates, initializes and inserts (commits) a new content inside this (the target folder) content.

For example, it can be used to create a new file system file. Internally this method does a XCommandProcessor::execute( "createNewContent", ... ); XCommandProcessor::execute( "setPropertyValues", ... ); XCommandProcessor::execute( "insert", ... ); calling sequence.

Parameters
rContentTypeis the type for the new UCB content. Each content provider implementation may introduce own types for its content objects (See queryCreatableContentsInfo()).
rPropertyNamesis a sequence of names of properties for that values are to set at the new content before it will be inserted ( committed ). The order of the names must correspond to the order of the property values.
rPropertyValuesis a sequence of property values that are to set at the new content before it will be inserted ( committed ). The order of the values must correspond to the order of the property names.
rStreamis a stream containing the content data for the new content (i.e. the content of a file to create)
rNewContentwill be filled by the implementation of this method with the new content.
Exceptions
css::ucb::CommandAbortedException
css::uno::RuntimeException
css::uno::Exception

References lock().

◆ insertNewContent() [2/2]

bool ucbhelper::Content::insertNewContent ( const OUString &  rContentType,
const css::uno::Sequence< OUString > &  rPropertyNames,
const css::uno::Sequence< css::uno::Any > &  rPropertyValues,
Content rNewContent 
)

This method creates, initializes and inserts ( commits ) a new content (i.e.

it could be used to create a new file system folder). Internally this method does a XCommandProcessor::execute( "createNewContent", ... ); XCommandProcessor::execute( "setPropertyValues", ... ); XCommandProcessor::execute( "insert", ... ); calling sequence.

Parameters
rContentTypeis the type for the new UCB content. Each content provider implementation may introduce own types for its content objects (See queryCreatableContentsInfo()).
rPropertyNamesis a sequence of names of properties for that values are to set at the new content before it will be inserted ( committed ). The order of the names must correspond to the order of the property values.
rPropertyValuesis a sequence of property values that are to set at the new content before it will be inserted ( committed ). The order of the values must correspond to the order of the property names.
rNewContentwill be filled by the implementation of this method with the new content.
Exceptions
css::ucb::CommandAbortedException
css::uno::RuntimeException
css::uno::Exception

◆ isDocument()

bool ucbhelper::Content::isDocument ( )

This method returns the value of the content's property "IsDocument".

Returns
true, if the content is a document ( it has a content stream ). false, otherwise.
Exceptions
css::ucb::CommandAbortedException
css::uno::RuntimeException
css::uno::Exception

Definition at line 1025 of file content.cxx.

References Any, ucbhelper::cancelCommandExecution(), get(), getPropertyValue(), m_xImpl, and O3TL_UNREACHABLE.

Referenced by openStream(), openStreamNoLock(), openWriteableStream(), and openWriteableStreamNoLock().

◆ isFolder()

bool ucbhelper::Content::isFolder ( )

This method returns the value of the content's property "IsFolder".

Returns
true, if the content is a folder ( it can contain other UCB contents). false, otherwise.
Exceptions
css::ucb::CommandAbortedException
css::uno::RuntimeException
css::uno::Exception

Definition at line 1008 of file content.cxx.

References Any, ucbhelper::cancelCommandExecution(), get(), getPropertyValue(), m_xImpl, and O3TL_UNREACHABLE.

◆ lock()

void ucbhelper::Content::lock ( )

This method lock the resource.

Exceptions
css::ucb::CommandAbortedException
css::uno::RuntimeException
css::uno::Exception

Definition at line 1041 of file content.cxx.

References aCommand, Command, and m_xImpl.

◆ openStream() [1/3]

Reference< XInputStream > ucbhelper::Content::openStream ( )

This methods gives read access to the content stream of a content (i.e the content of a file located at the local file system).

Internally it executes the command "open" at the content.

Returns
an implementation of the interface XInputStream, which can be used to read the content's data.
Exceptions
css::ucb::CommandAbortedException
css::uno::RuntimeException
css::uno::Exception

Definition at line 691 of file content.cxx.

References aCommand, Command, isDocument(), m_xImpl, and xSink.

◆ openStream() [2/3]

bool ucbhelper::Content::openStream ( const css::uno::Reference< css::io::XActiveDataSink > &  rSink)

This methods gives read access to the content stream of a content (i.e the content of a file located at the local file system).

Internally it executes the command "open" at the content.

Parameters
rSinkis the implementation of an XActiveDataSink interface, which shall be used by the content to deliver the data.
Exceptions
css::ucb::CommandAbortedException
css::uno::RuntimeException
css::uno::Exception

◆ openStream() [3/3]

bool ucbhelper::Content::openStream ( const css::uno::Reference< css::io::XOutputStream > &  rStream)

This methods gives read access to the content stream of a content (i.e the content of a file located at the local file system).

Internally it executes the command "open" at the content.

Parameters
rStreamis the implementation of an XOutputStream interface, which shall be used by the content to deliver the data.
Exceptions
css::ucb::CommandAbortedException
css::uno::RuntimeException
css::uno::Exception

◆ openStreamNoLock()

Reference< XInputStream > ucbhelper::Content::openStreamNoLock ( )

This methods gives read access to the content stream of a content (i.e the content of a file located at the local file system).

Internally it executes the command "open" at the content. The method requests opening without locking.

Returns
an implementation of the interface XInputStream, which can be used to read the content's data.
Exceptions
css::ucb::CommandAbortedException
css::uno::RuntimeException
css::uno::Exception

Definition at line 715 of file content.cxx.

References aCommand, Command, isDocument(), m_xImpl, and xSink.

◆ openWriteableStream()

Reference< XStream > ucbhelper::Content::openWriteableStream ( )

This methods gives read/write access to the content stream of a content (i.e the content of a file located at the local file system).

Internally it executes the command "open" at the content.

Returns
an implementation of the interface XStream, which can be used to read/write the content's data.
Exceptions
css::ucb::CommandAbortedException
css::uno::RuntimeException
css::uno::Exception

Definition at line 739 of file content.cxx.

References aCommand, Command, isDocument(), and m_xImpl.

◆ openWriteableStreamNoLock()

Reference< XStream > ucbhelper::Content::openWriteableStreamNoLock ( )

This methods gives read/write access to the content stream of a content (i.e the content of a file located at the local file system).

Internally it executes the command "open" at the content. The method requests opening without locking.

Returns
an implementation of the interface XStream, which can be used to read/write the content's data.
Exceptions
css::ucb::CommandAbortedException
css::uno::RuntimeException
css::uno::Exception

Definition at line 763 of file content.cxx.

References aCommand, Command, isDocument(), and m_xImpl.

◆ operator=() [1/2]

Content & ucbhelper::Content::operator= ( const Content rOther)

Assignment operator.

Parameters
rContentis the content this content shall be a copy of.

Definition at line 365 of file content.cxx.

References m_xImpl.

◆ operator=() [2/2]

Content & ucbhelper::Content::operator= ( Content &&  rOther)
noexcept

Move assignment operator.

Definition at line 371 of file content.cxx.

◆ queryCreatableContentsInfo()

Sequence< ContentInfo > ucbhelper::Content::queryCreatableContentsInfo ( )

This method returns the different types of contents this content can create.

Returns
the content types or an empty sequence if no contents can be created by this content.
Exceptions
css::ucb::CommandAbortedException
css::uno::RuntimeException
css::uno::Exception

Definition at line 849 of file content.cxx.

References getPropertyValue(), and m_xImpl.

◆ setCommandEnvironment()

void ucbhelper::Content::setCommandEnvironment ( const css::uno::Reference< css::ucb::XCommandEnvironment > &  xNewEnv)

This method sets a new command environment.

Parameters
xNewEnvis the new command environment.

Definition at line 395 of file content.cxx.

References m_xImpl.

◆ setPropertyValue()

Any ucbhelper::Content::setPropertyValue ( const OUString &  rPropertyName,
const css::uno::Any &  rValue 
)

This method can be used to set a single property value.

Parameters
rPropertyNameis the name of the property for that the value shall be set.
Returns
an any containing:
  • No value indicates, that the property value was set successfully.
  • css::beans::UnknownPropertyException indicates, that the property is not known to the content implementation.
  • css::beans::IllegalTypeException indicates, that the data type of the property value is not acceptable.
  • css::lang::IllegalAccessException indicates, that the property is constant.
  • css::lang::IllegalArgumentException indicates, that the property value is not acceptable. For instance, setting an empty title may be illegal.
  • Any other exception derived from css::uno::Exception indicates, that the value was not set successfully. For example, this can be a com::sun:star::ucb::InteractiveAugmentedIOException transporting the error code css::ucb::IOErrorCode::ACCESS_DENIED.
Exceptions
css::ucb::CommandAbortedException
css::uno::RuntimeException
css::uno::Exception

Definition at line 442 of file content.cxx.

References Any, and setPropertyValues().

◆ setPropertyValues()

css::uno::Sequence< css::uno::Any > ucbhelper::Content::setPropertyValues ( const css::uno::Sequence< OUString > &  rPropertyNames,
const css::uno::Sequence< css::uno::Any > &  rValues 
)

This method can be used to set multiple property values.

Parameters
rPropertyNamesis a sequence of names of properties for that values shall be set.
Returns
a sequence of any's which has exactly the same number of elements as the number of properties to set. Every sequence element contains the status for a property. The first sequence elements corresponds to the first element in the sequence of property names and so on.

An any containing:

  • No value indicates, that the property value was set successfully.
  • css::beans::UnknownPropertyException indicates, that the property is not known to the content implementation.
  • css::beans::IllegalTypeException indicates, that the data type of the property value is not acceptable.
  • css::lang::IllegalAccessException indicates, that the property is constant.
  • css::lang::IllegalArgumentException indicates, that the property value is not acceptable. For instance, setting an empty title may be illegal.
  • Any other exception derived from css::uno::Exception indicates, that the value was not set successfully. For example, this can be a com::sun:star::ucb::InteractiveAugmentedIOException transporting the error code css::ucb::IOErrorCode::ACCESS_DENIED.
    Exceptions
    css::ucb::CommandAbortedException
    css::uno::RuntimeException
    css::uno::Exception

References executeCommand().

Referenced by setPropertyValue().

◆ transferContent()

void ucbhelper::Content::transferContent ( const Content rSourceContent,
InsertOperation  eOperation,
const OUString &  rTitle,
const sal_Int32  nNameClashAction,
const OUString &  rMimeType = OUString(),
bool  bMajorVersion = false,
const OUString &  rCommentVersion = OUString(),
OUString *  pResultURL = nullptr,
const OUString &  rDocumentId = OUString() 
) const

This method transfers (copies/moves) a content.

It creates a new resource inside this (the target folder) content. The implementation is able to do cross-provider transfers (like copying a file from the local file system to a directory located on an HTTP server). Internally this method executes the command "globalTransfer" at the UCB.

Parameters
rSourceContentis the content that contains the data for the new UCB content.
eOperationdefines what shall be done with the source data ( COPY, MOVE, LINK ).
rTitlecontains a title for the new content. If this is an empty string, the new content will have the same title as the source content.
rNameClashActiondescribes how the implementation shall behave in case a content with a clashing name exists in the target folder. NameClash::ERROR will abort the operation, NameClash::OVERWRITE will overwrite the clashing content and all its data, NameClash::RENAME will generate and supply a non-clashing title.
See also
com/sun/star/ucb/NameClash.idl
Parameters
rMimeTypecontains the MIME type of the document to write.
bMajorVersiontells to create a new major version for checkin operations
rCommentVersioncontains the comment to use for checkin operations
rResultURLis a hacky way to get the update URL after the operation in case there was a change (introduced for the checkin operation)
rDocumentIdis the document Id ( in case of CMIS ).
Exceptions
css::ucb::CommandAbortedException
css::uno::RuntimeException
css::uno::Exception

Definition at line 945 of file content.cxx.

References aCommand, Any, ucbhelper::Checkin, Command, ucbhelper::Copy, getURL(), m_xImpl, and ucbhelper::Move.

◆ unlock()

void ucbhelper::Content::unlock ( )

This method unlock the resource.

Exceptions
css::ucb::CommandAbortedException
css::uno::RuntimeException
css::uno::Exception

Definition at line 1051 of file content.cxx.

References aCommand, Command, and m_xImpl.

◆ writeStream()

void ucbhelper::Content::writeStream ( const css::uno::Reference< css::io::XInputStream > &  rStream,
bool  bReplaceExisting 
)

This methods gives write access to the content stream of a content (i.e the content of a file located at the local file system).

Internally it executes the command "insert" at the content.

Parameters
rStreamis the implementation of an XInputStream interface, which contains the content data to write.
bReplaceExistingspecifies, whether any existing content data shall be overwritten.
Exceptions
css::ucb::CommandAbortedException
css::uno::RuntimeException
css::uno::Exception

Definition at line 831 of file content.cxx.

References aCommand, Command, and m_xImpl.

Member Data Documentation

◆ m_xImpl

rtl::Reference<Content_Impl> ucbhelper::Content::m_xImpl
private

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