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

implement XFrames, XIndexAccess and XElementAccess interfaces as helper for services @descr Use this class as helper for these interfaces. More...

#include <oframes.hxx>

Inheritance diagram for framework::OFrames:
[legend]
Collaboration diagram for framework::OFrames:
[legend]

Public Member Functions

 OFrames (const css::uno::Reference< css::frame::XFrame > &xOwner, FrameContainer *pFrameContainer)
 standard ctor @descr These initialize a new instance of this class with all needed information for work. More...
 
virtual void SAL_CALL append (const css::uno::Reference< css::frame::XFrame > &xFrame) override
 append frame to container @descr We share the container with our owner. More...
 
virtual void SAL_CALL remove (const css::uno::Reference< css::frame::XFrame > &xFrame) override
 remove frame from container @descr This is the companion to append(). More...
 
virtual css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > SAL_CALL queryFrames (sal_Int32 nSearchFlags) override
 return list of all applicable frames for given flags @descr Call these to get a list of all frames, which are match with given search flags. More...
 
virtual sal_Int32 SAL_CALL getCount () override
 get count of all current frames in container @descr This is the beginning of full index-access. More...
 
virtual css::uno::Any SAL_CALL getByIndex (sal_Int32 nIndex) override
 get specified container item by index @descr If you called getCount() successful - this method return the specified element as an Any. More...
 
virtual css::uno::Type SAL_CALL getElementType () override
 get uno-type of all container items @descr In current implementation type is fixed to XFrame! (container-lock is ignored) More...
 
virtual sal_Bool SAL_CALL hasElements () override
 get fill state of current container @descr Call these to get information about, if items exist in container or not. More...
 

Private Member Functions

virtual ~OFrames () override
 standard destructor @descr This method destruct an instance of this class and clear some member. More...
 
void impl_resetObject ()
 reset instance to default values @descr There are two ways to delete an instance of this class. More...
 
void impl_appendSequence (css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > &seqDestination, const css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > &seqSource)
 append one sequence to another @descr There is no operation to add to sequences! Use this helper-method to do this. More...
 

Static Private Member Functions

static bool impldbg_checkParameter_queryFrames (sal_Int32 nSearchFlags)
 

Private Attributes

css::uno::WeakReference< css::frame::XFrame > m_xOwner
 
FrameContainerm_pFrameContainer
 reference to owner of this instance (Hold no hard reference!) More...
 
bool m_bRecursiveSearchProtection
 with owner shared list to hold all direct children of an XFramesSupplier More...
 

Detailed Description

implement XFrames, XIndexAccess and XElementAccess interfaces as helper for services @descr Use this class as helper for these interfaces.

We share mutex and framecontainer with our owner. The framecontainer is a member of it from type "FrameContainer". That means; we have the same information as our owner. In current implementation we use mutex and lock-mechanism to prevent against compete access. In future we plan support of semaphore!

@devstatus deprecated

@ATTENTION Don't use this class as direct member - use it dynamically. Do not derive from this class. We hold a weakreference to our owner not to our superclass.

Definition at line 44 of file oframes.hxx.

Constructor & Destructor Documentation

◆ OFrames()

framework::OFrames::OFrames ( const css::uno::Reference< css::frame::XFrame > &  xOwner,
FrameContainer pFrameContainer 
)

standard ctor @descr These initialize a new instance of this class with all needed information for work.

We share framecontainer with owner implementation! It's a threadsafe container.

Parameters
xOwner,referenceto our owner. We hold a wekreference to prevent us against cross-references!
pFrameContainer,pointerto shared framecontainer of owner. It's valid only, if weakreference is valid!

Definition at line 38 of file oframes.cxx.

References SAL_WARN_IF.

◆ ~OFrames()

framework::OFrames::~OFrames ( )
overrideprivatevirtual

standard destructor @descr This method destruct an instance of this class and clear some member.

This method is protected, because it's not allowed to use this class as a member! You MUST use a dynamical instance (pointer). That's the reason for a protected dtor.

Definition at line 52 of file oframes.cxx.

References impl_resetObject().

Member Function Documentation

◆ append()

void SAL_CALL framework::OFrames::append ( const css::uno::Reference< css::frame::XFrame > &  xFrame)
overridevirtual

append frame to container @descr We share the container with our owner.

We can do this only, if no lock is set on container. Valid references are accepted only!

@seealso class FrameContainer

Parameters
xFrame,referenceto an existing frame to append. @onerror We do nothing in release or throw an assert in debug version.

Definition at line 59 of file oframes.cxx.

References framework::FrameContainer::append(), m_pFrameContainer, m_xOwner, SAL_WARN_IF, and xFrame.

◆ getByIndex()

Any SAL_CALL framework::OFrames::getByIndex ( sal_Int32  nIndex)
overridevirtual

get specified container item by index @descr If you called getCount() successful - this method return the specified element as an Any.

You must observe the range from 0 to count-1! Otherwise an IndexOutOfBoundsException is thrown.

@seealso class FrameContainer @seealso method getCount()

