LibreOffice Module ucbhelper (master) 1
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Friends | List of all members
ucbhelper::ContentProviderImplHelper Class Referenceabstract

This is an abstract base class for implementations of the service com.sun.star.ucb.ContentProvider. More...

#include <providerhelper.hxx>

Inheritance diagram for ucbhelper::ContentProviderImplHelper:
[legend]
Collaboration diagram for ucbhelper::ContentProviderImplHelper:
[legend]

Public Member Functions

 ContentProviderImplHelper (css::uno::Reference< css::uno::XComponentContext > xContext)
 
virtual ~ContentProviderImplHelper () override
 
virtual OUString SAL_CALL getImplementationName () override=0
 
virtual sal_Bool SAL_CALL supportsService (const OUString &ServiceName) override
 
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames () override=0
 
virtual css::uno::Reference< css::ucb::XContent > SAL_CALL queryContent (const css::uno::Reference< css::ucb::XContentIdentifier > &Identifier) override=0
 This method returns a content with the requested id. More...
 
virtual sal_Int32 SAL_CALL compareContentIds (const css::uno::Reference< css::ucb::XContentIdentifier > &Id1, const css::uno::Reference< css::ucb::XContentIdentifier > &Id2) override
 
osl::Mutex & getContentListMutex ()
 This method returns a mutex, which protects the content list of the provider. More...
 
void queryExistingContents (ContentRefList &rContents)
 This method fills a list with all contents existing at calling time. More...
 
css::uno::Reference< css::ucb::XPersistentPropertySet > getAdditionalPropertySet (const OUString &rKey, bool bCreate)
 This method returns the propertyset containing the Additional Core Properties of a content. More...
 
bool renameAdditionalPropertySet (const OUString &rOldKey, const OUString &rNewKey, bool bRecursive)
 This method renames the propertyset containing the Additional Core Properties of a content. More...
 
bool copyAdditionalPropertySet (const OUString &rSourceKey, const OUString &rTargetKey, bool bRecursive)
 This method copies the propertyset containing the Additional Core Properties of a content. More...
 
bool removeAdditionalPropertySet (const OUString &rKey, bool bRecursive)
 This method removes the propertyset containing the Additional Core Properties of a content. More...
 

Protected Member Functions

rtl::Reference< ContentImplHelperqueryExistingContent (const css::uno::Reference< css::ucb::XContentIdentifier > &Identifier)
 This method returns a content with the given id, if it already exists. More...
 
rtl::Reference< ContentImplHelperqueryExistingContent (const OUString &rURL)
 This method returns a content with the given URL, if it already exists. More...
 
void registerNewContent (const css::uno::Reference< css::ucb::XContent > &xContent)
 This method registers a newly created content instance with the content provider. More...
 

Protected Attributes

osl::Mutex m_aMutex
 
css::uno::Reference< css::uno::XComponentContext > m_xContext
 

Private Member Functions

UCBHELPER_DLLPRIVATE void removeContent (ContentImplHelper *pContent)
 
UCBHELPER_DLLPRIVATE css::uno::Reference< css::ucb::XPropertySetRegistry > getAdditionalPropertySetRegistry ()
 
UCBHELPER_DLLPRIVATE void cleanupRegisteredContents ()
 

Private Attributes

std::unique_ptr< ucbhelper_impl::ContentProviderImplHelper_Implm_pImpl
 

Friends

class ContentImplHelper
 

Detailed Description

This is an abstract base class for implementations of the service com.sun.star.ucb.ContentProvider.

It provides contents derived from class ucb::ContentImplHelper.

Features of the base class implementation:

Definition at line 63 of file providerhelper.hxx.

Constructor & Destructor Documentation

◆ ContentProviderImplHelper()

ucbhelper::ContentProviderImplHelper::ContentProviderImplHelper ( css::uno::Reference< css::uno::XComponentContext >  xContext)

Definition at line 63 of file providerhelper.cxx.

References m_pImpl, and m_xContext.

◆ ~ContentProviderImplHelper()

ucbhelper::ContentProviderImplHelper::~ContentProviderImplHelper ( )
overridevirtual

