2002-02-11 07:29:07 -06:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 06:59:37 -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:59:37 -05:00
|
|
|
* Copyright 2008 by Sun Microsystems, Inc.
|
2002-02-11 07:29:07 -06:00
|
|
|
*
|
2008-04-11 06:59:37 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2002-02-11 07:29:07 -06:00
|
|
|
*
|
2008-04-11 06:59:37 -05:00
|
|
|
* $RCSfile: setnodeaccess.hxx,v $
|
|
|
|
* $Revision: 1.7 $
|
2002-02-11 07:29:07 -06:00
|
|
|
*
|
2008-04-11 06:59:37 -05:00
|
|
|
* This file is part of OpenOffice.org.
|
2002-02-11 07:29:07 -06:00
|
|
|
*
|
2008-04-11 06:59:37 -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:59:37 -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:59:37 -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_SETNODEACCESS_HXX
|
|
|
|
#define CONFIGMGR_SETNODEACCESS_HXX
|
|
|
|
|
|
|
|
#include "nodeaccess.hxx"
|
2007-11-23 07:24:44 -06:00
|
|
|
#include "treefragment.hxx"
|
|
|
|
|
|
|
|
#include "treeaccessor.hxx"
|
2002-02-11 07:29:07 -06:00
|
|
|
|
|
|
|
namespace configmgr
|
|
|
|
{
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
namespace data
|
|
|
|
{
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
class TreeAccessor;
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
/** class that mediates access to the data of a Set node
|
|
|
|
<p>Is a handle class with reference copy semantics.</p>
|
|
|
|
*/
|
|
|
|
class SetNodeAccess
|
|
|
|
{
|
|
|
|
public:
|
2007-11-23 07:24:44 -06:00
|
|
|
typedef TreeAddress ElementAddress;
|
|
|
|
typedef TreeAccessor ElementAccess;
|
|
|
|
|
|
|
|
SetNodeAccess(const sharable::SetNode *_pNodeRef)
|
|
|
|
: m_pData((SetNodeAddress)_pNodeRef)
|
2002-02-11 07:29:07 -06:00
|
|
|
{}
|
|
|
|
|
2007-11-23 07:24:44 -06:00
|
|
|
SetNodeAccess(const sharable::Node *_pNodeRef)
|
|
|
|
: m_pData(check(_pNodeRef))
|
2002-02-11 07:29:07 -06:00
|
|
|
{}
|
|
|
|
|
|
|
|
explicit
|
|
|
|
SetNodeAccess(NodeAccess const & _aNode)
|
2007-11-23 07:24:44 -06:00
|
|
|
: m_pData(check(_aNode))
|
|
|
|
{}
|
2003-04-01 06:34:12 -06:00
|
|
|
|
2007-11-23 07:24:44 -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:24:44 -06:00
|
|
|
configuration::Name getName() const;
|
|
|
|
node::Attributes getAttributes() const;
|
2002-02-11 07:29:07 -06:00
|
|
|
|
|
|
|
bool isDefault() const;
|
|
|
|
|
|
|
|
bool isLocalizedValueSetNode() const;
|
|
|
|
|
2007-11-23 07:24:44 -06:00
|
|
|
configuration::Name getElementTemplateName() const;
|
|
|
|
configuration::Name getElementTemplateModule() const;
|
2002-02-11 07:29:07 -06:00
|
|
|
|
2007-11-23 07:24:44 -06:00
|
|
|
bool hasElement (configuration::Name const& _aName) const
|
|
|
|
{ return SetNodeAccess::implGetElement(_aName) != NULL; }
|
|
|
|
ElementAccess getElementTree (configuration::Name const& _aName) const
|
|
|
|
{ return TreeAccessor(implGetElement(_aName)); }
|
2002-02-11 07:29:07 -06:00
|
|
|
|
2007-11-23 07:24:44 -06:00
|
|
|
operator NodeAccess() const { return NodeAccess(NodeAddress(m_pData)); }
|
2002-02-11 07:29:07 -06:00
|
|
|
|
2007-11-23 07:24:44 -06:00
|
|
|
sharable::SetNode & data() const { return *m_pData; }
|
|
|
|
operator SetNodeAddress () const { return (SetNodeAddress)m_pData; }
|
|
|
|
operator NodeAddress () const { return (NodeAddress)m_pData; }
|
2002-02-11 07:29:07 -06:00
|
|
|
|
2007-11-23 07:24:44 -06:00
|
|
|
static void addElement(SetNodeAddress _aSetAddress, ElementAddress _aNewElement);
|
|
|
|
static ElementAddress removeElement(SetNodeAddress _aSetAddress,
|
|
|
|
configuration::Name const & _aName);
|
2002-02-11 07:29:07 -06:00
|
|
|
private:
|
2007-11-23 07:24:44 -06:00
|
|
|
static SetNodeAddress check(sharable::Node *pNode)
|
|
|
|
{ return pNode ? const_cast<SetNodeAddress>(pNode->setData()) : NULL; }
|
|
|
|
static SetNodeAddress check(NodeAccess const&aRef)
|
|
|
|
{ return check(static_cast<sharable::Node *>(aRef)); }
|
2002-02-11 07:29:07 -06:00
|
|
|
|
2007-11-23 07:24:44 -06:00
|
|
|
ElementAddress implGetElement(configuration::Name const& _aName) const;
|
2002-02-11 07:29:07 -06:00
|
|
|
|
2007-11-23 07:24:44 -06:00
|
|
|
SetNodeAddress m_pData;
|
2002-02-11 07:29:07 -06:00
|
|
|
};
|
|
|
|
|
2007-11-23 07:24:44 -06:00
|
|
|
SetNodeAddress toSetNodeAddress(NodeAddress const & _aNodeAddr);
|
2002-02-11 07:29:07 -06:00
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
inline
|
2007-11-23 07:24:44 -06:00
|
|
|
configuration::Name SetNodeAccess::getName() const
|
2006-11-06 07:49:00 -06:00
|
|
|
{ return NodeAccess::wrapName( data().info.getName() ); }
|
2002-02-11 07:29:07 -06:00
|
|
|
|
|
|
|
inline
|
2007-11-23 07:24:44 -06:00
|
|
|
configuration::Name SetNodeAccess::getElementTemplateName() const
|
|
|
|
{ return NodeAccess::wrapName( data().getElementTemplateName() ); }
|
2002-02-11 07:29:07 -06:00
|
|
|
|
|
|
|
inline
|
2007-11-23 07:24:44 -06:00
|
|
|
configuration::Name SetNodeAccess::getElementTemplateModule() const
|
|
|
|
{ return NodeAccess::wrapName( data().getElementTemplateModule() ); }
|
2002-02-11 07:29:07 -06:00
|
|
|
|
|
|
|
inline
|
2007-11-23 07:24:44 -06:00
|
|
|
node::Attributes SetNodeAccess::getAttributes() const
|
2003-04-01 06:34:12 -06:00
|
|
|
{ return sharable::node(data()).getAttributes(); }
|
2002-02-11 07:29:07 -06:00
|
|
|
|
|
|
|
inline
|
|
|
|
bool SetNodeAccess::isDefault() const
|
|
|
|
{ return data().info.isDefault(); }
|
|
|
|
|
|
|
|
inline
|
|
|
|
bool SetNodeAccess::isLocalizedValueSetNode() const
|
|
|
|
{ return data().isLocalizedValue(); }
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
} // namespace configmgr
|
|
|
|
|
|
|
|
#endif // CONFIGMGR_SETNODEACCESS_HXX
|
|
|
|
|