Parameters
nIndex,validindex to get container item.
Returns
A container item (specified by index) wrapped in an Any.

@onerror If a lock is set, we return an empty Any! @onerror If index out of range, an IndexOutOfBoundsException is thrown.

Definition at line 222 of file oframes.cxx.

References Any, framework::FrameContainer::getCount(), m_pFrameContainer, m_xOwner, nCount, and nIndex.

◆ getCount()

sal_Int32 SAL_CALL framework::OFrames::getCount ( )
overridevirtual

get count of all current frames in container @descr This is the beginning of full index-access.

With a count you can step over all items in container. Next call should be getByIndex(). But these mechanism works only, if no lock in container is set!

@seealso class FrameContainer @seealso method getByIndex()

Returns
Count of current items in container.

@onerror If a lock is set, we return 0 for prevent further access!

Definition at line 200 of file oframes.cxx.

References framework::FrameContainer::getCount(), m_pFrameContainer, m_xOwner, and nCount.

◆ getElementType()

Type SAL_CALL framework::OFrames::getElementType ( )
overridevirtual

get uno-type of all container items @descr In current implementation type is fixed to XFrame! (container-lock is ignored)

Returns
A uno-type descriptor.

Definition at line 249 of file oframes.cxx.

References cppu::UnoType< typename T >::get().

◆ hasElements()

sal_Bool SAL_CALL framework::OFrames::hasElements ( )
overridevirtual

get fill state of current container @descr Call these to get information about, if items exist in container or not.

(container-lock is ignored)

Returns
sal_True, if container contains some items.
sal_False, otherwise.

@onerror We return sal_False.

Definition at line 256 of file oframes.cxx.

References framework::FrameContainer::getCount(), m_pFrameContainer, and m_xOwner.

◆ impl_appendSequence()

void framework::OFrames::impl_appendSequence ( css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > &  seqDestination,
const css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > &  seqSource 
)
private

append one sequence to another @descr There is no operation to add to sequences! Use this helper-method to do this.

@seealso class Sequence

Parameters
seqDestination,referenceto sequence on which operation will append the other sequence.
seqSource,referenceto sequence for append.
Returns
"seqDestination" is parameter AND return value at the same time.

Definition at line 294 of file oframes.cxx.

Referenced by queryFrames().

◆ impl_resetObject()

void framework::OFrames::impl_resetObject ( )
private

reset instance to default values @descr There are two ways to delete an instance of this class.


1) delete with destructor
2) dispose from parent or factory ore ...
This method do the same for both ways! It free used memory and release references ...

@seealso method dispose() (if it exist!) @seealso destructor ~TaskEnumeration()

Definition at line 280 of file oframes.cxx.

References m_pFrameContainer, and m_xOwner.

Referenced by ~OFrames().

◆ impldbg_checkParameter_queryFrames()

bool framework::OFrames::impldbg_checkParameter_queryFrames ( sal_Int32  nSearchFlags)
staticprivate

Definition at line 344 of file oframes.cxx.

Referenced by queryFrames().

◆ queryFrames()

Sequence< css::uno::Reference< XFrame > > SAL_CALL framework::OFrames::queryFrames ( sal_Int32  nSearchFlags)
overridevirtual

return list of all applicable frames for given flags @descr Call these to get a list of all frames, which are match with given search flags.

Parameters
nSearchFlag,flagsto search right frames.
Returns
A list of founded frames.

@onerror An empty list is returned.

Definition at line 106 of file oframes.cxx.

References framework::FrameContainer::getCount(), impl_appendSequence(), impldbg_checkParameter_queryFrames(), m_bRecursiveSearchProtection, m_pFrameContainer, m_xOwner, nCount, nIndex, and SAL_WARN_IF.

◆ remove()

void SAL_CALL framework::OFrames::remove ( const css::uno::Reference< css::frame::XFrame > &  xFrame)
overridevirtual

remove frame from container @descr This is the companion to append().

We only accept valid references and don't work, if a lock is set.

@seealso class FrameContainer

Parameters
xFrame,referenceto an existing frame to remove. @onerror We do nothing in release or throw an assert in debug version.

Definition at line 82 of file oframes.cxx.

References m_pFrameContainer, m_xOwner, framework::FrameContainer::remove(), SAL_WARN_IF, and xFrame.

Member Data Documentation

◆ m_bRecursiveSearchProtection

bool framework::OFrames::m_bRecursiveSearchProtection
private

with owner shared list to hold all direct children of an XFramesSupplier

Definition at line 185 of file oframes.hxx.

Referenced by queryFrames().

◆ m_pFrameContainer

FrameContainer* framework::OFrames::m_pFrameContainer
private

reference to owner of this instance (Hold no hard reference!)

Definition at line 184 of file oframes.hxx.

Referenced by append(), getByIndex(), getCount(), hasElements(), impl_resetObject(), queryFrames(), and remove().

◆ m_xOwner

css::uno::WeakReference< css::frame::XFrame > framework::OFrames::m_xOwner
private

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