Definition at line 71 of file providerhelper.cxx.

Member Function Documentation

◆ cleanupRegisteredContents()

void ucbhelper::ContentProviderImplHelper::cleanupRegisteredContents ( )
private

◆ compareContentIds()

sal_Int32 SAL_CALL ucbhelper::ContentProviderImplHelper::compareContentIds ( const css::uno::Reference< css::ucb::XContentIdentifier > &  Id1,
const css::uno::Reference< css::ucb::XContentIdentifier > &  Id2 
)
overridevirtual

Definition at line 83 of file providerhelper.cxx.

◆ copyAdditionalPropertySet()

bool ucbhelper::ContentProviderImplHelper::copyAdditionalPropertySet ( const OUString &  rSourceKey,
const OUString &  rTargetKey,
bool  bRecursive 
)

This method copies the propertyset containing the Additional Core Properties of a content.

Parameters
rSourceKeyis the key of the source propertyset.
rTargetKeyis the key of the target propertyset.
bRecursiveis a flag indicating whether propertysets for children described by rSourceKey shall be copied, too.
Returns
True, if the operation succeeded - False, otherwise.

Definition at line 312 of file providerhelper.cxx.

References copyAdditionalPropertySet(), getAdditionalPropertySet(), getAdditionalPropertySetRegistry(), m_aMutex, and m_pImpl.

Referenced by copyAdditionalPropertySet().

◆ getAdditionalPropertySet()

uno::Reference< css::ucb::XPersistentPropertySet > ucbhelper::ContentProviderImplHelper::getAdditionalPropertySet ( const OUString &  rKey,
bool  bCreate 
)

This method returns the propertyset containing the Additional Core Properties of a content.

Parameters
rKeyis the key for the propertyset.
bCreateis a flag indicating whether the propertyset shall be created in case it does not exist.
Returns
the propertyset containing the Additional Core Properties.

Definition at line 223 of file providerhelper.cxx.

References getAdditionalPropertySetRegistry(), and m_pImpl.

Referenced by copyAdditionalPropertySet(), and renameAdditionalPropertySet().

◆ getAdditionalPropertySetRegistry()

uno::Reference< css::ucb::XPropertySetRegistry > ucbhelper::ContentProviderImplHelper::getAdditionalPropertySetRegistry ( )
private

◆ getContentListMutex()

osl::Mutex & ucbhelper::ContentProviderImplHelper::getContentListMutex ( )
inline

This method returns a mutex, which protects the content list of the provider.

So you can prevent modifications of that list easily.

Returns
the mutex.

Definition at line 178 of file providerhelper.hxx.

References m_aMutex.

◆ getImplementationName()

virtual OUString SAL_CALL ucbhelper::ContentProviderImplHelper::getImplementationName ( )
overridepure virtual

References supportsService().

◆ getSupportedServiceNames()

virtual css::uno::Sequence< OUString > SAL_CALL ucbhelper::ContentProviderImplHelper::getSupportedServiceNames ( )
overridepure virtual

◆ queryContent()

virtual css::uno::Reference< css::ucb::XContent > SAL_CALL ucbhelper::ContentProviderImplHelper::queryContent ( const css::uno::Reference< css::ucb::XContentIdentifier > &  Identifier)
overridepure virtual

This method returns a content with the requested id.

The implementation should:

  • Check, whether the Identifier is valid ( URL syntax ).
  • Use queryExistingContent(...) to determine, whether there exists already a content with the given id.
  • Return the possibly existing content.Create and return a new content, otherwise

◆ queryExistingContent() [1/2]

rtl::Reference< ContentImplHelper > ucbhelper::ContentProviderImplHelper::queryExistingContent ( const css::uno::Reference< css::ucb::XContentIdentifier > &  Identifier)
protected

This method returns a content with the given id, if it already exists.

Use this method in your "queryContent" implementation to ensure unique objects.

Parameters
Identifieris the content identifier, for that an existing content object is requested.
Returns
the content with the given identifier, if it exists or 0, if it does not exist.

◆ queryExistingContent() [2/2]

rtl::Reference< ContentImplHelper > ucbhelper::ContentProviderImplHelper::queryExistingContent ( const OUString &  rURL)
protected

