diff options
Diffstat (limited to 'configmgr/source/inc')
72 files changed, 0 insertions, 9893 deletions
diff --git a/configmgr/source/inc/anydata.hxx b/configmgr/source/inc/anydata.hxx deleted file mode 100644 index 8a50630f4542..000000000000 --- a/configmgr/source/inc/anydata.hxx +++ /dev/null @@ -1,78 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef INCLUDED_SHARABLE_ANYDATA_HXX -#define INCLUDED_SHARABLE_ANYDATA_HXX - -#include "rtl/ustring.h" -#include "sal/types.h" - -//----------------------------------------------------------------------------- -namespace com { namespace sun { namespace star { namespace uno { - class Any; - class Type; -} } } } -//----------------------------------------------------------------------------- - -namespace configmgr -{ -//----------------------------------------------------------------------------- - - namespace sharable - { - //----------------------------------------------------------------------------- - - union AnyData - { - sal_Bool boolValue; - sal_Int16 shortValue; - sal_Int32 intValue; - sal_Int64 *longValue; - double *doubleValue; - sal_uInt8 * binaryValue; // points to counted sal_(u)Int8 [] - rtl_uString * stringValue; // points to counted sal_Unicode [] - sal_uInt8 * sequenceValue; // points to counted AnyData [] (or SomeType [] ?) - void *data; // used to initialize to 0 - }; - - //----------------------------------------------------------------------------- - - sal_uInt8 getTypeCode(::com::sun::star::uno::Type const & _aType); - ::com::sun::star::uno::Type getUnoType( sal_uInt8 _aType); - - AnyData allocData(sal_uInt8 _aType, ::com::sun::star::uno::Any const & _aAny); - void freeData(sal_uInt8 _aType, AnyData _aData); - ::com::sun::star::uno::Any readData(sal_uInt8 _aType, AnyData _aData); - - //----------------------------------------------------------------------------- - } -//----------------------------------------------------------------------------- -} - - -#endif // INCLUDED_SHARABLE_ANYDATA_HXX - diff --git a/configmgr/source/inc/anynoderef.hxx b/configmgr/source/inc/anynoderef.hxx deleted file mode 100644 index 6b786f664fbc..000000000000 --- a/configmgr/source/inc/anynoderef.hxx +++ /dev/null @@ -1,157 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_CONFIGANYNODE_HXX_ -#define CONFIGMGR_CONFIGANYNODE_HXX_ - -#include "noderef.hxx" - -namespace configmgr -{ - namespace configapi { class Factory; } - namespace node { struct Attributes; } - - namespace configuration - { - //------------------------------------------------------------------------- - class NodeRef; - class ValueRef; - class AnyNodeRef; - class NodeID; - class Tree; - //------------------------------------------------------------------------- - - /// represents any node in some tree - class AnyNodeRef - { - public: - /// constructs an empty (invalid) node - AnyNodeRef(); - - AnyNodeRef(unsigned int nParentPos, unsigned int m_nDepth); - AnyNodeRef(rtl::OUString const& aName, unsigned int nParentPos); - - /// converts an inner node - explicit AnyNodeRef(NodeRef const& aInnerNode); - /// converts a value node - explicit AnyNodeRef(ValueRef const& aValueNode); - - /// copy a node (with reference semantics) - AnyNodeRef(AnyNodeRef const& rOther); - /// copy a node (with reference semantics) - AnyNodeRef& operator=(AnyNodeRef const& rOther); - - void swap(AnyNodeRef& rOther); - - ~AnyNodeRef(); - - /// checks, if this represents an existing node - inline bool isValid() const; - - /// checks if this a node (rather than a value only) - bool isNode() const; - - /// converts this, if it is a value - ValueRef toValue() const; - - /// converts this, if it is a inner node - NodeRef toNode() const; - -#if OSL_DEBUG_LEVEL > 0 - bool checkValidState() const; -#endif - - rtl::OUString m_sNodeName; - unsigned int m_nUsedPos; - unsigned int m_nDepth; - }; - //------------------------------------------------------------------------- - - /** checks whether there is an immediate child of <var>aNode</var> (which is in <var>aTree</var>) - specified by <var>aName</var> - - @return - <TRUE/> if the child node exists - <FALSE/> otherwise - */ - inline - bool hasChildOrElement(rtl::Reference< Tree > const& aTree, AnyNodeRef const& aNode, rtl::OUString const& aName) - { return aNode.isNode() && hasChildOrElement(aTree,aNode.toNode(),aName); } - - /** tries to find the immediate child of <var>aNode</var> (which is in <var>aTree</var>) - specified by <var>aName</var> - <p> On return <var>aNode</var> is modified to refer to the node found and - <var>aTree</var> will then refer to the tree that node is in. - <p/> - - @return The requested child node, if it exists - (then <var>aTree</var> refers to the tree containing the desired node), - */ - AnyNodeRef getChildOrElement(rtl::Reference< Tree > & aTree, NodeRef const& aParentNode, rtl::OUString const& aName); - - /** tries to find the descendant of <var>aNode</var> specified by <var>aPath</var> within <var>aTree</var> - <p> This function follows the given path stepwise, until a requested node is missing in the tree.</p> - <p> On return <var>aNode</var> is modified to refer to the last inner node found - and <var>aTree</var> will be unchanged (except for deprecated usage). - <p/> - <p> Also, <var>aPath</var> is modified to contain the unresolved part of the original path. - </p> - - @return the requested node, if the path could be resolved completely - (so <var>aNode</var> refers to the desired node or its parent, - and <var>aPath</var> is empty)<BR/> - an invalid node otherwise - */ - AnyNodeRef getLocalDescendant(rtl::Reference< Tree > const& aTree, NodeRef const& aNode, RelativePath const& aPath); - - /** tries to find the descendant of <var>aNode</var> (which is in <var>aTree</var>) specified by <var>aPath</var> - <p> This function follows the given path stepwise, until a requested node is missing in the tree.</p> - <p> On return <var>aNode</var> is modified to refer to the last inner node found and - <var>aTree</var> will then refer to the tree that node is in. - <p/> - <p> Also, <var>aPath</var> is modified to contain the unresolved part of the original path. - </p> - - @return the requested node, if the path could be resolved completely - (so <var>aNode</var> and <var>aTree</var> refer to the desired node or its parent, - and <var>aPath</var> is empty)<BR/> - an invalid node otherwise - */ - AnyNodeRef getDeepDescendant(rtl::Reference< Tree > & aTree, NodeRef& aNode, RelativePath& aPath); - - //------------------------------------------------------------------------- - inline bool AnyNodeRef::isValid() const - { - OSL_ASSERT( m_nUsedPos == 0 || checkValidState() ); - return m_nUsedPos != 0; - } - - //------------------------------------------------------------------------- - } -} - -#endif // CONFIGMGR_CONFIGANYNODE_HXX_ diff --git a/configmgr/source/inc/anypair.hxx b/configmgr/source/inc/anypair.hxx deleted file mode 100644 index 0ce5c9628179..000000000000 --- a/configmgr/source/inc/anypair.hxx +++ /dev/null @@ -1,118 +0,0 @@ -#ifndef CFGMGR_ANYPAIR_HXX -#define CFGMGR_ANYPAIR_HXX - -#include <uno/any2.h> -#include <com/sun/star/uno/Any.h> -#include <com/sun/star/lang/IllegalArgumentException.hpp> - -namespace configmgr -{ - namespace css = com::sun::star; - namespace uno = css::uno; - namespace lang = css::lang; - - //========================================================================== - //= flags for handling the state of an Anypair - //========================================================================== - enum { - cfgmgr_SELECT_FIRST = 0x01, - cfgmgr_SELECT_SECOND = 0x02, - cfgmgr_SELECT_BOTH = cfgmgr_SELECT_FIRST | cfgmgr_SELECT_SECOND - }; - - //========================================================================== - //= data structure for descriptive data for an AnyPair - //========================================================================== - struct cfgmgr_AnyPair_Desc - { - typelib_TypeDescriptionReference * pType; - sal_uInt8 nState; - }; - - inline bool cfgmgr_AnyPair_isNull(cfgmgr_AnyPair_Desc const* _pDesc, sal_uInt8 nSelect) - { return (_pDesc->nState & nSelect) == 0; } - - inline bool cfgmgr_AnyPair_isEmpty(cfgmgr_AnyPair_Desc const* _pDesc) - { return (typelib_TypeClass_VOID == _pDesc->pType->eTypeClass); } - - //========================================================================== - //= cfgmgr_AnyPair Basic (POD) data structure for a nullable pair of Anys - //========================================================================== - - struct cfgmgr_AnyPair - { - cfgmgr_AnyPair_Desc desc; - const void * first; - const void * second; - }; - -// ----------------------------------------------------------------------------- - //========================================================================== - //= AnyPair - //========================================================================== - // this AnyPair holds 2 nullable Any's which have to have the same type. - - class AnyPair - { - cfgmgr_AnyPair m_aAnyPair; - - public: - enum SelectMember - { - SELECT_FIRST = cfgmgr_SELECT_FIRST, - SELECT_SECOND = cfgmgr_SELECT_SECOND, - SELECT_BOTH = cfgmgr_SELECT_BOTH - }; - public: - explicit AnyPair(uno::Type const& _aType); // one Type, any's are null - explicit AnyPair(uno::Any const& _aAny, SelectMember _select); // one selected any - - explicit AnyPair(uno::Any const& _aAny, uno::Any const& _aAny2) SAL_THROW((lang::IllegalArgumentException)); - - // copy - AnyPair(AnyPair const& _aAny); - AnyPair& operator=(AnyPair const& _aAny); - - // d-tor - ~AnyPair(); - - // elementwise setters - sal_Bool setFirst(uno::Any const& _aAny); - sal_Bool setSecond(uno::Any const& _aAny); - - // clear data (but not type) - void clear(SelectMember _select = SELECT_BOTH); - - - // checking state and availablity of values - bool isEmpty() const { return cfgmgr_AnyPair_isEmpty(&m_aAnyPair.desc); } - - bool isNull () const { return ! hasValue(); } - - bool hasValue(SelectMember _select = SELECT_BOTH) const - { - return !cfgmgr_AnyPair_isNull(&m_aAnyPair.desc, (sal_uInt8)_select); - } - bool hasFirst() const - { - return hasValue(SELECT_FIRST); - } - bool hasSecond() const - { - return hasValue(SELECT_SECOND); - } - - // elementwise getters - uno::Type getValueType() const; - uno::Any getFirst() const; - uno::Any getSecond() const; - uno::Any getValue(SelectMember _select) const; - - }; - - - - -} // namespace - -#endif diff --git a/configmgr/source/inc/apitypes.hxx b/configmgr/source/inc/apitypes.hxx deleted file mode 100644 index 5e6bec5a4f56..000000000000 --- a/configmgr/source/inc/apitypes.hxx +++ /dev/null @@ -1,89 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_API_APITYPES_HXX_ -#define CONFIGMGR_API_APITYPES_HXX_ - -#include <com/sun/star/uno/Type.hxx> -#include <com/sun/star/uno/Reference.hxx> -#include <com/sun/star/uno/Any.hxx> -#include <com/sun/star/uno/Sequence.hxx> -#include <com/sun/star/uno/XInterface.hpp> -#include <rtl/ustring.hxx> - -#ifndef INCLUDED_VECTOR -#include <vector> -#define INCLUDED_VECTOR -#endif // INCLUDED_VECTOR - -namespace configmgr -{ - namespace configapi - { - namespace uno = ::com::sun::star::uno; - - inline - uno::Type getAnyType( ) - { - return ::getCppuType( static_cast< uno::Any const * >(0) ); - } - - inline - uno::Type getUnoInterfaceType( ) - { - return ::getCppuType( static_cast< uno::Reference< uno::XInterface > const * >(0) ); - } - - template <typename Interface> - inline - uno::Type getReferenceType( Interface const* ) - { - return ::getCppuType( static_cast< uno::Reference<Interface> const * >(0) ); - } - - template <typename Type> - inline - uno::Type getSequenceType( Type const* ) - { - return ::getCppuType( static_cast< uno::Sequence<Type> const * >(0) ); - } - - template <typename T> - inline - uno::Sequence<T> makeSequence(::std::vector<T> const& aVector) - { - if (aVector.empty()) - return uno::Sequence<T>(); - return uno::Sequence<T>(&aVector[0],aVector.size()); - } - } - -} - -#endif // CONFIGMGR_API_APITYPES_HXX_ - - diff --git a/configmgr/source/inc/attributes.hxx b/configmgr/source/inc/attributes.hxx deleted file mode 100644 index a7718157da7f..000000000000 --- a/configmgr/source/inc/attributes.hxx +++ /dev/null @@ -1,133 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_CONFIGURATION_ATTRIBUTES_HXX_ -#define CONFIGMGR_CONFIGURATION_ATTRIBUTES_HXX_ -namespace configmgr -{ - namespace node - { - enum State - { - isDefault, isToDefault = isDefault, - isMerged, isModification = isMerged, - isReplaced, isReplacement = isReplaced, - isAdded, isAddition = isAdded - }; - enum Access - { - accessNull = 0, - accessWritable = 0, - accessFinal = 1, - accessReadonly = 2, - accessReadonlyAndFinal = 3 - }; - inline Access makeAccess(bool readonly, bool final) - { return Access( (readonly ? accessReadonly : accessNull) | (final ? accessFinal : accessNull) ); } - inline bool isAccessReadonly(Access access) - { return (access & accessReadonly) != 0; } - inline bool isAccessFinal(Access access) - { return (access & accessFinal) != 0; } - - inline bool existsInDefault(State eState) { return eState <= isReplaced;} - inline bool isReplacedForUser(State eState) { return eState >= isReplaced;} - - /// holds attributes a node in the schema - struct Attributes - { - Attributes() - : state_(node::isMerged) - , bReadonly(false) - , bFinalized(false) - , bNullable(true) - , bLocalized(false) - , bMandatory(false) - , bRemovable(false) - {} - - State state() const { return State(0x03 & state_); } - void setState(State _state) { this->state_ = _state; } - - bool isWritable() const { return!bReadonly; } - bool isReadonly() const { return bReadonly; } - bool isFinalized() const { return bFinalized; } - - void markReadonly() { bReadonly = true; } - - Access getAccess() const - { return makeAccess(bReadonly,bFinalized); } - - void setAccess(bool _bReadonly, bool _bFinalized) - { bReadonly = _bReadonly; bFinalized = _bFinalized; } - - void setAccess(Access _aAccessLevel) - { setAccess( isAccessReadonly(_aAccessLevel), isAccessFinal(_aAccessLevel) ); } - - bool isNullable() const { return bNullable; } - void setNullable (bool _bNullable) {bNullable = _bNullable; } - - bool isLocalized() const { return bLocalized; } - void setLocalized (bool _bLocalized) {bLocalized = _bLocalized; } - - bool isMandatory() const { return bMandatory; } - bool isRemovable() const { return bRemovable; } - - void markMandatory() { bMandatory = true; } - void markRemovable() { bRemovable = true; } - - void setRemovability(bool _bRemovable, bool _bMandatory) - { bRemovable = _bRemovable; bMandatory = _bMandatory; } - - bool isDefault() const { return this->state() == node::isDefault;} - bool existsInDefault() const { return node::existsInDefault(this->state());} - bool isReplacedForUser() const { return node::isReplacedForUser(this->state());} - - void markAsDefault(bool _bDefault = true) - { - if (_bDefault) - this->state_ = node::isDefault; - else if (this->isDefault()) - this->state_ = node::isMerged; - } - - private: - State state_ : 2; // merged/replaced/default state - - bool bReadonly : 1; // write-protected, if true - bool bFinalized : 1; // can not be overridden - write protected when merged upwards - - bool bNullable : 1; // values only: can be NULL - bool bLocalized : 1; // values only: value may depend on locale - - bool bMandatory : 1; // cannot be removed/replaced in subsequent layers - bool bRemovable : 1; // can be removed - }; - - } -} - -#endif diff --git a/configmgr/source/inc/autoobject.hxx b/configmgr/source/inc/autoobject.hxx deleted file mode 100644 index f5ec5137a82f..000000000000 --- a/configmgr/source/inc/autoobject.hxx +++ /dev/null @@ -1,97 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_AUTOOBJECT_HXX -#define CONFIGMGR_AUTOOBJECT_HXX - -#include "sal/config.h" - -#include "boost/utility.hpp" - -#include "utility.hxx" - -namespace configmgr -{ -//----------------------------------------------------------------------------- - template < class Object > - class AutoObject: private boost::noncopyable - { - public: - AutoObject() : m_pObject(NULL) {} - AutoObject(Object * _obj) : m_pObject(_obj) {} - ~AutoObject() { delete m_pObject; } - - bool is() const; - Object * get() const; - Object * getOrCreate(); - private: - Object * internalCreate(); - private: - Object * m_pObject; - }; -//----------------------------------------------------------------------------- - - template < class Object > - inline - Object * AutoObject<Object>::get() const - { - return m_pObject; - } -//----------------------------------------------------------------------------- - - template < class Object > - inline - bool AutoObject<Object>::is() const - { - return get() != NULL; - } -//----------------------------------------------------------------------------- - - template < class Object > - Object * AutoObject<Object>::getOrCreate() - { - Object * p = get(); - return p ? p : internalCreate(); - } -//----------------------------------------------------------------------------- - - template < class Object > - Object * AutoObject<Object>::internalCreate() - { - if (m_pObject == NULL) - m_pObject = new Object(); - return m_pObject; - - } -//----------------------------------------------------------------------------- - -//////////////////////////////////////////////////////////////////////////////// - -} // namespace configmgr - -#endif - diff --git a/configmgr/source/inc/autoreferencemap.hxx b/configmgr/source/inc/autoreferencemap.hxx deleted file mode 100644 index 135531680540..000000000000 --- a/configmgr/source/inc/autoreferencemap.hxx +++ /dev/null @@ -1,129 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_AUTOREFERENCEMAP_HXX -#define CONFIGMGR_AUTOREFERENCEMAP_HXX - -#include <rtl/ref.hxx> -#ifndef INCLUDED_MAP -#include <map> -#define INCLUDED_MAP -#endif - -namespace configmgr -{ -//----------------------------------------------------------------------------- - - template < class Key, class Object, class KeyCompare = std::less<Key> > - class AutoReferenceMap - { - public: - typedef std::map<Key,rtl::Reference<Object>,KeyCompare> Map; - public: - AutoReferenceMap() {} - ~AutoReferenceMap() {} - - Map copy() const - { - return m_aMap; - } - void swap(Map & _rOtherData) - { - m_aMap.swap( _rOtherData ); - } - void swap(AutoReferenceMap & _rOther) - { - this->swap( _rOther.m_aMap ); - } - - - bool has(Key const & _aKey) const; - rtl::Reference<Object> get(Key const & _aKey) const; - - rtl::Reference<Object> insert(Key const & _aKey, rtl::Reference<Object> const & _anEntry); - rtl::Reference<Object> remove(Key const & _aKey); - - private: - rtl::Reference<Object> internalGet(Key const & _aKey) const - { - typename Map::const_iterator it = m_aMap.find(_aKey); - - return it != m_aMap.end() ? it->second : rtl::Reference<Object>(); - } - - rtl::Reference<Object> internalAdd(Key const & _aKey, rtl::Reference<Object> const & _aNewRef) - { - return m_aMap[_aKey] = _aNewRef; - } - - void internalDrop(Key const & _aKey) - { - m_aMap.erase(_aKey); - } - private: - Map m_aMap; - }; -//----------------------------------------------------------------------------- - - template < class Key, class Object, class KeyCompare > - bool AutoReferenceMap<Key,Object,KeyCompare>::has(Key const & _aKey) const - { - return internalGet(_aKey).is(); - } -//----------------------------------------------------------------------------- - - template < class Key, class Object, class KeyCompare > - rtl::Reference<Object> AutoReferenceMap<Key,Object,KeyCompare>::get(Key const & _aKey) const - { - return internalGet(_aKey); - } -//----------------------------------------------------------------------------- - - template < class Key, class Object, class KeyCompare > - rtl::Reference<Object> AutoReferenceMap<Key,Object,KeyCompare>::insert(Key const & _aKey, rtl::Reference<Object> const & _anEntry) - { - rtl::Reference<Object> aRef = internalAdd(_aKey,_anEntry); - return aRef; - - } -//----------------------------------------------------------------------------- - - template < class Key, class Object, class KeyCompare > - rtl::Reference<Object> AutoReferenceMap<Key,Object,KeyCompare>::remove(Key const & _aKey) - { - rtl::Reference<Object> aRef = internalGet(_aKey); - internalDrop(_aKey); - return aRef; - } -//----------------------------------------------------------------------------- - -//////////////////////////////////////////////////////////////////////////////// - -} // namespace configmgr - -#endif - diff --git a/configmgr/source/inc/backendfactory.hxx b/configmgr/source/inc/backendfactory.hxx deleted file mode 100644 index ebda5680adb5..000000000000 --- a/configmgr/source/inc/backendfactory.hxx +++ /dev/null @@ -1,68 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_BACKENDFACTORY_HXX_ -#define CONFIGMGR_BACKENDFACTORY_HXX_ - -#include <rtl/ref.hxx> -#include <com/sun/star/uno/XComponentContext.hpp> -#include <com/sun/star/configuration/backend/XBackend.hpp> - -namespace configmgr -{ -//----------------------------------------------------------------------------- - namespace backend - { -//----------------------------------------------------------------------------- - - struct IMergedDataProvider; -//----------------------------------------------------------------------------- - class BackendFactory - { - public: - rtl::Reference<IMergedDataProvider> createBackend(); - - com::sun::star::uno::Reference< com::sun::star::configuration::backend::XBackend > getUnoBackend(); - - static BackendFactory instance(com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const & _xCtx); - - private: - explicit - BackendFactory(com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const & _xCtx) - : m_xCtx(_xCtx) - {} - - com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xCtx; - }; -//----------------------------------------------------------------------------- - } -//----------------------------------------------------------------------------- -} - - -#endif - diff --git a/configmgr/source/inc/bootstrap.hxx b/configmgr/source/inc/bootstrap.hxx deleted file mode 100644 index dbe877aec6c1..000000000000 --- a/configmgr/source/inc/bootstrap.hxx +++ /dev/null @@ -1,240 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_BOOTSTRAP_HXX_ -#define CONFIGMGR_BOOTSTRAP_HXX_ - -#include "bootstrapcontext.hxx" - -// --------------------------------------------------------------------------------------- -#define BOOTSTRAP_ITEM_INIFILE "CFG_INIFILE" -// --------------------------------------------------------------------------------------- -// standard settings -#define SETTING_UNOSERVICE "BackendService" -#define SETTING_UNOWRAPPER "BackendWrapper" -#define SETTING_OFFLINE "Offline" -#define SETTING_LOCALE_NEW "Locale" -#define SETTING_ASYNC_NEW "EnableAsync" -#define SETTING_INIFILE "Inifile" - -// Prefixes -#define CONTEXT_MODULE_PREFIX_ "/modules/com.sun.star.configuration/" -#define CONTEXT_SECTION_BOOTSTRAP_ "bootstrap/" -#define CONTEXT_ITEM_PREFIX_ CONTEXT_MODULE_PREFIX_ CONTEXT_SECTION_BOOTSTRAP_ -#define BOOTSTRAP_ITEM_PREFIX_ "CFG_" - -// special internal context values -#define CONTEXT_SECTION_INTERNAL_ "factory/" -#define CONTEXT_INTERNAL_PREFIX_ CONTEXT_MODULE_PREFIX_ CONTEXT_SECTION_INTERNAL_ -#define CONTEXT_ITEM_ADMINFLAG CONTEXT_INTERNAL_PREFIX_"isAdminConfiguration" -#define CONTEXT_ITEM_BOOTSTRAP_ERROR CONTEXT_INTERNAL_PREFIX_"theBootstrapError" - -#define CONTEXT_ITEM_IS_WRAPPER_CONTEXT CONTEXT_INTERNAL_PREFIX_"isWrapperContext" -#define CONTEXT_ITEM_IS_BOOTSTRAP_CONTEXT CONTEXT_INTERNAL_PREFIX_"isBootstrapContext" - -// --------------------------------------------------------------------------------------- -#define A_DefaultProviderSingletonName "com.sun.star.configuration.theDefaultProvider" -#define K_DefaultBackendSingletonName "com.sun.star.configuration.backend.theDefaultBackend" -#define A_BootstrapContextSingletonName "com.sun.star.configuration.bootstrap.theBootstrapContext" -// ------------------------------------------------------------------------- -#define A_DefaultProviderServiceAndImplName "com.sun.star.configuration.DefaultProvider" -#define K_DefaultBackendServiceAndImplName "com.sun.star.configuration.backend.DefaultBackend" -// --------------------------------------------------------------------------------------- -namespace configmgr -{ - // ----------------------------------------------------------------------------------- - - namespace uno = ::com::sun::star::uno; - namespace lang = ::com::sun::star::lang; - namespace beans = ::com::sun::star::beans; - // ----------------------------------------------------------------------------------- - - /** Customized ComponentContext for configuration bootstrap data and runtime arguments - */ - class BootstrapContext : public ComponentContext - { - // creation and destruction - private: - friend uno::Reference<uno::XInterface> SAL_CALL - instantiateBootstrapContext( uno::Reference< uno::XComponentContext > const& xContext ); - - // constructor - BootstrapContext(uno::Reference< uno::XComponentContext > const & _xContext); - - // two-phase construct - void initialize(); - - protected: - using ComponentContext::initialize; - - public: - // XServiceInfo - virtual rtl::OUString SAL_CALL getImplementationName() - throw (uno::RuntimeException) ; - virtual sal_Bool SAL_CALL supportsService( - const rtl::OUString& aServiceName) - throw (uno::RuntimeException) ; - virtual uno::Sequence<rtl::OUString> SAL_CALL - getSupportedServiceNames(void) throw (uno::RuntimeException) ; - - - /** Constructs a Context based on the given arguments and context. - @param _xContext - The base context of this component context. - - @param _aArguments - The arguments used to create this component context. - */ - static uno::Reference< uno::XComponentContext > createWrapper(uno::Reference< uno::XComponentContext > const & _xContext, uno::Sequence < beans::NamedValue > const & _aOverrides); - - /** Checks, if the given context is a wrapper. - @param _xContext - The context that is checked. - */ - static sal_Bool isWrapper(uno::Reference< uno::XComponentContext > const & _xContext); - - /** Retrieves the BootstrapContext for the given non-bootstrap context. - @param _xContext - The context from which the bootstrap context should be retrieved. - - */ - static uno::Reference< uno::XComponentContext > get(uno::Reference< uno::XComponentContext > const & _xContext); - - /// Destroys this BootstrapContext - ~BootstrapContext(); - - // gets the INI that should be used for bootstrap data by default - static rtl::OUString getDefaultConfigurationBootstrapURL(); - - // interface implementations - public: - // XComponentContext - /** Retrieves a value from this context. - - @param name - The name of the value to retrieve. - A prefix of "com.sun.star.configuration.bootstrap." is stripped/ignored - - @returns - The requested value, or <VOID/> if the value is not found. - */ - virtual uno::Any SAL_CALL - getValueByName( const rtl::OUString& name ) - throw (uno::RuntimeException); - - public: // used by ArgumentHelper - static rtl::OUString makeContextName (rtl::OUString const & _aShortName); - - private: - static rtl::OUString makeBootstrapName(rtl::OUString const & _aLongName); - uno::Any makeBootstrapException(); - }; -// ----------------------------------------------------------------------------- - class ContextReader - { - public: - explicit - ContextReader(uno::Reference< uno::XComponentContext > const & context); - - // the underlying contexts - sal_Bool hasBootstrapContext() const { return m_fullcontext.is(); } - uno::Reference< uno::XComponentContext > const & getBootstrapContext() const { return m_fullcontext; } - uno::Reference< uno::XComponentContext > const & getBaseContext() const { return m_basecontext; } - uno::Reference< uno::XComponentContext > const & getBestContext() const { return m_fullcontext.is() ? m_fullcontext : m_basecontext; } - - uno::Reference< lang::XMultiComponentFactory > getServiceManager() const; - - /** Checks, if the given context has the given 'admin' flag setting.. - @param _xContext - The context that is checked. - */ - static bool testAdminService(uno::Reference< uno::XComponentContext > const & context, bool bAdmin); - - // general settings - sal_Bool isUnoBackend() const; - - sal_Bool hasUnoBackendService() const; - sal_Bool hasUnoBackendWrapper() const; - - sal_Bool hasLocale() const; - sal_Bool hasAsyncSetting() const; - sal_Bool hasOfflineSetting() const; - - rtl::OUString getUnoBackendService() const; - rtl::OUString getUnoBackendWrapper() const; - - rtl::OUString getLocale() const; - sal_Bool getAsyncSetting() const; - sal_Bool getOfflineSetting() const; - - // internal settings - should only ever be in configmgr::BootstrapContext instances - // get a special setting - sal_Bool isAdminService() const; - - // access to error diagnostics - sal_Bool isBootstrapValid() const; - uno::Any getBootstrapError() const; - private: - sal_Bool hasSetting(rtl::OUString const & _aSetting) const; - sal_Bool getBoolSetting(rtl::OUString const & _aSetting, sal_Bool bValue) const; - rtl::OUString getStringSetting(rtl::OUString const & _aSetting, rtl::OUString aValue) const; - uno::Any getSetting(rtl::OUString const & _aSetting) const; - private: - uno::Reference< uno::XComponentContext > m_basecontext; - uno::Reference< uno::XComponentContext > m_fullcontext; - }; - //------------------------------------------------------------------------ - - class ArgumentHelper - { - public: - explicit - ArgumentHelper(uno::Reference< uno::XComponentContext > const & context) - : m_context(context) - , m_bHasBackendArguments(false) - {} - - bool hasBackendArguments() const { return m_bHasBackendArguments; } - bool checkBackendArgument(beans::NamedValue const & aAdjustedValue); - - bool filterAndAdjustArgument(beans::NamedValue & rValue); - - static - bool extractArgument(beans::NamedValue & rValue, uno::Any const & aArgument); - - static beans::NamedValue makeAdminServiceOverride(sal_Bool bAdmin); - private: - uno::Reference< uno::XComponentContext > m_context; // context used to strip identical arguments - bool m_bHasBackendArguments; - }; -// ----------------------------------------------------------------------------------- - -} - -#endif // CONFIGMGR_BOOTSTRAP_HXX_ - - diff --git a/configmgr/source/inc/bootstrapcontext.hxx b/configmgr/source/inc/bootstrapcontext.hxx deleted file mode 100644 index 628a5309e3d5..000000000000 --- a/configmgr/source/inc/bootstrapcontext.hxx +++ /dev/null @@ -1,168 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_BOOTSTRAPCONTEXT_HXX_ -#define CONFIGMGR_BOOTSTRAPCONTEXT_HXX_ - -#include <cppuhelper/compbase3.hxx> -#include <cppuhelper/implbase1.hxx> -#include <rtl/bootstrap.h> -#include <com/sun/star/uno/XComponentContext.hpp> -#include <com/sun/star/uno/XCurrentContext.hpp> -#include <com/sun/star/lang/XEventListener.hpp> -#include <com/sun/star/lang/XUnoTunnel.hpp> -#include <com/sun/star/beans/NamedValue.hpp> -#include <com/sun/star/uno/Sequence.hxx> -#include <com/sun/star/lang/XServiceInfo.hpp> - -namespace com { namespace sun { namespace star { namespace uno { - class XComponentContext; -} } } } - -// ----------------------------------------------------------------------------- -#define SINGLETON_ "/singletons/" -#define SINGLETON( NAME ) rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SINGLETON_ NAME ) ) -// ----------------------------------------------------------------------------- -namespace configmgr -{ -// ----------------------------------------------------------------------------- - namespace uno = ::com::sun::star::uno; - namespace lang = ::com::sun::star::lang; - namespace beans = ::com::sun::star::beans; -// ----------------------------------------------------------------------------- - /** Base class for customized ComponentContext using bootstrap data and overrides - */ - class ComponentContext : public cppu::WeakComponentImplHelper3 < uno::XComponentContext, uno::XCurrentContext, lang::XServiceInfo > - { - // creation and destruction - public: - /** Constructs a ComponentContext based on the given overrides and context. - Initially no bootstrap data will be used. - - @param _xContext - The base context of this component context. - Values from here take precedence over values from bootstrap data. - - @param _aOverrides - The overrides used to create this component context. - These values take precedence over values from the base context or bootstrap data. - */ - explicit - ComponentContext(uno::Reference< uno::XComponentContext > const & _xContext); - - /// Destroys this BootstrapContext - ~ComponentContext(); - - // gets the INI in use for getting bootstrap data - rtl::OUString getBootstrapURL() const; - - static sal_Bool isPassthrough(uno::Reference< uno::XComponentContext > const & _xContext); - - static beans::NamedValue makePassthroughMarker(sal_Bool bPassthrough = true); - // interface implementations - public: - - // XComponentContext only - virtual uno::Reference< lang::XMultiComponentFactory > SAL_CALL - getServiceManager( ) - throw (uno::RuntimeException); - - protected: - // ComponentHelper - virtual void SAL_CALL disposing(); - - protected: - // two phase construct - also initialized the bootstrap data - void initialize(const rtl::OUString& _aBootstrapURL); - - bool lookupInContext ( uno::Any & _rValue, const rtl::OUString& _aName ) const; - bool lookupInBootstrap( uno::Any & _rValue, const rtl::OUString& _aName ) const; - - uno::Reference< uno::XComponentContext > const & basecontext() const { return m_xContext; } - - private: - /// The context that most requests are delegated to - uno::Reference< uno::XComponentContext > m_xContext; - /// The bootstrap data consulted as fallback - rtlBootstrapHandle m_hBootstrapData; - /// The service manager associated with this context - uno::Reference< lang::XMultiComponentFactory > m_xServiceManager; - }; -// ----------------------------------------------------------------------------- - - class UnoContextTunnel - { - public: - UnoContextTunnel(); - ~UnoContextTunnel(); - void tunnel(uno::Reference< uno::XComponentContext > const & xContext); - void passthru(uno::Reference< uno::XComponentContext > const & xContext); - uno::Any recoverFailure(bool bRaise); // true, if there is a failure - - static uno::Reference< uno::XComponentContext > recoverContext(uno::Reference< uno::XComponentContext > const & xFallback = uno::Reference< uno::XComponentContext >()); - static bool tunnelFailure(uno::Any const & aException, bool bRaise = false); - private: - uno::Reference< uno::XCurrentContext > m_xOldContext; - uno::Reference< lang::XUnoTunnel > m_xActiveTunnel; - class Tunnel; - }; -// ----------------------------------------------------------------------------- - - class DisposingForwarder : public cppu::WeakImplHelper1< lang::XEventListener > - { - uno::Reference< lang::XComponent > m_xTarget; - - DisposingForwarder( uno::Reference< lang::XComponent > const & xTarget ) SAL_THROW( () ) - : m_xTarget( xTarget ) - { OSL_ASSERT( m_xTarget.is() ); } - - virtual void SAL_CALL disposing( lang::EventObject const & rSource ) - throw (uno::RuntimeException); - public: - // listens at source for disposing, then disposes target - static inline void forward( - uno::Reference< lang::XComponent > const & xSource, - uno::Reference< lang::XComponent > const & xTarget ) - SAL_THROW( (uno::RuntimeException) ); - }; -//__________________________________________________________________________________________________ - inline void DisposingForwarder::forward( - uno::Reference< lang::XComponent > const & xSource, - uno::Reference< lang::XComponent > const & xTarget ) - SAL_THROW( (uno::RuntimeException) ) - { - if (xSource.is()) - { - xSource->addEventListener( new DisposingForwarder( xTarget ) ); - } - } -// ----------------------------------------------------------------------------- -} // namespace configmgr - -#endif - - diff --git a/configmgr/source/inc/bufferedfile.hxx b/configmgr/source/inc/bufferedfile.hxx deleted file mode 100644 index c9bde6e7f713..000000000000 --- a/configmgr/source/inc/bufferedfile.hxx +++ /dev/null @@ -1,65 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_BUFFEREDFILE_HXX -#define CONFIGMGR_BUFFEREDFILE_HXX - -#include "utility.hxx" -#include <boost/utility.hpp> -#include <osl/file.hxx> -#include <com/sun/star/io/IOException.hpp> - -#ifndef INCLUDED_VECTOR -#include <vector> -#define INCLUDED_VECTOR -#endif - -namespace configmgr -{ - - namespace io = com::sun::star::io; - - class BufferedOutputFile: private boost::noncopyable, public osl::FileBase - { - osl::File * m_pFile; - std::vector<sal_uInt8> m_buffer; - public: - BufferedOutputFile( rtl::OUString const& aFileURL, sal_uInt32 nBufferSizeHint = 0 ); - ~BufferedOutputFile (); - - RC open( sal_uInt32 uFlags ); - RC close(); - - //RC getPos( sal_uInt64& uPos ) - RC write(const void *pBuffer, sal_uInt64 uBytesToWrite, sal_uInt64& rBytesWritten); - - // as opposed to osl::File, this method is not const here - RC sync(); - }; -} // namespace - -#endif diff --git a/configmgr/source/inc/builddata.hxx b/configmgr/source/inc/builddata.hxx deleted file mode 100644 index f2f3c840e0c8..000000000000 --- a/configmgr/source/inc/builddata.hxx +++ /dev/null @@ -1,69 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_BUILDDATA_HXX -#define CONFIGMGR_BUILDDATA_HXX - -#include "treefragment.hxx" -#ifndef INCLUDED_MEMORY -#define INCLUDED_MEMORY -#include <memory> -#endif -//----------------------------------------------------------------------------- -namespace rtl { class OUString; } -//----------------------------------------------------------------------------- -namespace configmgr -{ -//----------------------------------------------------------------------------- - class INode; - class ISubtree; - class ValueNode; -//----------------------------------------------------------------------------- - namespace sharable { struct TreeFragment; } - namespace data - { -//----------------------------------------------------------------------------- - sharable::TreeFragment * buildTree(sharable::TreeFragment * tree); -//----------------------------------------------------------------------------- - sharable::TreeFragment * buildTree(rtl::OUString const & _aTreeName, INode const& _aNode, bool _bWithDefaults); -//----------------------------------------------------------------------------- - sharable::TreeFragment * buildElementTree(INode const& _aNode, rtl::OUString const & _aTypeName, bool _bWithDefaults); -//----------------------------------------------------------------------------- - void mergeDefaults(sharable::TreeFragment * _aBaseAddress, INode const& _aDefaultNode); -//----------------------------------------------------------------------------- - void destroyTree(sharable::TreeFragment * _aBaseAddress); -//----------------------------------------------------------------------------- - std::auto_ptr<INode> convertTree(sharable::TreeFragment * tree, bool _bUseTreeName); -//----------------------------------------------------------------------------- - } -//----------------------------------------------------------------------------- -} // namespace configmgr -//----------------------------------------------------------------------------- - -#endif // CONFIGMGR_BUILDDATA_HXX - - diff --git a/configmgr/source/inc/cachefactory.hxx b/configmgr/source/inc/cachefactory.hxx deleted file mode 100644 index 15b02877bf71..000000000000 --- a/configmgr/source/inc/cachefactory.hxx +++ /dev/null @@ -1,51 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_CACHEFACTORY_HXX_ -#define CONFIGMGR_CACHEFACTORY_HXX_ - -#include <rtl/ref.hxx> -#include <com/sun/star/uno/XComponentContext.hpp> - -namespace configmgr -{ -//----------------------------------------------------------------------------- - class TreeManager; -//----------------------------------------------------------------------------- - struct CacheFactory - { - rtl::Reference<TreeManager> - createCacheManager(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & _xContext); - - static CacheFactory & instance(); - }; -//----------------------------------------------------------------------------- -} - - -#endif // CONFIGMGR_CACHEFACTORY_HXX_ - diff --git a/configmgr/source/inc/change.hxx b/configmgr/source/inc/change.hxx deleted file mode 100644 index 67200d13776e..000000000000 --- a/configmgr/source/inc/change.hxx +++ /dev/null @@ -1,504 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_CHANGE_HXX -#define CONFIGMGR_CHANGE_HXX -#if defined(_MSC_VER) && (_MSC_VER >= 1400) -#pragma warning(disable : 4350) // behavior change: 'member1' called instead of 'member2' -#endif - -#include "valuenode.hxx" -#include "treesegment.hxx" -#include <sal/types.h> -#include <rtl/ustring.hxx> -#include <com/sun/star/uno/Sequence.hxx> - -#ifndef INCLUDED_MAP -#include <map> -#define INCLUDED_MAP -#endif -#ifndef INCLUDED_MEMORY -#include <memory> -#define INCLUDED_MEMORY -#endif - -namespace configmgr -{ - - namespace uno = com::sun::star::uno; - - class Change; - class SubtreeChange; - class ValueChange; - class AddNode; - class RemoveNode; - - - //========================================================================== - //= ChangeTreeAction - //========================================================================== - struct ChangeTreeAction - { - virtual void handle(ValueChange const& aValueNode) = 0; - virtual void handle(AddNode const& aAddNode) = 0; - virtual void handle(RemoveNode const& aRemoveNode) = 0; - virtual void handle(SubtreeChange const& aSubtree) = 0; - - void applyToChange(Change const& aChange); - void applyToChildren(SubtreeChange const& aSubtree); - protected: - virtual ~ChangeTreeAction() {} - }; - - struct ChangeTreeModification - { - virtual void handle(ValueChange& aValueNode) = 0; - virtual void handle(AddNode& aAddNode) = 0; - virtual void handle(RemoveNode& aRemoveNode) = 0; - virtual void handle(SubtreeChange& aSubtree) = 0; - - void applyToChange(Change& aChange); - void applyToChildren(SubtreeChange& aSubtree); - protected: - virtual ~ChangeTreeModification() {} - }; - - //========================================================================== - //= Change - //========================================================================== - class Change - { - protected: - rtl::OUString m_aName; - bool m_bIsToDefault; - - void swap(Change& aOther); - - public: - explicit - Change(rtl::OUString const& _rName, bool _bToDefault) - : m_aName(_rName) - , m_bIsToDefault(_bToDefault) - {} - - virtual ~Change() {} - - rtl::OUString getNodeName() const { return m_aName; } - void setNodeName(const rtl::OUString &aName) {m_aName = aName;} - - bool isToDefault() const { return m_bIsToDefault; } - - Change* getSubChange(rtl::OUString const& _rName) { return doGetChild(_rName); } - Change const* getSubChange(rtl::OUString const& _rName) const { return doGetChild(_rName); } - - virtual void dispatch(ChangeTreeAction& anAction) const = 0; - virtual void dispatch(ChangeTreeModification& anAction) = 0; - - virtual std::auto_ptr<Change> clone() const = 0; - - private: - virtual Change* doGetChild(rtl::OUString const& ) const { return 0; } - }; - - //========================================================================== - //= ValueChange - //========================================================================== - class ValueChange : public Change - { - public: - struct SetToDefault {}; - enum Mode { wasDefault, changeValue, setToDefault, changeDefault }; - - private: - uno::Type m_aValueType; - uno::Any m_aValue; - uno::Any m_aOldValue; - node::Attributes m_aAttributes; - Mode m_eMode; - public: - ValueChange( - rtl::OUString const& _rName, - const node::Attributes& _rAttributes, - Mode aMode, - uno::Any const & aNewValue, - uno::Any const & aOldValue = uno::Any()); - - virtual std::auto_ptr<Change> clone() const; - - bool isChange() const; - - uno::Type getValueType() const { return m_aValueType; } - - uno::Any getNewValue() const { return m_aValue; } - uno::Any getOldValue() const { return m_aOldValue; } - - void setNewValue(const uno::Any& _rNewVal); - void setNewValue(const uno::Any& _rNewVal, Mode aMode) - { setNewValue(_rNewVal); m_eMode = aMode;} - - bool isReplacedValue() const {return m_aAttributes.isReplacedForUser();} - bool isLocalizedValue() const {return m_aAttributes.isLocalized();} - - Mode getMode() const { return m_eMode; } - - const node::Attributes& getAttributes() const {return m_aAttributes;} - - void applyChangeNoRecover(ValueNode& aNode) const; - - virtual void dispatch(ChangeTreeAction& anAction) const { anAction.handle(*this); } - virtual void dispatch(ChangeTreeModification& anAction) { anAction.handle(*this); } - - friend class ApplyValueChange; - }; - - //========================================================================== - //= AddNode - //========================================================================== - class AddNode : public Change - { - rtl::Reference< data::TreeSegment > m_aOwnNewNode; - rtl::Reference< data::TreeSegment > m_aOwnOldNode; - sharable::TreeFragment * m_aInsertedTree; - bool m_bReplacing; - - private: - void operator=(AddNode const&); // not implemented - - // needed for clone() - AddNode(AddNode const&); - public: - AddNode(rtl::Reference< data::TreeSegment > const & _aAddedTree, rtl::OUString const& _rName, bool _bToDefault); - ~AddNode(); - - virtual std::auto_ptr<Change> clone() const; - - /// marks this as not merely adding a node but replacing another - void setReplacing() { m_bReplacing = true; } - /// is this not merely adding a node but replacing another ? - bool isReplacing() const { return m_bReplacing; } - - /// has this been applied and inserted - bool wasInserted() const { return m_aInsertedTree != NULL; } - - /** returns the node this change represents, even if this node does not own the new Node object any more. - This is somewhat dangerous if the node referenced by this object dies before the object itself does.<BR> - In this case all calls to this method will return nonsense. This case can be detected by testing - whether <method>getAddedNode</method> returns NULL. - */ - sharable::TreeFragment * getInsertedTree() const { return m_aInsertedTree; } - - /** returns the node this change represents; The Node object is owned by this change until - <method>releaseAddedNode</method> is called.<BR> - After ownership is lost this method returns NULL. - */ - sharable::TreeFragment const * getNewTreeData() const { return m_aOwnNewNode.is() ? m_aOwnNewNode->fragment : 0; } - - /** returns the node the change represents. . - */ - rtl::Reference< data::TreeSegment > getNewTree() const { return m_aOwnNewNode; } - - /** returns the node the change represents, and releases ownership of it. This means that - afterwards <method>getAddedNode</method> will return NULL. This change object keeps a reference - to the node though which can be retrieved using <method>getAddedNode_unsafe</method>. - */ - void clearNewTree() { m_aOwnNewNode.clear(); } - - /** . - */ - void setInsertedAddress(sharable::TreeFragment * const & _aInsertedAddress); - - - /** returns the node this change replaces, ihe Node object is owned by this change. - After ownership is lost this method returns NULL. - */ - sharable::TreeFragment const * getReplacedTreeData() const { return m_aOwnOldNode.is() ? m_aOwnOldNode->fragment : 0; } - - /** returns the node the change replaces. - */ - rtl::Reference< data::TreeSegment > getReplacedTree() const { return m_aOwnOldNode; } - - /** forgets about the node the change replaces - */ - void clearReplacedTree() { m_aOwnOldNode.clear(); } - - void takeReplacedTree(rtl::Reference< data::TreeSegment > const& _aTree); - - virtual void dispatch(ChangeTreeAction& anAction) const { anAction.handle(*this); } - virtual void dispatch(ChangeTreeModification& anAction) { anAction.handle(*this); } - }; - - //========================================================================== - //= RemoveNode - //========================================================================== - class RemoveNode : public Change - { - protected: - rtl::Reference< data::TreeSegment > m_aOwnOldNode; - bool m_bIsToDefault; - - private: - RemoveNode& operator=(const RemoveNode&); // not implemented - // needed for clone() - RemoveNode(const RemoveNode&); - public: - explicit - RemoveNode(rtl::OUString const& _rName, bool _bToDefault); - ~RemoveNode(); - - virtual std::auto_ptr<Change> clone() const; - - virtual void dispatch(ChangeTreeAction& anAction) const { anAction.handle(*this); } - virtual void dispatch(ChangeTreeModification& anAction) { anAction.handle(*this); } - - /** returns the node this change removes, ihe Node object is owned by this change. - After ownership is lost this method returns NULL. - */ - sharable::TreeFragment const * getRemovedTreeData() const { return m_aOwnOldNode.is() ? m_aOwnOldNode->fragment : 0; } - /** returns the node the change removes. - */ - rtl::Reference< data::TreeSegment > getRemovedTree() const { return m_aOwnOldNode; } - - /** forgets about the node the change removes, returning the previous setting with ownership - */ - void clearRemovedTree() { m_aOwnOldNode.clear(); } - - void takeRemovedTree(rtl::Reference< data::TreeSegment > const & _aTree); - }; - - //========================================================================== - //= SubtreeChange - //========================================================================== - class SubtreeChange : public Change - { - protected: - typedef ::std::map< ::rtl::OUString,Change* > Children; - Children m_aChanges; - ::rtl::OUString m_sTemplateName; /// path of the template for child instantiation - ::rtl::OUString m_sTemplateModule; /// module of the template for child instantiation - node::Attributes m_aAttributes; - - // don't create copy ops automatically - SubtreeChange(const SubtreeChange&); - void operator=(SubtreeChange&); - - using Change::swap; - - public: - class ChildIterator; - ChildIterator begin() const throw(); - ChildIterator end() const throw(); - - class MutatingChildIterator; - MutatingChildIterator begin_changes() throw(); - MutatingChildIterator end_changes() throw(); - - friend class MutatingChildIterator; - public: - SubtreeChange(const rtl::OUString& _rName, - const node::Attributes& _rAttr, - bool _bToDefault = false) - : Change(_rName,_bToDefault) - , m_aAttributes(_rAttr) - { - m_aAttributes.markAsDefault(_bToDefault); - } - - SubtreeChange(const rtl::OUString& _rName, - const rtl::OUString& _rTemplateName, - const rtl::OUString& _rTemplateModule, - const node::Attributes& _rAttr, - bool _bToDefault = false) - : Change(_rName,_bToDefault) - , m_sTemplateName(_rTemplateName) - , m_sTemplateModule(_rTemplateModule) - , m_aAttributes(_rAttr) - { - m_aAttributes.markAsDefault(_bToDefault); - } - - SubtreeChange(const ISubtree& _rTree, bool _bToDefault = false) - : Change(_rTree.getName(),_bToDefault) - , m_sTemplateName(_rTree.getElementTemplateName()) - , m_sTemplateModule(_rTree.getElementTemplateModule()) - , m_aAttributes(_rTree.getAttributes()) - { - m_aAttributes.markAsDefault(_bToDefault); - } - - SubtreeChange(const SubtreeChange& _rChange, treeop::NoChildCopy) - : Change(_rChange) - , m_sTemplateName(_rChange.getElementTemplateName()) - , m_sTemplateModule(_rChange.getElementTemplateModule()) - , m_aAttributes(_rChange.getAttributes()) - {} - - ~SubtreeChange(); - - SubtreeChange(const SubtreeChange&, treeop::DeepChildCopy); - - virtual std::auto_ptr<Change> clone() const; - - void swap(SubtreeChange& aOther); - - bool isReplacedNode() const { return m_aAttributes.isReplacedForUser(); } - bool isLocalizedContainer() const { return m_aAttributes.isLocalized(); } - - const node::Attributes& getAttributes() const {return m_aAttributes;} - - bool isSetNodeChange() const { return m_sTemplateName.getLength() != 0; } - - rtl::OUString getElementTemplateName() const { return m_sTemplateName; } - rtl::OUString getElementTemplateModule() const { return m_sTemplateModule; } - - void setElementTemplate(const rtl::OUString& _rName, const rtl::OUString& _rModule) - { m_sTemplateName = _rName; m_sTemplateModule = _rModule; } - - sal_Int32 size() const { return m_aChanges.size(); } - uno::Sequence< rtl::OUString > elementNames() const; - - void addChange(std::auto_ptr<Change> aChange); - ::std::auto_ptr<Change> removeChange(rtl::OUString const& _rName); - - Change* getChange(rtl::OUString const& _rName); - Change const* getChange(rtl::OUString const& _rName) const; - - virtual void dispatch(ChangeTreeAction& _anAction) const; - virtual void dispatch(ChangeTreeModification& _anAction); - - void forEachChange(ChangeTreeAction& _anAction) const; - void forEachChange(ChangeTreeModification& _anAction); - - private: - virtual Change* doGetChild(rtl::OUString const& _rName) const; - }; - - /** iterates through all children of a <type>SubtreeChange</type>. Every non-const action on the object - which is beeing iterated invalidates the iterator. - <BR> - beware of the lifetime of the tree change object : it has to live as long as the iterator does (at least) !! - */ - class SubtreeChange::ChildIterator - { - protected: - uno::Sequence< rtl::OUString > m_aNames; - const SubtreeChange* m_pTree; - sal_Int32 m_nPos; - - friend class SubtreeChange; - struct EndPos { }; - ChildIterator(const SubtreeChange* _pTree, struct EndPos); - - inline sal_Bool isValid() const { return m_nPos >= 0 && m_nPos < m_aNames.getLength(); } - - public: - ChildIterator(const SubtreeChange* _pTree); - - const Change& operator*() const; - const Change* operator->() const; - - ChildIterator& operator++(); - ChildIterator operator++(int) { ChildIterator ret(*this); ++*this; return ret; } - - ChildIterator& operator--(); - ChildIterator operator--(int) { ChildIterator ret(*this); --*this; return ret; } - - friend bool operator==(ChildIterator const& lhs, ChildIterator const& rhs); - friend bool operator!=(ChildIterator const& lhs, ChildIterator const& rhs) { return !(lhs == rhs); } - }; - - /** iterates through all children of a <type>SubtreeChange</type>. Every non-const action on the object - which is beeing iterated invalidates the iterator. - <BR> - beware of the lifetime of the tree change object : it has to live as long as the iterator does (at least) !! - */ - class SubtreeChange::MutatingChildIterator - { - protected: - SubtreeChange::Children::iterator m_aBaseIter; - - friend class SubtreeChange; - MutatingChildIterator(SubtreeChange::Children::iterator aBase) : m_aBaseIter(aBase) {}; - - public: - Change& current() const { return *m_aBaseIter->second; } - - Change& operator*() const { return current(); } - Change* operator->() const { return ¤t(); } - - MutatingChildIterator& operator++() { ++m_aBaseIter; return *this; } - MutatingChildIterator operator++(int) { return MutatingChildIterator(m_aBaseIter++); } - - MutatingChildIterator& operator--() { ++m_aBaseIter; return *this; } - MutatingChildIterator operator--(int) { return MutatingChildIterator(m_aBaseIter++); } - - friend bool operator==(MutatingChildIterator const& lhs, MutatingChildIterator const& rhs) - { return lhs.m_aBaseIter == rhs.m_aBaseIter; } - friend bool operator!=(MutatingChildIterator const& lhs, MutatingChildIterator const& rhs) { return !(lhs == rhs); } - }; - //========================================================================== - //= SubtreeChangeReferrer - //========================================================================== - /** a specialized SubtreeChange, which, upon desctruction, does not delete the changes - it holds - - <BR> - This implies that when using this class, you have to beware of the lifetime of the involved objects - */ - class SubtreeChangeReferrer : public SubtreeChange - { - // no explicit construction - SubtreeChangeReferrer() : SubtreeChange(::rtl::OUString(), node::Attributes()) { } - - public: - SubtreeChangeReferrer(const SubtreeChange& _rSource); - ~SubtreeChangeReferrer(); - }; - -//////////////////////////////////////////////////////////////////////////////// - //========================================================================== - extern bool isLocalizedValueSet(SubtreeChange const& _aSubtree); - extern bool isValueSet(SubtreeChange const& _aSubtree); - - //========================================================================== - //= inlines - //========================================================================== - inline void ChangeTreeAction::applyToChange(Change const& aChange) - { aChange.dispatch(*this); } - inline void ChangeTreeAction::applyToChildren(SubtreeChange const& aSubtree) - { aSubtree.forEachChange(*this); } - - inline void ChangeTreeModification::applyToChange(Change& aChange) - { aChange.dispatch(*this); } - inline void ChangeTreeModification::applyToChildren(SubtreeChange& aSubtree) - { aSubtree.forEachChange(*this); } - -//////////////////////////////////////////////////////////////////////////////// - -} // namespace configmgr - -#endif - diff --git a/configmgr/source/inc/confapifactory.hxx b/configmgr/source/inc/confapifactory.hxx deleted file mode 100644 index 8ff282b52463..000000000000 --- a/configmgr/source/inc/confapifactory.hxx +++ /dev/null @@ -1,178 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_API_FACTORY_HXX_ -#define CONFIGMGR_API_FACTORY_HXX_ - -#include <sal/types.h> - -namespace com { namespace sun { namespace star { - namespace uno - { - class XInterface; - template <class> class Reference; - class XComponentContext; - } - namespace lang - { - class XSingleComponentFactory; - } -} } } -namespace rtl { class OUString; } - -namespace configmgr -{ - namespace uno = ::com::sun::star::uno; - namespace lang = ::com::sun::star::lang; - - extern - uno::Reference< lang::XSingleComponentFactory > SAL_CALL - createProviderFactory( - ::rtl::OUString const & aImplementationName, - bool bAdmin - ) - SAL_THROW( () ); - - struct ServiceRegistrationInfo; - struct SingletonRegistrationInfo; - -// provider instantiation - uno::Reference<uno::XInterface> SAL_CALL - getDefaultConfigProviderSingleton( uno::Reference< uno::XComponentContext > const& xContext ); - - uno::Reference<uno::XInterface> SAL_CALL - instantiateDefaultProvider( uno::Reference< uno::XComponentContext > const& xContext ); - -// provider service info - const SingletonRegistrationInfo * getDefaultProviderSingletonInfo(); - const ServiceRegistrationInfo * getConfigurationProviderServiceInfo(); - const ServiceRegistrationInfo * getDefaultProviderServiceInfo(); - const ServiceRegistrationInfo * getAdminProviderServiceInfo(); - -// other services - instantiation and info - uno::Reference< uno::XInterface > SAL_CALL - instantiateConfigRegistry( uno::Reference< uno::XComponentContext > const& xContext ); - - const ServiceRegistrationInfo* getConfigurationRegistryServiceInfo(); - -// bootstrap context support - uno::Reference<uno::XInterface> SAL_CALL - instantiateBootstrapContext( uno::Reference< uno::XComponentContext > const& xContext ); - - const SingletonRegistrationInfo * getBootstrapContextSingletonInfo(); - const ServiceRegistrationInfo * getBootstrapContextServiceInfo(); - - namespace xml - { - uno::Reference< uno::XInterface > SAL_CALL instantiateSchemaParser - ( uno::Reference< uno::XComponentContext > const& xContext ); - uno::Reference< uno::XInterface > SAL_CALL instantiateLayerParser - ( uno::Reference< uno::XComponentContext > const& xContext ); - uno::Reference< uno::XInterface > SAL_CALL instantiateLayerWriter - ( uno::Reference< uno::XComponentContext > const& xContext ); - - const ServiceRegistrationInfo* getSchemaParserServiceInfo(); - const ServiceRegistrationInfo* getLayerParserServiceInfo(); - const ServiceRegistrationInfo* getLayerWriterServiceInfo(); - } - namespace backend - { - uno::Reference<uno::XInterface> SAL_CALL - getDefaultBackendSingleton( uno::Reference< uno::XComponentContext > const& xContext ); - - uno::Reference<uno::XInterface> SAL_CALL - instantiateDefaultBackend( uno::Reference< uno::XComponentContext > const& xContext ); - - uno::Reference< uno::XInterface > SAL_CALL - instantiateUpdateMerger( uno::Reference< uno::XComponentContext > const& xContext ); - - uno::Reference<uno::XInterface> SAL_CALL - instantiateSingleBackendAdapter( uno::Reference< uno::XComponentContext > const& xContext ); - - uno::Reference< uno::XInterface > SAL_CALL - instantiateMergeImporter( uno::Reference< uno::XComponentContext > const& xContext ); - - uno::Reference< uno::XInterface > SAL_CALL - instantiateCopyImporter( uno::Reference< uno::XComponentContext > const& xContext ); - - uno::Reference<uno::XInterface> SAL_CALL - instantiateMultiStratumBackend( uno::Reference< uno::XComponentContext > const& xContext ); - - const SingletonRegistrationInfo * getDefaultBackendSingletonInfo(); - const ServiceRegistrationInfo * getDefaultBackendServiceInfo(); - - const ServiceRegistrationInfo * getUpdateMergerServiceInfo(); - const ServiceRegistrationInfo * getSingleBackendAdapterServiceInfo(); - const ServiceRegistrationInfo * getMergeImportServiceInfo(); - const ServiceRegistrationInfo * getCopyImportServiceInfo(); - const ServiceRegistrationInfo * getMultiStratumBackendServiceInfo(); - } - namespace localbe - { - uno::Reference<uno::XInterface> SAL_CALL - instantiateLocalBackend( uno::Reference< uno::XComponentContext > const& xContext ); - - uno::Reference<uno::XInterface> SAL_CALL - instantiateLocalDataImporter( uno::Reference< uno::XComponentContext > const& xContext ); - - uno::Reference<uno::XInterface> SAL_CALL - instantiateLocalHierarchyBrowser( uno::Reference< uno::XComponentContext > const& xContext ); - - uno::Reference<uno::XInterface> SAL_CALL - instantiateLocalSchemaSupplier( uno::Reference< uno::XComponentContext > const& xContext ); - - uno::Reference<uno::XInterface> SAL_CALL - instantiateLocalLegacyStratum( uno::Reference< uno::XComponentContext > const& xContext ); - - uno::Reference<uno::XInterface> SAL_CALL - instantiateLocalDataStratum( uno::Reference< uno::XComponentContext > const& xContext ); - - uno::Reference<uno::XInterface> SAL_CALL - instantiateLocalReadonlyStratum( uno::Reference< uno::XComponentContext > const& xContext ); - - uno::Reference<uno::XInterface> SAL_CALL - instantiateLocalResourceStratum( uno::Reference< uno::XComponentContext > const& xContext ); - - uno::Reference<uno::XInterface> SAL_CALL - instantiateLocalMultiStratum( uno::Reference< uno::XComponentContext > const& xContext ); - - const ServiceRegistrationInfo * getLocalBackendServiceInfo(); - const ServiceRegistrationInfo * getLocalDataImportServiceInfo(); - const ServiceRegistrationInfo * getLocalHierarchyBrowserServiceInfo(); - const ServiceRegistrationInfo * getLocalSchemaSupplierServiceInfo(); - const ServiceRegistrationInfo * getLocalLegacyStratumServiceInfo(); - const ServiceRegistrationInfo * getLocalDataStratumServiceInfo(); - const ServiceRegistrationInfo * getLocalReadonlyStratumServiceInfo(); - const ServiceRegistrationInfo * getLocalResourceStratumServiceInfo(); - const ServiceRegistrationInfo * getLocalMultiStratumServiceInfo(); - } // localbe - -} // namespace configmgr - -#endif // CONFIGMGR_API_FACTORY_HXX_ - - diff --git a/configmgr/source/inc/confevents.hxx b/configmgr/source/inc/confevents.hxx deleted file mode 100644 index f9c126f345a7..000000000000 --- a/configmgr/source/inc/confevents.hxx +++ /dev/null @@ -1,213 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_API_EVENTS_HXX_ -#define CONFIGMGR_API_EVENTS_HXX_ - -#include <hash_set> -#include <map> -#include <set> - -#include "osl/mutex.hxx" -#include "rtl/ref.hxx" -#include "salhelper/simplereferenceobject.hxx" - -#include "configpath.hxx" -#include "utility.hxx" - -namespace rtl { class OUString; } - -namespace configmgr -{ - class Change; - struct TreeChangeList; - class TreeManager; - - namespace configuration { class AbsolutePath; } - - struct IConfigListener : public salhelper::SimpleReferenceObject - { - virtual void disposing(TreeManager * pSource) = 0; - }; - struct INodeListener : IConfigListener - { - virtual void nodeChanged(Change const& aChange, configuration::AbsolutePath const& aPath, TreeManager * pSource) = 0; - virtual void nodeDeleted(configuration::AbsolutePath const& aPath, TreeManager * pSource) = 0; - }; - - namespace internal - { - - //////////////////////////////////////////////////////////////////////// - template <class ListenerRef> - class BroadcastImplHelper - { - public: - osl::Mutex mutex; - - public: - BroadcastImplHelper() - {} - - ~BroadcastImplHelper() - { - OSL_ENSURE(m_aInterfaces.empty(), "Configuration Broadcaster was not disposed properly"); - } - - public: - typedef std::set<ListenerRef> Interfaces; - - public: - typename Interfaces::iterator addListener(ListenerRef aListener) - { - return m_aInterfaces.insert(aListener).first; - } - void removeListener(ListenerRef aListener) - { - m_aInterfaces.erase(aListener); - } - - void disposing(TreeManager * pSource); - - public: - typename Interfaces::const_iterator begin() const { return m_aInterfaces.begin(); } - typename Interfaces::const_iterator end() const { return m_aInterfaces.end(); } - - typename Interfaces::const_iterator find(ListenerRef aListener) const { return m_aInterfaces.find(aListener); } - typename Interfaces::iterator findFull(ListenerRef aListener) { return m_aInterfaces.find(aListener); } - private: - Interfaces m_aInterfaces; - - // no implementation - not copyable - BroadcastImplHelper(BroadcastImplHelper&); - void operator=(BroadcastImplHelper&); - }; - - //////////////////////////////////////////////////////////////////////// - template <class Listener> - void BroadcastImplHelper<Listener>::disposing(TreeManager * pSource) - { - osl::ClearableMutexGuard aGuard(this->mutex); // ensure that no notifications are running - - Interfaces aTargets; - aTargets.swap(m_aInterfaces); - - aGuard.clear(); - for(typename Interfaces::iterator it = aTargets.begin(); it != aTargets.end(); ) - { - typename Interfaces::iterator cur = it++; - if (*cur) - (*cur)->disposing(pSource); - } - } - - - ///////////////////////////////////////////////////////////////////////// - - class NodeListenerInfo - { - public: - typedef std::hash_set<configuration::AbsolutePath, configuration::Path::Hash, configuration::Path::Equiv> Pathes; - - public: - NodeListenerInfo(rtl::Reference<INodeListener> const& pListener) - : m_pListener(pListener) - { - } - - // path handling - Pathes const& pathList() const { return m_aPathes; } - - void addPath(configuration::AbsolutePath const& sPath) const { m_aPathes.insert(sPath); } - void removePath(configuration::AbsolutePath const& sPath) const { m_aPathes.erase(sPath); } - //void removeChildPathes(OUString const& sPath); - - // behave as pointer for use as a 'reference' class - rtl::Reference<INodeListener> get() const { return m_pListener; } - rtl::Reference<INodeListener> operator->() const { return get(); } - INodeListener& operator*() const { return *m_pListener; } - // needed to allow if (info) ... - struct HasListener; - operator HasListener const*() const { return reinterpret_cast<HasListener*>(m_pListener.get()); } - - bool operator < (NodeListenerInfo const& aInfo) const - { return std::less<INodeListener*>()(m_pListener.get(), aInfo.m_pListener.get()); } - - bool operator == (NodeListenerInfo const& aInfo) const - { return !!( m_pListener == aInfo.m_pListener); } - - bool operator > (NodeListenerInfo const& aInfo) const - { return aInfo.operator < (*this); } - bool operator >= (NodeListenerInfo const& aInfo) const - { return !operator<(aInfo); } - bool operator <= (NodeListenerInfo const& aInfo) const - { return !operator>(aInfo); } - - bool operator != (NodeListenerInfo const& aInfo) const - { return !operator==(aInfo); } - - private: - rtl::Reference<INodeListener> m_pListener; - mutable Pathes m_aPathes; // hack to be mutable even as set element - }; - } // namespace - - ///////////////////////////////////////////////////////////////////////// - class ConfigChangeBroadcastHelper // broadcasts changes for a given set of options - { - public: - ConfigChangeBroadcastHelper(); - ~ConfigChangeBroadcastHelper(); - - void broadcast(TreeChangeList const& anUpdate, sal_Bool bError, TreeManager * pSource); - - void addListener(configuration::AbsolutePath const& aName, rtl::Reference<INodeListener> const& ); - void removeListener(rtl::Reference<INodeListener> const&); - - void dispose(TreeManager * pSource); - - private: - void add(configuration::AbsolutePath const& aPath, rtl::Reference<INodeListener> const& pListener); - void remove(rtl::Reference<INodeListener> const& pListener); - - void dispatch(Change const& rBaseChange, configuration::AbsolutePath const& sChangeLocation, sal_Bool _bError, TreeManager * pSource); - void dispatch(TreeChangeList const& rList_, sal_Bool _bError, TreeManager * pSource); - void disposing(TreeManager * pSource); - - void dispatchInner(rtl::Reference<INodeListener> const& pTarget, configuration::AbsolutePath const& sTargetPath, Change const& rBaseChange, configuration::AbsolutePath const& sChangeLocation, sal_Bool _bError, TreeManager * pSource); - void dispatchOuter(rtl::Reference<INodeListener> const& pTarget, configuration::AbsolutePath const& sTargetPath, Change const& rBaseChange, configuration::AbsolutePath const& sChangeLocation, sal_Bool _bError, TreeManager * pSource); - - typedef std::multimap<configuration::AbsolutePath, internal::BroadcastImplHelper<internal::NodeListenerInfo>::Interfaces::iterator, configuration::Path::Before> PathMap; - internal::BroadcastImplHelper<internal::NodeListenerInfo> m_aListeners; - PathMap m_aPathMap; - }; -} // namespace - -#endif // CONFIGMGR_API_EVENTS_HXX_ - - - diff --git a/configmgr/source/inc/configdefaultprovider.hxx b/configmgr/source/inc/configdefaultprovider.hxx deleted file mode 100644 index ce589aa78dc5..000000000000 --- a/configmgr/source/inc/configdefaultprovider.hxx +++ /dev/null @@ -1,95 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_CONFIG_DEFAULTPROVIDER_HXX_ -#define CONFIGMGR_CONFIG_DEFAULTPROVIDER_HXX_ - -#include "utility.hxx" -#include <com/sun/star/uno/Exception.hpp> -#include <rtl/ref.hxx> - -#ifndef INCLUDED_MEMORY -#include <memory> -#define INCLUDED_MEMORY -#endif - -namespace configmgr -{ -//----------------------------------------------------------------------------- - class ISubtree; - class IDefaultableTreeManager; - class RequestOptions; - class TreeManager; - - namespace uno = com::sun::star::uno; -//----------------------------------------------------------------------------- - namespace configuration - { -//----------------------------------------------------------------------------- - - class Tree; - class NodeRef; -//----------------------------------------------------------------------------- - - /// provides access to the default for a given request - class DefaultProviderProxy; - - class DefaultProvider - { - rtl::Reference< DefaultProviderProxy > m_aProxy; - public: - // factory methods - static DefaultProvider createEmpty(); - static DefaultProvider create(rtl::Reference< Tree > const& _aRootTree, - RequestOptions const& _xOptions, - rtl::Reference< TreeManager > const & _xDefaultProvider, - IDefaultableTreeManager* _pDefaultableTree); - - // actual c'tor - explicit - DefaultProvider(rtl::Reference< DefaultProviderProxy > const& _xProviderProxy); - - // standard c/d-tors to make compiler barrier - DefaultProvider(DefaultProvider const& _aOther); - DefaultProvider& operator=(DefaultProvider const& _aOther); - ~DefaultProvider(); - - bool isValid() const { return !! m_aProxy.is(); } - - /// tries to load a default instance of the specified node - std::auto_ptr<ISubtree> getDefaultTree(rtl::Reference< Tree > const& _aTree, NodeRef const& _aNode) const SAL_THROW((com::sun::star::uno::Exception)); - - /// tries to load default data into the specified tree - bool fetchDefaultData(rtl::Reference< Tree > const& _aTreeRef) const SAL_THROW((com::sun::star::uno::Exception)); - }; - -//----------------------------------------------------------------------------- - - } -} - -#endif // CONFIGMGR_CONFIG_DEFAULTPROVIDER_HXX_ diff --git a/configmgr/source/inc/configexcept.hxx b/configmgr/source/inc/configexcept.hxx deleted file mode 100644 index 9cc24a843c9a..000000000000 --- a/configmgr/source/inc/configexcept.hxx +++ /dev/null @@ -1,117 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_CONFIGEXCEPT_HXX_ -#define CONFIGMGR_CONFIGEXCEPT_HXX_ - -#include <rtl/ustring.hxx> -#include <rtl/string.hxx> -#include <com/sun/star/uno/Exception.hpp> -#include <com/sun/star/lang/IllegalArgumentException.hpp> - -namespace configmgr -{ -//------------------------------------------------------------------------- - namespace uno = ::com::sun::star::uno; - namespace lang = ::com::sun::star::lang; -//----------------------------------------------------------------------------- - namespace configuration - { - //------------------------------------------------------------------------- - - class Exception - { - rtl::OString m_sAsciiMessage; - public: - Exception(char const* sAsciiMessage); - Exception(rtl::OString const& sAsciiMessage); - virtual ~Exception() {} - - virtual rtl::OUString message() const; - virtual char const* what() const; - }; - //------------------------------------------------------------------------- - - class InvalidName : public Exception - { - rtl::OUString m_sName; - public: - InvalidName(rtl::OUString const& sName, char const* sAsciiDescription); - - virtual rtl::OUString message() const; - }; - //------------------------------------------------------------------------- - - class ConstraintViolation - : public Exception - { - public: - ConstraintViolation(char const* sConstraint); - }; - //------------------------------------------------------------------------- - - class TypeMismatch : public Exception - { - rtl::OUString m_sTypes; - static rtl::OUString describe(rtl::OUString const& sFoundType, rtl::OUString const& sExpectedType); - public: - TypeMismatch(rtl::OUString const& sFoundType, rtl::OUString const& sExpectedType); - TypeMismatch(rtl::OUString const& sFoundType, rtl::OUString const& sExpectedType, char const* sAsciiDescription); - - virtual rtl::OUString message() const; - }; - //------------------------------------------------------------------------- - } - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- - namespace configapi - { - //------------------------------------------------------------------------- - class ExceptionMapper - { - configuration::Exception& m_eOriginal; - uno::Reference<uno::XInterface> m_xContext; - rtl::OUString m_sMessage; - public: - ExceptionMapper(configuration::Exception& e); - ~ExceptionMapper(); - - void setContext(uno::XInterface* pContext); - - rtl::OUString message() const; - uno::Reference<uno::XInterface> context() const; - - void illegalArgument(sal_Int16 nArgument = -1) throw(lang::IllegalArgumentException); - void unhandled() throw(uno::RuntimeException); - }; - //------------------------------------------------------------------------- - } -//----------------------------------------------------------------------------- -} - -#endif // CONFIGMGR_CONFIGEXCEPT_HXX_ diff --git a/configmgr/source/inc/configgroup.hxx b/configmgr/source/inc/configgroup.hxx deleted file mode 100644 index a9cb1dd5bb36..000000000000 --- a/configmgr/source/inc/configgroup.hxx +++ /dev/null @@ -1,114 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_CONFIGGROUP_HXX_ -#define CONFIGMGR_CONFIGGROUP_HXX_ - -#include "configexcept.hxx" -#include "noderef.hxx" -#include "configdefaultprovider.hxx" - -namespace com { namespace sun { namespace star { - namespace script { class XTypeConverter; } -} } } - -namespace configmgr -{ -//----------------------------------------------------------------------------- - namespace configuration - { -//----------------------------------------------------------------------------- - - class NodeChange; - class RelativePath; -//----------------------------------------------------------------------------- - - /// helper for updating a <type>NodeRef</type> that refers to a Group - class GroupUpdateHelper - { - rtl::Reference< Tree > m_aTree; - NodeRef m_aNode; - public: - GroupUpdateHelper(rtl::Reference< Tree > const& aParentTree, NodeRef const& aGroupNode); - ~GroupUpdateHelper() {} - - void validateNode(ValueRef const& aNode) const; - void validateNode(NodeRef const& aNode) const; - - rtl::Reference< Tree > const& tree() const { return m_aTree; } - NodeRef const& node() const { return m_aNode; } - private: - void implValidateTree(rtl::Reference< Tree > const& aTree) const; - void implValidateNode(rtl::Reference< Tree > const& aTree, NodeRef const& aNode) const; - void implValidateNode(rtl::Reference< 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; - com::sun::star::uno::Reference<com::sun::star::script::XTypeConverter> m_xTypeConverter; - public: - GroupUpdater(rtl::Reference< Tree > const& aParentTree, NodeRef const& aGroupNode, com::sun::star::uno::Reference<com::sun::star::script::XTypeConverter> const& xConverter); - - NodeChange validateSetValue(ValueRef const& aValueNode, com::sun::star::uno::Any const& newValue ); - - private: - com::sun::star::uno::Any implValidateValue(rtl::Reference< Tree > const& aTree, ValueRef const& aNode, com::sun::star::uno::Any const& aValue) const; - }; -//----------------------------------------------------------------------------- - - /// 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(rtl::Reference< Tree > const& _aParentTree, NodeRef const& _aGroupNode, DefaultProvider const& _aProvider); - - bool hasDoneSet() const { return m_bHasDoneSet; } - - NodeChange validateSetToDefaultValue(ValueRef const& aValueNode); - - NodeChange validateSetToDefaultState(NodeRef const& aNode); - - NodeChanges validateSetAllToDefault(); - - static bool isDataAvailable(rtl::Reference< Tree > const& _aParentTree, NodeRef const& _aGroupNode); - static bool ensureDataAvailable(rtl::Reference< Tree > const& _aParentTree, NodeRef const& _aGroupNode, DefaultProvider const& _aSource); - }; -//----------------------------------------------------------------------------- - bool isPossibleValueType(com::sun::star::uno::Type const& aValueType); -//----------------------------------------------------------------------------- - bool convertCompatibleValue(com::sun::star::uno::Reference<com::sun::star::script::XTypeConverter> const& xConverter, uno::Any& rConverted, - com::sun::star::uno::Any const& rNewValue, com::sun::star::uno::Type const& rTargetType); -//----------------------------------------------------------------------------- - } -} - -#endif // CONFIGMGR_CONFIGGROUP_HXX_ diff --git a/configmgr/source/inc/configinteractionhandler.hxx b/configmgr/source/inc/configinteractionhandler.hxx deleted file mode 100644 index 5fb881f4dd1e..000000000000 --- a/configmgr/source/inc/configinteractionhandler.hxx +++ /dev/null @@ -1,81 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_CONFIGINTERACTIONHANDLER_HXX -#define CONFIGMGR_CONFIGINTERACTIONHANDLER_HXX - -#include "sal/config.h" -#include "com/sun/star/uno/Reference.hxx" -#include "rtl/ref.hxx" -#include "uno/current_context.hxx" - -namespace com { namespace sun { namespace star { - namespace task { class XInteractionHandler; } - namespace uno { class Any; } -} } } -namespace rtl { class OUString; } - -namespace configmgr { namespace apihelper { - -/** - represents the InteractionHandler for configuration errors from the current - context. - - <p>Should only be kept in scope while the error is being handled.</p> -*/ -class ConfigurationInteractionHandler { -public: - ConfigurationInteractionHandler(); - - ~ConfigurationInteractionHandler(); - - com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler > - get() const; // throw (com::sun::star::uno::RuntimeException) - - void setRecursive( - com::sun::star::uno::Reference< - com::sun::star::task::XInteractionHandler > const & handler); - -private: - ConfigurationInteractionHandler(ConfigurationInteractionHandler &); - // not defined - void operator =(ConfigurationInteractionHandler &); // not defined - - com::sun::star::uno::Any getPreviousContextValue( - rtl::OUString const & name) const; - // throw (com::sun::star::uno::RuntimeException) - - class Context; - friend class Context; - - rtl::Reference< Context > m_context; - com::sun::star::uno::ContextLayer m_layer; -}; - -} } - -#endif diff --git a/configmgr/source/inc/configpath.hxx b/configmgr/source/inc/configpath.hxx deleted file mode 100644 index 4664ec032559..000000000000 --- a/configmgr/source/inc/configpath.hxx +++ /dev/null @@ -1,446 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_CONFIGPATH_HXX_ -#define CONFIGMGR_CONFIGPATH_HXX_ - -#include <rtl/ustring.hxx> - -#ifndef INCLUDED_VECTOR -#include <vector> -#define INCLUDED_VECTOR -#endif // INCLUDED_VECTOR - -namespace configmgr -{ - namespace configuration - { - //-------------------------------------------------------------------- - - /** check if this is a well-formed name for a - config Node (excluding set elements) - */ - bool isSimpleName(rtl::OUString const& sName) SAL_THROW(()); - - /** make a name out of <var>sName</var>, - validating that it can be used for a config Node (excluding set elements) - or template name. - @throws InvalidName - if the name is not valid for that purpose - */ - rtl::OUString validateNodeName(rtl::OUString const& sName); - - /** make a name out of <var>sName</var> - validating that it can be used for a config set element - @throws InvalidName - if the name is not valid for that purpose - */ - rtl::OUString validateElementName(rtl::OUString const& sName); - //------------------------------------------------------------------------ - - //------------------------------------------------------------------------ - namespace Path - { - //------------------------------------------------------------------------ - - class Component - { - /// holds the contents of this path component - rtl::OUString m_aName; - public: - /// construct a path component from a string, without any validation - Component(rtl::OUString const& _sName) SAL_THROW(()); - - /// is this component an empty name ? - bool isEmpty() const SAL_THROW(()) { return m_aName.getLength() == 0; } - /// is this component a simple name ? - bool isSimpleName() const SAL_THROW(()); - /// get the inner name for this component - rtl::OUString getName() const SAL_THROW(()); - /// get the embedded type name for this component (if any) - rtl::OUString getTypeName() const SAL_THROW(()); - - /// get the contents of this as string (unparsed). - rtl::OUString toPathString() const SAL_THROW(()) { return m_aName; } - - // hashing - for hash maps. compatible to equiv or matches - size_t hashCode() const SAL_THROW(()) - { return this->getName().hashCode(); } - - /// get the contents of this as a name (unparsed). Use with care ! - rtl::OUString const& getInternalName() const SAL_THROW(()) { return m_aName; } - - }; - - //------------------------------------------------------------------------- - - /// compare taking type wildcards into account - bool matches(Component const& lhs,Component const& rhs) SAL_THROW(()); - - /// compare by inner names only - bool before(Component const& lhs,Component const& rhs) SAL_THROW(()); - - /// compare by inner names only - bool equiv(Component const& lhs,Component const& rhs) SAL_THROW(()); - //------------------------------------------------------------------------- - - /// construct a empty path component - Component makeEmptyComponent() SAL_THROW(()); - - //------------------------------------------------------------------------- - /// construct a path component from a name, validating it as simple name - Component wrapSimpleName(rtl::OUString const& _aName); - - /// construct a path component from a type and element name, using a wildcard if no type is available - Component makeCompositeName(rtl::OUString const& _aElementName, rtl::OUString const& _aTypeName); - - //----------------------------------------------------------------------------- - /// construct a composite path component from a element name or string, using a wildcard type - template <class NameRep> - Component wrapElementName(NameRep const& _aElementName) SAL_THROW(()) - { - return makeCompositeName(_aElementName, NameRep()); - } - - //------------------------------------------------------------------------- - /// construct a path component from an arbitrary na,e or string - template <class NameRep> - Component wrapSafeName(NameRep const& _aName) SAL_THROW(()) - { - return isSimpleName(_aName) ? wrapSimpleName(_aName) : wrapElementName(_aName); - } - - //----------------------------------------------------------------------------- - /** lower-level representation of a path within the configuration - <p>Keeps the data in a vector of names in reverse order! </P> - */ - class Rep - { - public: - /// construct an empty path - Rep() SAL_THROW(()) : m_aComponents() {} - - /// construct a path consisting of a single component <var>_aName</var> - explicit Rep(Component const& _aName) SAL_THROW(()) : m_aComponents(1,_aName) {} - - /// construct a path consisting of a path subrange - explicit Rep(std::vector<Component>::const_reverse_iterator const& _first, std::vector<Component>::const_reverse_iterator const& _last) - : m_aComponents(_last.base(), _first.base()) {} - - /// swap contents with another instance - void swap(Rep& _aOther) SAL_THROW(()) { m_aComponents.swap(_aOther.m_aComponents); } - - /// modify a path by prepending <var>aName</var> - void prepend(Component const& _aName) SAL_THROW(()) { m_aComponents.push_back(_aName); } - - /// modify a path by prepending <var>aName</var> - void prepend(Rep const& _aOther) SAL_THROW(()); - - /// get the local name (the last component of this path) - Component const& getLocalName() const { check_not_empty(); return m_aComponents.front(); } - - /// get the next name (the first component of this path) - Component const& getFirstName() const { check_not_empty(); return m_aComponents.back(); } - - /// set this to the remainder after the first name (drop the first component of this path) - void dropFirstName() { check_not_empty(); m_aComponents.pop_back(); } - - /// get a /-separated string representation of this - rtl::OUString toString(bool _bAbsolute) const SAL_THROW(()); - - public: - /// check if this is an empty path - bool isEmpty() const SAL_THROW(()) { return m_aComponents.empty(); } - - /// Count the components of this - std::vector<Component>::size_type countComponents() const SAL_THROW(()) { return m_aComponents.size(); } - - /// Insert a component into this path - void insertComponent(std::vector<Component>::reverse_iterator _it, Component _aName) - { m_aComponents.insert(_it.base(),_aName); } - - /// Remove a component from this path - void removeComponent(std::vector<Component>::reverse_iterator _it) { m_aComponents.erase(_it.base()); } - - /// Remove all components from this path - void clearComponents() SAL_THROW(()) { m_aComponents.clear(); } - - /// get a STL style iterator to the first component - std::vector<Component>::const_reverse_iterator begin() const SAL_THROW(()) { return m_aComponents.rbegin(); } - /// get a STL style iterator to after the last component - std::vector<Component>::const_reverse_iterator end() const SAL_THROW(()) { return m_aComponents.rend(); } - - /// get a STL style iterator to the first component - std::vector<Component>::reverse_iterator begin_mutate() SAL_THROW(()) { return m_aComponents.rbegin(); } - /// get a STL style iterator to after the last component - std::vector<Component>::reverse_iterator end_mutate() SAL_THROW(()) { return m_aComponents.rend(); } - - // hashing - for hash maps - size_t hashCode() const SAL_THROW(()); - - /// preflight check for operations that require a non-empty path - void check_not_empty() const; - - private: - std::vector<Component> m_aComponents; - }; - //------------------------------------------------------------------------ - - /// compare taking type wildcards into account - bool matches(Rep const& lhs,Rep const& rhs) SAL_THROW(()); - - /// compare by inner names only - bool before(Rep const& lhs,Rep const& rhs) SAL_THROW(()); - - /// compare by inner names only - bool equiv(Rep const& lhs,Rep const& rhs) SAL_THROW(()); - //------------------------------------------------------------------------ - - /// check a path for a prefix - bool hasMatchingPrefix(Rep const& _aPath,Rep const& _aPrefix) SAL_THROW(()); - - /// remove a prefix from a path. Throws InvalidName if it isn't a prefix - Rep stripMatchingPrefix(Rep const& _aPath,Rep const& _aPrefix); - //------------------------------------------------------------------------ - - /// distinguishes which kind of path is present in a string - bool isAbsolutePath(rtl::OUString const& _sPath); - //------------------------------------------------------------------------ - } - //------------------------------------------------------------------------ - - class RelativePath - { - Path::Rep m_aRep; - public: - // Construction - /// construct a relative path from <var>aString</var> throwing InvalidName for parse errors - static RelativePath parse(rtl::OUString const& _aString); - - /// construct an empty relative path - RelativePath() SAL_THROW(()) : m_aRep() { init(); } - - /// construct a relative path having <var>aRep</var> as representation - explicit RelativePath(Path::Rep const& _aRep) - : m_aRep(_aRep) { init(); } - - /// CONVERSION: construct a relative path having <var>aName</var> as single component - RelativePath(Path::Component const& _aName) SAL_THROW(()); - - /// build the Path that results from appending <var>aPath</var> to this - RelativePath compose(RelativePath const& _aPath) const SAL_THROW(()); - - /// check if this is an empty path - bool isEmpty() const SAL_THROW(()) { return m_aRep.isEmpty(); } - - /// Count the components of this - std::vector<Path::Component>::size_type getDepth() const SAL_THROW(()) { return m_aRep.countComponents(); } - - /// get the local name (the last component of this path) - Path::Component const& getLocalName() const { return m_aRep.getLocalName(); } - - /// get the local name (the first component of this path) - Path::Component const& getFirstName() const { return m_aRep.getFirstName(); } - - /// set this to the remainder of this path after the first name (drop the first component of this path) - void dropFirstName() { m_aRep.dropFirstName(); } - - /// get a /-separated string representation of this - rtl::OUString toString() const SAL_THROW(()); - public: - // Iteration support - /// get a STL style iterator to the first component - std::vector<Path::Component>::const_reverse_iterator begin() const SAL_THROW(()) { return m_aRep.begin(); } - /// get a STL style iterator to after the last component - std::vector<Path::Component>::const_reverse_iterator end() const SAL_THROW(()) { return m_aRep.end(); } - - /// get a STL style iterator to the first component - std::vector<Path::Component>::reverse_iterator begin_mutate() SAL_THROW(()) { return m_aRep.begin_mutate(); } - /// get a STL style iterator to after the last component - std::vector<Path::Component>::reverse_iterator end_mutate() SAL_THROW(()) { return m_aRep.end_mutate(); } - - // Direct access - 'package' visible - /// Get a reference to (or copy of) the internal PathRep of this - Path::Rep const& rep() const SAL_THROW(()) { return m_aRep; } - - private: - void init(); - }; - - /// compare taking type wildcards into account - inline bool matches(RelativePath const& lhs,RelativePath const& rhs) SAL_THROW(()) - { return Path::matches(lhs.rep(),rhs.rep()); } - - //------------------------------------------------------------------------ - - class AbsolutePath - { - Path::Rep m_aRep; - public: - // Construction - /// construct a absolute path from <var>aString</var> throwing InvalidName for parse errors - static AbsolutePath parse(rtl::OUString const& _aString); - - /// construct a absolute path to a whole module (toplevel) without error checking - static AbsolutePath makeModulePath(rtl::OUString const& _aString) SAL_THROW(()); - - /// construct an absolute path to the (virtual) hierarchy root - static AbsolutePath root() SAL_THROW(()); - - /// construct an (otherwise invalid) substitute path for the root of a free-floating node - static AbsolutePath detachedRoot() SAL_THROW(()); - - /// construct a absolute path having <var>aRep</var> as representation - explicit AbsolutePath(Path::Rep const& _aRep) SAL_THROW(()) - : m_aRep(_aRep) { init(); } - - /// build the absolute path that results from appending <var>aPath</var> to this - AbsolutePath compose(RelativePath const& _aPath) const SAL_THROW(()); - - /// build the absolute path that results from removing the last component of this - AbsolutePath getParentPath() const; - - /// check if this is the path to the (imaginary) root node - bool isRoot() const SAL_THROW(()) { return m_aRep.isEmpty(); } -#if OSL_DEBUG_LEVEL > 0 - /// check if this is a path to a detached node - bool isDetached() const SAL_THROW(()); -#endif - /// get the local name (the last component of this path) - Path::Component const& getLocalName() const { return m_aRep.getLocalName(); } - - rtl::OUString const & getModuleName() const { return m_aRep.getFirstName().getInternalName(); } - - /// get a /-separated string representation of this - rtl::OUString toString() const SAL_THROW(()); - - /// Count the components of this - std::vector<Path::Component>::size_type getDepth() const SAL_THROW(()) { return m_aRep.countComponents(); } - public: - // Iteration support - /// get a STL style iterator to the first component - std::vector<Path::Component>::const_reverse_iterator begin() const SAL_THROW(()) { return m_aRep.begin(); } - /// get a STL style iterator to after the last component - std::vector<Path::Component>::const_reverse_iterator end() const SAL_THROW(()) { return m_aRep.end(); } - - /// get a STL style iterator to the first component - std::vector<Path::Component>::reverse_iterator begin_mutate() SAL_THROW(()) { return m_aRep.begin_mutate(); } - /// get a STL style iterator to after the last component - std::vector<Path::Component>::reverse_iterator end_mutate() SAL_THROW(()) { return m_aRep.end_mutate(); } - - // Direct access - 'package' visible - /// Get a reference to (or copy of) the internal PathRep of this - Path::Rep const& rep() const SAL_THROW(()) { return m_aRep; } - private: - void init() SAL_THROW(()); - }; - - /// compare taking type wildcards into account - inline bool matches(AbsolutePath const& lhs,AbsolutePath const& rhs) SAL_THROW(()) - { return Path::matches(lhs.rep(),rhs.rep()); } - - namespace Path - { - //------------------------------------------------------------------------ - template <class PathClass> - bool hasPrefix(PathClass const& _aPath, PathClass const& _aPrefix) SAL_THROW(()) - { - return hasMatchingPrefix(_aPath.rep(),_aPrefix.rep() ); - } - //------------------------------------------------------------------------ - - template <class PathClass> - RelativePath stripPrefix(PathClass const& _aPath, PathClass const& _aPrefix) - { - return RelativePath( stripMatchingPrefix(_aPath.rep(),_aPrefix.rep()) ); - } - //------------------------------------------------------------------------ - - // STL Helpers - //------------------------------------------------------------------------ - - /// a weak strict ordering considering only the name part - struct Before - { - bool operator()(Component const& lhs, Component const& rhs) const SAL_THROW(()) - { return before(lhs,rhs); } - bool operator()(Rep const& lhs, Rep const& rhs) const SAL_THROW(()) - { return before(lhs,rhs); } - bool operator()(AbsolutePath const& lhs, AbsolutePath const& rhs) const SAL_THROW(()) - { return before(lhs.rep(),rhs.rep()); } - bool operator()(RelativePath const& lhs, RelativePath const& rhs) const SAL_THROW(()) - { return before(lhs.rep(),rhs.rep()); } - }; - //------------------------------------------------------------------------ - - /// an equality relation considering only the name part (compatible to Before) - struct Equiv - { - bool operator()(Component const& lhs, Component const& rhs) const SAL_THROW(()) - { return equiv(lhs,rhs); } - bool operator()(Rep const& lhs, Rep const& rhs) const SAL_THROW(()) - { return equiv(lhs,rhs); } - bool operator()(AbsolutePath const& lhs, AbsolutePath const& rhs) const SAL_THROW(()) - { return equiv(lhs.rep(),rhs.rep()); } - bool operator()(RelativePath const& lhs, RelativePath const& rhs) const SAL_THROW(()) - { return equiv(lhs.rep(),rhs.rep()); } - }; - //------------------------------------------------------------------------ - - /// a hash generator (compatible to Equiv and Before) - struct Hash - { - size_t operator()(Component const& _aObject) const SAL_THROW(()) - { return _aObject.hashCode(); } - size_t operator()(Rep const& _aObject) const SAL_THROW(()) - { return _aObject.hashCode(); } - size_t operator()(AbsolutePath const& _aObject) const SAL_THROW(()) - { return _aObject.rep().hashCode(); } - size_t operator()(RelativePath const& _aObject) const SAL_THROW(()) - { return _aObject.rep().hashCode(); } - }; - //------------------------------------------------------------------------ - /// a binary predicate that is not (!) an equivalence relation - - struct Matches - { - bool operator()(Component const& lhs, Component const& rhs) const SAL_THROW(()) - { return matches(lhs,rhs); } - bool operator()(Rep const& lhs, Rep const& rhs) const SAL_THROW(()) - { return matches(lhs,rhs); } - bool operator()(AbsolutePath const& lhs, AbsolutePath const& rhs) const SAL_THROW(()) - { return matches(lhs.rep(),rhs.rep()); } - bool operator()(RelativePath const& lhs, RelativePath const& rhs) const SAL_THROW(()) - { return matches(lhs.rep(),rhs.rep()); } - }; - //------------------------------------------------------------------------ - } - //------------------------------------------------------------------------ - } -} - -#endif // CONFIGMGR_CONFIGNAME_HXX_ diff --git a/configmgr/source/inc/configset.hxx b/configmgr/source/inc/configset.hxx deleted file mode 100644 index b09446313fdf..000000000000 --- a/configmgr/source/inc/configset.hxx +++ /dev/null @@ -1,143 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_CONFIGSET_HXX_ -#define CONFIGMGR_CONFIGSET_HXX_ - -#include "configexcept.hxx" -#include "configdefaultprovider.hxx" -#include "template.hxx" -#include "noderef.hxx" -#include <rtl/ref.hxx> - -#ifndef INCLUDED_MEMORY -#include <memory> -#define INCLUDED_MEMORY -#endif - -namespace com { namespace sun { namespace star { - namespace script { class XTypeConverter; } -} } } - -namespace configmgr -{ - namespace data { class TreeSegment; } - - namespace configuration - { - namespace Path { class Component; } - //--------------------------------------------------------------------- - - class ElementTree; - - class NodeChange; - class Template; - - class SetElementFactory - { - TemplateProvider m_aProvider; - public: - SetElementFactory(TemplateProvider const& aProvider); - SetElementFactory(SetElementFactory const& aOther); - SetElementFactory& operator=(SetElementFactory const& aOther); - ~SetElementFactory(); - - rtl::Reference< ElementTree > instantiateTemplate(rtl::Reference<Template> const& aTemplate); - rtl::Reference< ElementTree > instantiateOnDefault(rtl::Reference< data::TreeSegment > const& _aTree, rtl::Reference<Template> const& aDummyTemplate); - - static TemplateProvider findTemplateProvider(rtl::Reference< Tree > const& aTree, NodeRef const& aNode); - }; - -//----------------------------------------------------------------------------- - - /// allows to insert,remove and replace an element of a <type>Node</type> that is a Container ("set") of full-fledged trees. - class TreeSetUpdater - { - rtl::Reference< Tree > m_aParentTree; - NodeRef m_aSetNode; - rtl::Reference<Template> m_aTemplate; - public: - TreeSetUpdater(rtl::Reference< Tree > const& aParentTree, NodeRef const& aSetNode, rtl::Reference< Template > const& aTemplate); - - NodeChange validateInsertElement (rtl::OUString const& aName, rtl::Reference< ElementTree > const& aNewElement); - - NodeChange validateReplaceElement(rtl::Reference< ElementTree > const& aElement, rtl::Reference< ElementTree > const& aNewElement); - - NodeChange validateRemoveElement (rtl::Reference< ElementTree > const& aElement); - private: - void implValidateSet(); - Path::Component implValidateElement(rtl::Reference< ElementTree > const& aElement, bool bReqRemovable); - void implValidateTree(rtl::Reference< ElementTree > const& aElementTree); - }; -//----------------------------------------------------------------------------- - /// allows to insert,remove and replace an element of a <type>Node</type> that is a Container ("set") of simple values. - class ValueSetUpdater - { - rtl::Reference< Tree > m_aParentTree; - NodeRef m_aSetNode; - rtl::Reference<Template> m_aTemplate; - com::sun::star::uno::Reference<com::sun::star::script::XTypeConverter> m_xTypeConverter; - public: - ValueSetUpdater(rtl::Reference< Tree > const& aParentTree, NodeRef const& aSetNode, - rtl::Reference< Template > const& aTemplate, com::sun::star::uno::Reference<com::sun::star::script::XTypeConverter> const& xConverter); - - NodeChange validateInsertElement (rtl::OUString const& aName, com::sun::star::uno::Any const& aNewValue); - - NodeChange validateReplaceElement(rtl::Reference< ElementTree > const& aElement, com::sun::star::uno::Any const& aNewValue); - - NodeChange validateRemoveElement (rtl::Reference< ElementTree > const& aElement); - private: - void implValidateSet(); - Path::Component implValidateElement(rtl::Reference< ElementTree > const& aElement, bool bReqRemovable); - com::sun::star::uno::Any implValidateValue(rtl::Reference< Tree > const& aElementTree, com::sun::star::uno::Any const& aValue); - com::sun::star::uno::Any implValidateValue(com::sun::star::uno::Any const& aValue); - - rtl::Reference<ElementTree> makeValueElement(rtl::OUString const& aName, rtl::Reference< Tree > const& aElementTree, com::sun::star::uno::Any const& aValue, bool bInserting); - rtl::Reference<ElementTree> makeValueElement(rtl::OUString const& aName, com::sun::star::uno::Any const& aValue, bool bInserting); - rtl::Reference< Tree > extractElementNode(rtl::Reference< ElementTree > const& aElement); - }; -//----------------------------------------------------------------------------- - - /// allows to restore to its default state a <type>Node</type> that is a Container ("set") of full-fledged trees. - class SetDefaulter - { - rtl::Reference< Tree > m_aParentTree; - NodeRef m_aSetNode; - DefaultProvider m_aDefaultProvider; - public: - SetDefaulter(rtl::Reference< Tree > const& aParentTree, NodeRef const& aSetNode, DefaultProvider const& aDefaultProvider); - - NodeChange validateSetToDefaultState(); - - private: - void implValidateSet(); - }; -//----------------------------------------------------------------------------- - } -} - -#endif // CONFIGMGR_CONFIGSET_HXX_ diff --git a/configmgr/source/inc/confsvccomponent.hxx b/configmgr/source/inc/confsvccomponent.hxx deleted file mode 100644 index 38d6b8eb79df..000000000000 --- a/configmgr/source/inc/confsvccomponent.hxx +++ /dev/null @@ -1,88 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_API_SVCCOMPONENT_HXX_ -#define CONFIGMGR_API_SVCCOMPONENT_HXX_ - -#include "serviceinfohelper.hxx" -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <cppuhelper/compbase1.hxx> -#include <cppuhelper/typeprovider.hxx> - -#ifndef _OSL_MUTEX_HXX_ -#include <osl/Mutex.hxx> -#endif -#include <rtl/ustring.hxx> - -namespace configmgr -{ - -//---------------------------------------------------------------------------- - namespace css = ::com::sun::star; - namespace uno = css::uno; - namespace lang = css::lang; - -//---------------------------------------------------------------------------- - class ServiceComponentImpl - : public ::cppu::WeakComponentImplHelper1< lang::XServiceInfo > - { - protected: - ServiceImplementationInfo const*const m_info; - public: - ServiceComponentImpl(ServiceImplementationInfo const* aInfo); - - // XTypeProvider - virtual uno::Sequence<sal_Int8> SAL_CALL getImplementationId( ) throw(uno::RuntimeException); - //virtual uno::Sequence<uno::Type> SAL_CALL getTypes( ) throw(uno::RuntimeException) = 0; - - // XServiceInfo - virtual rtl::OUString SAL_CALL getImplementationName( ) throw(uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(uno::RuntimeException); - virtual uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(uno::RuntimeException); - - // Component Helper - force override - virtual void SAL_CALL disposing() = 0; - // Component Helper - check object state - virtual void checkAlive() throw (uno::RuntimeException); - void checkAlive(char const* message) throw (uno::RuntimeException) - { checkAlive( rtl::OUString::createFromAscii(message) ); } - void checkAlive(rtl::OUString const& message) throw (uno::RuntimeException); - - // Extra helpers - static uno::Sequence<sal_Int8> getStaticImplementationId(ServiceImplementationInfo const* pServiceInfo) throw(uno::RuntimeException); - - private: // no implementation - ServiceComponentImpl(ServiceComponentImpl&); - void operator=(ServiceComponentImpl&); - }; -//---------------------------------------------------------------------------- - -} // namespace configmgr - -#endif // CONFIGMGR_API_SVCCOMPONENT_HXX_ - - diff --git a/configmgr/source/inc/datalock.hxx b/configmgr/source/inc/datalock.hxx deleted file mode 100644 index a2a739974efd..000000000000 --- a/configmgr/source/inc/datalock.hxx +++ /dev/null @@ -1,68 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_DATALOCK_HXX_ -#define CONFIGMGR_DATALOCK_HXX_ - -#include "sal/config.h" - -#include "osl/interlck.h" -#include "osl/mutex.hxx" - -namespace configmgr { - - class UnoApiLock - { - static osl::Mutex aCoreLock; - public: - static volatile oslInterlockedCount nHeld; - UnoApiLock() { acquire(); } - ~UnoApiLock() { release(); } - - static osl::Mutex &getLock() { return aCoreLock; } - static void acquire() { aCoreLock.acquire(); nHeld++; } - static void release() { nHeld--; aCoreLock.release(); } - static bool isHeld() { return nHeld != 0; } - }; - class UnoApiLockReleaser - { - oslInterlockedCount mnCount; - public: - UnoApiLockReleaser(); - ~UnoApiLockReleaser(); - }; - class UnoApiLockClearable : public UnoApiLock - { - bool mbSet; - public: - UnoApiLockClearable() : mbSet(true) { acquire(); } - ~UnoApiLockClearable() { clear(); } - void clear() { if (mbSet) { mbSet = false; release(); } } - }; -} - -#endif // CONFIGMGR_DATALOCK_HXX_ diff --git a/configmgr/source/inc/defaultprovider.hxx b/configmgr/source/inc/defaultprovider.hxx deleted file mode 100644 index 0f673b7f380c..000000000000 --- a/configmgr/source/inc/defaultprovider.hxx +++ /dev/null @@ -1,73 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_DEFAULTPROVIDER_HXX -#define CONFIGMGR_DEFAULTPROVIDER_HXX - -#include "sal/config.h" - -#include "com/sun/star/uno/Exception.hpp" -#include "sal/types.h" - -#include "utility.hxx" - -namespace configmgr -{ - namespace configuration - { - class AbsolutePath; - } - //------------------------- - class RequestOptions; - //========================================================================== - //= IDefaultableTreeManager - //========================================================================== - /* is a supplementary interface for an <type>OProviderImpl</type>. - <p>Supports functionality to load default data into the managed tree</p> - */ - class SAL_NO_VTABLE IDefaultableTreeManager - { - public: - /** attempt to load default data into the tree named by a path using certain options - and requiring a specific loading depth. - - @returns - <TRUE/>, if some default data is available within the tree - <FALSE/>, if no default data is available for the tree - */ - virtual sal_Bool fetchDefaultData(configuration::AbsolutePath const& aSubtreePath, - const RequestOptions& _xOptions - ) SAL_THROW((com::sun::star::uno::Exception)) = 0; - - }; - -//////////////////////////////////////////////////////////////////////////////// - -} // namespace configmgr - -#endif - diff --git a/configmgr/source/inc/emptylayer.hxx b/configmgr/source/inc/emptylayer.hxx deleted file mode 100644 index d61b38d0ee25..000000000000 --- a/configmgr/source/inc/emptylayer.hxx +++ /dev/null @@ -1,53 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_BACKEND_EMPTYLAYER_HXX -#define CONFIGMGR_BACKEND_EMPTYLAYER_HXX - -#include <com/sun/star/configuration/backend/XLayer.hpp> - -// ----------------------------------------------------------------------------- -namespace configmgr -{ - // ----------------------------------------------------------------------------- - namespace backend - { - // ----------------------------------------------------------------------------- - namespace uno = ::com::sun::star::uno; - namespace backenduno = ::com::sun::star::configuration::backend; - - // ----------------------------------------------------------------------------- - uno::Reference< backenduno::XLayer > createEmptyLayer(); - - bool checkEmptyLayer(uno::Reference< backenduno::XLayer > const & xLayer ); - // ----------------------------------------------------------------------------- - } // namespace xml - // ----------------------------------------------------------------------------- - -} // namespace configmgr -#endif - diff --git a/configmgr/source/inc/filehelper.hxx b/configmgr/source/inc/filehelper.hxx deleted file mode 100644 index e1dd4a03a412..000000000000 --- a/configmgr/source/inc/filehelper.hxx +++ /dev/null @@ -1,114 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef _CONFIGMGR_FILEHELPER_HXX_ -#define _CONFIGMGR_FILEHELPER_HXX_ - -#include "utility.hxx" -#include <osl/file.hxx> -#include <com/sun/star/io/IOException.hpp> - -namespace io = com::sun::star::io; - -namespace configmgr -{ - //========================================================================== - //= FileHelper - //========================================================================== - /** Within the FileHelper namespace there is a list of methods declared, which ease - specific file operations. - */ - namespace FileHelper - { - /// delimiter used in URLs and ConfPath - static const ::sal_Unicode delimiter = sal_Unicode('/'); - - /// Tests if the file exists. - bool fileExists(rtl::OUString const& _sFileURL); - - /// Tests if the directory exists. - bool dirExists(rtl::OUString const& _sDirURL); - - /** Returns the parent part of the pathname of this File URL, - or an empty string if the name has no parent part. - The parent part is generally everything leading up to the last occurrence - of the separator character. - */ - rtl::OUString getParentDir(rtl::OUString const& _aFileURL); - - /** - Returns the file name part of a file URL. - - @param aFileUrl file URL - @return everything in the URL from the last delimiter on - */ - rtl::OUString getFileName(const rtl::OUString& aFileUrl) ; - - /** - Splits a file URL between its parent directory/file name - parts. - - @param aFileUrl file URL - @param aParentDirectory parent directory filled on return - @param aFileName file name filled on return - */ - void splitFileUrl(const rtl::OUString& aFileUrl, - rtl::OUString& aParentDirectory, - rtl::OUString& aFileName) ; - - /** creates a directory whose pathname is specified by a FileURL. - @return true if directory could be created or does exist, otherwise false. - */ - osl::FileBase::RC mkdir(rtl::OUString const& _sDirURL); - - /** creates a directory whose pathname is specified by a FileURL, - including any necessary parent directories. - @return true if directory (or directories) could be created or do(es) exist, otherwise false. - */ - osl::FileBase::RC mkdirs(rtl::OUString const& _aDirectory); - - /** replaces a file specified by _aToURL with a file specified by _aFromURL. - */ - void replaceFile(const rtl::OUString& _aToURL, const rtl::OUString &_aFromURL) SAL_THROW((io::IOException)); - - /** removes a file specified by _aURL. Ignores the case of a non-existing file. - */ - bool tryToRemoveFile(const rtl::OUString& _aURL, bool tryBackupFirst); - - /** creates an error msg string for a given file error return code. - */ - rtl::OUString createOSLErrorString(osl::FileBase::RC eError); - - /** determines the status of a directory entry specified by a URL. - @return the Size of the file in bytes and the TimeValue of the last modification, if the file exists, - otherwise 0 and a TimeValue(0,0). - */ - sal_uInt64 getModifyStatus(rtl::OUString const& _aNormalizedFilename, TimeValue & rModifyTime); - } -} // namespace configmgr - -#endif diff --git a/configmgr/source/inc/flags.hxx b/configmgr/source/inc/flags.hxx deleted file mode 100644 index 100723f2f3fd..000000000000 --- a/configmgr/source/inc/flags.hxx +++ /dev/null @@ -1,133 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef INCLUDED_DATA_FLAGS_HXX -#define INCLUDED_DATA_FLAGS_HXX - -#include <sal/types.h> - -namespace configmgr -{ -//----------------------------------------------------------------------------- - namespace data - { - //----------------------------------------------------------------------------- - // node type + value type selector - fits into a byte (bit 5 currently unassigned) - namespace Type - { - enum Type - { - // Primitive Data Type is stored in bits 0-4 (bit 3 currently unused) - // base data types - value_any, // = 0 - value_string, // = 1 - value_boolean, // = 2 - value_short, // = 3 - value_int, // = 4 - value_long, // = 5 - value_double, // = 6 - value_binary, // = 7 - - mask_basetype = 0x0F, - - // sequence data types - flag_sequence = 0x10, - - value_invalid = value_any | flag_sequence, - - value_string_list = value_string | flag_sequence, - value_boolean_list = value_boolean | flag_sequence, - value_short_list = value_short | flag_sequence, - value_int_list = value_int | flag_sequence, - value_long_list = value_long | flag_sequence, - value_double_list = value_double | flag_sequence, - value_binary_list = value_binary | flag_sequence, - - mask_valuetype = mask_basetype | flag_sequence, // 0x1F - - // Node Type is stored in bits 6+7 - nodetype_shift_ = 6, - mask_nodetype = 0x03 << nodetype_shift_, // 0xC0 - - // maybe we should use 0 for node type 'value' - // to make the complete type be the valuetype ? - nodetype_invalid= 0x00, - - nodetype_value = 0x01 << nodetype_shift_, // 0x40 - nodetype_group = 0x02 << nodetype_shift_, // 0x80 - nodetype_set = 0x03 << nodetype_shift_, // 0xC0 - - flag_innernode = 0x02 << nodetype_shift_, // 0x80 - flag_setnode = 0x01 << nodetype_shift_ // 0x40 - }; - } - - //----------------------------------------------------------------------------- - // node attributes - namespace Flags - { - enum Type - { - readonly = 0x01, - finalized = 0x02, - - nullable = 0x04, - localized = 0x08, - - valueAvailable = 0x10, // only used for value nodes - defaultAvailable = 0x20, // only used for value nodes - - defaulted = 0x40, // somewhat redundant with State - defaultable = 0x80 // redundant with State (merged || defaulted) - }; - } - //----------------------------------------------------------------------------- - // set element or tree state - namespace State - { - enum Type - { - merged, // = 0, - result of merging defaults + changes - defaulted, // = 1, - result of copying defaults unchanged - replaced, // = 2, - result of copying new layer unchanged - added, // = 3, - same as 'replaced', but it is known, - // that there is no corresponding default - - mask_state = 0x0F, // leaves bits 3+4 reserved for states - - flag_mandatory = 0x10, // marks this element as non-removable/replacable - flag_readonly = 0x20, // marks this element as read-only - flag_default_avail = 0x40, // marks this element as containing default values - flag_removable = 0x80 // marks this element as removable - }; - } - //----------------------------------------------------------------------------- - } -//----------------------------------------------------------------------------- -} - -#endif // INCLUDED_DATA_FLAGS_HXX diff --git a/configmgr/source/inc/interactionrequest.hxx b/configmgr/source/inc/interactionrequest.hxx deleted file mode 100644 index 5d9573ed655f..000000000000 --- a/configmgr/source/inc/interactionrequest.hxx +++ /dev/null @@ -1,163 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_INTERACTIONREQUEST_HXX -#define CONFIGMGR_INTERACTIONREQUEST_HXX - -#include <com/sun/star/task/XInteractionRequest.hpp> -#include <com/sun/star/task/XInteractionAbort.hpp> -#include <com/sun/star/task/XInteractionRetry.hpp> -#include <com/sun/star/task/XInteractionApprove.hpp> -#include <com/sun/star/task/XInteractionDisapprove.hpp> -#include <cppuhelper/implbase1.hxx> - -namespace configmgr { -namespace apihelper { - namespace uno = com::sun::star::uno; - namespace task = com::sun::star::task; -//============================================================================ - -/** - * This class implements the interface XInteractionRequest. Instances can - * be passed directly to XInteractionHandler::handle(...). Each interaction - * request contains an exception describing the error and a number of - * interaction continuations describing the possible "answers" for the request. - * After the request was passed to XInteractionHandler::handle(...) the method - * getSelection() returns the continuation choosen by the interaction handler. - * - * The typical usage of this class would be: - * - * 1) Create exception object that shall be handled by the interaction handler. - * 2) Create InteractionRequest, supply exception as ctor parameter - * 3) Create continuations needed and add them to a sequence - * 4) Supply the continuations to the InteractionRequest by calling - * setContinuations(...) - * - * This class can also be used as base class for more specialized requests, - * like authentication requests. - */ -class InteractionRequest : public cppu::WeakImplHelper1<com::sun::star::task::XInteractionRequest> -{ - struct Impl; - Impl * m_pImpl; - -protected: - virtual ~InteractionRequest(); -public: - /** - * Constructor. - * - * @param rRequest is the exception describing the error. - */ - InteractionRequest( const com::sun::star::uno::Any & rRequest ); - - /** - * This method sets the continuations for the request. - * - * @param rContinuations contains the possible continuations. - */ - void setContinuations( - const uno::Sequence< uno::Reference< task::XInteractionContinuation > > & - rContinuations ); - - // XInteractionRequest - virtual uno::Any SAL_CALL - getRequest() - throw( uno::RuntimeException ); - - virtual uno::Sequence< uno::Reference< task::XInteractionContinuation > > SAL_CALL - getContinuations() - throw( com::sun::star::uno::RuntimeException ); - - // Non-interface methods. - - /** - * After passing this request to XInteractionHandler::handle, this method - * returns the continuation that was choosen by the interaction handler. - * - * @return the continuation choosen by an interaction handler or an empty - * reference, if the request was not (yet) handled. - */ - uno::Reference< task::XInteractionContinuation > getSelection() const; - - /** - * This method sets a continuation for the request. It also can be used - * to reset the continuation set by a previous XInteractionHandler::handle - * call in order to use this request object more then once. - * - * @param rxSelection is the interaction continuation to activate for - * the request or an empty reference in order to reset the - * current selection. - */ - void setSelection( - const uno::Reference< task::XInteractionContinuation > & rxSelection ); -}; - -//============================================================================ - -/** - * This template class implements a simple standard interaction continuation - * interface provided as template parameter. Classes instantiated from this - * template work together with class InteractionRequest. - * Instances of such a class can be passed along with an interaction request - * to indicate the possiblity to continue the operation that caused the request - * as indicated by the interface. - */ -template <class XThisContinuation > -class InteractionContinuation : public cppu::WeakImplHelper1< XThisContinuation > -{ - InteractionRequest * m_pRequest; -public: - InteractionContinuation( InteractionRequest * pRequest ) - : m_pRequest( pRequest ) {} - - // XInteractionContinuation - /** - * This method marks this continuation as "selected" at the request it - * belongs to. - * - * Derived classes must implement their XInteractionContinuation::select() - * method the way that they call this method. - */ - virtual void SAL_CALL select() - throw( com::sun::star::uno::RuntimeException ); -}; -//============================================================================ - -template <class XThisContinuation > -void SAL_CALL InteractionContinuation< XThisContinuation >::select() - throw( com::sun::star::uno::RuntimeException ) -{ - m_pRequest->setSelection(this); -} -//============================================================================ - - -} // namespace apihelper -} // namespace configmgr - -#endif /* !CONFIGMGR_INTERACTIONREQUEST_HXX */ diff --git a/configmgr/source/inc/localizedtreeactions.hxx b/configmgr/source/inc/localizedtreeactions.hxx deleted file mode 100644 index 3a3b4511284c..000000000000 --- a/configmgr/source/inc/localizedtreeactions.hxx +++ /dev/null @@ -1,52 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_LOCALIZEDTREEACTIONS_HXX -#define CONFIGMGR_LOCALIZEDTREEACTIONS_HXX - -#include "valuenode.hxx" -#include "treesegment.hxx" -//.......................................................................... -namespace configmgr -{ -class SubtreeChange; - -//========================================================================== -// Helper function to invoke the previous ones properly - -// convert to the given locale format, assuming the original representation was expanded -rtl::Reference< data::TreeSegment > cloneExpandedForLocale(sharable::TreeFragment * tree, rtl::OUString const& _sLocale); -// convert to the given locale format, assuming the original representation was expanded -std::auto_ptr<INode> reduceExpandedForLocale(std::auto_ptr<ISubtree> _pNode, rtl::OUString const& _sLocale); - -//.......................................................................... -} // namespace configmgr -//.......................................................................... - -#endif // CONFIGMGR_LOCALIZEDTREEACTIONS_HXX - - diff --git a/configmgr/source/inc/logger.hxx b/configmgr/source/inc/logger.hxx deleted file mode 100644 index 57787c336647..000000000000 --- a/configmgr/source/inc/logger.hxx +++ /dev/null @@ -1,113 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_LOGGER_HXX -#define CONFIGMGR_LOGGER_HXX - -#include <com/sun/star/uno/XComponentContext.hpp> -#include <com/sun/star/util/logging/XLogger.hpp> -#include <com/sun/star/util/logging/LogLevel.hpp> - -namespace configmgr -{ -// ----------------------------------------------------------------------------- - namespace uno = com::sun::star::uno; - namespace logging = com::sun::star::util::logging; - namespace LogLevel = logging::LogLevel; - - /// class providing access to a log output sink in the context - class Logger - { - uno::Reference< logging::XLogger > m_xLogger; - public: - Logger() : m_xLogger() {} - - Logger(uno::Reference< logging::XLogger > const & xLogger) - : m_xLogger(xLogger) - {} - - explicit - Logger(uno::Reference< uno::XComponentContext > const & xContext) - : m_xLogger( getUnoLoggerFromContext(xContext) ) - {} - - sal_Int32 level() const - { return m_xLogger.is() ? m_xLogger->getLevel() : LogLevel::OFF; } - - bool isLogging(sal_Int32 nLogLevel) const - { return m_xLogger.is() && m_xLogger->isLoggable(nLogLevel); } - - /// log output to the logger - void log(sal_Int32 nLevel, const rtl::OUString & msg, const char * sourceMethod = 0, const char * sourceClass = 0) const; - void log(sal_Int32 nLevel, const char * msg, const char * sourceMethod = 0, const char * sourceClass = 0) const; - - void error(const rtl::OUString & msg, const char * sourceMethod = 0, const char * sourceClass = 0) const - { log( LogLevel::SEVERE, msg, sourceMethod, sourceClass); } - void error(const char * msg, const char * sourceMethod = 0, const char * sourceClass = 0) const - { log( LogLevel::SEVERE, msg, sourceMethod, sourceClass); } - - void warning(const rtl::OUString & msg, const char * sourceMethod = 0, const char * sourceClass = 0) const - { log( LogLevel::WARNING, msg, sourceMethod, sourceClass); } - void warning(const char * msg, const char * sourceMethod = 0, const char * sourceClass = 0) const - { log( LogLevel::WARNING, msg, sourceMethod, sourceClass); } - - void info(const rtl::OUString & msg, const char * sourceMethod = 0, const char * sourceClass = 0) const - { log( LogLevel::INFO, msg, sourceMethod, sourceClass); } - void info(const char * msg, const char * sourceMethod = 0, const char * sourceClass = 0) const - { log( LogLevel::INFO, msg, sourceMethod, sourceClass); } - - void config(const rtl::OUString & msg, const char * sourceMethod = 0, const char * sourceClass = 0) const - { log( LogLevel::CONFIG, msg, sourceMethod, sourceClass); } - void config(const char * msg, const char * sourceMethod = 0, const char * sourceClass = 0) const - { log( LogLevel::CONFIG, msg, sourceMethod, sourceClass); } - - void fine(const rtl::OUString & msg, const char * sourceMethod = 0, const char * sourceClass = 0) const - { log( LogLevel::FINE, msg, sourceMethod, sourceClass); } - void fine(const char * msg, const char * sourceMethod = 0, const char * sourceClass = 0) const - { log( LogLevel::FINE, msg, sourceMethod, sourceClass); } - - void finer(const rtl::OUString & msg, const char * sourceMethod = 0, const char * sourceClass = 0) const - { log( LogLevel::FINER, msg, sourceMethod, sourceClass); } - void finer(const char * msg, const char * sourceMethod = 0, const char * sourceClass = 0) const - { log( LogLevel::FINER, msg, sourceMethod, sourceClass); } - - void finest(const rtl::OUString & msg, const char * sourceMethod = 0, const char * sourceClass = 0) const - { log( LogLevel::FINEST, msg, sourceMethod, sourceClass); } - void finest(const char * msg, const char * sourceMethod = 0, const char * sourceClass = 0) const - { log( LogLevel::FINEST, msg, sourceMethod, sourceClass); } - - uno::Reference< logging::XLogger > getUnoLogger() const { return m_xLogger; } - - static - uno::Reference< logging::XLogger > - getUnoLoggerFromContext(uno::Reference< uno::XComponentContext > const & xContext); - }; -// ----------------------------------------------------------------------------- -} // namespace configmgr - -#endif // CONFIGMGR_LOGGER_HXX - diff --git a/configmgr/source/inc/matchlocale.hxx b/configmgr/source/inc/matchlocale.hxx deleted file mode 100644 index fe32f375dbf5..000000000000 --- a/configmgr/source/inc/matchlocale.hxx +++ /dev/null @@ -1,215 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -/* PLEASE DON'T DELETE ANY COMMENT LINES, ALSO IT'S UNNECESSARY. */ - -#ifndef CONFIGMGR_MATCHLOCALE_HXX -#define CONFIGMGR_MATCHLOCALE_HXX - -#include <com/sun/star/uno/Sequence.hxx> -#include <com/sun/star/lang/Locale.hpp> - -#include <rtl/ustring.hxx> -#include <vector> - -namespace configmgr -{ -// ----------------------------------------------------------------------------- - - namespace localehelper - { - // ------------------------------------------------------------------------- - namespace uno = ::com::sun::star::uno; - namespace lang = ::com::sun::star::lang; - - // ------------------------------------------------------------------------- - extern char const * const c_sAnyLanguage; - extern char const * const c_sDefLanguage; - - extern bool isAnyLanguage(rtl::OUString const & _sLanguage); - extern bool isDefaultLanguage(rtl::OUString const & _sLanguage); - - extern rtl::OUString getAnyLanguage(); - extern rtl::OUString getDefaultLanguage(); - - extern com::sun::star::lang::Locale getAnyLocale(); - extern com::sun::star::lang::Locale getDefaultLocale(); - - // ------------------------------------------------------------------------- - // the max value of std::vector< com::sun::star::lang::Locale >::size_type - marks out-of-range (Value == -1 == ~0) - std::vector< com::sun::star::lang::Locale >::size_type const c_noPosition = std::vector< com::sun::star::lang::Locale >::size_type(0)-std::vector< com::sun::star::lang::Locale >::size_type(1); - - // conversion helpers - com::sun::star::lang::Locale makeLocale(rtl::OUString const& sLocaleName_); - rtl::OUString makeIsoLocale(com::sun::star::lang::Locale const& aUnoLocale_); - - std::vector< com::sun::star::lang::Locale > makeLocaleSequence(uno::Sequence<rtl::OUString> const& sLocaleNames_); - uno::Sequence<rtl::OUString> makeIsoSequence(std::vector< com::sun::star::lang::Locale > const& aLocales_); - - inline - bool equalLocale(com::sun::star::lang::Locale const & lhs, com::sun::star::lang::Locale const & rhs) - { return lhs.Language == rhs.Language && lhs.Country == rhs.Country; } - - inline - bool equalLanguage(com::sun::star::lang::Locale const & lhs, com::sun::star::lang::Locale const & rhs) - { return lhs.Language == rhs.Language; } - // ------------------------------------------------------------------------- - bool designatesAllLocales(com::sun::star::lang::Locale const& aLocale_); - bool designatesAllLocales(std::vector< com::sun::star::lang::Locale > const& aLocales_); - // ------------------------------------------------------------------------- - - /// result of matching a locale against a target locale - enum MatchQuality - { - MISMATCH = 0, /// match: locales do not match (must be zero!) - MATCH_LANGUAGE, /// match: languages match - country mismatch - MATCH_LANGUAGE_PLAIN, /// match: languages match - no country to match - MATCH_LOCALE, /// match: full match - BEST_MATCH = MATCH_LOCALE - }; - - /// compare two locales for 'nearness' - MatchQuality match(com::sun::star::lang::Locale const& aLocale_, com::sun::star::lang::Locale const& aTarget_); - - - // ------------------------------------------------------------------------- - /// result of matching a Locale against a target sequence of locales - class MatchResult - { - std::vector< com::sun::star::lang::Locale >::size_type m_nPos; - MatchQuality m_eQuality; - - public: - /// construct a default (no match) result - MatchResult() - { reset(); } - - /// construct a result from given parameters - use with care - MatchResult(std::vector< com::sun::star::lang::Locale >::size_type nPos_, MatchQuality eQuality_) - : m_nPos( nPos_ ) - , m_eQuality(eQuality_) - {} - - /// construct an optimum result - static MatchResult best() { return MatchResult(0,MATCH_LOCALE); } - - /// has there been a match - bool isMatch() const { return m_eQuality != MISMATCH; } - /// is this the best match possible ? - bool isBest() const { return m_nPos == 0 && m_eQuality == MATCH_LOCALE; } - - /// retrieve the position that was matched - std::vector< com::sun::star::lang::Locale >::size_type position() const { return m_nPos; } - /// retrieve the quality of match - MatchQuality quality() const { return m_eQuality; } - - /// assign the given position and quality, if they are an improvement - bool improve(std::vector< com::sun::star::lang::Locale >::size_type nPos, MatchQuality eQuality_); - - /// reset to no match or best match state - void reset() - { - m_nPos = c_noPosition; - m_eQuality = MISMATCH; - } - - // --------------------------------------------------------------------- - // comparing MatchResults - friend bool operator ==(MatchResult const& lhs, MatchResult const& rhs) - { - return lhs.m_nPos == rhs.m_nPos && - lhs.m_eQuality == rhs.m_eQuality; - } - - // ordering of MatchResults - greater is better - friend bool operator < (MatchResult const& lhs, MatchResult const& rhs) - { - if (lhs.m_nPos > rhs.m_nPos) return true; // greater position is worse - if (lhs.m_nPos < rhs.m_nPos) return false; - - return (lhs.m_eQuality < rhs.m_eQuality); // least Quality is worse - } - - }; - - // --------------------------------------------------------------------- - // derived relational operators - inline bool operator !=(MatchResult const& lhs, MatchResult const& rhs) - { return !(lhs == rhs); } - inline bool operator > (MatchResult const& lhs, MatchResult const& rhs) - { return rhs < lhs; } - inline bool operator <= (MatchResult const& lhs, MatchResult const& rhs) - { return !(rhs < lhs); } - inline bool operator >=(MatchResult const& lhs, MatchResult const& rhs) - { return !(lhs < rhs); } - - /// improve an existing match of a locale against a sequence of locales - bool improveMatch(MatchResult& rMatch_, com::sun::star::lang::Locale const& aLocale_, std::vector< com::sun::star::lang::Locale > const& aTarget_); - - /// match a locale against a sequence of locales for a given quality level - bool isMatch(com::sun::star::lang::Locale const& aLocales, std::vector< com::sun::star::lang::Locale > const& aTarget_, MatchQuality eRequiredQuality_); - - // ------------------------------------------------------------------------- - /// add defaults to a sequence of locales - void addFallbackLocales(std::vector< com::sun::star::lang::Locale >& aTargetList_); - - // ------------------------------------------------------------------------- - class FindBestLocale - { - public: - /// construct a MatchLocale with a single target locale - FindBestLocale(com::sun::star::lang::Locale const& aTarget_); - - /// is there any match ? - bool isMatch() const { return m_aResult.isMatch(); } - - /// is there an optimum match (so we are done) ? - bool isBestMatch() const { return m_aResult.isBest(); } - - /// get the quality of the best match found - MatchQuality getMatchQuality() const { return m_aResult.quality(); } - - /// check, if the given locale improves the quality. if it does, accept it - bool accept(com::sun::star::lang::Locale const& aLocale_); - - /// reset the match result, indicating whether a match is needed at all - void reset(bool bNeedLocale_ = true); - - private: - void implSetTarget(std::vector< com::sun::star::lang::Locale > const& aTarget_); - - std::vector< com::sun::star::lang::Locale > m_aTarget; - MatchResult m_aResult; - }; - - } // namespace -// ----------------------------------------------------------------------------- - -} // namespace - -#endif - diff --git a/configmgr/source/inc/mergechange.hxx b/configmgr/source/inc/mergechange.hxx deleted file mode 100644 index 7bc24333a705..000000000000 --- a/configmgr/source/inc/mergechange.hxx +++ /dev/null @@ -1,68 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef INCLUDED_CONFIGMGR_MERGECHANGE_HXX -#define INCLUDED_CONFIGMGR_MERGECHANGE_HXX - -#include "namecreator.hxx" -#include "change.hxx" -#include "treechangelist.hxx" - -namespace configmgr -{ - // method that applies changes on a existing subtree - void combineUpdates (SubtreeChange const& _anUpdate, SubtreeChange& _aCombinedUpdate); - - // ----------------------------------------------------------------------------- - class OStripDefaults : private ChangeTreeModification - { - SubtreeChange& m_rParent; - public: - OStripDefaults(SubtreeChange& _rSubtree) : m_rParent(_rSubtree) {} - - bool isEmpty() const { return m_rParent.size() == 0; } - - OStripDefaults& strip(); - - static bool strip(SubtreeChange& _rSubtree) - { - return OStripDefaults(_rSubtree).strip().isEmpty(); - } - private: - void stripOne(Change& _rChange); - - virtual void handle(ValueChange& _rValueNode); - virtual void handle(AddNode& _rAddNode); - virtual void handle(RemoveNode& _rRemoveNode); - virtual void handle(SubtreeChange& _rSubtree); - }; - - // ----------------------------------------------------------------------------- -} // namespace configmgr - -#endif - diff --git a/configmgr/source/inc/mergeddataprovider.hxx b/configmgr/source/inc/mergeddataprovider.hxx deleted file mode 100644 index f4b42b3f0680..000000000000 --- a/configmgr/source/inc/mergeddataprovider.hxx +++ /dev/null @@ -1,173 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_BACKEND_MERGEDDATAPROVIDER_HXX -#define CONFIGMGR_BACKEND_MERGEDDATAPROVIDER_HXX - -#include "sal/config.h" - -#include "salhelper/simplereferenceobject.hxx" - -#include "request.hxx" -#include "requesttypes.hxx" -#include "utility.hxx" - -namespace configmgr -{ -// --------------------------------------------------------------------------- - namespace backend - { -// --------------------------------------------------------------------------- - /** Listener interface for receiving notifications - about changes to previously requested data - */ - struct SAL_NO_VTABLE INodeDataListener - { - /** is called to indicate changes within the data being observed. - - @param _aOriginalRequest - identifies the data that changed - */ - virtual void dataChanged(ComponentRequest const & _aOriginalRequest) SAL_THROW(()) = 0; - }; -// --------------------------------------------------------------------------- - - /// Interface providing access to template (schema) data - struct SAL_NO_VTABLE ITemplateDataProvider - { - /** loads a given template and returns it as return value - - @param _aRequest - identifies the template to be loaded - - @returns - A valid instance of the given template. - - <p> Currently a request with empty template name - will retrieve a group node holding all templates - of a component. - </p> - - @throws com::sun::star::uno::Exception - if the template cannot be retrieved. - The exact exception being thrown may depend on the underlying backend. - */ - virtual ResultHolder< TemplateInstance > getTemplateData(TemplateRequest const & _aRequest) - SAL_THROW((com::sun::star::uno::Exception)) = 0; - }; -// --------------------------------------------------------------------------- - - /** Composite interface providing full access to merged configuration data - from some data store. - - <p> Loading and updating of data is supported. - Support for notification depends on the backend. - </p> - */ - struct IMergedDataProvider - : salhelper::SimpleReferenceObject - , ITemplateDataProvider - { - /** loads merged data for a (partial) tree and returns it as return value. - - @param _aRequest - identifies the component to be loaded - - @param _pListener - a listener to observe subsequent changes to the data requested - - <p> If NULL, no notifications will be sent. </p> - - <p> Otherwise the listener will be notified of changes. - The listener must subsequently be removed by calling - <member>removeRequestListener</member>. - The listener must live at least until it is removed. - </p> - - @returns - A valid component instance for the given request. - - @throws com::sun::star::uno::Exception - if the node cannot be retrieved. - The exact exception being thrown may depend on the underlying backend. - */ - virtual ResultHolder< ComponentInstance > getNodeData(ComponentRequest const & _aRequest, - ITemplateDataProvider* _aTemplateProvider, - INodeDataListener * _pListener = NULL) - SAL_THROW((com::sun::star::uno::Exception)) = 0; - - /** remove a listener registered for a previous request. - <p>This may also release some open resources for the request.</p> - - @param _pListener - a listener that was passed to a previous succes - - @param _aRequest - identifies the component associated with the listener - */ - virtual void removeRequestListener(INodeDataListener * _pListener, - const ComponentRequest& aRequest) SAL_THROW(()) = 0; - - /** applies an update to the stored data. - - @param _anUpdate - identifies the node to be updated and - describes the changes to be applied. - - @throws com::sun::star::uno::Exception - if the node cannot be updated. - The exact exception being thrown may depend on the underlying backend. - */ - virtual void updateNodeData(UpdateRequest const & _anUpdate) - SAL_THROW((com::sun::star::uno::Exception)) = 0; - - /** loads default data for a (partial) tree and returns it as return value - - @param _aRequest - identifies the node to be loaded - - @returns - A valid node instance for the default state of the given node. - - <p>May be NULL, if the node exists but has no default equivalent.</p> - - @throws com::sun::star::uno::Exception - if the default cannot be retrieved. - The exact exception being thrown may depend on the underlying backend. - */ - virtual ResultHolder< NodeInstance > getDefaultData(NodeRequest const & _aRequest) - SAL_THROW((com::sun::star::uno::Exception)) = 0; - }; - -// --------------------------------------------------------------------------- - } // namespace backend - -// --------------------------------------------------------------------------- -} // namespace configmgr - -#endif - diff --git a/configmgr/source/inc/namecreator.hxx b/configmgr/source/inc/namecreator.hxx deleted file mode 100644 index 25a1da53c09e..000000000000 --- a/configmgr/source/inc/namecreator.hxx +++ /dev/null @@ -1,73 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef INCLUDED_CONFIGMGR_NAMECREATOR_HXX -#define INCLUDED_CONFIGMGR_NAMECREATOR_HXX - -#include "configpath.hxx" - -namespace configmgr -{ - // ----------------------------------------------------------------------------- - class Change; - class SubtreeChange; - // ----------------------------------------------------------------------------- - - class ONameCreator - { - public: - ONameCreator() {} - - void pushName(const configuration::Path::Component &_aName) { m_aNameList.push_back(_aName); } - void popName() { m_aNameList.pop_back(); } - - void clear() { m_aNameList.clear(); } - - static configuration::Path::Component createName(Change const& _rChange, SubtreeChange const* _pParent); - private: - std::vector< configuration::Path::Component > m_aNameList; - }; - - template <class PathClass> - class OPathCreator : public ONameCreator - { - public: - OPathCreator() : m_aBasePath( configuration::Path::Rep() ) {} - OPathCreator(PathClass const & _aBasePath) : m_aBasePath(_aBasePath) {} - - void init(PathClass const & _aBasePath) - { clear(); m_aBasePath = _aBasePath; } - - private: - PathClass m_aBasePath; - }; - // ----------------------------------------------------------------------------- - -} // namespace configmgr - -#endif - diff --git a/configmgr/source/inc/node.hxx b/configmgr/source/inc/node.hxx deleted file mode 100644 index 0e102921872d..000000000000 --- a/configmgr/source/inc/node.hxx +++ /dev/null @@ -1,229 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef INCLUDED_SHARABLE_NODE_HXX -#define INCLUDED_SHARABLE_NODE_HXX - -#include "rtl/ustring.hxx" - -#include "flags.hxx" -#include "anydata.hxx" - -namespace configmgr -{ -//----------------------------------------------------------------------------- - namespace node { struct Attributes; } -//----------------------------------------------------------------------------- - namespace sharable - { - struct TreeFragment; - union Node; - //----------------------------------------------------------------------------- - struct NodeInfo - { - rtl_uString * name; - sal_uInt16 parent; // always counts backwards - sal_uInt8 flags; - sal_uInt8 type; // contains discriminator for union - - rtl::OUString getName() const; - node::Attributes getNodeInfoAttributes() const; - bool isDefault() const; - bool isLocalized() const; - - void markAsDefault(bool bDefault = true); - }; - //----------------------------------------------------------------------------- - struct GroupNode - { - NodeInfo info; - sal_uInt16 numDescendants; // = number of descendants - - bool hasDefaultsAvailable() const; - - Node * getFirstChild() const; - Node * getNextChild(Node * child) const; - Node * getChild(rtl::OUString const & name) const; - - static inline GroupNode * from(Node * node); - }; - //----------------------------------------------------------------------------- - struct SetNode - { - - NodeInfo info; - sal_uInt8 * elementType; // points to template [MM:SetNode *?] - TreeFragment * elements; // points to first element (TreeFragmentHeader) - - rtl::OUString getElementTemplateName() const; - rtl::OUString getElementTemplateModule() const; - - TreeFragment * getFirstElement() const; - TreeFragment * getNextElement(TreeFragment * _pElement) const; - TreeFragment * getElement(rtl::OUString const & name) const; - - void addElement(TreeFragment * newElement); - TreeFragment * removeElement(rtl::OUString const & name); - - static inline SetNode * from(Node * node); - - // low-level helper for template data abstraction - static - sal_uInt8 * allocTemplateData(const rtl::OUString &rName, - const rtl::OUString &rModule); - static - sal_uInt8 * copyTemplateData(sal_uInt8 * _aTemplateData); - static - void releaseTemplateData(sal_uInt8 * _aTemplateData); - }; - //----------------------------------------------------------------------------- - struct ValueNode - { - NodeInfo info; - AnyData value; - AnyData defaultValue; - - bool isNull() const; - bool hasUsableDefault() const; - - com::sun::star::uno::Any getValue() const; - com::sun::star::uno::Type getValueType() const; - com::sun::star::uno::Any getUserValue() const; - com::sun::star::uno::Any getDefaultValue() const; - - void setValue(com::sun::star::uno::Any const & newValue); - void setToDefault(); - void changeDefault(com::sun::star::uno::Any const & newDefault); - - static inline ValueNode * from(Node * node); - - private: - void releaseValue(); - sal_uInt8 adaptType(com::sun::star::uno::Any const & newValue); - }; - //----------------------------------------------------------------------------- - // TODO: optimized representation of localized values (now as set; mapping locale->element-name) - // TODO (?): better representation of sets of values - //----------------------------------------------------------------------------- - union Node - { - NodeInfo info; - GroupNode group; - SetNode set; - ValueNode value; - - // info access - bool isNamed(rtl::OUString const & _aName) const; - rtl::OUString getName() const; - node::Attributes getAttributes() const; - bool isDefault() const; - - // type checks - bool isGroup() const { return typeIs (data::Type::nodetype_group); } - bool isSet() const { return typeIs (data::Type::nodetype_set); } - bool isValue() const { return typeIs (data::Type::nodetype_value); } - - // checked access - inline GroupNode * groupData(); - inline GroupNode const * groupData() const; - inline SetNode * setData(); - inline SetNode const * setData() const; - inline ValueNode * valueData(); - inline ValueNode const * valueData() const; - - // navigation - bool isFragmentRoot() const; -#if OSL_DEBUG_LEVEL > 0 - Node * getParentNode(); - Node const * getParentNode() const; -#endif - TreeFragment * getTreeFragment(); - TreeFragment const * getTreeFragment() const; - - Node * getSubnode(rtl::OUString const & name); - - private: - bool typeIs(data::Type::Type eType) const - { return (info.type & data::Type::mask_nodetype) == eType; } - }; - - //----------------------------------------------------------------------------- - inline GroupNode * GroupNode::from(Node * node) - { return node == 0 ? 0 : node->groupData(); } - - inline SetNode * SetNode::from(Node * node) - { return node == 0 ? 0 : node->setData(); } - - inline ValueNode * ValueNode::from(Node * node) - { return node == 0 ? 0 : node->valueData(); } - - inline GroupNode * Node::groupData() - { return isGroup() ? &this->group : NULL; } - inline GroupNode const * Node::groupData() const - { return isGroup() ? &this->group : NULL; } - inline SetNode * Node::setData() - { return isSet() ? &this->set : NULL; } - inline SetNode const * Node::setData() const - { return isSet() ? &this->set : NULL; } - inline ValueNode * Node::valueData() - { return isValue() ? &this->value : NULL; } - inline ValueNode const * Node::valueData() const - { return isValue() ? &this->value : NULL; } - - inline Node * node(ValueNode * pNode) - { return reinterpret_cast<Node*>(pNode); } - inline Node * node(GroupNode * pNode) - { return reinterpret_cast<Node*>(pNode); } - inline Node * node(SetNode * pNode) - { return reinterpret_cast<Node*>(pNode); } - - inline Node const * node(ValueNode const* pNode) - { return reinterpret_cast<Node const*>(pNode); } - inline Node const * node(GroupNode const* pNode) - { return reinterpret_cast<Node const*>(pNode); } - inline Node const * node(SetNode const* pNode) - { return reinterpret_cast<Node const*>(pNode); } - //----------------------------------------------------------------------------- - inline Node & node(ValueNode & pNode) - { return reinterpret_cast<Node&>(pNode); } - inline Node & node(GroupNode & pNode) - { return reinterpret_cast<Node&>(pNode); } - inline Node & node(SetNode & pNode) - { return reinterpret_cast<Node&>(pNode); } - - inline Node const & node(ValueNode const& pNode) - { return reinterpret_cast<Node const&>(pNode); } - inline Node const & node(GroupNode const& pNode) - { return reinterpret_cast<Node const&>(pNode); } - inline Node const & node(SetNode const& pNode) - { return reinterpret_cast<Node const&>(pNode); } - //----------------------------------------------------------------------------- - } -//----------------------------------------------------------------------------- -} - -#endif // INCLUDED_SHARABLE_NODE_HXX diff --git a/configmgr/source/inc/nodechange.hxx b/configmgr/source/inc/nodechange.hxx deleted file mode 100644 index db9856917b69..000000000000 --- a/configmgr/source/inc/nodechange.hxx +++ /dev/null @@ -1,157 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_CONFIGCHANGE_HXX_ -#define CONFIGMGR_CONFIGCHANGE_HXX_ - -#include "rtl/ref.hxx" - -#include "configexcept.hxx" - -#include <vector> - -namespace configmgr -{ - namespace configuration - { -//----------------------------------------------------------------------------- - class AbsolutePath; - class RelativePath; - class NodeRef; - class NodeID; - class SubNodeID; - class Tree; -//----------------------------------------------------------------------------- - - class NodeChange; - class NodeChangeImpl; - class NodeChangeLocation; - class NodeChangeInformation; - class NodeChangesInformation; -//----------------------------------------------------------------------------- - - /// represents a node position in some tree - class NodeChange - { - public: - /// constructs an empty (unchanging) node change - NodeChange(); - /// constructs a node change with a given implementation - NodeChange(NodeChangeImpl* pImpl); - /// copies a node change with reference semantics - NodeChange(NodeChange const& rOther); - /// copies a node change with reference semantics - NodeChange& operator=(NodeChange const& rOther); - /// swaps the contents of this with another NodeChange - void swap(NodeChange& rOther); - /// destroys a node change - ~NodeChange(); - - /// checks, if this may represent an actual change (might not be tested) - bool maybeChange() const; - /// checks, if this represents an actual change (PRE: must be tested) - bool isChange() const; - /// retrieve information about the changed data, appending to a sequence, returning the count - sal_uInt32 getChangeInfos(NodeChangesInformation& rInfo) const; - /// retrieve information about what node is changed - bool getChangeLocation(NodeChangeLocation& rLoc) const; - - /// test whether this would really be a change (as close as possible) - NodeChange& test(); - NodeChange const& test() const; - - /// apply this change and check whether the target node changed - NodeChange& apply(); - NodeChange const& apply() const; - - // retrieve the tree where the change is actually taking place - rtl::Reference< Tree > getAffectedTree() const; - // retrieve the node where the change is actually taking place - NodeRef getAffectedNode() const; - - // Comparison - friend bool operator==(NodeChange const& lhs, NodeChange const& rhs) - { - return lhs.m_pImpl == rhs.m_pImpl; - } - friend bool operator!=(NodeChange const& lhs, NodeChange const& rhs) - { - return lhs.m_pImpl != rhs.m_pImpl; - } - - /// provides access to the internal Implementation for related classes - NodeChangeImpl* impl() const { return m_pImpl; } - private: - NodeChangeImpl* m_pImpl; - void init(), deinit(); - }; - - /** represents a collection of updates to nodes (identified by <type>NodeChange</type>s) within a hierarchy of config entries - */ - class NodeChanges - { - public: - /// Constructs an empty collection of changes - NodeChanges(); - - /// checks whether there are any (non-empty) changes in this - bool isEmpty() const; - - /// retrieves the total count of changes in this collection - std::vector<NodeChange>::size_type getCount() const { return m_aChanges.size(); } - - /// retrieve information about the changed data, appending to a sequence, returning the count - sal_uInt32 getChangesInfos(NodeChangesInformation& rInfos) const; - - /// test all changes - NodeChanges& test() { implTest(); return *this; } - NodeChanges const& test() const { implTest(); return *this; } - - /// remove all changes known to be doing nothing from this collection. - NodeChanges& compact(); - - /** insert a change into this collection - */ - void add(NodeChange const& aChange); - - /// returns an STL-style iterator to the first element of the collection - std::vector<NodeChange>::const_iterator begin() const { return m_aChanges.begin(); } - std::vector<NodeChange>::iterator begin() { return m_aChanges.begin(); } - - /// returns an STL-style iterator to past the last element of the collection - std::vector<NodeChange>::const_iterator end() const { return m_aChanges.end(); } - std::vector<NodeChange>::iterator end() { return m_aChanges.end(); } - - private: - void implTest() const; - std::vector<NodeChange> m_aChanges; - }; - - } -} - -#endif // CONFIGMGR_CONFIGCHANGE_HXX_ diff --git a/configmgr/source/inc/nodechangeinfo.hxx b/configmgr/source/inc/nodechangeinfo.hxx deleted file mode 100644 index 2abc5dccece9..000000000000 --- a/configmgr/source/inc/nodechangeinfo.hxx +++ /dev/null @@ -1,246 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_CONFIGCHANGEINFO_HXX_ -#define CONFIGMGR_CONFIGCHANGEINFO_HXX_ - -#include "configpath.hxx" -#include "noderef.hxx" -#include "valueref.hxx" -#include <rtl/ref.hxx> - -#ifndef INCLUDED_VECTOR -#include <vector> -#define INCLUDED_VECTOR -#endif - -namespace configmgr -{ - namespace configuration - { -//----------------------------------------------------------------------------- - class NodeRef; - class ValueRef; - class NodeID; - class SubNodeID; - - class ElementTree; - -//----------------------------------------------------------------------------- - /// captures the values of something changing - template <class DataT> - struct DataChange - { - DataT newValue; - DataT oldValue; - - DataChange() - : newValue(), oldValue() - {} - - DataChange(DataT const& newValue_, DataT const& oldValue_) - : newValue(newValue_), oldValue(oldValue_) - {} - - // note: maybe we should support a comparison object - bool isDataChange() const - { return !(oldValue == newValue); } // not using != to avoid conversion warning - }; - -//----------------------------------------------------------------------------- - /// information about what changed (but close to no context) - class NodeChangeData - { - public: - //------------------------------------------------- - enum Type - { - eNoChange, - - // Changes to value nodes - eSetValue, - eSetDefault, - - // Changes to set nodes - eInsertElement, - eReplaceElement, - eRemoveElement, - - eRenameElementTree, // not fully supported yet - - eResetSetDefault - }; - //------------------------------------------------- - - bool isEmptyChange() const { return eNoChange == type; } - bool isValueChange() const { return eSetValue <= type && type <= eSetDefault; } - bool isSetChange() const { return eInsertElement <= type && type <= eRemoveElement; } - bool isRemoveSetChange() const { return eRemoveElement == type;} - bool isReplaceSetChange() const { return eReplaceElement == type;} - //------------------------------------------------- - bool isDataChange() const; - - //------------------------------------------------- - // wrapper object creation - rtl::Reference< Tree > getNewElementTree() const; - rtl::Reference< Tree > getOldElementTree() const; - - NodeID getNewElementNodeID() const; - NodeID getOldElementNodeID() const; - //------------------------------------------------- - - //-- Compiler barrier for element tree ------------ - NodeChangeData(); - NodeChangeData(NodeChangeData const& aOther); - NodeChangeData& operator=(NodeChangeData const& aOther); - ~NodeChangeData(); - //------------------------------------------------- - Type type; - - // Value change: old/new value; Set change: new/old api element (if known); Rename: old/new name - DataChange< com::sun::star::uno::Any > unoData; - // Value change: NULL,NULL; Set change: new/old tree element; Rename: the affected element-tree (twice) - DataChange< rtl::Reference<ElementTree> > element; - //------------------------------------------------- - }; - - //------------------------------------------------- - // Identify the location of a change. Interpretation of members may depend upon - class NodeChangeLocation - { - public: - //------------------------------------------------- - // checks whether the base has been properly set up. - // Does not check for existence of the affected node -#if OSL_DEBUG_LEVEL > 0 - /// check whether the location has been initialized properly - bool isValidData() const; -#endif - /// check whether the location is for a valid object - bool isValidLocation() const; - - //------------------------------------------------- - /// retrieve the path from the base node to the changed node (which might be a child of the affected node) - RelativePath getAccessor() const { return m_path; } - - /// retrieve the tree where the change is actually initiated/reported - rtl::Reference< Tree > getBaseTree() const; - /// retrieve the node where the change is actually initiated/reported - NodeRef getBaseNode() const; - - /// retrieve the tree where the change is actually taking place (may be Empty, if the tree has never been accessed) - rtl::Reference< Tree > getAffectedTreeRef() const; - /// identify the node where the change is actually taking place - NodeID getAffectedNodeID() const; - - /// identify the node (within the affected tree), that actually is changed (this one may be a value node) - SubNodeID getChangingValueID() const; - - //------------------------------------------------- - void setAccessor( RelativePath const& aAccessor ); - - void setBase( NodeID const& aBaseID ); - void setBase( rtl::Reference< Tree > const& aBaseTree, NodeRef const& aBaseNode ) - { setBase( NodeID(aBaseTree,aBaseNode) ); } - - void setAffected( NodeID const& aTargetID ); - void setAffected( rtl::Reference< Tree > const& aTargetTree, NodeRef const& aTargetNode ) - { setAffected( NodeID(aTargetTree,aTargetNode) ); } - - void setChangingSubnode( bool bSubnode = true ); - //------------------------------------------------- - NodeChangeLocation(); - // NodeChangeLocation(NodeChangeLocation const& aOther); - // NodeChangeLocation& operator=(NodeChangeLocation const& aOther); - // ~NodeChangeLocation(); - //------------------------------------------------- - private: - RelativePath m_path; // path from baseNode to changing node - NodeID m_base; // a (non-empty) node - NodeID m_affected; // identifies the affected node (if available) - bool m_bSubNodeChanging; // do we change a value ? - //------------------------------------------------- - }; -//----------------------------------------------------------------------------- - class NodeChangeInformation - { - public: - //------------------------------------------------- - explicit - NodeChangeInformation() - : change() - , location() - { - } - //------------------------------------------------- - NodeChangeData change; - NodeChangeLocation location; - - //------------------------------------------------- - bool hasValidLocation() const { return location.isValidLocation(); } - bool isDataChange() const { return change.isDataChange(); } - - bool isEmptyChange() const { return change.isEmptyChange(); } - bool isValueChange() const { return change.isValueChange(); } - bool isSetChange() const { return change.isSetChange(); } - //------------------------------------------------- - }; -//----------------------------------------------------------------------------- - - class NodeChangesInformation - { - public: - std::vector< NodeChangeInformation >::size_type size() const { return m_data.size(); } - bool empty() const { return m_data.empty(); } - - void reserve(std::vector< NodeChangeInformation >::size_type sz_) { m_data.reserve(sz_); } - void clear() { m_data.clear(); } - void swap(NodeChangesInformation& aOther) throw() { m_data.swap(aOther.m_data); } - - void push_back(NodeChangeInformation const& aChange_) - { m_data.push_back(aChange_); } - - std::vector< NodeChangeInformation >::const_iterator begin() const { return m_data.begin(); } - std::vector< NodeChangeInformation >::const_iterator end() const { return m_data.end(); } - private: - std::vector< NodeChangeInformation > m_data; - }; -//----------------------------------------------------------------------------- - } -} - -#if !defined(WNT) || (defined(WNT) && _MSC_VER < 1400) -namespace std -{ - template <> - inline - void swap(configmgr::configuration::NodeChangesInformation& lhs, configmgr::configuration::NodeChangesInformation& rhs) - { lhs.swap(rhs); } -} -#endif - -#endif // CONFIGMGR_CONFIGCHANGEINFO_HXX_ diff --git a/configmgr/source/inc/nodeconverter.hxx b/configmgr/source/inc/nodeconverter.hxx deleted file mode 100644 index 276b29f99979..000000000000 --- a/configmgr/source/inc/nodeconverter.hxx +++ /dev/null @@ -1,61 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_NODECONVERTER_HXX -#define CONFIGMGR_NODECONVERTER_HXX - -#include "change.hxx" - -//.......................................................................... -namespace configmgr -{ -//.......................................................................... - class OTreeNodeFactory; -//.......................................................................... - class OTreeNodeConverter - { - OTreeNodeFactory& m_rFactory; - public: - OTreeNodeConverter(); - OTreeNodeConverter(OTreeNodeFactory& _rFactory) - : m_rFactory(_rFactory) {} - - OTreeNodeFactory& nodeFactory() const { return m_rFactory; } - // node conversion functions - std::auto_ptr<ISubtree> createCorrespondingNode(SubtreeChange const& _rChange); - std::auto_ptr<ValueNode> createCorrespondingNode(ValueChange const& _rChange); - - std::auto_ptr<ISubtree> createCorrespondingTree(SubtreeChange& _rChange); - }; - -//.......................................................................... -} // namespace configmgr -//.......................................................................... - -#endif // CONFIGMGR_NODECONVERTER_HXX - - diff --git a/configmgr/source/inc/noderef.hxx b/configmgr/source/inc/noderef.hxx deleted file mode 100644 index 430b4af0cd9f..000000000000 --- a/configmgr/source/inc/noderef.hxx +++ /dev/null @@ -1,268 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_CONFIGNODE_HXX_ -#define CONFIGMGR_CONFIGNODE_HXX_ - -#include "rtl/ref.hxx" - -#include "configexcept.hxx" -#include "configpath.hxx" -#include "tree.hxx" - -#ifndef INCLUDED_VECTOR -#include <vector> -#define INCLUDED_VECTOR -#endif - -namespace configmgr -{ - class INode; - - namespace view { class ViewTreeAccess; } - namespace configapi { class Factory; } - namespace node { struct Attributes; } - namespace configuration - { - //------------------------------------------------------------------------- - class AbsolutePath; - class RelativePath; - namespace Path { class Component; } - - class NodeChange; - class NodeChanges; - class NodeRef; - class ValueRef; - class AnyNodeRef; - - class NodeID; - - const unsigned int C_TreeDepthAll = ~0u; - //------------------------------------------------------------------------- - - /// represents a inner node position in some tree - class NodeRef - { - public: - /// constructs an empty (invalid) node - NodeRef(); - - NodeRef(unsigned int nPos, unsigned int nDepth); - - /// copy a node (with reference semantics) - NodeRef(NodeRef const& rOther); - /// copy a node (with reference semantics) - NodeRef& operator=(NodeRef const& rOther); - - void swap(NodeRef& rOther); - - ~NodeRef(); - - /// checks, if this represents an existing node - inline bool isValid() const; - - /// returns the offset of this Node - inline unsigned int getOffset() const; - - /// returns the offset of this Node - inline unsigned int getDepth() const; - - private: - friend class AnyNodeRef; - private: - unsigned int m_nPos; - unsigned int m_nDepth; - }; - //------------------------------------------------------------------------- - - class NodeID - { - public: - NodeID(rtl::Reference< Tree > const& rTree, NodeRef const& rNode); - NodeID(Tree* pImpl, unsigned int nNode); - - // comparison - // equality - friend bool operator==(NodeID const& lhs, NodeID const& rhs) - { return lhs.m_pTree == rhs.m_pTree && lhs.m_nNode == rhs.m_nNode; } - // ordering - friend bool operator < (NodeID const& lhs, NodeID const& rhs); - // checking - bool isEmpty() const; - // checking - bool isValidNode() const; - // hashing - size_t hashCode() const; - // use as index - returns a value in the range 0..rTree.getContainedNodes() for the tree used to construct this - unsigned int toIndex() const; - - Tree * getTree() const { return m_pTree; } - - unsigned int getOffset() const { return m_nNode; } - - NodeRef getNode() const; - - private: - Tree* m_pTree; - unsigned int m_nNode; - }; - //------------------------------------------------------------------------- - - /** make a name out of <var>sName</var>. - @throws InvalidName - if <var>sName</var> is not a valid name for a member of group <var>aNode</var> within <var>aTree</var> - - */ - rtl::OUString validateChildName(rtl::OUString const& sName, rtl::Reference< Tree > const& aTree, NodeRef const& aNode ); - - /** make a name out of <var>sName</var>. - @throws InvalidName - if <var>sName</var> is not a valid name for an element of set <var>aNode</var> within <var>aTree</var> - - */ - rtl::OUString validateElementName(rtl::OUString const& sName, rtl::Reference< Tree > const& aTree, NodeRef const& aNode ); - - /** make a name out of <var>sName</var>. - @throws InvalidName - if <var>sName</var> is not a valid name for a child of <var>aNode</var> within <var>aTree</var> - - */ - rtl::OUString validateChildOrElementName(rtl::OUString const& sName, rtl::Reference< Tree > const& aTree, NodeRef const& aNode ); - - /** make one path component out of <var>sName</var>. - @throws InvalidName - if <var>sName</var> is not a valid name for an element of set <var>aNode</var> within <var>aTree</var> - - */ - Path::Component validateElementPathComponent(rtl::OUString const& sName, rtl::Reference< Tree > const& aTree, NodeRef const& aNode ); - - /** parse <var>aPath</var> into a relative path, - valid in the context of node <var>aNode<var/> in <var>aTree<var/>. - - @returns - <var>aPath<var/> parsed as a relative path - @throws InvalidName - if <var>aPath<var/> is not a relative path or not valid in the context of <var>aNode<var/> - */ - RelativePath validateRelativePath(rtl::OUString const& aPath, rtl::Reference< Tree > const& aTree, NodeRef const& aNode); - - /** parse <var>aPath</var> as a configuration path - and reduce it to be relative to node <var>aNode<var/> in <var>aTree<var/>. - - @returns - the result of parsing <var>aPath<var/>, if that results in a relative path, or - the part of it relative to <var>aNode<var/>, - if it is an absolute path to a descendant of <var>aNode<var/> - @throws InvalidName - if <var>aPath<var/> is not awell-formed path or - if it is an absolute path that is not to a descendant of <var>aNode<var/> - */ - RelativePath validateAndReducePath(rtl::OUString const& aPath, rtl::Reference< Tree > const& aTree, NodeRef const& aNode); - /** checks whether there is an immediate child of <var>aNode</var> (which is in <var>aTree</var>) - specified by <var>aName</var> - - @return - <TRUE/> if the child node exists - <FALSE/> otherwise - */ - bool hasChildOrElement(rtl::Reference< Tree > const& aTree, NodeRef const& aNode, rtl::OUString const& aName); - - /** checks whether there is an immediate child of <var>aNode</var> (which is in <var>aTree</var>) - specified by <var>aName</var> - - @return - <TRUE/> if the child node exists - <FALSE/> otherwise - */ - bool hasChildOrElement(rtl::Reference< Tree > const& aTree, NodeRef const& aNode, Path::Component const& aName); - - /** tries to find the immediate child of <var>aNode</var> (which is in <var>aTree</var>) - specified by <var>aName</var> - <p> On return <var>aNode</var> is modified to refer to the node found and - <var>aTree</var> will then refer to the tree that node is in. - <p/> - <p>Caution: May miss an existing child unless the child has been accessed before.</p> - - @return - <TRUE/> if the child node exists and is available - (so <var>aNode</var> and <var>aTree</var> refer to the desired node), - <FALSE/> otherwise - - @see NodeRef::getAvailableChild - */ - bool findInnerChildOrAvailableElement(rtl::Reference< Tree >& aTree, NodeRef& aNode, rtl::OUString const& aName); - - /// test whether the given node is a structural (inner) node - bool isStructuralNode(rtl::Reference< Tree > const& aTree, NodeRef const& aNode); - - /// test whether the given inner node is a group node - bool isGroupNode(rtl::Reference< Tree > const& aTree, NodeRef const& aNode); - - /// get the value for a node that is a simple value (as tree element) - com::sun::star::uno::Any getSimpleElementValue(rtl::Reference< Tree > const& aTree, NodeRef const& aNode); - - /// test whether the given inner node is a set node - bool isSetNode(rtl::Reference< Tree > const& aTree, NodeRef const& aNode); - - void getAllContainedNodes(rtl::Reference< Tree > const& aTree, std::vector<NodeID>& aList); - NodeID findNodeFromIndex(rtl::Reference< Tree > const& aTreeRef, unsigned int nIndex); - - //------------------------------------------------------------------------- - inline bool NodeRef::isValid() const - { - return m_nPos != 0; - } - - //------------------------------------------------------------------------- - inline unsigned int NodeRef::getOffset() const - { - return m_nPos; - } - - //------------------------------------------------------------------------- - inline unsigned int NodeRef::getDepth() const - { - return m_nDepth; - } - - //------------------------------------------------------------------------- - inline bool operator!=(NodeID const& lhs, NodeID const& rhs) - { return !(lhs == rhs); } - //--------------------------------------------------------------------- - - inline bool operator>=(NodeID const& lhs, NodeID const& rhs) - { return !(lhs < rhs); } - //--------------------------------------------------------------------- - inline bool operator > (NodeID const& lhs, NodeID const& rhs) - { return (rhs < lhs); } - inline bool operator<=(NodeID const& lhs, NodeID const& rhs) - { return !(rhs < lhs); } - //------------------------------------------------------------------------- - } -} - -#endif // CONFIGMGR_CONFIGNODE_HXX_ diff --git a/configmgr/source/inc/nodevisitor.hxx b/configmgr/source/inc/nodevisitor.hxx deleted file mode 100644 index 9578a59067ef..000000000000 --- a/configmgr/source/inc/nodevisitor.hxx +++ /dev/null @@ -1,77 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef INCLUDED_CONFIGMGR_SOURCE_INC_NODEVISITOR_HXX -#define INCLUDED_CONFIGMGR_SOURCE_INC_NODEVISITOR_HXX - -#include "sal/config.h" - -namespace configmgr { namespace sharable { - struct GroupNode; - struct SetNode; - struct TreeFragment; - struct ValueNode; - union Node; -} } - -namespace configmgr { namespace data { - -class NodeVisitor { -public: - virtual ~NodeVisitor() = 0; - - bool visitNode(sharable::Node * node); - - bool visitChildren(sharable::GroupNode * node); - -protected: - virtual bool handle(sharable::Node * node); - - virtual bool handle(sharable::ValueNode * node); - - virtual bool handle(sharable::GroupNode * node); - - virtual bool handle(sharable::SetNode * node); -}; - -class SetVisitor: public NodeVisitor { -public: - virtual ~SetVisitor() = 0; - - bool visitTree(sharable::TreeFragment * tree); - - bool visitElements(sharable::SetNode * node); - -protected: - using NodeVisitor::handle; - - virtual bool handle(sharable::TreeFragment * tree); -}; - -} } - -#endif diff --git a/configmgr/source/inc/options.hxx b/configmgr/source/inc/options.hxx deleted file mode 100644 index 5d851ae7b951..000000000000 --- a/configmgr/source/inc/options.hxx +++ /dev/null @@ -1,102 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_MISC_OPTIONS_HXX_ -#define CONFIGMGR_MISC_OPTIONS_HXX_ - -#include "requestoptions.hxx" -#include <com/sun/star/uno/Any.hxx> -#include <com/sun/star/uno/Reference.hxx> -#include "utility.hxx" -#include <salhelper/simplereferenceobject.hxx> -#include <vos/ref.hxx> - -namespace configmgr -{ - namespace css = ::com::sun::star; - - /** - class OOptions is created one time per Configuration[update]Access - all important options should stored in this class. - The object will be forwarded to all other objects so we only - need to extend this classobject and all other class can work with - the new options or important options etc. - */ - - class OOptions : public salhelper::SimpleReferenceObject - { - RequestOptions m_aRequestOptions; // current options to use - - public: - OOptions() - : m_aRequestOptions() - {} - - explicit - OOptions(const RequestOptions& _aDefaultOptions) - : m_aRequestOptions(_aDefaultOptions) - { - } - - OOptions(const OOptions& _aOtherOptions) - : SimpleReferenceObject() - , m_aRequestOptions(_aOtherOptions.m_aRequestOptions) - { - } - - bool isForSessionUser() const { return ! m_aRequestOptions.hasEntity(); } - - rtl::OUString getLocale() const { return m_aRequestOptions.getLocale(); } - rtl::OUString getUser() const { return m_aRequestOptions.getEntity(); } - - RequestOptions const & getRequestOptions() const - { return m_aRequestOptions; } - - void setUser(const rtl::OUString & _rUser) - { m_aRequestOptions.setEntity(_rUser); } - - void setLocale(const com::sun::star::lang::Locale & _rLocale) - { m_aRequestOptions.setLocale(_rLocale); } - - void setMultiLocaleMode() - { m_aRequestOptions.setAllLocales(); } - - void enableAsync(bool _bEnable) - { m_aRequestOptions.enableAsync(_bEnable); } - }; - - struct ltOptions - { - lessRequestOptions ltData; - bool operator()(vos::ORef<OOptions> const &o1, vos::ORef<OOptions> const &o2) const - { - return ltData(o1->getRequestOptions(),o2->getRequestOptions()); - } - }; -} // namespace - -#endif diff --git a/configmgr/source/inc/oslstream.hxx b/configmgr/source/inc/oslstream.hxx deleted file mode 100644 index 0a07044ad955..000000000000 --- a/configmgr/source/inc/oslstream.hxx +++ /dev/null @@ -1,131 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef _CONFIGMGR_OSLSTREAM_HXX_ -#define _CONFIGMGR_OSLSTREAM_HXX_ - -#include <com/sun/star/io/XOutputStream.hpp> -#include <com/sun/star/io/XInputStream.hpp> -#include <cppuhelper/implbase1.hxx> -#include <osl/mutex.hxx> - -#include "bufferedfile.hxx" - -namespace osl -{ - class File; -} - -namespace configmgr -{ - namespace stario = ::com::sun::star::io; - namespace staruno = ::com::sun::star::uno; - -// ----------------------------------------------------------------------------- - /// OSLInputStreamWrapper - implementation of XInputStream on an (unbuffered) osl::File - class OSLInputStreamWrapper : public ::cppu::WeakImplHelper1<stario::XInputStream> - { - ::osl::Mutex m_aMutex; - ::osl::File* m_pFile; - sal_Bool m_bFileOwner : 1; - - public: - /// c'tor. _rStream must live at least until closeInput() is called on this stream - OSLInputStreamWrapper(::osl::File& _rStream); - /// c'tor. if bOwner is <FALSE/> *pStream must live at least until closeInput() is called on this stream - OSLInputStreamWrapper(::osl::File* pStream, sal_Bool bOwner=sal_False); - virtual ~OSLInputStreamWrapper(); - - // stario::XInputStream - virtual sal_Int32 SAL_CALL - readBytes(staruno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead) - throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException); - - virtual sal_Int32 SAL_CALL - readSomeBytes(staruno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead) - throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException); - - virtual void SAL_CALL - skipBytes(sal_Int32 nBytesToSkip) - throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException); - - virtual sal_Int32 SAL_CALL available() throw(stario::NotConnectedException, staruno::RuntimeException); - virtual void SAL_CALL closeInput() throw(stario::NotConnectedException, staruno::RuntimeException); - }; - -// ----------------------------------------------------------------------------- - /// OSLOutputStreamWrapper - implementation of XOutputStream on an (unbuffered) osl::File - class OSLOutputStreamWrapper : public ::cppu::WeakImplHelper1<stario::XOutputStream> - { - ::osl::Mutex m_aMutex; - ::osl::File& rFile; - - public: - /// c'tor. _rStream must live at least until closeOutput() is called on this stream - OSLOutputStreamWrapper(::osl::File& _rFile) :rFile(_rFile) { } - - // stario::XOutputStream - virtual void SAL_CALL writeBytes(const staruno::Sequence< sal_Int8 >& aData) - throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException); - - virtual void SAL_CALL flush() - throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException); - - virtual void SAL_CALL closeOutput() - throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException); - }; -// ----------------------------------------------------------------------------- - /// BufferedFileOutputStream - buffered implementation of XOutputStream on an osl::File - class BufferedFileOutputStream: public ::cppu::WeakImplHelper1<stario::XOutputStream> - { - BufferedOutputFile m_aFile; - - public: - BufferedFileOutputStream(rtl::OUString const & aFileURL, bool bCreate=true, sal_uInt32 nBufferSizeHint=0); - virtual ~BufferedFileOutputStream(); - - // stario::XOutputStream - virtual void SAL_CALL writeBytes(const staruno::Sequence< sal_Int8 >& aData) - throw(stario::NotConnectedException, stario::BufferSizeExceededException, - stario::IOException, staruno::RuntimeException); - - virtual void SAL_CALL flush() - throw(stario::NotConnectedException, stario::BufferSizeExceededException, - stario::IOException, staruno::RuntimeException); - - virtual void SAL_CALL closeOutput() - throw(stario::NotConnectedException, stario::BufferSizeExceededException, - stario::IOException, staruno::RuntimeException); - }; -// ----------------------------------------------------------------------------- - -} // namespace configmgr - -#endif // _CONFIGMGR_OSLSTREAM_HXX_ - - - diff --git a/configmgr/source/inc/propertysethelper.hxx b/configmgr/source/inc/propertysethelper.hxx deleted file mode 100644 index 16289691be14..000000000000 --- a/configmgr/source/inc/propertysethelper.hxx +++ /dev/null @@ -1,110 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_MISC_PROPERTYSETHELPER_HXX -#define CONFIGMGR_MISC_PROPERTYSETHELPER_HXX - -#include <cppuhelper/propshlp.hxx> -#include <cppuhelper/weak.hxx> - -//.......................................................................... -namespace configmgr { - namespace apihelper { -//.......................................................................... - namespace uno = com::sun::star::uno; - namespace lang = com::sun::star::lang; - namespace beans = com::sun::star::beans; -//.......................................................................... -class BroadcasterBase -{ - osl::Mutex m_aMutex; - cppu::OBroadcastHelper m_aBroadcastHelper; - -protected: - BroadcasterBase() : m_aMutex(), m_aBroadcastHelper(m_aMutex) {} - ~BroadcasterBase() {} - - osl::Mutex & getBroadcastMutex() { return m_aMutex; } - cppu::OBroadcastHelper & getBroadcastHelper() { return m_aBroadcastHelper; } -}; - -//.......................................................................... - -class PropertySetHelper : protected BroadcasterBase // must be first - , public cppu::OWeakObject - , public cppu::OPropertySetHelper // not copyable -{ -public: - PropertySetHelper(); - ~PropertySetHelper(); - - // XInterface - virtual uno::Any SAL_CALL queryInterface( uno::Type const & rType ) throw (uno::RuntimeException); - virtual void SAL_CALL acquire() throw (); - virtual void SAL_CALL release() throw (); - // XTypeProvider - virtual uno::Sequence< uno::Type > SAL_CALL getTypes() throw (uno::RuntimeException); - - // to be provided by derived classes - // virtual uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (uno::RuntimeException) = 0; - - // XPropertySet - virtual uno::Reference< beans::XPropertySetInfo > SAL_CALL - getPropertySetInfo( ) throw (uno::RuntimeException); - - -protected: -// new methods still to be overridden - virtual cppu::IPropertyArrayHelper * SAL_CALL newInfoHelper() = 0; - -// cppu::OPropertySetHelper interface -#if 0 // these methods still must be overridden - virtual cppu::IPropertyArrayHelper * SAL_CALL newInfoHelper() = 0; - - virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const uno::Any& rValue ) - throw (uno::Exception) = 0; - - virtual void SAL_CALL getFastPropertyValue( uno::Any& rValue, sal_Int32 nHandle ) const = 0; -#endif - virtual cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); - - // default implementation: does not do any conversion - virtual sal_Bool SAL_CALL convertFastPropertyValue( - uno::Any & rConvertedValue, uno::Any & rOldValue, - sal_Int32 nHandle, const uno::Any& rValue ) - throw (lang::IllegalArgumentException); -private: - cppu::IPropertyArrayHelper * m_pHelper; -}; -//.......................................................................... - } // namespace apihelper -} // namespace configmgr -//.......................................................................... - -#endif - - diff --git a/configmgr/source/inc/request.hxx b/configmgr/source/inc/request.hxx deleted file mode 100644 index 242230970da9..000000000000 --- a/configmgr/source/inc/request.hxx +++ /dev/null @@ -1,152 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_BACKEND_REQUEST_HXX_ -#define CONFIGMGR_BACKEND_REQUEST_HXX_ - -#include "requestoptions.hxx" -#include "requesttypes.hxx" -#include "configpath.hxx" - -namespace configmgr -{ -// --------------------------------------------------------------------------- - namespace backend - { -// --------------------------------------------------------------------------- - - class NodeRequest - { - configuration::AbsolutePath m_aNodePath; - RequestOptions m_aOptions; - public: - NodeRequest(configuration::AbsolutePath const& _aNodePath, RequestOptions const & _aOptions) - : m_aNodePath(_aNodePath) - , m_aOptions(_aOptions) - { - } - - configuration::AbsolutePath const & getPath() const { return m_aNodePath; } - RequestOptions const & getOptions() const { return m_aOptions; } - }; -// --------------------------------------------------------------------------- - - class ComponentRequest - { - rtl::OUString m_aComponentName; - RequestOptions m_aOptions; - bool m_bForcedReload; - public: - ComponentRequest(rtl::OUString const& _aComponentName, RequestOptions const & _aOptions) - : m_aComponentName(_aComponentName) - , m_aOptions(_aOptions) - , m_bForcedReload(false) - { - } - - rtl::OUString const & getComponentName() const { return m_aComponentName; } - RequestOptions const & getOptions() const { return m_aOptions; } - - bool isForcingReload() const { return m_bForcedReload; } - void forceReload(bool _bForce = true) { m_bForcedReload = _bForce; } - }; -// --------------------------------------------------------------------------- - - class TemplateRequest - { - rtl::OUString m_aComponentName; - rtl::OUString m_aTemplateName; - - public: - static - TemplateRequest forComponent(rtl::OUString const & _aComponentName) - { - return TemplateRequest( rtl::OUString(), _aComponentName); - } - - explicit - TemplateRequest(rtl::OUString const & _aTemplateName, rtl::OUString const & _aComponentName) - : m_aComponentName(_aComponentName) - , m_aTemplateName(_aTemplateName) - {} - - bool isComponentRequest() const { return m_aTemplateName.getLength() == 0; } - rtl::OUString getTemplateName() const { return m_aTemplateName; } - rtl::OUString getComponentName() const { return m_aComponentName; } - - }; - -// --------------------------------------------------------------------------- - - class UpdateRequest - { - ConstUpdateInstance m_aUpdate; - RequestOptions m_aOptions; - rtl::OUString m_aRQID; - public: - explicit - UpdateRequest( UpdateInstance const & _aUpdate, - RequestOptions const & _aOptions) - : m_aUpdate(_aUpdate) - , m_aOptions(_aOptions) - {} - - explicit - UpdateRequest( ConstUpdateInstance const & _aUpdate, - RequestOptions const & _aOptions) - : m_aUpdate(_aUpdate) - , m_aOptions(_aOptions) - {} - - explicit - UpdateRequest( ConstUpdateInstance::Data _aUpdateData, - configuration::AbsolutePath const & _aRootpath, - RequestOptions const & _aOptions) - : m_aUpdate(_aUpdateData, _aRootpath) - , m_aOptions(_aOptions) - {} - - bool isSyncRequired() const { return !m_aOptions.isAsyncEnabled(); } - - RequestOptions const & getOptions() const { return m_aOptions; } - configuration::AbsolutePath const & getUpdateRoot() const { return m_aUpdate.root(); } - - ConstUpdateInstance const & getUpdate() const { return m_aUpdate; } - ConstUpdateInstance::Data getUpdateData() const { return m_aUpdate.data(); } - - void setRequestId(rtl::OUString const & _aRQID) { m_aRQID = _aRQID; } - rtl::OUString getRequestId() const { return m_aRQID; } - }; - - inline ComponentRequest getComponentRequest(UpdateRequest const & _aUR) - { return ComponentRequest(_aUR.getUpdateRoot().getModuleName(), _aUR.getOptions()); } -// --------------------------------------------------------------------------- - } // namespace -// --------------------------------------------------------------------------- -} // namespace - -#endif diff --git a/configmgr/source/inc/requestoptions.hxx b/configmgr/source/inc/requestoptions.hxx deleted file mode 100644 index 5613be1450a7..000000000000 --- a/configmgr/source/inc/requestoptions.hxx +++ /dev/null @@ -1,121 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_MISC_REQUESTOPTIONS_HXX_ -#define CONFIGMGR_MISC_REQUESTOPTIONS_HXX_ - -#include <com/sun/star/lang/Locale.hpp> -#include <rtl/ustring.hxx> - -namespace configmgr -{ -// --------------------------------------------------------------------------- - - /** - Options which can be used to modify a request for data - */ - class RequestOptions - { - public: - /// Default constructor. Sets options to use defaults. - RequestOptions() - : m_sLocale() - , m_sEntity() - , m_bEnableAsync(true) - , m_bReload(false) - {} - - /// @returns <TRUE/>, if data can be written asynchronously - bool isAsyncEnabled() const { return m_bEnableAsync; } - /// @returns <TRUE/>, if data is reloaded into cache - bool isRefreshEnabled() const { return m_bReload; } - /** @returns - <TRUE/>, if a locale is specified, <BR/> - <FALSE/>, if the default locale should be used - */ - bool hasLocale() const { return m_sLocale.Language.getLength() != 0; } - /// @returns the locale to get data for - bool isForAllLocales() const; - /// @returns the locale to get data for - compatibilty version - rtl::OUString getLocale() const { return getIsoLocale(); } - /// @returns the locale to get data for - rtl::OUString getIsoLocale() const; - /// @returns the locale to get data for - com::sun::star::lang::Locale const & getUnoLocale() const { return m_sLocale; } - - /** @returns - <TRUE/>, if an entity is specified, <BR/> - <FALSE/>, if data of the session user is requested - */ - bool hasEntity() const { return m_sEntity.getLength() != 0; } - /// @returns the entity to get data for - rtl::OUString getEntity() const { return m_sEntity; } - - /// sets the entity to get data for to the given entity - void setEntity(rtl::OUString const & _sEntity) { m_sEntity = _sEntity; } - /// resets the entity to get data for to be the session user - void clearEntity() { m_sEntity = rtl::OUString(); } - - /// sets the locale so data is gotten for all locales - void setAllLocales(); - /// sets the locale to get data for to the given locale - void setLocale(com::sun::star::lang::Locale const & _aLocale) { m_sLocale = _aLocale; } - /// sets the locale to get data for to the given locale - void setIsoLocale(rtl::OUString const & _sLocale); - /// sets a fallback locale, if no locale is set yet - void ensureLocaleSet(); - - /// marks asyncronous access a enabled or disabled - void enableAsync(bool _bEnable = true) { m_bEnableAsync = _bEnable; } - /// enforce a refresh to cache - void forceRefresh(bool _bEnable = true) { m_bReload = _bEnable; } - // comparison/container helpers - /// function that defines a weak strict ordering on RequestOptions - friend sal_Int32 compareRequestOptions(RequestOptions const& lhs, RequestOptions const& rhs); - private: - com::sun::star::lang::Locale m_sLocale; /// locale to fetch data for - rtl::OUString m_sEntity; /// user/group/role to fetch data for - bool m_bEnableAsync; /// true, if data may be - bool m_bReload; /// reload into cache from backend - }; - -// --------------------------------------------------------------------------- - struct lessRequestOptions - { - bool operator()(RequestOptions const & lhs, RequestOptions const & rhs) const - { return compareRequestOptions(lhs,rhs) < 0; } - }; -// --------------------------------------------------------------------------- - struct equalRequestOptions - { - bool operator()(RequestOptions const & lhs, RequestOptions const & rhs) const - { return compareRequestOptions(lhs,rhs) == 0; } - }; -// --------------------------------------------------------------------------- -} // namespace - -#endif diff --git a/configmgr/source/inc/requesttypes.hxx b/configmgr/source/inc/requesttypes.hxx deleted file mode 100644 index bc2389cc4840..000000000000 --- a/configmgr/source/inc/requesttypes.hxx +++ /dev/null @@ -1,234 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_BACKEND_REQUESTTYPES_HXX_ -#define CONFIGMGR_BACKEND_REQUESTTYPES_HXX_ - -#include "sal/config.h" - -#include "salhelper/simplereferenceobject.hxx" - -#include "valuenode.hxx" -#include "treechangelist.hxx" -#include "configpath.hxx" - -#ifndef _CONFIGMGR_UTILITY_HXX_ -#include <utility.hxx> -#endif - -#ifndef INCLUDED_MEMORY -#include <memory> -#define INCLUDED_MEMORY -#endif - -namespace configmgr -{ -// --------------------------------------------------------------------------- - namespace backend - { -// --------------------------------------------------------------------------- - struct ComponentDataStruct - { - const std::auto_ptr<ISubtree>& data; - rtl::OUString name; - ComponentDataStruct (const std::auto_ptr<ISubtree>& _data, rtl::OUString _name) - : data(_data), name(_name) {} - }; -// --------------------------------------------------------------------------- - struct NodeInstance - { - typedef std::auto_ptr<ISubtree> Data; - - explicit - NodeInstance(Data _node, configuration::AbsolutePath const & _rootpath) - : m_node(_node) - , m_root(_rootpath) - { - } - - Data const & data() const { return m_node; } - configuration::AbsolutePath const & root() const { return m_root; } - - Data & mutableData() { return m_node; } - Data extractData() { return m_node; } - private: - Data m_node; - configuration::AbsolutePath m_root; - }; -// --------------------------------------------------------------------------- - struct TemplateInstance - { - typedef std::auto_ptr<INode> Data; - - explicit - TemplateInstance(Data _node, rtl::OUString const & _name, rtl::OUString const & _component) - : m_node(_node) - , m_name(_name) - , m_component(_component) - { - } - - Data const & data() const { return m_node; } - rtl::OUString const & name() const { return m_name; } - rtl::OUString const & component() const { return m_component; } - - Data extractData() { return m_node; } - private: - Data m_node; - rtl::OUString m_name; // if empty, this is a complete set of component templates - rtl::OUString m_component; - }; -// --------------------------------------------------------------------------- - struct ComponentInstance - { - typedef std::auto_ptr<ISubtree> Data; - - explicit - ComponentInstance(Data _node, Data _template, rtl::OUString const & _component) - : m_node(_node) - , m_template(_template) - , m_component(_component) - { - } - - Data const & data() const { return m_node; } - Data const & templateData() const { return m_template; } - rtl::OUString const & component() const { return m_component; } - - ComponentDataStruct componentTemplateData () const { return ComponentDataStruct(m_template,m_component);} - ComponentDataStruct componentNodeData () const { return ComponentDataStruct(m_node,m_component);} - Data & mutableData() { return m_node; } - Data extractData() { return m_node; } - Data extractTemplateData() { return m_template; } - private: - Data m_node; - Data m_template; - rtl::OUString m_component; - }; -// --------------------------------------------------------------------------- - struct UpdateInstance - { - typedef SubtreeChange * Data; - - explicit - UpdateInstance(Data _update, configuration::AbsolutePath const & _rootpath) - : m_update(_update) - , m_root(_rootpath) - { - } - - UpdateInstance(UpdateInstance & _aModifiableOther) - : m_update(_aModifiableOther.m_update) - , m_root(_aModifiableOther.m_root) - { - } - - Data data() { return m_update; } - SubtreeChange const * data() const { return m_update; } - configuration::AbsolutePath const & root() const { return m_root; } - private: - Data m_update; - configuration::AbsolutePath m_root; - }; -// --------------------------------------------------------------------------- - struct ConstUpdateInstance - { - typedef SubtreeChange const * Data; - - explicit - ConstUpdateInstance(Data _update, configuration::AbsolutePath const & _rootpath) - : m_update(_update) - , m_root(_rootpath) - { - } - - // conversion - ConstUpdateInstance(UpdateInstance const & _aModifiable) - : m_update(_aModifiable.data()) - , m_root(_aModifiable.root()) - { - } - - Data data() const { return m_update; } - configuration::AbsolutePath const & root() const { return m_root; } - private: - Data m_update; - configuration::AbsolutePath m_root; - }; -// --------------------------------------------------------------------------- -// --------------------------------------------------------------------------- -// Due to the use of auto_ptr, the XxxInstance classes cannot easily be used as return values -// To return them, they should be wrapped into a ResultHolder - - template <class Instance_> - class ResultHolder - { - struct RCInstance : public salhelper::SimpleReferenceObject - { - RCInstance(Instance_ & _instance) - : instance(_instance) {} - Instance_ instance; - }; - - rtl::Reference< RCInstance > m_xInstance; - public: - explicit - ResultHolder(Instance_ & _rInstance) - : m_xInstance( new RCInstance(_rInstance) ) - {} - - bool isEmpty() const { return !m_xInstance.is(); } - - bool is() const { return m_xInstance.is() && m_xInstance->instance.data().get(); } - - Instance_ const & instance() const { return m_xInstance->instance; } - - Instance_ const & operator *() const { return instance(); } - Instance_ const * operator->() const { return &instance(); } - Instance_ & mutableInstance() { return m_xInstance->instance; } - - typename Instance_::Data extractDataAndClear() - { - typename Instance_::Data aData = m_xInstance->instance.extractData(); - this->clear(); - return aData; - } - - void releaseAndClear() - { - typename Instance_::Data aData = this->extractDataAndClear(); - aData.release(); - } - - void clear() { m_xInstance.clear(); } - }; -// --------------------------------------------------------------------------- - } -// --------------------------------------------------------------------------- -} // namespace - -#endif diff --git a/configmgr/source/inc/roottree.hxx b/configmgr/source/inc/roottree.hxx deleted file mode 100644 index 493a3bfc6f3d..000000000000 --- a/configmgr/source/inc/roottree.hxx +++ /dev/null @@ -1,112 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_ROOTTREE_HXX_ -#define CONFIGMGR_ROOTTREE_HXX_ - -#include "sal/config.h" - -#include <memory> - -#include "boost/utility.hpp" -#include "rtl/ref.hxx" - -#include "utility.hxx" - -namespace configmgr -{ -//----------------------------------------------------------------------------- - namespace sharable { union Node; } - class SubtreeChange; - struct TreeChangeList; - - namespace configuration - { -//----------------------------------------------------------------------------- - class Tree; - class NodeRef; - class NodeChangesInformation; - class AbsolutePath; - class TemplateProvider; - -//----------------------------------------------------------------------------- - - rtl::Reference< Tree > createReadOnlyTree( AbsolutePath const& aRootPath, - sharable::Node * _aCacheNode, - unsigned int nDepth, - TemplateProvider const& aTemplateProvider); - - rtl::Reference< Tree > createUpdatableTree( AbsolutePath const& aRootPath, - sharable::Node * _aCacheNode, - unsigned int nDepth, - TemplateProvider const& aTemplateProvider); - -//----------------------------------------------------------------------------- - class CommitHelper: private boost::noncopyable - { - struct Data; - - std::auto_ptr<Data> m_pData; - Tree* m_pTree; - public: - CommitHelper(rtl::Reference< Tree > const& aTree); - ~CommitHelper(); - - // collect all changes into rChangeList - bool prepareCommit(TreeChangeList& rChangeList); - - // finish and clean up the changes in rChangeList after they are integrated - void finishCommit(TreeChangeList& rChangeList); - // throw away and clean up the changes in rChangeList after a commit failed - void failedCommit(TreeChangeList& rChangeList); - }; - -//----------------------------------------------------------------------------- - /** adjusts <var>aTree</var> tree to the (externally produced) changes under <var>aExternalChanges</var> - and collects the changes this induces locally. - @param rLocalChanges - a collection that will hold the changes induced by <var>aExternalChanges</var>. - @param aExternalChanges - a structured change that has already been applied to the master tree. - @param aBaseTree - the tree that contains (directly) the affected node of <var>aExternalChanges</var>. - @param aBaseNode - a NodeRef referring to the (directly) affected node of <var>aExternalChanges</var>. - @return - <TRUE/> if any changes occur in this tree (so rLocalChanges is not empty), <FALSE/> otherwise. - - */ - bool adjustToChanges( NodeChangesInformation& rLocalChanges, - rtl::Reference< Tree > const& aBaseTree, NodeRef const& aBaseNode, - SubtreeChange const& aExternalChange) ; - - -//----------------------------------------------------------------------------- - } -} - -#endif // CONFIGMGR_ROOTTREE_HXX_ diff --git a/configmgr/source/inc/sequence.hxx b/configmgr/source/inc/sequence.hxx deleted file mode 100644 index 51017e3c2dda..000000000000 --- a/configmgr/source/inc/sequence.hxx +++ /dev/null @@ -1,105 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef INCLUDED_SHARABLE_SEQUENCE_HXX -#define INCLUDED_SHARABLE_SEQUENCE_HXX - -#include "anydata.hxx" -#include <com/sun/star/uno/Sequence.hxx> - -namespace configmgr -{ -//----------------------------------------------------------------------------- - namespace sharable - { - //----------------------------------------------------------------------------- - - sal_uInt8 * allocSequence(sal_uInt8 _aElementType, ::sal_Sequence const * _pSeqData); - void freeSequence(sal_uInt8 _aElementType, sal_uInt8 * _aSeq); - - ::sal_Sequence * readSequence(sal_uInt8 _aElementType, sal_uInt8 * _aSeq); - ::com::sun::star::uno::Any readAnySequence(sal_uInt8 _aElementType, sal_uInt8 * _aSeq); - //----------------------------------------------------------------------------- - - sal_uInt8 * allocBinary(::com::sun::star::uno::Sequence<sal_Int8> const & _aBinaryValue); - void freeBinary(sal_uInt8 * _aSeq); - - ::com::sun::star::uno::Sequence<sal_Int8> readBinary(sal_uInt8 * _aSeq); - //----------------------------------------------------------------------------- - - template <class ET> - inline - sal_uInt8 getElementTypeCode(::com::sun::star::uno::Sequence<ET> const & ) - { - ::com::sun::star::uno::Type aElementType = ::getCppuType( static_cast<ET const *>(NULL) ); - return getTypeCode(aElementType); - } - - template <class ET> - sal_uInt8 * allocSequence(::com::sun::star::uno::Sequence<ET> const & _aSeq) - { - sal_uInt8 aTC = getElementTypeCode(_aSeq); - ::sal_Sequence const * pSeqData = _aSeq.get(); - return allocSequence(aTC, pSeqData); - } - - template <class ET> - void readSequence(::com::sun::star::uno::Sequence<ET> & _rSeq, sal_uInt8 * _aSeq) - { - sal_uInt8 aElementType = getElementTypeCode(_rSeq); - - ::sal_Sequence * pNewSequence = readSequence(aElementType, _aSeq); - - if (!pNewSequence) return; - - ::com::sun::star::uno::Sequence<ET> aNewSequence(pNewSequence, SAL_NO_ACQUIRE); - - _rSeq = aNewSequence; - } - - template <class ET> - bool readSequence(::com::sun::star::uno::Sequence<ET> & _rSeq, sal_uInt8 _aElementType, sal_uInt8 * _aSeq) - { - if (getElementTypeCode(_rSeq) != _aElementType) return false; - - ::sal_Sequence * pNewSequence = readSequence(_aElementType, _aSeq); - - if (!pNewSequence) return false; - - ::com::sun::star::uno::Sequence<ET> aNewSequence(pNewSequence, SAL_NO_ACQUIRE); - - _rSeq = aNewSequence; - - return true; - } -//----------------------------------------------------------------------------- - } -//----------------------------------------------------------------------------- -} - - -#endif // INCLUDED_SHARABLE_SEQUENCE_HXX diff --git a/configmgr/source/inc/serviceinfohelper.hxx b/configmgr/source/inc/serviceinfohelper.hxx deleted file mode 100644 index 7af0202f1bf7..000000000000 --- a/configmgr/source/inc/serviceinfohelper.hxx +++ /dev/null @@ -1,135 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_SERVICEINFOHELPER_HXX_ -#define CONFIGMGR_SERVICEINFOHELPER_HXX_ - -#include <com/sun/star/lang/XServiceInfo.hpp> - -namespace configmgr -{ -// ----------------------------------------------------------------------------- - namespace uno = ::com::sun::star::uno; - namespace lang = ::com::sun::star::lang; -// ----------------------------------------------------------------------------- - - /// POD struct describing the registration information of a service implementation - struct ServiceRegistrationInfo - { - /// The implementation name of this service implementation - sal_Char const * implementationName; - /// The services for which this service implementation is registered - sal_Char const * const * registeredServiceNames; - }; -// ----------------------------------------------------------------------------- - - /// POD struct describing the implementation information of a service implementation - struct ServiceImplementationInfo - { - /// The implementation name of this service implementation - sal_Char const * implementationName; - /// The services for which this service implementation is registered - sal_Char const * const * registeredServiceNames; - /// Additional services implemented by this service implementation, for which it is not registered - sal_Char const * const * additionalServiceNames; - }; -// ----------------------------------------------------------------------------- - - // ServiceImplementationInfo has a compatible initial sequence with struct ServiceRegistrationInfo - - inline - ServiceRegistrationInfo const * - getRegistrationInfo(ServiceImplementationInfo const * _info) - { - return reinterpret_cast<ServiceRegistrationInfo const *>(_info); - } -// ----------------------------------------------------------------------------- - - /// POD struct describing the registration information of a singleton - struct SingletonRegistrationInfo - { - /// The name of this singleton - sal_Char const * singletonName; - /// The implementation, which owns this singleton - sal_Char const * implementationName; - /// The service, which should be instatiated for this singleton - sal_Char const * instantiatedServiceName; - /// A name for a pseudo-implementation, which is mapped to this singleton - ServiceRegistrationInfo const * mappedImplementation; - }; -// ----------------------------------------------------------------------------- - - class ServiceRegistrationHelper - { - ServiceRegistrationInfo const*const m_info; - - public: - ServiceRegistrationHelper(ServiceRegistrationInfo const* _info) - : m_info(_info) - {} - - ServiceRegistrationHelper(ServiceImplementationInfo const* _info) - : m_info(getRegistrationInfo(_info)) - {} - - sal_Int32 countServices() const; - - rtl::OUString getImplementationName( ) const - throw(uno::RuntimeException); - - uno::Sequence< rtl::OUString > getRegisteredServiceNames( ) const - throw(uno::RuntimeException); - }; -// ----------------------------------------------------------------------------- - - class ServiceInfoHelper - { - ServiceImplementationInfo const*const m_info; - - public: - ServiceInfoHelper(ServiceImplementationInfo const* _info) - : m_info(_info) - {} - - sal_Int32 countServices() const; - - rtl::OUString getImplementationName( ) const - throw(uno::RuntimeException); - - sal_Bool supportsService( rtl::OUString const & ServiceName ) const - throw(uno::RuntimeException); - - uno::Sequence< rtl::OUString > getSupportedServiceNames( ) const - throw(uno::RuntimeException); - }; -// ----------------------------------------------------------------------------- - -} // namespace configmgr - -#endif - - diff --git a/configmgr/source/inc/simpleinteractionrequest.hxx b/configmgr/source/inc/simpleinteractionrequest.hxx deleted file mode 100644 index 8e8b4d6f1c35..000000000000 --- a/configmgr/source/inc/simpleinteractionrequest.hxx +++ /dev/null @@ -1,101 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_SIMPLEINTERACTIONREQUEST_HXX -#define CONFIGMGR_SIMPLEINTERACTIONREQUEST_HXX - -#include "interactionrequest.hxx" - -// this file was copied and adapted from the corresponding file in module ucbhelper - -namespace configmgr { -namespace apihelper { - - namespace uno = com::sun::star::uno; -/** - This class implements a simple interaction request. The user must not deal - with XInteractionContinuations directly, but can use constants that are - mapped internally to the according objects. This class encapsulates the - standard Interaction Continuations "Abort", "Retry", "Approve" and - "Disaprrove". Instances can be passed directly to - XInteractionHandler::handle(...). - - @see InteractionRequest - @see InteractionAbort - @see InteractionRetry - @see InteractionApprove - @see InteractionDisapprove - */ - class SimpleInteractionRequest : public InteractionRequest - { - public: - /** - * Constructor. - * - * @param rRequest is the exception describing the error. - * @param nContinuations contains the possible "answers" for the request. - * This can be any of the CONTINUATION_* constants combinations - * listed above. - */ - SimpleInteractionRequest( const uno::Any & rRequest, - const sal_uInt32 nContinuations ); - - /** - * After passing this request to XInteractionHandler::handle, this method - * returns the continuation that was choosen by the interaction handler. - * - * @return the continuation choosen by an interaction handler or - * CONTINUATION_UNKNOWN, if the request was not (yet) handled. - */ - sal_uInt32 getResponse() const; - }; - -/** These are the constants that can be passed to the constructor of class - * SimpleInteractionRequest and that are returned by method - * SimpleInteractionRequest::getResponse(). - */ - - /** The request was not (yet) handled by the interaction handler. */ - const sal_uInt32 CONTINUATION_UNKNOWN = 0; - - /** The interaction handler selected XInteractionAbort. */ - const sal_uInt32 CONTINUATION_ABORT = 1; - - /** The interaction handler selected XInteractionRetry. */ - const sal_uInt32 CONTINUATION_RETRY = 2; - - /** The interaction handler selected XInteractionApprove. */ - const sal_uInt32 CONTINUATION_APPROVE = 4; - - /** The interaction handler selected XInteractionDisapprove. */ - const sal_uInt32 CONTINUATION_DISAPPROVE = 8; - - -} // namespace apihelper -} // namespace configmgr - -#endif /* !CONFIGMGR_SIMPLEINTERACTIONREQUEST_HXX */ diff --git a/configmgr/source/inc/simpletypehelper.hxx b/configmgr/source/inc/simpletypehelper.hxx deleted file mode 100644 index 55c1130de996..000000000000 --- a/configmgr/source/inc/simpletypehelper.hxx +++ /dev/null @@ -1,53 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_SIMPLETYPEHELPER_HXX -#define CONFIGMGR_SIMPLETYPEHELPER_HXX - -#include <com/sun/star/uno/Type.hxx> - -namespace configmgr -{ - namespace uno = com::sun::star::uno; - - namespace SimpleTypeHelper - { - uno::Type getBooleanType(); - - uno::Type getShortType(); - uno::Type getIntType(); - uno::Type getLongType(); - - uno::Type getDoubleType(); - - uno::Type getStringType(); - - uno::Type getBinaryType(); - uno::Type getAnyType(); - } -} -#endif diff --git a/configmgr/source/inc/stack.hxx b/configmgr/source/inc/stack.hxx deleted file mode 100644 index 164abb8818e2..000000000000 --- a/configmgr/source/inc/stack.hxx +++ /dev/null @@ -1,58 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_STACK_HXX_ -#define CONFIGMGR_STACK_HXX_ - -#ifndef INCLUDED_STACK -#include <stack> -#define INCLUDED_STACK -#endif -#ifndef INCLUDED_VECTOR -#include <vector> -#define INCLUDED_VECTOR -#endif - -namespace configmgr -{ - - // simple wrapper for a vector-based stack - template <typename T_> - struct Stack : public std::stack< T_, std::vector<T_> > - { - typedef typename std::vector<T_>::const_iterator bottomup_iterator; - typedef typename std::vector<T_>::const_reverse_iterator topdown_iterator; - bottomup_iterator begin_up() const { return this->c.begin(); } - bottomup_iterator end_up() const { return this->c.end(); } - topdown_iterator begin_down() const { return this->c.rbegin(); } - topdown_iterator end_down() const { return this->c.rend(); } - }; -} - -#endif // CONFIGMGR_STACK_HXX_ - - diff --git a/configmgr/source/inc/strdecl.hxx b/configmgr/source/inc/strdecl.hxx deleted file mode 100644 index 6fb2212e6529..000000000000 --- a/configmgr/source/inc/strdecl.hxx +++ /dev/null @@ -1,60 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ -#ifndef _CONFIGMGR_STRDECL_HXX_ -#define _CONFIGMGR_STRDECL_HXX_ - -#include "strings.hxx" - -//......................................................................... -namespace configmgr -{ -//......................................................................... - -// extern declaration for predefined strings - - // simple types names - DECLARE_CONSTASCII_USTRING(TYPE_BOOLEAN); - DECLARE_CONSTASCII_USTRING(TYPE_SHORT); - DECLARE_CONSTASCII_USTRING(TYPE_INT); - DECLARE_CONSTASCII_USTRING(TYPE_LONG); - DECLARE_CONSTASCII_USTRING(TYPE_DOUBLE); - DECLARE_CONSTASCII_USTRING(TYPE_STRING); - // Type: Sequence<bytes> - DECLARE_CONSTASCII_USTRING(TYPE_BINARY); - // Universal type: Any - DECLARE_CONSTASCII_USTRING(TYPE_ANY); - - // special template names for native/localized value types - DECLARE_CONSTASCII_USTRING(TEMPLATE_MODULE_NATIVE_PREFIX); - DECLARE_CONSTASCII_USTRING(TEMPLATE_MODULE_NATIVE_VALUE); - DECLARE_CONSTASCII_USTRING(TEMPLATE_MODULE_LOCALIZED_VALUE); - - DECLARE_CONSTASCII_USTRING(TEMPLATE_LIST_SUFFIX); - -} // namespace configmgr -#endif - diff --git a/configmgr/source/inc/strings.hxx b/configmgr/source/inc/strings.hxx deleted file mode 100644 index 7afff58c10f0..000000000000 --- a/configmgr/source/inc/strings.hxx +++ /dev/null @@ -1,74 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef _CONFIGMGR_STRINGS_HXX_ -#define _CONFIGMGR_STRINGS_HXX_ - -#include <sal/types.h> -#include <rtl/ustring.hxx> - - -//......................................................................... -namespace configmgr -{ -//......................................................................... - -struct UStringDescription -{ - const sal_Char* m_pZeroTerminatedName; - sal_Int32 m_nLen; - rtl_TextEncoding m_encoding; - - UStringDescription(const sal_Char* _pName, sal_Int32 _nLen, rtl_TextEncoding _encoding) - : m_pZeroTerminatedName( _pName ) - , m_nLen( _nLen ) - , m_encoding(_encoding ) - , m_aString (_pName, _nLen, _encoding) - { - } - - sal_Int32 getLength() const { return m_nLen; } - operator ::rtl::OUString const&() const { return m_aString; } - operator const sal_Char*() const { return m_pZeroTerminatedName; } - -private: - rtl::OUString m_aString; - UStringDescription(); -}; - -#define DECLARE_CONSTASCII_USTRING(name) \ - extern ::configmgr::UStringDescription name - -#define IMPLEMENT_CONSTASCII_USTRING(name, asciivalue) \ - ::configmgr::UStringDescription name(RTL_CONSTASCII_USTRINGPARAM(asciivalue)) - -//......................................................................... -} // namespace frm -//......................................................................... - -#endif // _CONFIGMGR_STRINGS_HXX_ - diff --git a/configmgr/source/inc/template.hxx b/configmgr/source/inc/template.hxx deleted file mode 100644 index b75a0f0dcc09..000000000000 --- a/configmgr/source/inc/template.hxx +++ /dev/null @@ -1,107 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_CONFIGTEMPLATE_HXX_ -#define CONFIGMGR_CONFIGTEMPLATE_HXX_ - -#include "configexcept.hxx" -#include "configpath.hxx" -#include <rtl/ref.hxx> -#include <salhelper/simplereferenceobject.hxx> -#ifndef _CONFIGMGR_UTILITY_HXX_ -#include <utility.hxx> -#endif - -namespace configmgr -{ -//----------------------------------------------------------------------------- - class RequestOptions; - class TreeManager; - namespace sharable { struct SetNode; } - namespace configuration - { -//----------------------------------------------------------------------------- - - class AbsolutePath; -//----------------------------------------------------------------------------- - - struct TemplateProvider_Impl; - class TemplateProvider - { - friend class SetElementFactory; - friend class TemplateImplHelper; - - rtl::Reference<TemplateProvider_Impl> m_aImpl; - public: - TemplateProvider(); // creates an empty (invalid) template instance provider - TemplateProvider(rtl::Reference< TreeManager > const & xProvider, RequestOptions const& xOptions); - TemplateProvider(TemplateProvider const& aOther); - TemplateProvider& operator=(TemplateProvider const& aOther); - ~TemplateProvider(); - - bool isValid() const { return !!m_aImpl.is(); } - }; -//----------------------------------------------------------------------------- - - /// provides information about the elements of a <type>Node</type> that is a Container ("set"). - class Template : public salhelper::SimpleReferenceObject - { - rtl::OUString m_aName; - rtl::OUString m_aModule; - com::sun::star::uno::Type m_aInstanceType; - private: - explicit Template(rtl::OUString const& aName, rtl::OUString const& aModule,com::sun::star::uno::Type const& aType); - - public: - /// checks if the type of an instance of this is known - bool isInstanceTypeKnown() const; - - /// checks if this is a 'value' template <p> PRE: the instance type is known </p> - bool isInstanceValue() const; - - /// get the UNO type for instances (primarily (only ?) for 'value' templates) <p> PRE: the instance type is known </p> - com::sun::star::uno::Type getInstanceType() const; - - /// get the path where the template is located - rtl::OUString getPathString() const; - - /// get the local name of the template - rtl::OUString getName() const { return m_aName; } - - /// get the package name of the template - rtl::OUString getModule() const { return m_aModule; } - - friend class TemplateImplHelper; - }; - - /// make a template instance that matches the elements of the given set. Ensures that the element type is known - rtl::Reference<Template> makeSetElementTemplate(sharable::SetNode * set, TemplateProvider const& _aProvider); -//----------------------------------------------------------------------------- - } -} - -#endif // CONFIGMGR_CONFIGTEMPLATE_HXX_ diff --git a/configmgr/source/inc/tracer.hxx b/configmgr/source/inc/tracer.hxx deleted file mode 100644 index 722f5a9d8f0f..000000000000 --- a/configmgr/source/inc/tracer.hxx +++ /dev/null @@ -1,135 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef _CONFIGMGR_TRACER_HXX_ -#define _CONFIGMGR_TRACER_HXX_ - -#if OSL_DEBUG_LEVEL > 0 -#define CFG_ENABLE_TRACING -#endif - -#ifdef CFG_ENABLE_TRACING - -#include <sal/types.h> -#include <rtl/string.hxx> -#include <osl/mutex.hxx> - -#include <stdarg.h> -#include <stdio.h> - -#ifdef WNT -#include <sys/timeb.h> -#else -#include <sys/time.h> -#endif - -#define OUSTRING2ASCII(rtlOUString) ::rtl::OString((rtlOUString).getStr(), (rtlOUString).getLength(), RTL_TEXTENCODING_ASCII_US).getStr() - -#define CFG_TRACE_INFO OTraceIndent aIndent; OConfigTracer::traceInfo -// FIXME: do something more intelligent here -// the CFG_TRACE_INFO2 macro exists only to have a unique name of aIndent2 -// so it does not hide aIndent in an outer scope (which would produce a -// a shadowing warning -#define CFG_TRACE_INFO2 OTraceIndent aIndent2; OConfigTracer::traceInfo -#define CFG_TRACE_WARNING OTraceIndent aIndent; OConfigTracer::traceWarning -#define CFG_TRACE_ERROR OTraceIndent aIndent; OConfigTracer::traceError -#define CFG_TRACE_INFO_NI OConfigTracer::traceInfo -#define CFG_TRACE_WARNING_NI OConfigTracer::traceWarning -#define CFG_TRACE_ERROR_NI OConfigTracer::traceError - -namespace configmgr -{ - -struct OTracerSetup; -class OConfigTracer -{ - friend class OTraceIndent; - -protected: - static ::osl::Mutex & getMutex(); - static OTracerSetup* s_pImpl; -#ifdef WNT - static timeb s_aStartTime; -#else - static timeval s_aStartTime; -#endif - -private: - OConfigTracer(); // never implemented, no instantiation of this class allowed, only static members - -public: - static void traceInfo(const sal_Char* _pFormat, ...); -#if OSL_DEBUG_LEVEL > 0 - static void traceWarning(const sal_Char* _pFormat, ...); - static void traceError(const sal_Char* _pFormat, ...); -#endif -protected: - static void implTrace(const sal_Char* _pType, const sal_Char* _pFormat, va_list args); - static void startGlobalTimer(); - static sal_uInt32 getGlobalTimer(); - - static void inc(); - static void dec(); - - static void indent(); - - static void ensureData(); - static void ensureInitalized(); -}; - -class OTraceIndent -{ -public: - OTraceIndent() { OConfigTracer::inc(); } - ~OTraceIndent() { OConfigTracer::dec(); } -}; - -} // namespace configmgr - -#else // !CFG_ENABLE_TRACING - -#include <stdio.h> - -#define OUSTRING2ASCII(rtlOUString) "nothing" - -namespace configmgr { -inline static void dont_trace(const char*,...) {} -} - -#define CFG_TRACE_INFO dont_trace -#define CFG_TRACE_INFO2 dont_trace -#define CFG_TRACE_WARNING dont_trace -#define CFG_TRACE_ERROR dont_trace -#define CFG_TRACE_INFO_NI dont_trace -#define CFG_TRACE_WARNING_NI dont_trace -#define CFG_TRACE_ERROR_NI dont_trace -#define CFG_TRACE_TO_DEVICE dont_trace - -#endif // CFG_ENABLE_TRACING - -#endif // _CONFIGMGR_TRACER_HXX_ - diff --git a/configmgr/source/inc/tree.hxx b/configmgr/source/inc/tree.hxx deleted file mode 100644 index a8661173c068..000000000000 --- a/configmgr/source/inc/tree.hxx +++ /dev/null @@ -1,665 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_CONFIGNODEIMPL_HXX_ -#define CONFIGMGR_CONFIGNODEIMPL_HXX_ - -#include "change.hxx" -#include "configpath.hxx" -#include "template.hxx" -#include "utility.hxx" -#include <rtl/ref.hxx> -#include <salhelper/simplereferenceobject.hxx> -#include <osl/diagnose.h> - -#ifndef INCLUDED_VECTOR -#include <vector> -#define INCLUDED_VECTOR -#endif -#ifndef INCLUDED_MAP -#include <map> -#define INCLUDED_MAP -#endif -#ifndef INCLUDED_MEMORY -#include <memory> -#define INCLUDED_MEMORY -#endif - -namespace configmgr -{ - namespace node { struct Attributes; } - namespace sharable { union Node; } - namespace view { class ViewStrategy; } - namespace configuration - { -//----------------------------------------------------------------------------- - class AnyNodeRef; - class ElementTree; - class GroupNodeImpl; - class NodeChange; - class NodeChanges; - class NodeImpl; - class NodeRef; - class SetNodeImpl; - class TemplateProvider; - class Tree; - class ValueElementNodeImpl; - class ValueMemberNode; - class ValueRef; -//----------------------------------------------------------------------------- - // WARNING: a similar item is in noderef.hxx - const unsigned int c_TreeDepthAll = ~0u; - -//----------------------------------------------------------------------------- - inline - unsigned int& incDepth(unsigned int& rDepth) - { - if (rDepth != c_TreeDepthAll) ++rDepth; - return rDepth; - } - - inline - unsigned int& decDepth(unsigned int& rDepth) - { - OSL_ENSURE(rDepth != 0,"Cannot decrement zero depth"); - if (rDepth != c_TreeDepthAll && rDepth != 0) --rDepth; - return rDepth; - } - - inline - unsigned int childDepth(unsigned int nDepth) - { return decDepth(nDepth); } - - inline - unsigned int parentDepth(unsigned int nDepth) - { return incDepth(nDepth); } - - inline - unsigned int remainingDepth(unsigned int nOuterDepth, unsigned int nRelativeDepth) - { - OSL_ENSURE(nRelativeDepth != c_TreeDepthAll,"RelativeDepth can't be infinite"); - OSL_ENSURE(nRelativeDepth <= nOuterDepth,"ERROR: RelativeDepth is larger than enclosing depth"); - - unsigned int nInnerDepth = (nOuterDepth == c_TreeDepthAll) ? nOuterDepth : - (nRelativeDepth < nOuterDepth) ? nOuterDepth-nRelativeDepth : - 0; - return nInnerDepth; - } - //------------------------------------------------------------------------- - - /// interface for a class that can be used to do some operation on a set of <type>NodeRef</type>s and <type>ValueRef</type>s. - struct NodeVisitor - { - /// returned from <method>handle</method> to indicate whether the operation is complete or should continue - enum Result { DONE, CONTINUE }; - /// do the operation on <var>aNode</var>. needs to be implemented by concrete visitor classes - virtual Result handle(rtl::Reference< Tree > const& aTree, NodeRef const& aNode) = 0; - /// do the operation on <var>aValue</var>. needs to be implemented by concrete visitor classes - virtual Result handle(rtl::Reference< Tree > const& aTree, ValueRef const& aValue) = 0; - protected: - virtual ~NodeVisitor() {} - }; -//----------------------------------------------------------------------------- - -// class Node Impl -//----------------------------------------------------------------------------- - - /** is the Implementation class for class <type>Node</type>, held inside a <type>Tree</type>. - <p> Implements some functionality common to all node types. - </p> - <p> Otherwise it provides (not really typesafe) access to a - <type scope='configmgr::configuration::NodeType>NodeImpl</type> which implements - functionality for a node of a given type - (as given by a <type scope='configmgr::configuration::NodeType>Enum</type> value). - </p> - */ - class NodeData - { - rtl::Reference<NodeImpl> m_pSpecificNode; - rtl::OUString m_aName_; // cached for better performance - unsigned int m_nParent; - public: - NodeData(rtl::Reference<NodeImpl> const& aSpecificNodeImpl, rtl::OUString const& aName, unsigned int nParent); - - void rebuild(rtl::Reference<view::ViewStrategy> const& _xNewStrategy, sharable::Node * _aNewData); - // COMMON: information - rtl::OUString getName() const { return m_aName_; } - unsigned int getParent() const { return m_nParent; } - - // change management - public: - // BASIC NODE: access to common attributes - NodeImpl & nodeImpl() { return implGetNodeImpl(); } - NodeImpl const & nodeImpl() const { return implGetNodeImpl(); } - - // SET: access to child elements - bool isSetNode() const; - SetNodeImpl& setImpl() { return implGetSetImpl(); } - SetNodeImpl const& setImpl() const { return implGetSetImpl(); } - - // VALUES: access to data - bool isValueElementNode() const; - ValueElementNodeImpl& valueElementImpl() { return implGetValueImpl(); } - ValueElementNodeImpl const& valueElementImpl() const { return implGetValueImpl(); } - - // GROUP: access to children - bool isGroupNode() const; - GroupNodeImpl& groupImpl() { return implGetGroupImpl(); } - GroupNodeImpl const&groupImpl() const { return implGetGroupImpl(); } - - // access helper - public: - sharable::Node * getOriginalNodeAccess() const; - - private: - NodeImpl& implGetNodeImpl() const; - SetNodeImpl& implGetSetImpl() const; - GroupNodeImpl& implGetGroupImpl() const ; - ValueElementNodeImpl& implGetValueImpl() const ; - }; -//----------------------------------------------------------------------------- - /** represents a hierarchy of config entries (identified by <type>NodeRef</type>s and <type>ValueRef</type>s) - - <p>Examples for trees include</p> - <ulist> - <li>A module tree (for a specific set of parameters).</li> - <li>An updating tree (for a part of the whole).</li> - <li>A set element (updating or not), which could be detached.</li> - <ulist> - <p> Holds a list of <type>Node</type> which it allows to access by - <type>unsigned int</type> (which is basically a one-based index). - </p> - <p> Also provides for navigation to the context this tree is located in - </p> - */ - class Tree : public salhelper::SimpleReferenceObject - { - friend class view::ViewStrategy; - protected: - // Construction - /// creates a Tree for a detached, virgin tree - Tree( ); - - /// creates a Tree with a parent tree - Tree(Tree& rParentTree, unsigned int nParentNode); - - virtual ~Tree() = 0; - - /// fills this Tree starting from _aRootNode, using the given factory and the tree's template provider - void build(rtl::Reference<view::ViewStrategy> const& _xStrategy, sharable::Node * _aRootNode, unsigned int nDepth, TemplateProvider const& aTemplateProvider); - - void rebuild(rtl::Reference<view::ViewStrategy> const& _xNewStrategy, sharable::Node * _aNewData); - - public: - // realeses the data this refers to - virtual void disposeData(); - - // Context Access - /// gets the path to the root node of this tree - AbsolutePath getRootPath() const; - /// gets the tree of parent node of this tree - Tree* getContextTree() { return m_pParentTree; } - /// gets the tree of parent node of this tree - Tree const *getContextTree() const { return m_pParentTree; } - /// gets the offset of parent node of this tree within its tree - unsigned int getContextNode() const { return m_nParentNode; } - - // Node Collection information - /// checks whether <var>nNode</var> is a valid node offset in this tree - bool isValidNode(unsigned int nNode) const; - - bool isRootNode(NodeRef const & node) const; - - NodeRef getRootNode() const; - - NodeRef getContextNodeRef() const; - - bool isValidValueNode(ValueRef const & value); - -#if OSL_DEBUG_LEVEL > 0 - bool isValidAnyNode(AnyNodeRef const & node); -#endif - - /// checks whether the node has any element nodes (of its own) - bool hasElements(NodeRef const & node); - - bool hasElement(NodeRef const & node, rtl::OUString const & name); - - bool hasElement(NodeRef const & node, Path::Component const & name); - - /** gets the element with the given name of the given node - <p>PRE: <code>hasElement(node, name)</code></p> - <p>If there is no such element, may return an empty node or - raise an exception (?)</p> - - @throws InvalidName - if name is not a valid child name for this node - */ - rtl::Reference< ElementTree > getElement( - NodeRef const & node, rtl::OUString const & name); - - /** gets the element with the given name of the given node, if it is - available - <p>PRE: <code>hasElement(node, name)</code></p> - <p>If there is no such element, may return an empty node or - raise an exception (?)</p> - <p>Caution: May miss existing children unless hasChild/getChild - has been called before.</p> - - @throws InvalidName - if name is not a valid child name for this node - */ - rtl::Reference< ElementTree > getAvailableElement( - NodeRef const & node, rtl::OUString const & name); - - /// checks whether the node has any child nodes (in this tree) - bool hasChildren(NodeRef const & node); - - bool hasChildValue( - NodeRef const & node, rtl::OUString const & name); - - bool hasChildNode(NodeRef const & node, rtl::OUString const & name); - - bool hasChild(NodeRef const & node, rtl::OUString const & name); - - /** gets the child value (in this tree) with the given name of the - given node - <p>PRE: <code>hasChildValue(node, name)</code></p> - <P>If there is no such node, may return an empty node or raise - an exception (?)</p> - - @throws InvalidName - if <var>aName</var> is not a valid child name for this node - */ - ValueRef getChildValue( - NodeRef const & node, rtl::OUString const & name); - - NodeRef getChildNode( - NodeRef const & node, rtl::OUString const & name); - - AnyNodeRef getAnyChild( - NodeRef const& node, rtl::OUString const & name); - - node::Attributes getAttributes(NodeRef const & node); - - node::Attributes getAttributes(AnyNodeRef const & node); - - node::Attributes getAttributes(ValueRef const & value); - - com::sun::star::uno::Type getUnoType(ValueRef const & value); - - /// return the parent of the given node (or an empty node, if it is - /// the tree root) - NodeRef getParent(NodeRef const & node); - - /// return the parent of the given value (or an empty node, if it is - /// the tree root) - NodeRef getParent(ValueRef const & value); - - AbsolutePath getAbsolutePath(NodeRef const & node); - - /// retrieves the current value for the given node, provided there - /// is one and it is available (only works for value nodes) - com::sun::star::uno::Any getNodeValue(ValueRef const & value); - - /// checks whether the given node has a default value (only works - /// for value nodes) - bool hasNodeDefault(ValueRef const & value); - - /// checks whether the given node assumes its default value (only - /// works for value nodes) - bool isNodeDefault(ValueRef const & value); - - /// checks whether the given node has a default state - bool hasNodeDefault(NodeRef const & node); - - /// checks whether the given node assumes its default state - bool isNodeDefault(NodeRef const & node); - - /// checks whether the given node has a default state - bool hasNodeDefault(AnyNodeRef const & node); - - /// checks whether the given node assumes its default state - bool isNodeDefault(AnyNodeRef const & node); - - /// checks whether the default values are available for the children - /// of the given node (if applicable) - bool areValueDefaultsAvailable(NodeRef const & node); - - /// retrieves the default value for the given node, provided there - /// is one and it is available (only works for value nodes) - com::sun::star::uno::Any getNodeDefaultValue( - ValueRef const & value); - - bool hasChanges(); - - /// lists any pending changes on this tree - bool collectChanges(NodeChanges & changes); - - void integrate( - NodeChange & change, NodeRef const & node, bool local); - - void integrate( - NodeChanges & changes, NodeRef const & node, bool local); - - NodeVisitor::Result visit( - NodeRef const & node, NodeVisitor & visitor) - { return visitor.handle(this, node); } - - NodeVisitor::Result visit( - ValueRef const & value, NodeVisitor & visitor) - { return visitor.handle(this, value); } - - /** lets the given visitor visit the child nodes of the given node - - The order in which nodes are visited is repeatable (but - currently unspecified). Visits nodes until NodeVisitor::DONE is - returned, then returns NodeVisitor::DONE. If all visits return - NodeVisitor::CONTINUE, returns NodeVisitor::CONTINUE. If no - children are present, returns NodeVisitor::CONTINUE. - */ - NodeVisitor::Result dispatchToChildren( - NodeRef const & node, NodeVisitor & visitor); - - NodeRef getNode(unsigned int offset) const; - - rtl::Reference< Template > extractElementInfo(NodeRef const & node); - - /// gets the depth that is available in this tree (due to the original request) - unsigned int getAvailableDepth() const { return m_nDepth; } - - /// gets the depth that is available in this tree within the given node - unsigned int getRemainingDepth(unsigned int nNode) const - { return remainingDepth(getAvailableDepth(),depthTo(nNode)); } - - // Node Collection navigation - /** gets the simple name of the node <var>nNode</var> - <p>PRE: <code>isValidNode(nNode)</code> - </p> - */ - rtl::OUString getSimpleNodeName(unsigned int nNode) const; - - /** gets the simple name of the root node (i.e. of the tree as a whole) - */ - virtual rtl::OUString getSimpleRootName() const; - - /** gets the full name of the root node - */ - Path::Component getExtendedRootName() const; - - /** gets the number of hierarchy levels from the root node to node <var>nNode</var> - in this tree - <p>In particular <code>depthTo(N) == 0</code> if <code>N == root()</code> - </p> - <p>PRE: <code>isValidNode(nNode)</code> - </p> - */ - unsigned int depthTo(unsigned int nNode) const; - - /// append the local path (relative to root) to a node to a collection of names - void prependLocalPathTo(unsigned int nNode, Path::Rep& rNames); - - // check whether defaults are available - bool hasDefaults(unsigned int _nNode) const; - public: - enum { ROOT = 1 }; /// base of <type>unsigned int</type>s used in this class - - /** gets the <type>unsigned int</type> of the parent node <var>nNode</var> in this tree - or 0 (zero) if it is the root node - <p>PRE: <code>isValidNode(nNode)</code> - </p> - */ - unsigned int parent_(unsigned int nNode) const; - - // Node iteration and access - /** gets the <type>unsigned int</type> of the first child node - of node <var>nParent</var> in this tree (in list order) - or 0 (zero) if it has no children in this tree - <p>PRE: <code>isValidNode(nParent)</code> - </p> - */ - unsigned int firstChild_ (unsigned int nParent) const; - - /** gets the <type>unsigned int</type> of the first child node - of node <var>nParent</var> that is after - node <var>nNode</var> in this tree (in list order) - or 0 (zero) if there is no such node - <p>if <code>nStartAfter == 0</code> searching starts at the beginning - </p> - <p>PRE: <code>isValidNode(nParent)</code> - </p> - <p>PRE: <code>isValidNode(nStartAfter) || nStartAfter == 0</code> - </p> - */ - unsigned int findNextChild_(unsigned int nParent, unsigned int nStartAfter) const; - - /** gets the <type>unsigned int</type> of the first (and only) child node - of node <var>nParent</var> in this tree (in list order) - where the name of the node is <var>aName</var>, - or 0 (zero) if there is no such node - <p>PRE: <code>isValidNode(nParent)</code> - </p> - */ - unsigned int findChild_(unsigned int nParent, rtl::OUString const& aName) const; - - // Node Collection access - /// get the number of nodes in this tree - unsigned int nodeCount() const; - - /// get the <type>NodeData</type> for node <var>nNode</var> in this tree - NodeData* nodeData(unsigned int nNode); - /// get the <type>NodeData</type> for node <var>nNode</var> in this tree - NodeData const* nodeData(unsigned int nNode) const; - /// get the <type>NodeData</type> for node <var>nNode</var> in this tree - NodeImpl& nodeImpl(unsigned int nNode) { return nodeData(nNode)->nodeImpl(); } - /// get the <type>NodeData</type> for node <var>nNode</var> in this tree - NodeImpl const& nodeImpl(unsigned int nNode) const { return nodeData(nNode)->nodeImpl(); } - - unsigned int nodeOffset(NodeData const & rNodeData) const; - - // Behavior - rtl::Reference< view::ViewStrategy > getViewBehavior() const; - protected: - // immediate commit -/* // implementation of commit protocol - void commitDirect(); - - void implCommitDirectFrom(unsigned int nNode); -*/ - void implRebuild(unsigned int nNode, sharable::Node * _aNewData); - - protected: - /// set a new parent context for this tree - void setContext(Tree* pParentTree, unsigned int nParentNode); - /// set no-parent context for this tree - void clearContext(); - - inline // is protected and should be used only in the implementation - rtl::OUString implGetOriginalName(unsigned int nNode) const; - - private: - /// get the full name of the root of this tree - virtual Path::Component doGetRootName() const = 0; - - /// prepend the absolute path to the root of this tree (no context use) - virtual void doFinishRootPath(Path::Rep& rPath) const = 0; - - ValueMemberNode getMemberNode(ValueRef const & value); - - rtl::Reference<view::ViewStrategy> m_xStrategy; - std::vector<NodeData> m_aNodes; - Tree* m_pParentTree; - unsigned int m_nParentNode; - unsigned int m_nDepth; - - /// prepend the absolute path to the root of this tree (using context if present) - void implPrependRootPath(Path::Rep& rPath) const; - - friend class TreeImplBuilder; - }; - - /// checks, if tree represents a real tree - bool isEmpty(Tree * tree); -//----------------------------------------------------------------------------- - - class ElementTree : public Tree - { - public: - - /// creates a Tree for a detached, virgin instance of <var>aTemplate</var> (always will be direct) - ElementTree(rtl::Reference< data::TreeSegment > const& _aElementData, rtl::Reference<Template> aTemplate, TemplateProvider const& aTemplateProvider ); - - /** creates a Tree with a parent tree, that (supposedly) - is an instance of <var>aTemplateInfo</var> - */ - ElementTree(rtl::Reference<view::ViewStrategy> const& _xStrategy, - Tree& rParentTree, unsigned int nParentNode, - sharable::TreeFragment * dataTree, unsigned int nDepth, - rtl::Reference<Template> aTemplateInfo, - TemplateProvider const& aTemplateProvider ); - - /** creates a Tree with no parent node, that (supposedly) - is an instance of <var>aTemplateInfo</var> - */ - ElementTree(rtl::Reference<view::ViewStrategy> const& _xStrategy, - sharable::TreeFragment * dataTree, unsigned int nDepth, - rtl::Reference<Template> aTemplateInfo, - TemplateProvider const& aTemplateProvider ); - - ~ElementTree(); - - // realeses the data this refers to - virtual void disposeData(); - - // rebuilding - using Tree::rebuild; - void rebuild(rtl::Reference<view::ViewStrategy> const& _xNewStrategy, sharable::TreeFragment * newData); - - // data access - sharable::TreeFragment * getOriginalTreeAccess() const { return m_aDataAddress; } - - // Tree information - virtual rtl::OUString getSimpleRootName() const; - /// checks whether this is an instance of a known template - bool isTemplateInstance() const { return !!m_aInstanceInfo.is(); } - /// checks whether this is an instance of the given template - bool isInstanceOf(rtl::Reference<Template> const& aTemplateInfo) const - { return m_aInstanceInfo == aTemplateInfo && aTemplateInfo.is(); } - /// retrieves the template that this is an instance of - rtl::Reference<Template> getTemplate() const { return m_aInstanceInfo; } - /// makes a complete name from a simple name and template information - Path::Component makeExtendedName(rtl::OUString const& aSimpleName) const; - - // node control operation - /// check if this is a free-floating tree - bool isFree() const { return m_aOwnData.is(); } - /// transfer ownership to the given set - void attachTo(sharable::SetNode * updatableSetNode, rtl::OUString const& aElementName); - /// tranfer ownership from the given set - void detachFrom(sharable::SetNode * updatableSetNode, rtl::OUString const& aElementName); - - /// take ownership of the given tree (which must not already be the one in use) - void takeTreeAndRebuild(rtl::Reference< data::TreeSegment > const& _aElementData); - /// take ownership of the given tree (which must already be the one in use) - void takeTreeBack(rtl::Reference< data::TreeSegment > const& _aElementData); - - /// release ownership - rtl::Reference< data::TreeSegment > releaseOwnedTree(); - - // context operation - /// set a new root name - void renameTree(rtl::OUString const& aNewName); - /// set a new parent context for this tree - void moveTree(Tree* pParentTree, unsigned int nParentNode); - /// set no-parent context for this tree - void detachTree(); - - private: - static bool isUpdatableSegment(Tree& _rTree); - - virtual Path::Component doGetRootName() const; - - virtual void doFinishRootPath(Path::Rep& rPath) const; - private: - rtl::Reference<Template> const m_aInstanceInfo; - rtl::OUString m_aElementName; - sharable::TreeFragment * m_aDataAddress; - rtl::Reference< data::TreeSegment > m_aOwnData; - }; -//----------------------------------------------------------------------------- - inline - bool Tree::isValidNode(unsigned int nNode) const - { - return ROOT <= nNode && nNode < nodeCount() + ROOT; - } - //--------------------------------------------------------------------- - inline - unsigned int Tree::nodeCount() const - { - return m_aNodes.size(); - } - //--------------------------------------------------------------------- - inline - NodeData* Tree::nodeData(unsigned int nNode) - { - if (nNode == 0) return NULL; - OSL_ASSERT(isValidNode(nNode)); - return &m_aNodes[nNode - ROOT]; - } - //--------------------------------------------------------------------- - inline - NodeData const* Tree::nodeData(unsigned int nNode) const - { - if (nNode == 0) return NULL; - OSL_ASSERT(isValidNode(nNode)); - return &m_aNodes[nNode - ROOT]; - } - //--------------------------------------------------------------------- - inline - unsigned int Tree::nodeOffset(NodeData const & rNode) const - { - unsigned int nOffset = ROOT + (&rNode - &m_aNodes[0]); - OSL_ASSERT(isValidNode(nOffset)); - return nOffset; - } - -//----------------------------------------------------------------------------- -// helper for other impl classes -//----------------------------------------------------------------------------- -#if OSL_DEBUG_LEVEL > 0 - struct ElementHelper - { - static - com::sun::star::uno::Type getUnoType(rtl::Reference< ElementTree > const& aElement); - }; -#endif -//----------------------------------------------------------------------------- - } -//----------------------------------------------------------------------------- -} - -#endif // CONFIGMGR_CONFIGNODEIMPL_HXX_ diff --git a/configmgr/source/inc/treeactions.hxx b/configmgr/source/inc/treeactions.hxx deleted file mode 100644 index 0ebe5827f1bd..000000000000 --- a/configmgr/source/inc/treeactions.hxx +++ /dev/null @@ -1,89 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef _CONFIGMGR_TREEACTIONS_HXX_ -#define _CONFIGMGR_TREEACTIONS_HXX_ - -#include "change.hxx" - -#ifndef INCLUDED_VECTOR -#include <vector> -#define INCLUDED_VECTOR -#endif - -//.......................................................................... -namespace configmgr -{ -//----------------------------------------------------------------------------- - -//========================================================================== -//= OChangeActionCounter -//========================================================================== -/** collects meta data about a changes tree -*/ -struct OChangeActionCounter : public ChangeTreeAction -{ - sal_Int32 nValues, nAdds, nRemoves; - - OChangeActionCounter() :nValues(0), nAdds(0), nRemoves(0) {} - - virtual void handle(ValueChange const& aValueNode); - virtual void handle(AddNode const& aAddNode); - virtual void handle(RemoveNode const& aRemoveNode); - virtual void handle(SubtreeChange const& aSubtree); - - sal_Bool hasChanges() const {return nValues || nAdds || nRemoves;} -}; - -// =================================================================== -// = CollectNames -// =================================================================== -class CollectNames : public NodeAction -{ -public: - std::vector<rtl::OUString> const& list() const { return aList; } - - CollectNames() : aList() {} - - void handle(ValueNode const& aValue) { add(aValue); } - void handle(ISubtree const& m_aSubtree) { add(m_aSubtree); } - - void add(INode const& aNode) - { - aList.push_back(aNode.getName()); - } -private: - std::vector<rtl::OUString> aList; -}; - -//.......................................................................... -} // namespace configmgr -//.......................................................................... - -#endif // _CONFIGMGR_TREEACTIONS_HXX_ - - diff --git a/configmgr/source/inc/treechangefactory.hxx b/configmgr/source/inc/treechangefactory.hxx deleted file mode 100644 index 43627135f833..000000000000 --- a/configmgr/source/inc/treechangefactory.hxx +++ /dev/null @@ -1,104 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_TREE_CHANGEFACTORY_HXX -#define CONFIGMGR_TREE_CHANGEFACTORY_HXX - -#include "change.hxx" - -#ifndef INCLUDED_MEMORY -#include <memory> -#define INCLUDED_MEMORY -#endif - - -namespace configmgr -{ - - namespace uno = ::com::sun::star::uno; - - //========================================================================== - - class OTreeChangeFactory - { - public: - //----------------------------------------------- - std::auto_ptr<SubtreeChange> createSetNodeChange( - rtl::OUString const& _aName, - rtl::OUString const& _aTemplateName, - rtl::OUString const& _aTemplateModule, - node::Attributes _aAttrs, - bool _bToDefault = false); - //----------------------------------------------- - - //= Set Changes ============================================================ - std::auto_ptr<AddNode> createAddNodeChange( - rtl::Reference< data::TreeSegment > const & _aNewTree, - rtl::OUString const& _aName, - bool _bToDefault = false); - - //----------------------------------------------- - std::auto_ptr<RemoveNode> createRemoveNodeChange( - rtl::OUString const& _aName, - bool _bToDefault = false); - - //= special case: Dummy ISubtree ============================================================ - static std::auto_ptr<SubtreeChange> createDummyChange( - rtl::OUString const& _aName, - rtl::OUString const& _aElementTypeName); - - //----------------------------------------------- - }; - - OTreeChangeFactory& getDefaultTreeChangeFactory(); - //========================================================================== - inline - std::auto_ptr<Change> base_ptr(std::auto_ptr<SubtreeChange> pChange) - { return std::auto_ptr<Change>(pChange.release()); } - //========================================================================== - inline - std::auto_ptr<Change> base_ptr(std::auto_ptr<ValueChange> pChange) - { return std::auto_ptr<Change>(pChange.release()); } - //========================================================================== - inline - std::auto_ptr<Change> base_ptr(std::auto_ptr<AddNode> pChange) - { return std::auto_ptr<Change>(pChange.release()); } - //========================================================================== - inline - std::auto_ptr<Change> base_ptr(std::auto_ptr<RemoveNode> pChange) - { return std::auto_ptr<Change>(pChange.release()); } - //========================================================================== - - bool isGenericSetElementType(rtl::OUString const& _aElementType); - bool isDummySetElementModule(rtl::OUString const& _aElementModule); - rtl::OUString getGenericSetElementType(); - rtl::OUString getDummySetElementModule(); - //========================================================================== - -} // namespace configmgr - -#endif diff --git a/configmgr/source/inc/treechangelist.hxx b/configmgr/source/inc/treechangelist.hxx deleted file mode 100644 index a2a9c6161073..000000000000 --- a/configmgr/source/inc/treechangelist.hxx +++ /dev/null @@ -1,120 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -/* PLEASE DON'T DELETE ANY COMMENT LINES, ALSO IT'S UNNECESSARY. */ - - -#ifndef CONFIGMGR_TREECHANGELIST_HXX -#define CONFIGMGR_TREECHANGELIST_HXX - -#include "change.hxx" -#include "attributes.hxx" -#include "configpath.hxx" -#include "requestoptions.hxx" - -namespace configmgr -{ - -//////////////////////////////////////////////////////////////////////////////// - - //========================================================================== - //= TreeChangeList - //========================================================================== - struct TreeChangeList - { - TreeChangeList(const RequestOptions& _aOptions, - const configuration::AbsolutePath& _rRootPath, - const SubtreeChange& _aSubtree, - treeop::DeepChildCopy _doDeepCopy) - : root(_aSubtree,_doDeepCopy) - , m_aLocation(_rRootPath) - , m_aOptions(_aOptions) - {} - - /** ctor - @param _rRootPath path to the root of the whole to-be-updated subtree - */ - TreeChangeList( const RequestOptions& _aOptions, - const configuration::AbsolutePath& _rRootPath, - const node::Attributes& _rAttr = node::Attributes()) - : root(_rRootPath.getLocalName().getName(), _rAttr) - , m_aLocation(_rRootPath) - , m_aOptions(_aOptions) - {} - - /** ctor - @param _rLocalName relative path within the to-be-updated subtree - */ - TreeChangeList( const RequestOptions& _aOptions, - const configuration::AbsolutePath& _rRootPath, - rtl::OUString const & _rChildTemplateName, - rtl::OUString const & _rChildTemplateModule, - const node::Attributes& _rAttr = node::Attributes()) - : root(_rRootPath.getLocalName().getName(), _rChildTemplateName, _rChildTemplateModule, _rAttr) - , m_aLocation(_rRootPath) - , m_aOptions(_aOptions) - {} - - /** ctor - @param _rTreeList list to initialize the path, no childs are copied - */ - TreeChangeList( const TreeChangeList& _rTree, treeop::NoChildCopy _rNoCopy) - : root(_rTree.root, _rNoCopy) - , m_aLocation(_rTree.m_aLocation) - , m_aOptions(_rTree.m_aOptions) - {} - - /// is root a change for the module root - bool isModuleRootChange() const { return m_aLocation.getDepth() <= 1; } - - /// get the module these changes belong to - rtl::OUString getModuleName() const { return m_aLocation.getModuleName(); } - - /// get the full path to the root (location + root-name) - void setRootPath(const configuration::AbsolutePath& _rRootPath) - { m_aLocation = _rRootPath; } - - /// get the full path to the root (location + root-name) - configuration::AbsolutePath const& getRootNodePath() const { return m_aLocation; } - - /// get the full path to the root (location) - configuration::AbsolutePath getRootContextPath() const { return m_aLocation.getParentPath(); } - - RequestOptions const & getOptions() const { return m_aOptions; } - - public: - SubtreeChange root; // the root of the whole tree of updates - private: - configuration::AbsolutePath m_aLocation; // absolute path to the parent of the node corresponding to this->root - RequestOptions m_aOptions; // options for the tree that is concerned by these changes - }; -//---------------------------------------------------------------------------- - -} // namespace configmgr - -#endif - diff --git a/configmgr/source/inc/treefragment.hxx b/configmgr/source/inc/treefragment.hxx deleted file mode 100644 index 109fed509113..000000000000 --- a/configmgr/source/inc/treefragment.hxx +++ /dev/null @@ -1,138 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef INCLUDED_SHARABLE_TREEFRAGMENT_HXX -#define INCLUDED_SHARABLE_TREEFRAGMENT_HXX - -#include "flags.hxx" -#include "node.hxx" - -namespace configmgr -{ -//----------------------------------------------------------------------------- - namespace sharable - { - //----------------------------------------------------------------------------- - /* a TreeFragment header is interpreted differently, depending on the kind of TreeFragment - - - for a set element - name points to the element name (the name in the root node is the template name) - parent points to the SetNode that is the parent. The containing treefragment can - be recovered from this with some care - next points to the next element of the same set. It is null for the last element. - state is fully used here - - - for a template tree - name points to the template name (same as the name in the root node) - component points to the home component name of the template - (often the same as 'component' in the component tree) - next points to another template TreeFragment. It is null for the last template. - state must be 'replaced' here (rarely it might be marked as mandatory) - - - for a component tree - name points to the component name (same as the name in the root node) - component is equal to name (or NULL ?) - next points to another template TreeFragment. It is null if there is no template. - state must be either 'defaulted' or 'merged' - (it should be marked as mandatory although that is not used yet) - */ - struct TreeFragmentHeader - { - struct TreeFragment *next; // next sibling set element or template - rtl_uString * name; // element-name/template name - union // context - { - union Node *parent; // parent node - rtl_uString * component; // component name - }; - sal_uInt16 count; // number of contained nodes - sal_uInt8 state; - sal_uInt8 reserved; - }; - //----------------------------------------------------------------------------- - /* a tree fragment is stored as a variable-sized struct - containing a header and a fixed sequence of nodes - - R - - A - - A1 - | | - | - A2 - | - - B - | - - C - - C1 - - C11 - | | | - | | - C12 - | | - | - C2 - - C21 - | - - D - - is stored as - - H(count = 12) : [R;A;A1;A2;B;C;C1;C11;C12;C2;C21;D] - */ - //----------------------------------------------------------------------------- - /* tree fragments are used for: Component trees, Template trees, Set elements - - They are only fragments, as for a TreeFragment a Set is considered a leaf node. - Set elements are maintained as a singly linked list that is accessible from the set node - - A cache component has the Root (component tree) TreeFragment at a well-known location. - The 'next' element of the component tree points to the list of template TreeFragments - used in the component. - */ - struct TreeFragment - { - TreeFragmentHeader header; // really variable-sized: - Node nodes[1]; // nodes[header.count] - - // header info access - bool hasDefaultsAvailable() const; - - bool isDefault() const; - bool isNew() const; - - bool isNamed(rtl::OUString const & _aName) const; - - rtl::OUString getName() const; - - void setName(rtl::OUString const & name); - - configmgr::node::Attributes getAttributes()const; - - Node * getRootNode() { return nodes; } - - static TreeFragment *allocate(sal_uInt32 nFragments); - static void free_shallow( TreeFragment *pFragment ); - }; - //----------------------------------------------------------------------------- - - } -//----------------------------------------------------------------------------- -} - -#endif // INCLUDED_SHARABLE_TREEFRAGMENT_HXX diff --git a/configmgr/source/inc/treemanager.hxx b/configmgr/source/inc/treemanager.hxx deleted file mode 100644 index f62955022849..000000000000 --- a/configmgr/source/inc/treemanager.hxx +++ /dev/null @@ -1,157 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_TREEMANAGER_HXX_ -#define CONFIGMGR_TREEMANAGER_HXX_ - -#include <memory> - -#include "salhelper/simplereferenceobject.hxx" - -#include "defaultprovider.hxx" -#include "confevents.hxx" -#include "options.hxx" -#include "autoreferencemap.hxx" -#include "autoobject.hxx" - -namespace configmgr -{ - namespace uno = ::com::sun::star::uno; - - namespace backend { - class CacheController; - class ComponentRequest; - class UpdateRequest; - } - namespace sharable { - struct TreeFragment; - union Node; - } - - //========================================================================== - //= TreeManager - //========================================================================== - class CacheClientAccess; - class CacheData; - class ConfigChangeBroadcastHelper; - class ISubtree; - //========================================================================== - class TreeManager: public salhelper::SimpleReferenceObject { - typedef AutoReferenceMap< RequestOptions, CacheClientAccess, lessRequestOptions> CacheList; - - osl::Mutex m_aCacheControllerMutex; - rtl::Reference< backend::CacheController > m_xCacheController; - - rtl::Reference< backend::CacheController > maybeGetBackendCache() SAL_THROW(()); - rtl::Reference< backend::CacheController > getCacheLoader() SAL_THROW((com::sun::star::uno::RuntimeException)); - void disposeBackendCache() SAL_THROW(()); - - CacheList m_aCacheList; // Map - AutoObject< CacheData > m_aTemplates; - sal_Bool m_bEnableAsync; - - virtual ~TreeManager(); - - public: - /** ctor - */ - explicit - TreeManager(rtl::Reference< backend::CacheController > const & _xBackend); - - // disposing the cache before destroying - void dispose(); - - /** requests a node given by it's path. Basicly, this means - that the node is fetch from the cache when it contains it else it ask the server - system into it's cache. - @param _rSubtreePath the path to the node in URI notation. - @param _nMinLevels indicates how many tree levels under the node determined by <arg>_rSubtreePath</arg> - should be loaded - */ - sharable::Node * requestSubtree(configuration::AbsolutePath const& _rSubtreePath, - RequestOptions const& _aOptions - ) SAL_THROW((com::sun::star::uno::Exception)); - - void updateTree(TreeChangeList& aChanges) SAL_THROW((com::sun::star::uno::Exception)); - - void saveAndNotifyUpdate(TreeChangeList const& aChanges) SAL_THROW((com::sun::star::uno::Exception)); - - void releaseSubtree(configuration::AbsolutePath const& aSubtreePath, - RequestOptions const& _aOptions ) SAL_THROW(()); - - void fetchSubtree( configuration::AbsolutePath const& aSubtreePath, - RequestOptions const& _xOptions - ) SAL_THROW(()); - - void refreshAll() SAL_THROW((com::sun::star::uno::Exception)); - void flushAll() SAL_THROW(()); - void enableAsync(const sal_Bool& bEnableAsync) SAL_THROW(()) ; - - sal_Bool fetchDefaultData( configuration::AbsolutePath const& aSubtreePath, - RequestOptions const& _aOptions - ) SAL_THROW((com::sun::star::uno::Exception)); - - std::auto_ptr<ISubtree> requestDefaultData(configuration::AbsolutePath const& aSubtreePath, - const RequestOptions& _aOptions - ) SAL_THROW((com::sun::star::uno::Exception)); - - sharable::TreeFragment * requestTemplate( rtl::OUString const& aName, rtl::OUString const& aModule - ) SAL_THROW((com::sun::star::uno::Exception)); - - // implementation interfaces - void refreshSubtree(const configuration::AbsolutePath &_aAbsoluteSubtreePath, - const RequestOptions& _aOptions) SAL_THROW((com::sun::star::uno::Exception)); - - void addListener(configuration::AbsolutePath const& aName, const RequestOptions& _aOptions, rtl::Reference<INodeListener> const& pListener); - void removeListener(const RequestOptions& _aOptions, rtl::Reference<INodeListener> const& pListener); - - void componentCreated(backend::ComponentRequest const & _aComponent) SAL_THROW(()); - void componentChanged(backend::UpdateRequest const & _anUpdate) SAL_THROW(()); - - private: - CacheData & getTemplates() { return * m_aTemplates.get(); } - - configuration::AbsolutePath encodeTemplateLocation(rtl::OUString const & _rLogicalTemplateName, rtl::OUString const &_rModule); - - private: - rtl::Reference<CacheClientAccess> getCacheAlways(RequestOptions const & _aOptions); - - // disposing - void disposeAll(); - - void fireChanges(TreeChangeList const& _aChanges, sal_Bool _bError); - ConfigChangeBroadcastHelper* getBroadcastHelper(RequestOptions const& _aOptions, bool bCreate); - void disposeBroadcastHelper(ConfigChangeBroadcastHelper* pHelper); - - void nodeUpdated(TreeChangeList& _rChanges); - }; - -} - - -#endif - diff --git a/configmgr/source/inc/treenodefactory.hxx b/configmgr/source/inc/treenodefactory.hxx deleted file mode 100644 index 0a016cbb536b..000000000000 --- a/configmgr/source/inc/treenodefactory.hxx +++ /dev/null @@ -1,96 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_TREE_NODEFACTORY_HXX -#define CONFIGMGR_TREE_NODEFACTORY_HXX - -#include "valuenode.hxx" - -#ifndef INCLUDED_MEMORY -#include <memory> -#define INCLUDED_MEMORY -#endif -#if defined(_MSC_VER) && (_MSC_VER >= 1400) -#pragma warning(disable : 4350) -#endif -namespace configmgr -{ - - namespace uno = ::com::sun::star::uno; - - //========================================================================== - - class OTreeNodeFactory - { - public: - //= ValueNodes ============================================================ - std::auto_ptr<ValueNode> createValueNode( - rtl::OUString const& aName, - uno::Any const& aValue, - node::Attributes _aAttrs); - - //----------------------------------------------- - std::auto_ptr<ValueNode> createValueNode( - rtl::OUString const& aName, - uno::Any const& aValue, - uno::Any const& aDefault, - node::Attributes _aAttrs); - - //----------------------------------------------- - std::auto_ptr<ValueNode> createNullValueNode( - rtl::OUString const& aName, - uno::Type const& aType, - node::Attributes _aAttrs); - - //= ISubtree ============================================================ - std::auto_ptr<ISubtree> createGroupNode( - rtl::OUString const& aName, - node::Attributes _aAttrs); - - //----------------------------------------------- - std::auto_ptr<ISubtree> createSetNode( - rtl::OUString const& aName, - rtl::OUString const& _rTemplateName, - rtl::OUString const& _rTemplateModule, - node::Attributes _aAttrs); - }; - - OTreeNodeFactory& getDefaultTreeNodeFactory(); - //========================================================================== - inline - std::auto_ptr<INode> base_ptr(std::auto_ptr<ISubtree> pNode) - { return std::auto_ptr<INode>(pNode.release()); } - //========================================================================== - inline - std::auto_ptr<INode> base_ptr(std::auto_ptr<ValueNode> pNode) - { return std::auto_ptr<INode>(pNode.release()); } - //========================================================================== - - -} // namespace configmgr - -#endif diff --git a/configmgr/source/inc/treesegment.hxx b/configmgr/source/inc/treesegment.hxx deleted file mode 100644 index badea86541a2..000000000000 --- a/configmgr/source/inc/treesegment.hxx +++ /dev/null @@ -1,73 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef INCLUDED_CONFIGMGR_SOURCE_INC_TREESEGMENT_HXX -#define INCLUDED_CONFIGMGR_SOURCE_INC_TREESEGMENT_HXX - -#include "sal/config.h" - -#include <memory> - -#include "rtl/ref.hxx" -#include "salhelper/simplereferenceobject.hxx" - -namespace rtl { class OUString; } - -namespace configmgr { - class INode; - namespace sharable { struct TreeFragment; } - - namespace data { - // rtl::Reference< TreeSegment > is a reference counted - // sharable::TreeFragment *. A null reference is always modeled as an - // empty rtl::Reference< TreeSegment >, never as a null fragment. - class TreeSegment: public salhelper::SimpleReferenceObject { - public: - static rtl::Reference< TreeSegment > create( - std::auto_ptr< INode > tree, rtl::OUString const & type); - - static rtl::Reference< TreeSegment > create( - rtl::OUString const & name, std::auto_ptr< INode > tree); - - static rtl::Reference< TreeSegment > create( - sharable::TreeFragment * tree); - - static rtl::Reference< TreeSegment > create( - rtl::Reference< TreeSegment > const & tree) - { return create(tree.is() ? tree->fragment : 0); } - - sharable::TreeFragment * const fragment; // non-null - - private: - TreeSegment(sharable::TreeFragment * tree); - - virtual ~TreeSegment(); - }; - } -} - -#endif diff --git a/configmgr/source/inc/typeconverter.hxx b/configmgr/source/inc/typeconverter.hxx deleted file mode 100644 index ab2c5be2509c..000000000000 --- a/configmgr/source/inc/typeconverter.hxx +++ /dev/null @@ -1,80 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ -#ifndef CONFIGMGR_TYPECONVERTER_HXX -#define CONFIGMGR_TYPECONVERTER_HXX - -#include "utility.hxx" -#include <com/sun/star/script/XTypeConverter.hpp> -#include <rtl/ustring.hxx> -#include <com/sun/star/uno/Sequence.hxx> - -namespace configmgr -{ - namespace uno = ::com::sun::star::uno; - namespace script = ::com::sun::star::script; - - // UNO Type handling - uno::Type getSequenceElementType(uno::Type const& rSequenceType); - - uno::Type getBasicType(uno::Type const& rType, bool& bSequence); - inline - uno::Type getBasicType(uno::Type const& rType) - { bool dummy; return getBasicType(rType,dummy); } - - // Any Conversion - uses TypeConverter - uno::Any toAny( const uno::Reference< script::XTypeConverter >& xTypeConverter, - const ::rtl::OUString& _rValue, - const uno::TypeClass& _rTypeClass) - SAL_THROW((script::CannotConvertException , com::sun::star::uno::RuntimeException)); - - rtl::OUString toString(const uno::Reference< script::XTypeConverter >& xTypeConverter, const uno::Any& rValue) - SAL_THROW((script::CannotConvertException , com::sun::star::uno::RuntimeException)); - - // Type conversion - ::rtl::OUString toTypeName(const uno::TypeClass& _rTypeClass); - - uno::Type toType(const ::rtl::OUString& _rsType); - uno::Type toListType(const ::rtl::OUString& _rsElementType); - ::rtl::OUString toTypeName(const uno::Type& _rType); - - inline - uno::Type toType(const ::rtl::OUString& _rsSimpleType, bool isList) - { - return isList ? toListType(_rsSimpleType) : toType(_rsSimpleType); - } - - // template names - ::rtl::OUString toTemplateName(const uno::Type& _rType); - ::rtl::OUString toTemplateName(const uno::TypeClass& _rBasicType, bool bList = false); - ::rtl::OUString toTemplateName(const ::rtl::OUString& _rBasicTypeName, bool bList = false); - - uno::Type parseTemplateName(::rtl::OUString const& sTypeName); - bool parseTemplateName(::rtl::OUString const& sTypeName, ::rtl::OUString& _rBasicName, bool& bList); - -} // namespace configmgr - -#endif /* CONFIGMGR_TYPECONVERTER_HXX */ diff --git a/configmgr/source/inc/updatehelper.hxx b/configmgr/source/inc/updatehelper.hxx deleted file mode 100644 index 0d53078d4fca..000000000000 --- a/configmgr/source/inc/updatehelper.hxx +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_UPDATEHELPER_HXX -#define CONFIGMGR_UPDATEHELPER_HXX - -#include "change.hxx" - -namespace configmgr { - namespace sharable { union Node; } - -// apply a already matching set of changes to the target tree - void applyUpdateToTree(SubtreeChange& _anUpdateTree, sharable::Node * _aRootNode); - -// apply a set of changes to the target tree - void applyUpdateWithAdjustmentToTree(SubtreeChange& _anUpdateTree, sharable::Node * _aRootNode); - -// apply a set of changes to the target tree, return true, if there are changes found - bool createUpdateFromDifference(SubtreeChange& _rResultingUpdateTree, sharable::Node * existingData, ISubtree const & _aNewData); -} - -#endif diff --git a/configmgr/source/inc/utility.hxx b/configmgr/source/inc/utility.hxx deleted file mode 100644 index 664015459ee8..000000000000 --- a/configmgr/source/inc/utility.hxx +++ /dev/null @@ -1,50 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef INCLUDED_CONFIGMGR_SOURCE_INC_UTILITY_HXX -#define INCLUDED_CONFIGMGR_SOURCE_INC_UTILITY_HXX - -#include "sal/config.h" - -#include "rtl/ustring.h" -#include "rtl/ustring.hxx" - -#if defined _MSC_VER && _MSC_VER >= 1400 -#pragma warning(disable: 4350) - // behavior change: 'member1' called instead of 'member2' -#endif - -namespace configmgr { - - inline rtl_uString * acquireString(rtl::OUString const & string) { - rtl_uString_acquire(string.pData); - return string.pData; - } - -} - -#endif diff --git a/configmgr/source/inc/valuenode.hxx b/configmgr/source/inc/valuenode.hxx deleted file mode 100644 index a9cbc7970710..000000000000 --- a/configmgr/source/inc/valuenode.hxx +++ /dev/null @@ -1,293 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef _CONFIGMGR_TREE_VALUENODE_HXX -#define _CONFIGMGR_TREE_VALUENODE_HXX - -#include "attributes.hxx" -#include "anypair.hxx" -#include <com/sun/star/uno/Any.h> -#include <rtl/ustring.hxx> - -#include <string.h> -#ifndef INCLUDED_MEMORY -#include <memory> -#define INCLUDED_MEMORY -#endif - -namespace configmgr -{ - - namespace css = com::sun::star; - namespace uno = css::uno; - - class INode; - class ISubtree; - class ValueNode; - - // helper (tag) class - namespace treeop { struct NoChildCopy {}; struct DeepChildCopy {}; enum { ALL_LEVELS = -1 }; } - //========================================================================== - //= Visitors - //========================================================================== - struct NodeAction - { - virtual void handle(ValueNode const&) = 0; - virtual void handle(ISubtree const&) = 0; - - void applyToNode(INode const&); - void applyToChildren(ISubtree const&); - protected: - virtual ~NodeAction() {} - }; - - struct NodeModification - { - virtual void handle(ValueNode&) = 0; - virtual void handle(ISubtree&) = 0; - - void applyToNode(INode&); - void applyToChildren(ISubtree&); - protected: - virtual ~NodeModification() {} - }; - - class INode - { - rtl::OUString m_aName; - node::Attributes m_aAttributes; - - protected: - INode(){} - - void markAsDefault(bool _bDefault = true) - { - m_aAttributes.markAsDefault(_bDefault); - } - public: - explicit - INode(rtl::OUString const& aName, node::Attributes); - - virtual ~INode(); - - virtual std::auto_ptr<INode> clone() const = 0; - public: - - const rtl::OUString& getName() const { return m_aName; } - node::Attributes getAttributes() const { return m_aAttributes; } - - bool isDefault() const { return m_aAttributes.isDefault(); } - bool isLocalized() const { return m_aAttributes.isLocalized(); } - - void modifyState(node::State _eNewState); - void modifyAccess(node::Access _aAccessLevel); - void markMandatory(); - void markRemovable(); - void promoteAccessToDefault(); - - // to be used with caution. If the node is referenced from somewhere else under it's old name, - // you may have problems with this inconsistence - void setName(const rtl::OUString& _rNewName) { m_aName = _rNewName; } - - virtual ValueNode* asValueNode(); - virtual ValueNode const* asValueNode() const; - virtual ISubtree* asISubtree(); - virtual ISubtree const* asISubtree() const; - - // double dispatch support - virtual void dispatch(NodeAction&) const = 0; - virtual void dispatch(NodeModification&) = 0; - }; - -// ----------------------------------------------------------------------------- - - //========================================================================== - //= ISubtree - //========================================================================== - class ISubtree : public INode - { - sal_Int16 m_nLevel; /// determines if everything is read - sal_Int16 m_nDefaultLevels; /// determines if defaults are read - rtl::OUString m_sId; - rtl::OUString m_sTemplateName; /// path of the template for child instantiation - rtl::OUString m_sTemplateModule; /// module of the template for child instantiation - - virtual INode* doGetChild(rtl::OUString const& name) const = 0; - - protected: - ISubtree():m_nLevel(0){} - - ISubtree(ISubtree const& other) - :INode(other) - ,m_nLevel(other.m_nLevel) - ,m_nDefaultLevels(other.m_nDefaultLevels) - ,m_sId() // do not copy ID while cloning ! - ,m_sTemplateName(other.m_sTemplateName) - ,m_sTemplateModule(other.m_sTemplateModule) - {} - - public: - // Ctor for group trees - ISubtree(const rtl::OUString& aName, const node::Attributes& _rAttrs) - :INode(aName, _rAttrs) - ,m_nLevel(0) - ,m_nDefaultLevels(0) - {} - - // Ctor for set trees - ISubtree(const rtl::OUString& aName, - const rtl::OUString& _rTemplateName, - const rtl::OUString& _rTemplateModule, - const node::Attributes& _rAttrs) - :INode(aName, _rAttrs) - ,m_nLevel(0) - ,m_nDefaultLevels(0) - ,m_sTemplateName(_rTemplateName) - ,m_sTemplateModule(_rTemplateModule){} - - INode* getChild(rtl::OUString const& name) { return doGetChild(name); } - INode const* getChild(rtl::OUString const& name) const { return doGetChild(name); } - - ISubtree* asISubtree(); - ISubtree const* asISubtree() const; - - using INode::markAsDefault; - - sal_Int16 getLevel() const { return m_nLevel; } - - void setLevels(sal_Int16 _nLevel,sal_Int16 _nDefaultsLevel); - - bool isSetNode() const { return m_sTemplateName.getLength() != 0; } - - void makeSetNode(rtl::OUString const& _sTemplateName, rtl::OUString const& _sTemplateModule) - { m_sTemplateName = _sTemplateName; m_sTemplateModule = _sTemplateModule; } - - rtl::OUString const& getElementTemplateName() const { return m_sTemplateName; } - rtl::OUString const& getElementTemplateModule() const { return m_sTemplateModule; } - - virtual INode* addChild(std::auto_ptr<INode> node) =0; // takes ownership - virtual ::std::auto_ptr<INode> removeChild(rtl::OUString const& name) =0; // releases ownership - - // Iteration support, stop if (action returns true) - virtual void forEachChild(NodeAction& anAction) const = 0; - virtual void forEachChild(NodeModification& anAction) = 0; - - // double dispatch support - virtual void dispatch(NodeAction& anAction) const { anAction.handle(*this); } - virtual void dispatch(NodeModification& anAction) { anAction.handle(*this); } - }; - - //========================================================================== - //= ValueNode - //========================================================================== - class ValueNode : public INode - { - AnyPair m_aValuePair; - // uno::Type m_aType; - // uno::Any m_aValue; - // uno::Any m_aDefaultValue; - - public: - //ValueNode(){} - - //explicit ValueNode(node::Attributes _aAttrs):INode(_aAttrs){} - - /* - ValueNode(rtl::OUString const& aName, node::Attributes _aAttrs) - : INode(aName, _aAttrs) - , m_aValuePair() - {} - */ - ValueNode(rtl::OUString const& aName,uno::Type const& aType, node::Attributes _aAttrs) - : INode(aName, _aAttrs) - , m_aValuePair(aType) - { - } - ValueNode(rtl::OUString const& aName,uno::Any const& anAny, node::Attributes _aAttrs) - : INode(aName, _aAttrs) - , m_aValuePair(anAny, selectMember(_aAttrs.isDefault())) - { - } - ValueNode(rtl::OUString const& aName,uno::Any const& anAny,uno::Any const& aDefault, node::Attributes _aAttrs) - : INode(aName, _aAttrs) - , m_aValuePair(anAny, aDefault) - { - } - - bool isEmpty() const {return m_aValuePair.isEmpty();} - bool isValid() const {return !m_aValuePair.isEmpty();} - - bool isNull() const {return m_aValuePair.isNull();} - bool hasUsableDefault() const {return getAttributes().isNullable() || m_aValuePair.hasSecond();} - - uno::Type getValueType() const {return m_aValuePair.getValueType();} - uno::Any getValue() const {return m_aValuePair.getValue( selectMember(this->isDefault()) );} - uno::Any getUserValue() const {return m_aValuePair.getFirst();} - uno::Any getDefault() const {return m_aValuePair.getSecond();} - - bool setValueType(uno::Type const& _aType); - bool setValue(uno::Any const& _aValue); - void setDefault(); - - bool changeDefault(uno::Any const& _aValue); - void promoteToDefault(); - - virtual std::auto_ptr<INode> clone() const; - - ValueNode* asValueNode(); - ValueNode const* asValueNode() const; - // double dispatch support - virtual void dispatch(NodeAction& anAction) const { anAction.handle(*this); } - virtual void dispatch(NodeModification& anAction) { anAction.handle(*this); } - - private: - static AnyPair::SelectMember selectValue() { return AnyPair::SELECT_FIRST; } - static AnyPair::SelectMember selectDeflt() { return AnyPair::SELECT_SECOND; } - static AnyPair::SelectMember selectMember(bool bDeflt) - { return bDeflt ? AnyPair::SELECT_SECOND : AnyPair::SELECT_FIRST; } - }; - //========================================================================== - - extern bool isLocalizedValueSet(ISubtree const& _aSubtree); - - //========================================================================== - //= inlines - //========================================================================== - inline void NodeAction::applyToNode(INode const& aNode) - { aNode.dispatch(*this); } - inline void NodeAction::applyToChildren(ISubtree const& aSubtree) - { aSubtree.forEachChild(*this); } - - inline void NodeModification::applyToNode(INode& aNode) - { aNode.dispatch(*this); } - inline void NodeModification::applyToChildren(ISubtree& aSubtree) - { aSubtree.forEachChild(*this); } - - -} // namespace configmgr - -#endif diff --git a/configmgr/source/inc/valueref.hxx b/configmgr/source/inc/valueref.hxx deleted file mode 100644 index 5e24da39d8b8..000000000000 --- a/configmgr/source/inc/valueref.hxx +++ /dev/null @@ -1,132 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_CONFIGVALUEREF_HXX_ -#define CONFIGMGR_CONFIGVALUEREF_HXX_ - -#include "noderef.hxx" - -namespace configmgr -{ - namespace node { struct Attributes; } - - namespace configuration - { - //------------------------------------------------------------------------- - class Tree; - //------------------------------------------------------------------------- - - /// represents a value node in some tree - class ValueRef - { - public: - /// constructs an empty (invalid) node - ValueRef(); - - ValueRef(rtl::OUString const& aName, unsigned int nParentPos); - - /// copy a node (with reference semantics) - ValueRef(ValueRef const& rOther); - /// copy a node (with reference semantics) - ValueRef& operator=(ValueRef const& rOther); - - void swap(ValueRef& rOther); - - ~ValueRef(); - - /// checks, if this represents an existing node - inline bool isValid() const; - - bool checkValidState() const; - - rtl::OUString m_sNodeName; - unsigned int m_nParentPos; - }; - //------------------------------------------------------------------------- - - /** extract the value from a plain value - */ - inline - com::sun::star::uno::Any getSimpleValue(rtl::Reference< Tree > const& aTree, ValueRef const& aNode) - { return aTree->getNodeValue( aNode ); } - - //------------------------------------------------------------------------- - inline bool ValueRef::isValid() const - { - OSL_ASSERT( m_nParentPos == 0 || checkValidState() ); - return m_nParentPos != 0; - } - - //------------------------------------------------------------------------- - - class SubNodeID - { - public: - static SubNodeID createEmpty() { return SubNodeID(); } - SubNodeID(rtl::Reference< Tree > const& rTree, NodeRef const& rParentNode, rtl::OUString const& aName); - SubNodeID(NodeID const& rParentNodeID, rtl::OUString const& aName); - - // comparison - // equality - friend bool operator==(SubNodeID const& lhs, SubNodeID const& rhs) - { return lhs.m_aParentID == rhs.m_aParentID && lhs.m_sNodeName == rhs.m_sNodeName; } - // ordering - friend bool operator < (SubNodeID const& lhs, SubNodeID const& rhs); - // checking - bool isValidNode() const; - // hashing - size_t hashCode() const { return m_aParentID.hashCode() + 5*m_sNodeName.hashCode(); } - // containing node this - NodeID getParentID() const { return m_aParentID; } - // containing node this - rtl::OUString getNodeName() const { return m_sNodeName; } - private: - SubNodeID(); // create an empty one - rtl::OUString m_sNodeName; - NodeID m_aParentID; - }; - //------------------------------------------------------------------------- - - void getAllChildrenHelper(NodeID const& aNode, std::vector<SubNodeID>& aList); - - //------------------------------------------------------------------------- - inline bool operator!=(SubNodeID const& lhs, SubNodeID const& rhs) - { return !(lhs == rhs); } - //--------------------------------------------------------------------- - - inline bool operator>=(SubNodeID const& lhs, SubNodeID const& rhs) - { return !(lhs < rhs); } - //--------------------------------------------------------------------- - inline bool operator > (SubNodeID const& lhs, SubNodeID const& rhs) - { return (rhs < lhs); } - inline bool operator<=(SubNodeID const& lhs, SubNodeID const& rhs) - { return !(rhs < lhs); } - //------------------------------------------------------------------------- - } -} - -#endif // CONFIGMGR_CONFIGVALUENODE_HXX_ diff --git a/configmgr/source/inc/valuetypeconverter.hxx b/configmgr/source/inc/valuetypeconverter.hxx deleted file mode 100644 index fd6fc7afe764..000000000000 --- a/configmgr/source/inc/valuetypeconverter.hxx +++ /dev/null @@ -1,155 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_VALUECONVERTER_HXX -#define CONFIGMGR_VALUECONVERTER_HXX - -#include "utility.hxx" -#include <com/sun/star/script/XTypeConverter.hpp> -#include <com/sun/star/uno/Sequence.hxx> -#include <com/sun/star/uno/Type.hxx> - -#ifndef INCLUDED_VECTOR -#include <vector> -#define INCLUDED_VECTOR -#endif - -namespace configmgr -{ - namespace uno = ::com::sun::star::uno; - namespace script = ::com::sun::star::script; - -// ----------------------------------------------------------------------------- - class ValueConverter - { - /// TypeConverter is used for converting type from string values - uno::Reference< script::XTypeConverter > m_xTypeConverter; - /// Value info - uno::Type m_aType; - rtl::OUString m_sSeparator; - bool m_bNull; - public: - /// construct a value converter with no initial type info - ValueConverter(const uno::Reference< script::XTypeConverter > & _xTC) - : m_xTypeConverter(_xTC) - , m_aType() - { - implReset(); - } - - /// construct a value converter with a type - ValueConverter(uno::Type const& _aType, const uno::Reference< script::XTypeConverter > & _xTC) - : m_xTypeConverter(_xTC) - , m_aType(_aType) - { - implReset(); - } - - /// provide access to the TypeConverter that is used for converting string format - uno::Reference< script::XTypeConverter > const& getTypeConverter() const SAL_THROW(()) - { - return m_xTypeConverter; - } - - /// (re)start the converter with the current type - void restart() - { - implReset(); - } - - /// (re)start the converter with a new type info (or none) - void reset(uno::Type const & _aType = uno::Type()) - { - m_aType = _aType; - implReset(); - } - - /// set the NULL state of this converter - void setIsNull(bool bNull = true) - { - m_bNull = bNull; - } - - /// set the separator of this converter - void setSeparator(rtl::OUString const & _aSeparator) - { - m_sSeparator = _aSeparator; - } - - /// get the (UNO) type - bool isTypeSet() const { return m_aType.getTypeClass() != uno::TypeClass_VOID; } - - /// get the (UNO) type - uno::Type getType() const { return m_aType; } - - /// is this marked null - bool isNull() const { return m_bNull; } - - /// does this have a list type - bool isList() const; - - /// does this have a separator set - bool hasSeparator() const { return m_sSeparator.getLength() != 0; } - - /// converting a value - uno::Any convertToAny(rtl::OUString const& aContent) const - SAL_THROW((script::CannotConvertException , com::sun::star::uno::RuntimeException)); - - /// converting a list - uno::Any convertListToAny(uno::Sequence< rtl::OUString > const& aContentList) const - SAL_THROW((script::CannotConvertException , com::sun::star::uno::RuntimeException)); - - /// converting a binary value - uno::Sequence<sal_Int8> parseBinary(rtl::OUString const& aBinaryString) const - SAL_THROW((script::CannotConvertException , com::sun::star::uno::RuntimeException)); - - /// splits a string list - uno::Sequence< rtl::OUString > splitStringList(rtl::OUString const& aContent) const; - private: - /// converting a list - bool convertListToAny(std::vector< rtl::OUString > const& aContentList, uno::Any& rValue) const - SAL_THROW((script::CannotConvertException , com::sun::star::uno::RuntimeException)); - - /// converting a scalar value - bool convertScalarToAny(rtl::OUString const& aContent, uno::Any& rValue) const - SAL_THROW((script::CannotConvertException , com::sun::star::uno::RuntimeException)); - - /// splitting a string list - void splitListData(rtl::OUString const& aContent, std::vector< rtl::OUString >& rContentList) const - SAL_THROW(()); - private: - void implReset() SAL_THROW(()) - { - m_sSeparator = rtl::OUString(); - m_bNull = false; - } - }; -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- -} // namespace - -#endif diff --git a/configmgr/source/inc/wrapexception.hxx b/configmgr/source/inc/wrapexception.hxx deleted file mode 100644 index c942a2190286..000000000000 --- a/configmgr/source/inc/wrapexception.hxx +++ /dev/null @@ -1,128 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * 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. - * - ************************************************************************/ - -#ifndef CONFIGMGR_WRAPEXCEPTION_HXX -#define CONFIGMGR_WRAPEXCEPTION_HXX - -#include <com/sun/star/configuration/MissingBootstrapFileException.hpp> -#include <com/sun/star/configuration/InvalidBootstrapFileException.hpp> -#include <com/sun/star/configuration/InstallationIncompleteException.hpp> -#include <com/sun/star/configuration/CannotLoadConfigurationException.hpp> -#include <com/sun/star/configuration/backend/BackendSetupException.hpp> -#include <com/sun/star/configuration/backend/AuthenticationFailedException.hpp> -#include <com/sun/star/configuration/backend/InvalidAuthenticationMechanismException.hpp> -#include <com/sun/star/configuration/backend/CannotConnectException.hpp> -#include <com/sun/star/configuration/backend/InsufficientAccessRightsException.hpp> - -#include <com/sun/star/configuration/backend/BackendAccessException.hpp> -#include <com/sun/star/configuration/backend/ConnectionLostException.hpp> -#include <com/sun/star/configuration/backend/MalformedDataException.hpp> - -#include <com/sun/star/lang/DisposedException.hpp> -#include <com/sun/star/lang/WrappedTargetException.hpp> -#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> -#include <com/sun/star/xml/sax/SAXException.hpp> -#include <com/sun/star/xml/sax/SAXParseException.hpp> - -#define WRAP_EXCEPTION( ETyp, Raise ) \ - catch (ETyp & _e_) { Raise( uno::makeAny(_e_) ); } - -#define WRAP_EXCEPTION1( ETyp, Raise, Arg ) \ - catch (ETyp & _e_) { Raise( uno::makeAny(_e_), (Arg) ); } - -#define PASS_EXCEPTION( ETyp ) \ - catch (ETyp & ) { throw; } - -#define WRAP_CONFIGBACKEND_CREATION_EXCEPTIONS( Raise ) \ - WRAP_EXCEPTION(::com::sun::star::configuration::backend::InsufficientAccessRightsException, Raise) \ - WRAP_EXCEPTION(::com::sun::star::configuration::backend::AuthenticationFailedException, Raise) \ - WRAP_EXCEPTION(::com::sun::star::configuration::backend::InvalidAuthenticationMechanismException, Raise) \ - WRAP_EXCEPTION(::com::sun::star::configuration::backend::CannotConnectException, Raise) \ - WRAP_EXCEPTION(::com::sun::star::configuration::backend::BackendSetupException, Raise) \ - WRAP_EXCEPTION(::com::sun::star::configuration::backend::BackendAccessException, Raise) \ - WRAP_EXCEPTION(::com::sun::star::configuration::MissingBootstrapFileException, Raise) \ - WRAP_EXCEPTION(::com::sun::star::configuration::InvalidBootstrapFileException, Raise) \ - WRAP_EXCEPTION(::com::sun::star::configuration::InstallationIncompleteException, Raise) \ - WRAP_EXCEPTION(::com::sun::star::configuration::CannotLoadConfigurationException, Raise) \ - WRAP_EXCEPTION(::com::sun::star::lang::WrappedTargetException, Raise) \ - WRAP_EXCEPTION(::com::sun::star::lang::WrappedTargetRuntimeException, Raise) \ - WRAP_EXCEPTION(::com::sun::star::lang::DisposedException, Raise) \ - WRAP_EXCEPTION(::com::sun::star::uno::RuntimeException, Raise) \ - WRAP_EXCEPTION(::com::sun::star::uno::Exception, Raise) - -#define WRAP_CONFIGBACKEND_EXCEPTIONS( Raise ) \ - WRAP_EXCEPTION(::com::sun::star::configuration::backend::InsufficientAccessRightsException, Raise) \ - WRAP_EXCEPTION(::com::sun::star::configuration::backend::ConnectionLostException, Raise) \ - WRAP_EXCEPTION(::com::sun::star::configuration::backend::BackendAccessException, Raise) \ - -#define WRAP_CONFIGDATA_EXCEPTIONS( Raise ) \ - WRAP_EXCEPTION(::com::sun::star::configuration::backend::MalformedDataException, Raise) \ - WRAP_CONFIGBACKEND_EXCEPTIONS( Raise ) \ - WRAP_EXCEPTION(::com::sun::star::lang::WrappedTargetException, Raise) \ - -#define WRAP_SAX_EXCEPTIONS( Raise ) \ - WRAP_EXCEPTION(::com::sun::star::xml::sax::SAXParseException, Raise) \ - WRAP_EXCEPTION(::com::sun::star::xml::sax::SAXException, Raise) \ - -#define WRAP_OTHER_EXCEPTIONS( Raise ) \ - WRAP_EXCEPTION(::com::sun::star::uno::Exception, Raise) - -#define WRAP_CONFIGBACKEND_CREATION_EXCEPTIONS1( Raise, Arg ) \ - WRAP_EXCEPTION1(::com::sun::star::configuration::backend::InsufficientAccessRightsException, Raise, Arg) \ - WRAP_EXCEPTION1(::com::sun::star::configuration::backend::AuthenticationFailedException, Raise, Arg) \ - WRAP_EXCEPTION1(::com::sun::star::configuration::backend::InvalidAuthenticationMechanismException, Raise, Arg) \ - WRAP_EXCEPTION1(::com::sun::star::configuration::backend::CannotConnectException, Raise, Arg) \ - WRAP_EXCEPTION1(::com::sun::star::configuration::backend::BackendSetupException, Raise, Arg) \ - WRAP_EXCEPTION1(::com::sun::star::configuration::backend::BackendAccessException, Raise, Arg) \ - WRAP_EXCEPTION1(::com::sun::star::configuration::MissingBootstrapFileException, Raise, Arg) \ - WRAP_EXCEPTION1(::com::sun::star::configuration::InvalidBootstrapFileException, Raise, Arg) \ - WRAP_EXCEPTION1(::com::sun::star::configuration::InstallationIncompleteException, Raise, Arg) \ - WRAP_EXCEPTION1(::com::sun::star::configuration::CannotLoadConfigurationException, Raise, Arg) \ - WRAP_EXCEPTION1(::com::sun::star::lang::WrappedTargetException, Raise, Arg) \ - WRAP_EXCEPTION1(::com::sun::star::lang::WrappedTargetRuntimeException, Raise, Arg) \ - WRAP_EXCEPTION1(::com::sun::star::lang::DisposedException, Raise, Arg) \ - WRAP_EXCEPTION1(::com::sun::star::uno::RuntimeException, Raise, Arg) \ - WRAP_EXCEPTION1(::com::sun::star::uno::Exception, Raise, Arg) - -#define WRAP_CONFIGBACKEND_EXCEPTIONS1( Raise, Arg ) \ - WRAP_EXCEPTION1(::com::sun::star::configuration::backend::InsufficientAccessRightsException, Raise, Arg) \ - WRAP_EXCEPTION1(::com::sun::star::configuration::backend::ConnectionLostException, Raise, Arg) \ - WRAP_EXCEPTION1(::com::sun::star::configuration::backend::BackendAccessException, Raise, Arg) \ - -#define WRAP_CONFIGDATA_EXCEPTIONS1( Raise, Arg ) \ - WRAP_EXCEPTION1(::com::sun::star::configuration::backend::MalformedDataException, Raise, Arg) \ - WRAP_CONFIGBACKEND_EXCEPTIONS1( Raise, Arg ) \ - WRAP_EXCEPTION1(::com::sun::star::lang::WrappedTargetException, Raise, Arg) \ - -#define WRAP_SAX_EXCEPTIONS1( Raise, Arg ) \ - WRAP_EXCEPTION1(::com::sun::star::xml::sax::SAXParseException, Raise, Arg) \ - WRAP_EXCEPTION1(::com::sun::star::xml::sax::SAXException, Raise, Arg) \ - -#define WRAP_OTHER_EXCEPTIONS1( Raise, Arg ) \ - WRAP_EXCEPTION1(::com::sun::star::uno::Exception, Raise, Arg) - -#endif // CONFIGMGR_WRAPEXCEPTION_HXX |