2002-02-11 07:29:07 -06:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 06:52:29 -05:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2002-02-11 07:29:07 -06:00
|
|
|
*
|
2008-04-11 06:52:29 -05:00
|
|
|
* Copyright 2008 by Sun Microsystems, Inc.
|
2002-02-11 07:29:07 -06:00
|
|
|
*
|
2008-04-11 06:52:29 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2002-02-11 07:29:07 -06:00
|
|
|
*
|
2008-04-11 06:52:29 -05:00
|
|
|
* $RCSfile: groupnodeaccess.hxx,v $
|
2008-06-16 07:43:19 -05:00
|
|
|
* $Revision: 1.9 $
|
2002-02-11 07:29:07 -06:00
|
|
|
*
|
2008-04-11 06:52:29 -05:00
|
|
|
* This file is part of OpenOffice.org.
|
2002-02-11 07:29:07 -06:00
|
|
|
*
|
2008-04-11 06:52:29 -05:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2002-02-11 07:29:07 -06:00
|
|
|
*
|
2008-04-11 06:52:29 -05:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2002-02-11 07:29:07 -06:00
|
|
|
*
|
2008-04-11 06:52:29 -05:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2002-02-11 07:29:07 -06:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#ifndef CONFIGMGR_GROUPNODEACCESS_HXX
|
|
|
|
#define CONFIGMGR_GROUPNODEACCESS_HXX
|
|
|
|
|
|
|
|
#include "nodeaccess.hxx"
|
|
|
|
|
|
|
|
namespace configmgr
|
|
|
|
{
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
namespace data
|
|
|
|
{
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
class GroupNodeAccess
|
|
|
|
{
|
|
|
|
public:
|
2007-11-23 07:18:41 -06:00
|
|
|
GroupNodeAccess(const sharable::GroupNode *_pNodeRef)
|
|
|
|
: m_pData((GroupNodeAddress)_pNodeRef)
|
2002-02-11 07:29:07 -06:00
|
|
|
{}
|
|
|
|
|
|
|
|
explicit
|
|
|
|
GroupNodeAccess(NodeAccess const & _aNode)
|
2007-11-23 07:18:41 -06:00
|
|
|
: m_pData(check(_aNode))
|
|
|
|
{}
|
2002-02-11 07:29:07 -06:00
|
|
|
|
2007-11-23 07:18:41 -06:00
|
|
|
~GroupNodeAccess() {}
|
2003-04-01 06:33:00 -06:00
|
|
|
|
2007-11-23 07:18:41 -06:00
|
|
|
static bool isInstance(NodeAccess const & _aNode)
|
|
|
|
{ return check(_aNode) != NULL; }
|
2002-02-11 07:29:07 -06:00
|
|
|
|
|
|
|
bool isValid() const { return m_pData != NULL; }
|
|
|
|
|
2007-11-23 07:18:41 -06:00
|
|
|
configuration::Name getName() const;
|
|
|
|
node::Attributes getAttributes() const;
|
2002-02-11 07:29:07 -06:00
|
|
|
|
|
|
|
bool isDefault() const;
|
|
|
|
|
2007-11-23 07:18:41 -06:00
|
|
|
bool hasChild(configuration::Name const& _aName) const
|
|
|
|
{ return implGetChild(_aName) != NULL; }
|
2003-04-17 07:28:49 -05:00
|
|
|
|
2007-11-23 07:18:41 -06:00
|
|
|
bool hasChildren() const
|
|
|
|
{ return m_pData->numDescendants > 0 ? true : false; }
|
2002-02-11 07:29:07 -06:00
|
|
|
|
2007-11-23 07:18:41 -06:00
|
|
|
NodeAccess getChildNode(configuration::Name const& _aName) const
|
|
|
|
{ return NodeAccess(implGetChild(_aName)); }
|
2002-02-11 07:29:07 -06:00
|
|
|
|
2007-11-23 07:18:41 -06:00
|
|
|
operator NodeAccess() const { return NodeAccess(NodeAddress(m_pData)); }
|
2002-02-11 07:29:07 -06:00
|
|
|
|
2007-11-23 07:18:41 -06:00
|
|
|
sharable::GroupNode& data() const { return *m_pData; }
|
|
|
|
operator GroupNodeAddress () const { return (GroupNodeAddress)m_pData; }
|
2002-02-11 07:29:07 -06:00
|
|
|
|
|
|
|
private:
|
2007-11-23 07:18:41 -06:00
|
|
|
NodeAddress implGetChild(configuration::Name const& _aName) const;
|
|
|
|
static GroupNodeAddress check(sharable::Node *pNode)
|
|
|
|
{ return pNode ? const_cast<GroupNodeAddress>(pNode->groupData()) : NULL; }
|
|
|
|
static GroupNodeAddress check(NodeAccess const&aRef)
|
|
|
|
{ return check(static_cast<sharable::Node *>(aRef)); }
|
2002-02-11 07:29:07 -06:00
|
|
|
|
2007-11-23 07:18:41 -06:00
|
|
|
GroupNodeAddress m_pData;
|
2002-02-11 07:29:07 -06:00
|
|
|
};
|
2008-06-16 07:43:19 -05:00
|
|
|
#if OSL_DEBUG_LEVEL > 0
|
2007-11-23 07:18:41 -06:00
|
|
|
GroupNodeAddress toGroupNodeAddress(NodeAddress const & _aNodeAddr);
|
2008-06-16 07:43:19 -05:00
|
|
|
#endif
|
2002-02-11 07:29:07 -06:00
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
inline
|
2007-11-23 07:18:41 -06:00
|
|
|
configuration::Name GroupNodeAccess::getName() const
|
2006-11-06 07:48:46 -06:00
|
|
|
{ return NodeAccess::wrapName( data().info.getName() ); }
|
2002-02-11 07:29:07 -06:00
|
|
|
|
|
|
|
inline
|
2007-11-23 07:18:41 -06:00
|
|
|
node::Attributes GroupNodeAccess::getAttributes() const
|
2003-04-01 06:33:00 -06:00
|
|
|
{ return sharable::node(data()).getAttributes(); }
|
2002-02-11 07:29:07 -06:00
|
|
|
|
|
|
|
inline
|
|
|
|
bool GroupNodeAccess::isDefault() const
|
|
|
|
{ return data().info.isDefault(); }
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
} // namespace configmgr
|
|
|
|
|
|
|
|
#endif // CONFIGMGR_GROUPNODEACCESS_HXX
|
|
|
|
|