This method returns a content with the given URL, if it already exists.

Parameters
rURLis the URL ( content identifier string ), for that an existing content object is requested.
Returns
the content with the given URL, if it exists or 0, if it does not exist.

Definition at line 140 of file providerhelper.cxx.

References cleanupRegisteredContents(), m_aMutex, and m_pImpl.

◆ queryExistingContents()

void ucbhelper::ContentProviderImplHelper::queryExistingContents ( ContentRefList rContents)

This method fills a list with all contents existing at calling time.

Note: You may prevent modifications of the content list at any time by acquiring the content list mutex of the provider.

Parameters
rContentsis the list to fill with the children.

Definition at line 162 of file providerhelper.cxx.

References cleanupRegisteredContents(), m_aMutex, and m_pImpl.

◆ registerNewContent()

void ucbhelper::ContentProviderImplHelper::registerNewContent ( const css::uno::Reference< css::ucb::XContent > &  xContent)
protected

This method registers a newly created content instance with the content provider.

It should be called directly after creating a new content instance. The provider can reuse a registered instance upon subsequent requests for content instances with an identifier of a registered instance. Note that the provider does not hold a hard reference on the registered instance. If last external reference is gone, the provider will remove the instance from its inventory of known instances. Nothing will happen in case an already registered instance shall be registered more than once.

Parameters
thecontent instance that is to be registered.

Definition at line 180 of file providerhelper.cxx.

References aURL, cleanupRegisteredContents(), m_aMutex, and m_pImpl.

◆ removeAdditionalPropertySet()

bool ucbhelper::ContentProviderImplHelper::removeAdditionalPropertySet ( const OUString &  rKey,
bool  bRecursive 
)

This method removes the propertyset containing the Additional Core Properties of a content.

Parameters
rKeyis the key of the propertyset.
bRecursiveis a flag indicating whether propertysets for children described by rOldKey shall be removed, too.
Returns
True, if the operation succeeded - False, otherwise.

Definition at line 437 of file providerhelper.cxx.

References getAdditionalPropertySetRegistry(), m_aMutex, m_pImpl, and removeAdditionalPropertySet().

Referenced by removeAdditionalPropertySet().

◆ removeContent()

void ucbhelper::ContentProviderImplHelper::removeContent ( ContentImplHelper pContent)
private

◆ renameAdditionalPropertySet()

bool ucbhelper::ContentProviderImplHelper::renameAdditionalPropertySet ( const OUString &  rOldKey,
const OUString &  rNewKey,
bool  bRecursive 
)

This method renames the propertyset containing the Additional Core Properties of a content.

Parameters
rOldKeyis the old key of the propertyset.
rNewKeyis the new key for the propertyset.
bRecursiveis a flag indicating whether propertysets for children described by rOldKey shall be renamed, too.
Returns
True, if the operation succeeded - False, otherwise.

Definition at line 239 of file providerhelper.cxx.

References getAdditionalPropertySet(), getAdditionalPropertySetRegistry(), m_aMutex, m_pImpl, and renameAdditionalPropertySet().

Referenced by renameAdditionalPropertySet().

◆ supportsService()

sal_Bool SAL_CALL ucbhelper::ContentProviderImplHelper::supportsService ( const OUString &  ServiceName)
overridevirtual

Definition at line 76 of file providerhelper.cxx.

References ServiceName, and cppu::supportsService().

Friends And Related Function Documentation

◆ ContentImplHelper

friend class ContentImplHelper
friend

Definition at line 68 of file providerhelper.hxx.

Member Data Documentation

◆ m_aMutex

osl::Mutex ucbhelper::ContentProviderImplHelper::m_aMutex
protected

◆ m_pImpl

std::unique_ptr<ucbhelper_impl::ContentProviderImplHelper_Impl> ucbhelper::ContentProviderImplHelper::m_pImpl
private

◆ m_xContext

css::uno::Reference< css::uno::XComponentContext > ucbhelper::ContentProviderImplHelper::m_xContext
protected

Definition at line 74 of file providerhelper.hxx.

Referenced by getAdditionalPropertySetRegistry().


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