2000-11-07 07:40:31 -06:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 06:45:59 -05:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-11-07 07:40:31 -06:00
|
|
|
*
|
2008-04-11 06:45:59 -05:00
|
|
|
* Copyright 2008 by Sun Microsystems, Inc.
|
2000-11-07 07:40:31 -06:00
|
|
|
*
|
2008-04-11 06:45:59 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-11-07 07:40:31 -06:00
|
|
|
*
|
2008-04-11 06:45:59 -05:00
|
|
|
* $RCSfile: configgroup.hxx,v $
|
|
|
|
* $Revision: 1.9 $
|
2000-11-07 07:40:31 -06:00
|
|
|
*
|
2008-04-11 06:45:59 -05:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-11-07 07:40:31 -06:00
|
|
|
*
|
2008-04-11 06:45:59 -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.
|
2000-11-07 07:40:31 -06:00
|
|
|
*
|
2008-04-11 06:45:59 -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).
|
2000-11-07 07:40:31 -06:00
|
|
|
*
|
2008-04-11 06:45:59 -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.
|
2000-11-07 07:40:31 -06:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#ifndef CONFIGMGR_CONFIGGROUP_HXX_
|
|
|
|
#define CONFIGMGR_CONFIGGROUP_HXX_
|
|
|
|
|
|
|
|
#include "configexcept.hxx"
|
|
|
|
#include "noderef.hxx"
|
2001-09-28 06:44:40 -05:00
|
|
|
#include "configdefaultprovider.hxx"
|
2000-11-07 07:40:31 -06:00
|
|
|
|
2000-11-10 10:32:37 -06:00
|
|
|
namespace com { namespace sun { namespace star {
|
|
|
|
namespace script { class XTypeConverter; }
|
|
|
|
} } }
|
|
|
|
|
2000-11-07 07:40:31 -06:00
|
|
|
namespace configmgr
|
|
|
|
{
|
2002-02-11 06:47:56 -06:00
|
|
|
//-----------------------------------------------------------------------------
|
2000-11-07 07:40:31 -06:00
|
|
|
namespace configuration
|
|
|
|
{
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
typedef com::sun::star::uno::Type UnoType;
|
|
|
|
typedef com::sun::star::uno::Any UnoAny;
|
2000-11-10 10:32:37 -06:00
|
|
|
typedef com::sun::star::uno::Reference<com::sun::star::script::XTypeConverter> UnoTypeConverter;
|
2000-11-07 07:40:31 -06:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class NodeChange;
|
|
|
|
class RelativePath;
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2001-09-28 06:44:40 -05:00
|
|
|
/// helper for updating a <type>NodeRef</type> that refers to a Group
|
|
|
|
class GroupUpdateHelper
|
2000-11-07 07:40:31 -06:00
|
|
|
{
|
|
|
|
Tree m_aTree;
|
|
|
|
NodeRef m_aNode;
|
|
|
|
public:
|
2001-09-28 06:44:40 -05:00
|
|
|
GroupUpdateHelper(Tree const& aParentTree, NodeRef const& aGroupNode);
|
|
|
|
~GroupUpdateHelper() {}
|
2000-11-07 07:40:31 -06:00
|
|
|
|
2001-09-28 06:44:40 -05:00
|
|
|
void validateNode(ValueRef const& aNode) const;
|
|
|
|
void validateNode(NodeRef const& aNode) const;
|
2000-11-07 07:40:31 -06:00
|
|
|
|
2001-09-28 06:44:40 -05:00
|
|
|
Tree const& tree() const { return m_aTree; }
|
|
|
|
NodeRef const& node() const { return m_aNode; }
|
|
|
|
private:
|
|
|
|
void implValidateTree(Tree const& aTree) const;
|
|
|
|
void implValidateNode(Tree const& aTree, NodeRef const& aNode) const;
|
|
|
|
void implValidateNode(Tree const& aTree, ValueRef const& aNode) const;
|
|
|
|
};
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/// allows to update values of a simple type within a <type>NodeRef</type> that refers to a Group
|
|
|
|
class GroupUpdater
|
|
|
|
{
|
|
|
|
GroupUpdateHelper m_aHelper;
|
|
|
|
UnoTypeConverter m_xTypeConverter;
|
|
|
|
public:
|
|
|
|
GroupUpdater(Tree const& aParentTree, NodeRef const& aGroupNode, UnoTypeConverter const& xConverter);
|
2000-11-07 07:40:31 -06:00
|
|
|
|
2001-06-20 14:27:17 -05:00
|
|
|
NodeChange validateSetValue(ValueRef const& aValueNode, UnoAny const& newValue );
|
|
|
|
|
2000-11-07 07:40:31 -06:00
|
|
|
private:
|
2001-06-20 14:27:17 -05:00
|
|
|
UnoAny implValidateValue(Tree const& aTree, ValueRef const& aNode, UnoAny const& aValue) const;
|
2000-11-07 07:40:31 -06:00
|
|
|
};
|
2000-11-10 10:32:37 -06:00
|
|
|
//-----------------------------------------------------------------------------
|
2001-09-28 06:44:40 -05:00
|
|
|
|
|
|
|
/// allows to reset to default value or state members of a <type>NodeRef</type> that refers to a Group
|
|
|
|
class GroupDefaulter
|
|
|
|
{
|
|
|
|
GroupUpdateHelper m_aHelper;
|
|
|
|
DefaultProvider m_aDefaultProvider;
|
|
|
|
bool m_bHasDoneSet;
|
|
|
|
public:
|
|
|
|
GroupDefaulter(Tree const& _aParentTree, NodeRef const& _aGroupNode, DefaultProvider const& _aProvider);
|
|
|
|
|
|
|
|
bool hasDoneSet() const { return m_bHasDoneSet; }
|
|
|
|
|
2002-02-11 06:47:56 -06:00
|
|
|
bool isDataAvailable();
|
2001-09-28 06:44:40 -05:00
|
|
|
|
|
|
|
NodeChange validateSetToDefaultValue(ValueRef const& aValueNode);
|
|
|
|
|
|
|
|
NodeChange validateSetToDefaultState(NodeRef const& aNode);
|
|
|
|
|
|
|
|
NodeChanges validateSetAllToDefault();
|
2002-02-11 06:47:56 -06:00
|
|
|
|
|
|
|
static bool isDataAvailable(TreeRef const& _aParentTree, NodeRef const& _aGroupNode);
|
|
|
|
static bool ensureDataAvailable(TreeRef const& _aParentTree, NodeRef const& _aGroupNode, DefaultProvider const& _aSource);
|
2001-09-28 06:44:40 -05:00
|
|
|
};
|
2002-08-13 07:33:45 -05:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
bool isPossibleValueType(UnoType const& aValueType);
|
2001-09-28 06:44:40 -05:00
|
|
|
//-----------------------------------------------------------------------------
|
2000-11-10 10:32:37 -06:00
|
|
|
bool convertCompatibleValue(UnoTypeConverter const& xConverter, uno::Any& rConverted,
|
|
|
|
UnoAny const& rNewValue, UnoType const& rTargetType);
|
2000-11-07 07:40:31 -06:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // CONFIGMGR_CONFIGGROUP_HXX_
|