22#include <com/sun/star/frame/FrameSearchFlag.hpp>
23#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
33using namespace ::
cppu;
41 , m_pFrameContainer ( pFrameContainer )
42 , m_bRecursiveSearchProtection( false )
47 SAL_WARN_IF( !xOwner.is() || !pFrameContainer,
"fwk",
"OFrames::OFrames(): Invalid parameter detected!" );
65 SAL_WARN_IF( !
xFrame.is(),
"fwk",
"OFrames::append(): Invalid parameter detected!" );
69 css::uno::Reference< XFramesSupplier > xOwner(
m_xOwner.get(), UNO_QUERY );
75 xFrame->setCreator( xOwner );
78 SAL_WARN_IF( !xOwner.is(),
"fwk",
"OFrames::append():Our owner is dead - you can't append any frames ...!" );
88 SAL_WARN_IF( !
xFrame.is(),
"fwk",
"OFrames::remove(): Invalid parameter detected!" );
92 css::uno::Reference< XFramesSupplier > xOwner(
m_xOwner.get(), UNO_QUERY );
102 SAL_WARN_IF( !xOwner.is(),
"fwk",
"OFrames::remove(): Our owner is dead - you can't remove any frames ...!" );
115 Sequence< css::uno::Reference< XFrame > > seqFrames;
119 css::uno::Reference< XFrame > xOwner(
m_xOwner.get(), UNO_QUERY );
132 SAL_WARN_IF( (nSearchFlags & FrameSearchFlag::AUTO),
"fwk",
"OFrames::queryFrames(): Search with AUTO-flag is not supported yet!" );
140 if( nSearchFlags & FrameSearchFlag::PARENT )
142 css::uno::Reference< XFrame > xParent = xOwner->getCreator();
150 if( nSearchFlags & FrameSearchFlag::SELF )
156 if( nSearchFlags & FrameSearchFlag::SIBLINGS )
162 css::uno::Reference< XFramesSupplier > xParent = xOwner->getCreator();
175 if ( nSearchFlags & FrameSearchFlag::CHILDREN )
179 sal_Int32
const nChildSearchFlags = FrameSearchFlag::SELF | FrameSearchFlag::CHILDREN;
193 SAL_WARN_IF( !xOwner.is(),
"fwk",
"OFrames::queryFrames(): Our owner is dead - you can't query for frames ...!" );
209 css::uno::Reference< XFrame > xOwner(
m_xOwner.get(), UNO_QUERY );
228 throw IndexOutOfBoundsException(
"OFrames::getByIndex - Index out of bounds",
229 static_cast<OWeakObject *
>(
this) );
236 css::uno::Reference< XFrame > xOwner(
m_xOwner.get(), UNO_QUERY );
241 aReturnValue <<= (*m_pFrameContainer)[
nIndex];
261 bool bHasElements =
false;
264 css::uno::Reference< XFrame > xOwner(
m_xOwner.get(), UNO_QUERY );
295 const Sequence< css::uno::Reference< XFrame > >& seqSource )
298 sal_Int32 nSourceCount = seqSource.getLength();
299 sal_Int32 nDestinationCount = seqDestination.getLength();
300 const css::uno::Reference< XFrame >* pSourceAccess = seqSource.getConstArray();
301 css::uno::Reference< XFrame >* pDestinationAccess = seqDestination.getArray();
304 Sequence< css::uno::Reference< XFrame > > seqResult ( nSourceCount + nDestinationCount );
305 css::uno::Reference< XFrame >* pResultAccess = seqResult.getArray();
306 sal_Int32 nResultPosition = 0;
309 for ( sal_Int32 nSourcePosition=0; nSourcePosition<nSourceCount; ++nSourcePosition )
311 pResultAccess[nResultPosition] = pSourceAccess[nSourcePosition];
319 for ( sal_Int32 nDestinationPosition=0; nDestinationPosition<nDestinationCount; ++nDestinationPosition )
321 pResultAccess[nResultPosition] = pDestinationAccess[nDestinationPosition];
326 seqDestination.realloc( 0 );
327 seqDestination = seqResult;
350 ( nSearchFlags != FrameSearchFlag::AUTO ) &&
351 ( !( nSearchFlags & FrameSearchFlag::PARENT ) ) &&
352 ( !( nSearchFlags & FrameSearchFlag::SELF ) ) &&
353 ( !( nSearchFlags & FrameSearchFlag::CHILDREN ) ) &&
354 ( !( nSearchFlags & FrameSearchFlag::CREATE ) ) &&
355 ( !( nSearchFlags & FrameSearchFlag::SIBLINGS ) ) &&
356 ( !( nSearchFlags & FrameSearchFlag::TASKS ) ) &&
357 ( !( nSearchFlags & FrameSearchFlag::ALL ) ) &&
358 ( !( nSearchFlags & FrameSearchFlag::GLOBAL ) )
css::uno::Type const & get()
void append(const css::uno::Reference< css::frame::XFrame > &xFrame)
add/remove/mark container items
sal_uInt32 getCount() const
deprecated IndexAccess!
void remove(const css::uno::Reference< css::frame::XFrame > &xFrame)
-****************************************************************************************************...
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.
virtual sal_Bool SAL_CALL hasElements() override
get fill state of current container @descr Call these to get information about, if items exist in con...
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...
void impl_resetObject()
reset instance to default values @descr There are two ways to delete an instance of this class.
virtual sal_Int32 SAL_CALL getCount() override
get count of all current frames in container @descr This is the beginning of full index-access.
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-meth...
bool m_bRecursiveSearchProtection
with owner shared list to hold all direct children of an XFramesSupplier
virtual css::uno::Type SAL_CALL getElementType() override
get uno-type of all container items @descr In current implementation type is fixed to XFrame!...
css::uno::WeakReference< css::frame::XFrame > m_xOwner
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().
static bool impldbg_checkParameter_queryFrames(sal_Int32 nSearchFlags)
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 wo...
FrameContainer * m_pFrameContainer
reference to owner of this instance (Hold no hard reference!)
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,...
virtual ~OFrames() override
standard destructor @descr This method destruct an instance of this class and clear some member.
#define SAL_WARN_IF(condition, area, stream)
Reference< XFrame > xFrame