2009-05-15 14:06:56 +02:00
|
|
|
/*************************************************************************
|
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
*
|
|
|
|
* Copyright 2009 by Sun Microsystems, Inc.
|
|
|
|
*
|
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
|
|
|
*
|
|
|
|
* $RCSfile: code,v $
|
|
|
|
*
|
|
|
|
* $Revision: 1.4 $
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#include "precompiled_configmgr.hxx"
|
|
|
|
#include "sal/config.h"
|
|
|
|
|
2009-06-03 18:02:52 +02:00
|
|
|
#include <vector>
|
|
|
|
|
2009-05-15 14:06:56 +02:00
|
|
|
#include "com/sun/star/beans/Property.hpp"
|
|
|
|
#include "com/sun/star/beans/PropertyAttribute.hpp"
|
|
|
|
#include "com/sun/star/beans/PropertyVetoException.hpp"
|
|
|
|
#include "com/sun/star/beans/UnknownPropertyException.hpp"
|
|
|
|
#include "com/sun/star/beans/XPropertiesChangeListener.hpp"
|
|
|
|
#include "com/sun/star/beans/XPropertyChangeListener.hpp"
|
|
|
|
#include "com/sun/star/beans/XPropertySetInfo.hpp"
|
|
|
|
#include "com/sun/star/beans/XVetoableChangeListener.hpp"
|
|
|
|
#include "com/sun/star/container/NoSuchElementException.hpp"
|
|
|
|
#include "com/sun/star/container/XContainerListener.hpp"
|
2009-05-15 18:00:17 +02:00
|
|
|
#include "com/sun/star/lang/IllegalArgumentException.hpp"
|
2009-05-15 14:06:56 +02:00
|
|
|
#include "com/sun/star/lang/NoSupportException.hpp"
|
|
|
|
#include "com/sun/star/lang/WrappedTargetException.hpp"
|
2009-05-15 18:00:17 +02:00
|
|
|
#include "com/sun/star/lang/XUnoTunnel.hpp"
|
2009-05-15 14:06:56 +02:00
|
|
|
#include "com/sun/star/uno/Any.hxx"
|
|
|
|
#include "com/sun/star/uno/Reference.hxx"
|
|
|
|
#include "com/sun/star/uno/RuntimeException.hpp"
|
|
|
|
#include "com/sun/star/uno/Sequence.hxx"
|
|
|
|
#include "com/sun/star/uno/Type.hxx"
|
2009-05-18 15:03:21 +02:00
|
|
|
#include "com/sun/star/uno/TypeClass.hpp"
|
2009-05-15 14:06:56 +02:00
|
|
|
#include "com/sun/star/uno/XInterface.hpp"
|
2009-06-24 16:10:18 +02:00
|
|
|
#include "com/sun/star/util/ElementChange.hpp"
|
2009-05-15 14:06:56 +02:00
|
|
|
#include "comphelper/sequenceasvector.hxx"
|
|
|
|
#include "cppu/unotype.hxx"
|
|
|
|
#include "cppuhelper/exc_hlp.hxx"
|
|
|
|
#include "cppuhelper/weak.hxx"
|
|
|
|
#include "osl/diagnose.h"
|
|
|
|
#include "osl/mutex.hxx"
|
2009-05-15 18:00:17 +02:00
|
|
|
#include "rtl/ref.hxx"
|
2009-05-15 14:06:56 +02:00
|
|
|
#include "rtl/ustring.h"
|
|
|
|
#include "rtl/ustring.hxx"
|
|
|
|
#include "sal/types.h"
|
|
|
|
|
|
|
|
#include "access.hxx"
|
2009-05-18 15:03:21 +02:00
|
|
|
#include "childaccess.hxx"
|
2009-05-15 14:06:56 +02:00
|
|
|
#include "components.hxx"
|
|
|
|
#include "groupnode.hxx"
|
2009-07-22 14:41:57 +02:00
|
|
|
#include "layer.hxx"
|
2009-05-15 14:06:56 +02:00
|
|
|
#include "localizedpropertynode.hxx"
|
2009-05-20 17:20:08 +02:00
|
|
|
#include "localizedpropertyvaluenode.hxx"
|
2009-05-15 14:06:56 +02:00
|
|
|
#include "lock.hxx"
|
|
|
|
#include "node.hxx"
|
|
|
|
#include "propertynode.hxx"
|
|
|
|
#include "rootaccess.hxx"
|
|
|
|
#include "setnode.hxx"
|
2009-05-18 15:03:21 +02:00
|
|
|
#include "type.hxx"
|
2009-05-15 14:06:56 +02:00
|
|
|
|
|
|
|
namespace configmgr {
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
namespace css = com::sun::star;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2009-05-20 17:20:08 +02:00
|
|
|
bool Access::isValue() {
|
|
|
|
osl::MutexGuard g(lock);
|
|
|
|
rtl::Reference< Node > p(getNode());
|
|
|
|
return dynamic_cast< PropertyNode * >(p.get()) != 0 ||
|
2009-05-22 16:49:07 +02:00
|
|
|
dynamic_cast< LocalizedPropertyValueNode * >(p.get()) != 0 ||
|
2009-05-20 17:20:08 +02:00
|
|
|
(dynamic_cast< LocalizedPropertyNode * >(p.get()) != 0 &&
|
2009-06-04 10:46:43 +02:00
|
|
|
!Components::allLocales(getRootAccess()->getLocale()));
|
2009-05-15 14:06:56 +02:00
|
|
|
}
|
|
|
|
|
2009-05-29 15:19:40 +02:00
|
|
|
void Access::releaseChild(rtl::OUString const & name) {
|
2009-06-23 17:14:12 +02:00
|
|
|
cachedChildren_.erase(name);
|
2009-05-29 15:19:40 +02:00
|
|
|
}
|
|
|
|
|
2009-06-03 11:29:12 +02:00
|
|
|
Access::Access(): AccessBase(lock) {}
|
2009-05-15 14:06:56 +02:00
|
|
|
|
|
|
|
Access::~Access() {}
|
|
|
|
|
2009-07-02 14:21:36 +02:00
|
|
|
css::uno::Any Access::queryInterface(css::uno::Type const & aType)
|
|
|
|
throw (css::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
OSL_ASSERT(thisIs(IS_ANY));
|
|
|
|
osl::MutexGuard g(lock);
|
|
|
|
checkLocalizedPropertyAccess();
|
|
|
|
css::uno::Any res(AccessBase::queryInterface(aType));
|
|
|
|
if (res.hasValue()) {
|
|
|
|
if (aType.getTypeName().equalsAsciiL(
|
|
|
|
RTL_CONSTASCII_STRINGPARAM("com.sun.beans.XPropertySetInfo")) ||
|
|
|
|
aType.getTypeName().equalsAsciiL(
|
|
|
|
RTL_CONSTASCII_STRINGPARAM("com.sun.beans.XPropertySet")) ||
|
|
|
|
aType.getTypeName().equalsAsciiL(
|
|
|
|
RTL_CONSTASCII_STRINGPARAM(
|
|
|
|
"com.sun.beans.XMultiPropertySet")) ||
|
|
|
|
aType.getTypeName().equalsAsciiL(
|
|
|
|
RTL_CONSTASCII_STRINGPARAM(
|
|
|
|
"com.sun.beans.XHierarchicalPropertySet")) ||
|
|
|
|
aType.getTypeName().equalsAsciiL(
|
|
|
|
RTL_CONSTASCII_STRINGPARAM(
|
|
|
|
"com.sun.beans.XMultiHierarchicalPropertySet")))
|
|
|
|
{
|
|
|
|
if (dynamic_cast< GroupNode * >(getNode().get()) == 0) {
|
|
|
|
res.clear();
|
|
|
|
}
|
|
|
|
} else if (aType.getTypeName().equalsAsciiL(
|
|
|
|
RTL_CONSTASCII_STRINGPARAM(
|
|
|
|
"com.sun.star.container.XNameReplace")))
|
|
|
|
{
|
|
|
|
if (!getRootAccess()->isUpdate()) {
|
|
|
|
res.clear();
|
|
|
|
}
|
|
|
|
} else if (aType.getTypeName().equalsAsciiL(
|
|
|
|
RTL_CONSTASCII_STRINGPARAM(
|
|
|
|
"com.sun.star.container.XNameContainer")))
|
|
|
|
{
|
|
|
|
GroupNode * group = dynamic_cast< GroupNode * >(getNode().get());
|
|
|
|
if ((group != 0 && !group->isExtensible()) ||
|
|
|
|
!getRootAccess()->isUpdate())
|
|
|
|
{
|
|
|
|
res.clear();
|
|
|
|
}
|
|
|
|
} else if (aType.getTypeName().equalsAsciiL(
|
|
|
|
RTL_CONSTASCII_STRINGPARAM(
|
|
|
|
"com.sun.star.lang.XSingleServiceFactory")))
|
|
|
|
{
|
|
|
|
if (dynamic_cast< SetNode * >(getNode().get()) == 0 ||
|
|
|
|
!getRootAccess()->isUpdate())
|
|
|
|
{
|
|
|
|
res.clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Access::checkLocalizedPropertyAccess() {
|
|
|
|
if (dynamic_cast< LocalizedPropertyNode * >(getNode().get()) != 0 &&
|
|
|
|
!Components::allLocales(getRootAccess()->getLocale()))
|
|
|
|
{
|
|
|
|
throw css::uno::RuntimeException(
|
|
|
|
rtl::OUString(
|
|
|
|
RTL_CONSTASCII_USTRINGPARAM(
|
|
|
|
"configmgr Access to specialized LocalizedPropertyNode")),
|
|
|
|
static_cast< cppu::OWeakObject * >(this));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-24 16:10:18 +02:00
|
|
|
rtl::Reference< Node > Access::getParentNode() {
|
|
|
|
rtl::Reference< Access > parent(getParentAccess());
|
|
|
|
return parent.is() ? parent->getNode() : rtl::Reference< Node >();
|
|
|
|
}
|
|
|
|
|
2009-06-25 13:51:29 +02:00
|
|
|
rtl::Reference< ChildAccess > Access::getChild(rtl::OUString const & name) {
|
|
|
|
HardChildMap::iterator i(modifiedChildren_.find(name));
|
|
|
|
return i == modifiedChildren_.end()
|
|
|
|
? getUnmodifiedChild(name) : getModifiedChild(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector< rtl::Reference< ChildAccess > > Access::getAllChildren() {
|
|
|
|
std::vector< rtl::Reference< ChildAccess > > vec;
|
|
|
|
NodeMap & members = getMemberNodes();
|
|
|
|
for (NodeMap::iterator i(members.begin()); i != members.end(); ++i) {
|
2009-07-23 12:42:37 +02:00
|
|
|
if (!i->second->isRemoved() &&
|
|
|
|
modifiedChildren_.find(i->first) == modifiedChildren_.end())
|
|
|
|
{
|
2009-06-25 13:51:29 +02:00
|
|
|
vec.push_back(getUnmodifiedChild(i->first));
|
|
|
|
OSL_ASSERT(vec.back().is());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (HardChildMap::iterator i(modifiedChildren_.begin());
|
|
|
|
i != modifiedChildren_.end(); ++i)
|
|
|
|
{
|
|
|
|
rtl::Reference< ChildAccess > child(getModifiedChild(i));
|
|
|
|
if (child.is()) {
|
|
|
|
vec.push_back(child);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return vec;
|
|
|
|
}
|
|
|
|
|
2009-06-24 16:53:49 +02:00
|
|
|
void Access::checkValue(
|
|
|
|
com::sun::star::uno::Any const & value, Type type, bool nillable)
|
|
|
|
{
|
|
|
|
bool ok;
|
|
|
|
switch (type) {
|
|
|
|
case TYPE_NIL:
|
|
|
|
OSL_ASSERT(false);
|
|
|
|
// fall through (cannot happen)
|
|
|
|
case TYPE_ERROR:
|
|
|
|
ok = false;
|
|
|
|
break;
|
|
|
|
case TYPE_ANY:
|
|
|
|
switch (mapType(value)) {
|
|
|
|
case TYPE_ANY:
|
|
|
|
OSL_ASSERT(false);
|
|
|
|
// fall through (cannot happen)
|
|
|
|
case TYPE_ERROR:
|
|
|
|
ok = false;
|
|
|
|
break;
|
|
|
|
case TYPE_NIL:
|
|
|
|
ok = nillable;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ok = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ok = value.hasValue() ? value.isExtractableTo(mapType(type)) : nillable;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (!ok) {
|
|
|
|
throw css::lang::IllegalArgumentException(
|
|
|
|
rtl::OUString(
|
|
|
|
RTL_CONSTASCII_USTRINGPARAM(
|
|
|
|
"configmgr inappropriate property value")),
|
|
|
|
static_cast< cppu::OWeakObject * >(this), -1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-25 13:51:29 +02:00
|
|
|
void Access::insertLocalizedPropertyValueChild(
|
|
|
|
rtl::OUString const & name, com::sun::star::uno::Any const & value)
|
|
|
|
{
|
|
|
|
LocalizedPropertyNode * locprop =
|
|
|
|
dynamic_cast< LocalizedPropertyNode * >(getNode().get());
|
|
|
|
OSL_ASSERT(locprop != 0);
|
|
|
|
checkValue(value, locprop->getType(), locprop->isNillable());
|
|
|
|
rtl::Reference< ChildAccess > child(
|
|
|
|
new ChildAccess(
|
|
|
|
getRootAccess(), this, name,
|
2009-07-28 15:30:19 +02:00
|
|
|
new LocalizedPropertyValueNode(NO_LAYER, value)));
|
2009-06-25 13:51:29 +02:00
|
|
|
child->markAsModified();
|
|
|
|
//TODO notify change
|
|
|
|
}
|
|
|
|
|
2009-06-24 16:10:18 +02:00
|
|
|
void Access::reportChildChanges(
|
|
|
|
std::vector< css::util::ElementChange > * changes)
|
|
|
|
{
|
|
|
|
OSL_ASSERT(changes != 0);
|
|
|
|
for (HardChildMap::iterator i(modifiedChildren_.begin());
|
|
|
|
i != modifiedChildren_.end(); ++i)
|
|
|
|
{
|
|
|
|
rtl::Reference< ChildAccess > child(getModifiedChild(i));
|
|
|
|
if (child.is()) {
|
|
|
|
child->reportChildChanges(changes);
|
|
|
|
changes->push_back(css::util::ElementChange());
|
|
|
|
//TODO: changed value and/or inserted node
|
|
|
|
} else {
|
|
|
|
changes->push_back(css::util::ElementChange()); //TODO: removed node
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-29 15:30:40 +02:00
|
|
|
void Access::commitChildChanges(bool valid) {
|
2009-07-23 12:42:37 +02:00
|
|
|
while (!modifiedChildren_.empty()) {
|
2009-07-29 15:30:40 +02:00
|
|
|
bool childValid = valid;
|
2009-07-23 12:42:37 +02:00
|
|
|
HardChildMap::iterator i(modifiedChildren_.begin());
|
|
|
|
rtl::Reference< ChildAccess > child(getModifiedChild(i));
|
|
|
|
if (child.is()) {
|
2009-07-29 15:30:40 +02:00
|
|
|
childValid = childValid && !child->isFinalized();
|
|
|
|
child->commitChanges(childValid);
|
2009-07-23 12:42:37 +02:00
|
|
|
//TODO: currently, this is called here for directly inserted
|
|
|
|
// children as well as for children whose sub-children were
|
|
|
|
// modified (and should never be called for directly removed
|
|
|
|
// children); clarify what exactly should happen here for
|
|
|
|
// directly inserted children
|
|
|
|
}
|
|
|
|
if (i->second->isModified()) {
|
2009-07-27 14:34:10 +02:00
|
|
|
NodeMap & members = getMemberNodes();
|
|
|
|
NodeMap::iterator j(members.find(i->first));
|
2009-07-08 17:25:16 +02:00
|
|
|
if (child.is()) {
|
2009-07-23 12:42:37 +02:00
|
|
|
// Inserted:
|
2009-07-28 15:30:19 +02:00
|
|
|
if (j != members.end()) {
|
2009-07-29 15:30:40 +02:00
|
|
|
childValid = childValid &&
|
|
|
|
j->second->getFinalized() == NO_LAYER;
|
|
|
|
if (childValid) {
|
|
|
|
child->getNode()->setMandatory(
|
|
|
|
j->second->getMandatory());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (childValid) {
|
|
|
|
getMemberNodes()[i->first] = child->getNode();
|
2009-07-28 15:30:19 +02:00
|
|
|
}
|
2009-07-08 17:25:16 +02:00
|
|
|
} else {
|
2009-07-29 15:30:40 +02:00
|
|
|
// Removed:
|
|
|
|
childValid = childValid && j != members.end() &&
|
|
|
|
j->second->getFinalized() == NO_LAYER &&
|
|
|
|
j->second->getMandatory() == NO_LAYER;
|
|
|
|
if (childValid) {
|
2009-07-28 15:30:19 +02:00
|
|
|
j->second->remove(NO_LAYER);
|
2009-07-23 12:42:37 +02:00
|
|
|
}
|
2009-07-08 17:25:16 +02:00
|
|
|
}
|
2009-07-29 15:30:40 +02:00
|
|
|
if (childValid) {
|
|
|
|
Components::singleton().addModification(
|
|
|
|
getPath() +
|
|
|
|
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) +
|
|
|
|
Components::createSegment(
|
|
|
|
i->second->getNode()->getTemplateName(), i->first));
|
|
|
|
}
|
2009-07-23 12:42:37 +02:00
|
|
|
i->second->committed();
|
2009-06-24 16:10:18 +02:00
|
|
|
}
|
2009-07-23 12:42:37 +02:00
|
|
|
modifiedChildren_.erase(i);
|
2009-06-24 16:10:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-02 14:21:36 +02:00
|
|
|
rtl::OUString Access::getImplementationName() throw (css::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
OSL_ASSERT(thisIs(IS_ANY));
|
|
|
|
osl::MutexGuard g(lock);
|
|
|
|
checkLocalizedPropertyAccess();
|
|
|
|
throw css::uno::RuntimeException(
|
|
|
|
rtl::OUString(
|
|
|
|
RTL_CONSTASCII_USTRINGPARAM(
|
|
|
|
"configmgr Access has no service implementation name")),
|
|
|
|
static_cast< cppu::OWeakObject * >(this));
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool Access::supportsService(rtl::OUString const & ServiceName)
|
|
|
|
throw (css::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
OSL_ASSERT(thisIs(IS_ANY));
|
|
|
|
osl::MutexGuard g(lock);
|
|
|
|
checkLocalizedPropertyAccess();
|
|
|
|
css::uno::Sequence< rtl::OUString > names(getSupportedServiceNames());
|
|
|
|
for (sal_Int32 i = 0; i < names.getLength(); ++i) {
|
|
|
|
if (names[i] == ServiceName) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
css::uno::Sequence< rtl::OUString > Access::getSupportedServiceNames()
|
|
|
|
throw (css::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
OSL_ASSERT(thisIs(IS_ANY));
|
|
|
|
osl::MutexGuard g(lock);
|
|
|
|
checkLocalizedPropertyAccess();
|
|
|
|
comphelper::SequenceAsVector< rtl::OUString > services;
|
|
|
|
services.push_back(
|
|
|
|
rtl::OUString(
|
|
|
|
RTL_CONSTASCII_USTRINGPARAM(
|
|
|
|
"com.sun.star.configuration.ConfigurationAccess")));
|
|
|
|
if (getRootAccess()->isUpdate()) {
|
|
|
|
services.push_back(
|
|
|
|
rtl::OUString(
|
|
|
|
RTL_CONSTASCII_USTRINGPARAM(
|
|
|
|
"com.sun.star.configuration.ConfigurationUpdateAccess")));
|
|
|
|
}
|
|
|
|
services.push_back(
|
|
|
|
rtl::OUString(
|
|
|
|
RTL_CONSTASCII_USTRINGPARAM(
|
|
|
|
"com.sun.star.configuration.HierarchyAccess")));
|
|
|
|
services.push_back(
|
|
|
|
rtl::OUString(
|
|
|
|
RTL_CONSTASCII_USTRINGPARAM(
|
|
|
|
"com.sun.star.configuration.HierarchyElement")));
|
|
|
|
if (dynamic_cast< GroupNode * >(getNode().get()) != 0) {
|
|
|
|
services.push_back(
|
|
|
|
rtl::OUString(
|
|
|
|
RTL_CONSTASCII_USTRINGPARAM(
|
|
|
|
"com.sun.star.configuration.GroupAccess")));
|
|
|
|
services.push_back(
|
|
|
|
rtl::OUString(
|
|
|
|
RTL_CONSTASCII_USTRINGPARAM(
|
|
|
|
"com.sun.star.configuration.PropertyHierarchy")));
|
|
|
|
if (getRootAccess()->isUpdate()) {
|
|
|
|
services.push_back(
|
|
|
|
rtl::OUString(
|
|
|
|
RTL_CONSTASCII_USTRINGPARAM(
|
|
|
|
"com.sun.star.configuration.GroupUpdate")));
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
services.push_back(
|
|
|
|
rtl::OUString(
|
|
|
|
RTL_CONSTASCII_USTRINGPARAM(
|
|
|
|
"com.sun.star.configuration.SetAccess")));
|
|
|
|
services.push_back(
|
|
|
|
rtl::OUString(
|
|
|
|
RTL_CONSTASCII_USTRINGPARAM(
|
|
|
|
"com.sun.star.configuration.SimpleSetAccess")));
|
|
|
|
if (getRootAccess()->isUpdate()) {
|
|
|
|
services.push_back(
|
|
|
|
rtl::OUString(
|
|
|
|
RTL_CONSTASCII_USTRINGPARAM(
|
|
|
|
"com.sun.star.configuration.SetUpdate")));
|
|
|
|
services.push_back(
|
|
|
|
rtl::OUString(
|
|
|
|
RTL_CONSTASCII_USTRINGPARAM(
|
|
|
|
"com.sun.star.configuration.SimpleSetUpdate")));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
addSupportedServiceNames(&services);
|
|
|
|
return services.getAsConstList();
|
|
|
|
}
|
|
|
|
|
2009-05-19 17:32:24 +02:00
|
|
|
css::uno::Type Access::getElementType() throw (css::uno::RuntimeException) {
|
2009-05-26 17:25:36 +02:00
|
|
|
OSL_ASSERT(thisIs(IS_ANY));
|
2009-05-19 17:32:24 +02:00
|
|
|
osl::MutexGuard g(lock);
|
2009-07-02 14:21:36 +02:00
|
|
|
checkLocalizedPropertyAccess();
|
2009-05-19 17:32:24 +02:00
|
|
|
rtl::Reference< Node > p(getNode());
|
|
|
|
if (LocalizedPropertyNode * locprop =
|
|
|
|
dynamic_cast< LocalizedPropertyNode * >(p.get()))
|
|
|
|
{
|
|
|
|
return mapType(locprop->getType());
|
|
|
|
} else if (dynamic_cast< GroupNode * >(p.get()) != 0) {
|
|
|
|
//TODO: Should a specific type be returned for a non-extensible group
|
|
|
|
// with homogeneous members or for an extensible group that currently
|
|
|
|
// has only homegeneous members?
|
|
|
|
return cppu::UnoType< cppu::UnoVoidType >::get();
|
|
|
|
} else if (dynamic_cast< SetNode * >(p.get()) != 0) {
|
|
|
|
return cppu::UnoType< cppu::UnoVoidType >::get(); //TODO: correct?
|
|
|
|
} else {
|
|
|
|
OSL_ASSERT(false);
|
|
|
|
throw css::uno::RuntimeException(
|
|
|
|
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("this cannot happen")),
|
|
|
|
static_cast< cppu::OWeakObject * >(this));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool Access::hasElements() throw (css::uno::RuntimeException) {
|
2009-05-26 17:25:36 +02:00
|
|
|
OSL_ASSERT(thisIs(IS_ANY));
|
2009-05-19 17:32:24 +02:00
|
|
|
osl::MutexGuard g(lock);
|
2009-07-02 14:21:36 +02:00
|
|
|
checkLocalizedPropertyAccess();
|
2009-06-24 16:26:23 +02:00
|
|
|
return !getAllChildren().empty(); //TODO: optimize
|
2009-06-04 10:46:43 +02:00
|
|
|
}
|
|
|
|
|
2009-05-19 17:32:24 +02:00
|
|
|
css::uno::Any Access::getByName(rtl::OUString const & aName)
|
|
|
|
throw (
|
|
|
|
css::container::NoSuchElementException,
|
|
|
|
css::lang::WrappedTargetException, css::uno::RuntimeException)
|
|
|
|
{
|
2009-05-26 17:25:36 +02:00
|
|
|
OSL_ASSERT(thisIs(IS_ANY));
|
2009-05-19 17:32:24 +02:00
|
|
|
osl::MutexGuard g(lock);
|
2009-07-02 14:21:36 +02:00
|
|
|
checkLocalizedPropertyAccess();
|
2009-05-20 17:20:08 +02:00
|
|
|
rtl::Reference< ChildAccess > child(getChild(aName));
|
|
|
|
if (!child.is()) {
|
2009-05-20 13:33:52 +02:00
|
|
|
throw css::container::NoSuchElementException(
|
|
|
|
aName, static_cast< cppu::OWeakObject * >(this));
|
2009-05-19 17:32:24 +02:00
|
|
|
}
|
2009-05-20 17:20:08 +02:00
|
|
|
return child->asValue();
|
2009-05-19 17:32:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
css::uno::Sequence< rtl::OUString > Access::getElementNames()
|
|
|
|
throw (css::uno::RuntimeException)
|
|
|
|
{
|
2009-05-26 17:25:36 +02:00
|
|
|
OSL_ASSERT(thisIs(IS_ANY));
|
2009-05-19 17:32:24 +02:00
|
|
|
osl::MutexGuard g(lock);
|
2009-07-02 14:21:36 +02:00
|
|
|
checkLocalizedPropertyAccess();
|
2009-06-03 18:02:52 +02:00
|
|
|
std::vector< rtl::Reference< ChildAccess > > children(getAllChildren());
|
|
|
|
comphelper::SequenceAsVector< rtl::OUString > names;
|
|
|
|
for (std::vector< rtl::Reference< ChildAccess > >::iterator i(
|
|
|
|
children.begin());
|
|
|
|
i != children.end(); ++i)
|
2009-05-19 17:32:24 +02:00
|
|
|
{
|
2009-06-03 18:02:52 +02:00
|
|
|
names.push_back((*i)->getName());
|
2009-05-19 17:32:24 +02:00
|
|
|
}
|
2009-06-03 18:02:52 +02:00
|
|
|
return names.getAsConstList();
|
2009-05-19 17:32:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool Access::hasByName(rtl::OUString const & aName)
|
|
|
|
throw (css::uno::RuntimeException)
|
|
|
|
{
|
2009-05-26 17:25:36 +02:00
|
|
|
OSL_ASSERT(thisIs(IS_ANY));
|
2009-05-19 17:32:24 +02:00
|
|
|
osl::MutexGuard g(lock);
|
2009-07-02 14:21:36 +02:00
|
|
|
checkLocalizedPropertyAccess();
|
2009-05-20 17:20:08 +02:00
|
|
|
return getChild(aName).is();
|
2009-05-19 17:32:24 +02:00
|
|
|
}
|
|
|
|
|
2009-05-15 14:06:56 +02:00
|
|
|
css::uno::Any Access::getByHierarchicalName(rtl::OUString const & aName)
|
|
|
|
throw (css::container::NoSuchElementException, css::uno::RuntimeException)
|
|
|
|
{
|
2009-06-23 17:46:49 +02:00
|
|
|
OSL_ASSERT(thisIs(IS_ANY));
|
2009-05-15 14:06:56 +02:00
|
|
|
osl::MutexGuard g(lock);
|
2009-07-02 14:21:36 +02:00
|
|
|
checkLocalizedPropertyAccess();
|
2009-05-20 17:20:08 +02:00
|
|
|
rtl::Reference< ChildAccess > child(getSubChild(aName));
|
|
|
|
if (!child.is()) {
|
|
|
|
throw css::container::NoSuchElementException(
|
|
|
|
aName, static_cast< cppu::OWeakObject * >(this));
|
2009-05-15 14:06:56 +02:00
|
|
|
}
|
2009-05-20 17:20:08 +02:00
|
|
|
return child->asValue();
|
2009-05-15 14:06:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool Access::hasByHierarchicalName(rtl::OUString const & aName)
|
|
|
|
throw (css::uno::RuntimeException)
|
|
|
|
{
|
2009-06-23 17:46:49 +02:00
|
|
|
OSL_ASSERT(thisIs(IS_ANY));
|
2009-05-15 14:06:56 +02:00
|
|
|
osl::MutexGuard g(lock);
|
2009-07-02 14:21:36 +02:00
|
|
|
checkLocalizedPropertyAccess();
|
2009-05-20 17:20:08 +02:00
|
|
|
return getSubChild(aName).is();
|
2009-05-15 14:06:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void Access::addContainerListener(
|
|
|
|
css::uno::Reference< css::container::XContainerListener > const & xListener)
|
|
|
|
throw (css::uno::RuntimeException)
|
|
|
|
{
|
2009-06-23 17:46:49 +02:00
|
|
|
OSL_ASSERT(thisIs(IS_ANY));
|
2009-07-02 14:21:36 +02:00
|
|
|
osl::MutexGuard g(lock);
|
|
|
|
checkLocalizedPropertyAccess();
|
2009-05-15 14:06:56 +02:00
|
|
|
rBHelper.addListener(
|
|
|
|
cppu::UnoType< css::container::XContainerListener >::get(), xListener);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Access::removeContainerListener(
|
|
|
|
css::uno::Reference< css::container::XContainerListener > const & xListener)
|
|
|
|
throw (css::uno::RuntimeException)
|
|
|
|
{
|
2009-06-23 17:46:49 +02:00
|
|
|
OSL_ASSERT(thisIs(IS_ANY));
|
2009-07-02 14:21:36 +02:00
|
|
|
osl::MutexGuard g(lock);
|
|
|
|
checkLocalizedPropertyAccess();
|
2009-05-15 14:06:56 +02:00
|
|
|
rBHelper.removeListener(
|
|
|
|
cppu::UnoType< css::container::XContainerListener >::get(), xListener);
|
|
|
|
}
|
|
|
|
|
|
|
|
rtl::OUString Access::getExactName(rtl::OUString const & /*aApproximateName*/)
|
|
|
|
throw (css::uno::RuntimeException)
|
|
|
|
{
|
2009-06-23 17:46:49 +02:00
|
|
|
OSL_ASSERT(thisIs(IS_ANY));
|
2009-07-02 14:21:36 +02:00
|
|
|
osl::MutexGuard g(lock);
|
|
|
|
checkLocalizedPropertyAccess();
|
2009-05-15 14:06:56 +02:00
|
|
|
if(true)abort();*(char*)0=0;throw 0;//TODO
|
|
|
|
}
|
|
|
|
|
|
|
|
css::uno::Sequence< css::beans::Property > Access::getProperties()
|
|
|
|
throw (css::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
OSL_ASSERT(thisIs(IS_GROUP));
|
2009-06-03 18:02:52 +02:00
|
|
|
osl::MutexGuard g(lock);
|
|
|
|
std::vector< rtl::Reference< ChildAccess > > children(getAllChildren());
|
|
|
|
comphelper::SequenceAsVector< css::beans::Property > properties;
|
|
|
|
for (std::vector< rtl::Reference< ChildAccess > >::iterator i(
|
|
|
|
children.begin());
|
|
|
|
i != children.end(); ++i)
|
|
|
|
{
|
|
|
|
properties.push_back((*i)->asProperty());
|
|
|
|
}
|
|
|
|
return properties.getAsConstList();
|
2009-05-15 14:06:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
css::beans::Property Access::getPropertyByName(rtl::OUString const & aName)
|
|
|
|
throw (css::beans::UnknownPropertyException, css::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
OSL_ASSERT(thisIs(IS_GROUP));
|
|
|
|
osl::MutexGuard g(lock);
|
2009-05-20 17:20:08 +02:00
|
|
|
rtl::Reference< ChildAccess > child(getChild(aName));
|
|
|
|
if (!child.is()) {
|
2009-05-15 14:06:56 +02:00
|
|
|
throw css::beans::UnknownPropertyException(
|
|
|
|
aName, static_cast< cppu::OWeakObject * >(this));
|
|
|
|
}
|
2009-05-20 17:20:08 +02:00
|
|
|
return child->asProperty();
|
2009-05-15 14:06:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool Access::hasPropertyByName(rtl::OUString const & Name)
|
|
|
|
throw (css::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
OSL_ASSERT(thisIs(IS_GROUP));
|
2009-05-20 17:20:08 +02:00
|
|
|
osl::MutexGuard g(lock);
|
|
|
|
return getChild(Name).is();
|
2009-05-15 14:06:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
rtl::OUString Access::getHierarchicalName() throw (css::uno::RuntimeException) {
|
2009-06-23 17:46:49 +02:00
|
|
|
OSL_ASSERT(thisIs(IS_ANY));
|
2009-07-02 14:21:36 +02:00
|
|
|
osl::MutexGuard g(lock);
|
|
|
|
checkLocalizedPropertyAccess();
|
2009-07-13 17:15:58 +02:00
|
|
|
return getPath();
|
2009-05-15 14:06:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
rtl::OUString Access::composeHierarchicalName(
|
|
|
|
rtl::OUString const & /*aRelativeName*/)
|
|
|
|
throw (
|
|
|
|
css::lang::IllegalArgumentException, css::lang::NoSupportException,
|
|
|
|
css::uno::RuntimeException)
|
|
|
|
{
|
2009-06-23 17:46:49 +02:00
|
|
|
OSL_ASSERT(thisIs(IS_ANY));
|
2009-07-02 14:21:36 +02:00
|
|
|
osl::MutexGuard g(lock);
|
|
|
|
checkLocalizedPropertyAccess();
|
2009-05-15 14:06:56 +02:00
|
|
|
if(true)abort();*(char*)0=0;throw 0;//TODO
|
|
|
|
}
|
|
|
|
|
|
|
|
void Access::setName(rtl::OUString const & /*aName*/)
|
|
|
|
throw (css::uno::RuntimeException)
|
|
|
|
{
|
2009-06-23 17:46:49 +02:00
|
|
|
OSL_ASSERT(thisIs(IS_ANY));
|
2009-07-02 14:21:36 +02:00
|
|
|
osl::MutexGuard g(lock);
|
|
|
|
checkLocalizedPropertyAccess();
|
2009-05-15 14:06:56 +02:00
|
|
|
if(true)abort();*(char*)0=0;throw 0;//TODO
|
|
|
|
}
|
|
|
|
|
2009-05-15 18:00:17 +02:00
|
|
|
css::beans::Property Access::getAsProperty() throw (css::uno::RuntimeException)
|
|
|
|
{
|
2009-05-26 17:25:36 +02:00
|
|
|
OSL_ASSERT(thisIs(IS_ANY));
|
2009-05-15 18:00:17 +02:00
|
|
|
osl::MutexGuard g(lock);
|
2009-07-02 14:21:36 +02:00
|
|
|
checkLocalizedPropertyAccess();
|
2009-05-20 17:20:08 +02:00
|
|
|
return asProperty();
|
2009-05-15 18:00:17 +02:00
|
|
|
}
|
|
|
|
|
2009-05-15 14:06:56 +02:00
|
|
|
css::uno::Reference< css::beans::XPropertySetInfo > Access::getPropertySetInfo()
|
|
|
|
throw (css::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
OSL_ASSERT(thisIs(IS_GROUP));
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Access::setPropertyValue(
|
2009-05-19 17:32:24 +02:00
|
|
|
rtl::OUString const & aPropertyName, css::uno::Any const & aValue)
|
2009-05-15 14:06:56 +02:00
|
|
|
throw (
|
|
|
|
css::beans::UnknownPropertyException, css::beans::PropertyVetoException,
|
|
|
|
css::lang::IllegalArgumentException, css::lang::WrappedTargetException,
|
|
|
|
css::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
OSL_ASSERT(thisIs(IS_GROUP));
|
2009-05-19 17:32:24 +02:00
|
|
|
osl::MutexGuard g(lock);
|
2009-06-04 10:46:43 +02:00
|
|
|
if (!getRootAccess()->isUpdate()) {
|
2009-05-19 17:32:24 +02:00
|
|
|
throw css::uno::RuntimeException(
|
|
|
|
rtl::OUString(
|
|
|
|
RTL_CONSTASCII_USTRINGPARAM(
|
2009-05-29 16:48:52 +02:00
|
|
|
"configmgr setPropertyValue on non-update access")),
|
2009-05-19 17:32:24 +02:00
|
|
|
static_cast< cppu::OWeakObject * >(this));
|
|
|
|
}
|
2009-05-20 17:20:08 +02:00
|
|
|
rtl::Reference< ChildAccess > child(getChild(aPropertyName));
|
|
|
|
if (!child.is()) {
|
2009-05-19 17:32:24 +02:00
|
|
|
throw css::beans::UnknownPropertyException(
|
|
|
|
aPropertyName, static_cast< cppu::OWeakObject * >(this));
|
|
|
|
}
|
2009-07-29 15:30:40 +02:00
|
|
|
child->checkFinalized();
|
2009-05-20 17:20:08 +02:00
|
|
|
child->setProperty(aValue);
|
2009-05-15 14:06:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
css::uno::Any Access::getPropertyValue(rtl::OUString const & PropertyName)
|
|
|
|
throw (
|
|
|
|
css::beans::UnknownPropertyException, css::lang::WrappedTargetException,
|
|
|
|
css::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
OSL_ASSERT(thisIs(IS_GROUP));
|
|
|
|
osl::MutexGuard g(lock);
|
2009-05-20 17:20:08 +02:00
|
|
|
rtl::Reference< ChildAccess > child(getChild(PropertyName));
|
|
|
|
if (!child.is()) {
|
2009-05-15 14:06:56 +02:00
|
|
|
throw css::beans::UnknownPropertyException(
|
|
|
|
PropertyName, static_cast< cppu::OWeakObject * >(this));
|
|
|
|
}
|
2009-05-20 17:20:08 +02:00
|
|
|
return child->asValue();
|
2009-05-15 14:06:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void Access::addPropertyChangeListener(
|
|
|
|
rtl::OUString const & /*aPropertyName*/, //TODO
|
|
|
|
css::uno::Reference< css::beans::XPropertyChangeListener > const &
|
|
|
|
xListener)
|
|
|
|
throw (
|
|
|
|
css::beans::UnknownPropertyException, css::lang::WrappedTargetException,
|
|
|
|
css::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
OSL_ASSERT(thisIs(IS_GROUP));
|
|
|
|
rBHelper.addListener(
|
|
|
|
cppu::UnoType< css::beans::XPropertyChangeListener >::get(), xListener);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Access::removePropertyChangeListener(
|
|
|
|
rtl::OUString const & /*aPropertyName*/, //TODO
|
|
|
|
css::uno::Reference< css::beans::XPropertyChangeListener > const &
|
|
|
|
aListener)
|
|
|
|
throw (
|
|
|
|
css::beans::UnknownPropertyException, css::lang::WrappedTargetException,
|
|
|
|
css::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
OSL_ASSERT(thisIs(IS_GROUP));
|
|
|
|
rBHelper.removeListener(
|
|
|
|
cppu::UnoType< css::beans::XPropertyChangeListener >::get(), aListener);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Access::addVetoableChangeListener(
|
|
|
|
rtl::OUString const & /*PropertyName*/, //TODO
|
|
|
|
css::uno::Reference< css::beans::XVetoableChangeListener > const &
|
|
|
|
aListener)
|
|
|
|
throw (
|
|
|
|
css::beans::UnknownPropertyException, css::lang::WrappedTargetException,
|
|
|
|
css::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
OSL_ASSERT(thisIs(IS_GROUP));
|
|
|
|
rBHelper.addListener(
|
|
|
|
cppu::UnoType< css::beans::XVetoableChangeListener >::get(), aListener);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Access::removeVetoableChangeListener(
|
|
|
|
rtl::OUString const & /*PropertyName*/, //TODO
|
|
|
|
css::uno::Reference< css::beans::XVetoableChangeListener > const &
|
|
|
|
aListener)
|
|
|
|
throw (
|
|
|
|
css::beans::UnknownPropertyException, css::lang::WrappedTargetException,
|
|
|
|
css::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
OSL_ASSERT(thisIs(IS_GROUP));
|
|
|
|
rBHelper.removeListener(
|
|
|
|
cppu::UnoType< css::beans::XVetoableChangeListener >::get(), aListener);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Access::setPropertyValues(
|
|
|
|
css::uno::Sequence< rtl::OUString > const & /*aPropertyNames*/,
|
|
|
|
css::uno::Sequence< css::uno::Any > const & /*aValues*/)
|
|
|
|
throw (
|
|
|
|
css::beans::PropertyVetoException, css::lang::IllegalArgumentException,
|
|
|
|
css::lang::WrappedTargetException, css::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
OSL_ASSERT(thisIs(IS_GROUP));
|
|
|
|
if(true)abort();*(char*)0=0;throw 0;//TODO
|
|
|
|
}
|
|
|
|
|
|
|
|
css::uno::Sequence< css::uno::Any > Access::getPropertyValues(
|
|
|
|
css::uno::Sequence< rtl::OUString > const & /*aPropertyNames*/)
|
|
|
|
throw (css::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
OSL_ASSERT(thisIs(IS_GROUP));
|
|
|
|
if(true)abort();*(char*)0=0;throw 0;//TODO
|
|
|
|
}
|
|
|
|
|
|
|
|
void Access::addPropertiesChangeListener(
|
|
|
|
css::uno::Sequence< rtl::OUString > const & /*aPropertyNames*/, //TODO
|
|
|
|
css::uno::Reference< css::beans::XPropertiesChangeListener > const &
|
|
|
|
xListener)
|
|
|
|
throw (css::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
OSL_ASSERT(thisIs(IS_GROUP));
|
|
|
|
rBHelper.addListener(
|
|
|
|
cppu::UnoType< css::beans::XPropertiesChangeListener >::get(),
|
|
|
|
xListener);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Access::removePropertiesChangeListener(
|
|
|
|
css::uno::Reference< css::beans::XPropertiesChangeListener > const &
|
|
|
|
xListener)
|
|
|
|
throw (css::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
OSL_ASSERT(thisIs(IS_GROUP));
|
|
|
|
rBHelper.removeListener(
|
|
|
|
cppu::UnoType< css::beans::XPropertiesChangeListener >::get(),
|
|
|
|
xListener);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Access::firePropertiesChangeEvent(
|
|
|
|
css::uno::Sequence< rtl::OUString > const & /*aPropertyNames*/,
|
|
|
|
css::uno::Reference< css::beans::XPropertiesChangeListener > const &
|
|
|
|
/*xListener*/)
|
|
|
|
throw (css::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
OSL_ASSERT(thisIs(IS_GROUP));
|
|
|
|
if(true)abort();*(char*)0=0;throw 0;//TODO
|
|
|
|
}
|
|
|
|
|
|
|
|
css::uno::Reference< css::beans::XHierarchicalPropertySetInfo >
|
|
|
|
Access::getHierarchicalPropertySetInfo() throw (css::uno::RuntimeException) {
|
|
|
|
OSL_ASSERT(thisIs(IS_GROUP));
|
|
|
|
if(true)abort();*(char*)0=0;throw 0;//TODO
|
|
|
|
}
|
|
|
|
|
|
|
|
void Access::setHierarchicalPropertyValue(
|
2009-05-19 17:32:24 +02:00
|
|
|
rtl::OUString const & aHierarchicalPropertyName,
|
|
|
|
css::uno::Any const & aValue)
|
2009-05-15 14:06:56 +02:00
|
|
|
throw (
|
|
|
|
css::beans::UnknownPropertyException, css::beans::PropertyVetoException,
|
|
|
|
css::lang::IllegalArgumentException, css::lang::WrappedTargetException,
|
|
|
|
css::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
OSL_ASSERT(thisIs(IS_GROUP));
|
2009-05-19 17:32:24 +02:00
|
|
|
osl::MutexGuard g(lock);
|
2009-06-04 10:46:43 +02:00
|
|
|
if (!getRootAccess()->isUpdate()) {
|
2009-05-19 17:32:24 +02:00
|
|
|
throw css::uno::RuntimeException(
|
|
|
|
rtl::OUString(
|
|
|
|
RTL_CONSTASCII_USTRINGPARAM(
|
2009-05-29 16:48:52 +02:00
|
|
|
"configmgr setHierarchicalPropertyName on non-update"
|
|
|
|
" access")),
|
2009-05-19 17:32:24 +02:00
|
|
|
static_cast< cppu::OWeakObject * >(this));
|
|
|
|
}
|
2009-05-20 17:20:08 +02:00
|
|
|
rtl::Reference< ChildAccess > child(getSubChild(aHierarchicalPropertyName));
|
|
|
|
if (!child.is()) {
|
2009-05-19 17:32:24 +02:00
|
|
|
throw css::beans::UnknownPropertyException(
|
|
|
|
aHierarchicalPropertyName,
|
|
|
|
static_cast< cppu::OWeakObject * >(this));
|
|
|
|
}
|
2009-05-20 17:20:08 +02:00
|
|
|
child->setProperty(aValue);
|
2009-05-15 14:06:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
css::uno::Any Access::getHierarchicalPropertyValue(
|
2009-06-25 14:42:08 +02:00
|
|
|
rtl::OUString const & aHierarchicalPropertyName)
|
2009-05-15 14:06:56 +02:00
|
|
|
throw (
|
|
|
|
css::beans::UnknownPropertyException,
|
|
|
|
css::lang::IllegalArgumentException, css::lang::WrappedTargetException,
|
|
|
|
css::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
OSL_ASSERT(thisIs(IS_GROUP));
|
2009-06-25 14:42:08 +02:00
|
|
|
osl::MutexGuard g(lock);
|
|
|
|
rtl::Reference< ChildAccess > child(getSubChild(aHierarchicalPropertyName));
|
|
|
|
if (!child.is()) {
|
|
|
|
throw css::beans::UnknownPropertyException(
|
|
|
|
aHierarchicalPropertyName,
|
|
|
|
static_cast< cppu::OWeakObject * >(this));
|
|
|
|
}
|
|
|
|
return child->asValue();
|
2009-05-15 14:06:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void Access::setHierarchicalPropertyValues(
|
|
|
|
css::uno::Sequence< rtl::OUString > const & /*aHierarchicalPropertyNames*/,
|
|
|
|
css::uno::Sequence< css::uno::Any > const & /*Values*/)
|
|
|
|
throw (
|
|
|
|
css::beans::PropertyVetoException, css::lang::IllegalArgumentException,
|
|
|
|
css::lang::WrappedTargetException, css::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
OSL_ASSERT(thisIs(IS_GROUP));
|
|
|
|
if(true)abort();*(char*)0=0;throw 0;//TODO
|
|
|
|
}
|
|
|
|
|
|
|
|
css::uno::Sequence< css::uno::Any > Access::getHierarchicalPropertyValues(
|
|
|
|
css::uno::Sequence< rtl::OUString > const & /*aHierarchicalPropertyNames*/)
|
|
|
|
throw (
|
|
|
|
css::lang::IllegalArgumentException, css::lang::WrappedTargetException,
|
|
|
|
css::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
OSL_ASSERT(thisIs(IS_GROUP));
|
|
|
|
if(true)abort();*(char*)0=0;throw 0;//TODO
|
|
|
|
}
|
|
|
|
|
|
|
|
void Access::replaceByName(
|
|
|
|
rtl::OUString const & aName, css::uno::Any const & aElement)
|
|
|
|
throw (
|
|
|
|
css::lang::IllegalArgumentException,
|
|
|
|
css::container::NoSuchElementException,
|
|
|
|
css::lang::WrappedTargetException, css::uno::RuntimeException)
|
|
|
|
{
|
2009-06-23 17:46:49 +02:00
|
|
|
OSL_ASSERT(thisIs(IS_ANY|IS_UPDATE));
|
2009-05-15 14:06:56 +02:00
|
|
|
osl::MutexGuard g(lock);
|
2009-07-02 14:21:36 +02:00
|
|
|
checkLocalizedPropertyAccess();
|
2009-05-19 10:49:37 +02:00
|
|
|
rtl::Reference< Node > p(getNode());
|
|
|
|
if (dynamic_cast< GroupNode * >(p.get()) != 0) {
|
2009-05-15 14:06:56 +02:00
|
|
|
try {
|
|
|
|
setPropertyValue(aName, aElement);
|
|
|
|
} catch (css::beans::UnknownPropertyException & e) {
|
|
|
|
throw css::container::NoSuchElementException(e.Message, e.Context);
|
|
|
|
} catch (css::beans::PropertyVetoException & e) {
|
|
|
|
css::uno::Any ex(cppu::getCaughtException());
|
|
|
|
throw css::lang::WrappedTargetException(e.Message, e.Context, ex);
|
|
|
|
}
|
2009-05-19 10:49:37 +02:00
|
|
|
} else if (dynamic_cast< SetNode * >(p.get()) != 0) {
|
2009-05-15 14:06:56 +02:00
|
|
|
if(true)abort();*(char*)0=0;throw 0;//TODO
|
2009-06-23 17:46:49 +02:00
|
|
|
} else if (dynamic_cast< LocalizedPropertyNode * >(p.get()) != 0) {
|
|
|
|
if(true)abort();*(char*)0=0;throw 0;//TODO
|
2009-05-15 14:06:56 +02:00
|
|
|
} else {
|
|
|
|
OSL_ASSERT(false);
|
|
|
|
throw css::uno::RuntimeException(
|
|
|
|
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("this cannot happen")),
|
2009-05-15 18:00:17 +02:00
|
|
|
static_cast< cppu::OWeakObject * >(this));
|
2009-05-15 14:06:56 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Access::insertByName(
|
2009-05-15 18:00:17 +02:00
|
|
|
rtl::OUString const & aName, css::uno::Any const & aElement)
|
2009-05-15 14:06:56 +02:00
|
|
|
throw (
|
|
|
|
css::lang::IllegalArgumentException,
|
|
|
|
css::container::ElementExistException,
|
|
|
|
css::lang::WrappedTargetException, css::uno::RuntimeException)
|
|
|
|
{
|
2009-06-23 17:46:49 +02:00
|
|
|
OSL_ASSERT(thisIs(IS_EXTENSIBLE|IS_UPDATE));
|
2009-05-15 18:00:17 +02:00
|
|
|
osl::MutexGuard g(lock);
|
2009-07-02 14:21:36 +02:00
|
|
|
checkLocalizedPropertyAccess();
|
2009-07-29 15:30:40 +02:00
|
|
|
checkFinalized();
|
2009-06-24 12:58:15 +02:00
|
|
|
if (getChild(aName).is()) {
|
|
|
|
throw css::container::ElementExistException(
|
|
|
|
aName, static_cast< cppu::OWeakObject * >(this));
|
|
|
|
}
|
2009-05-19 10:49:37 +02:00
|
|
|
rtl::Reference< Node > p(getNode());
|
2009-06-04 14:38:04 +02:00
|
|
|
if (dynamic_cast< GroupNode * >(p.get()) != 0) {
|
2009-06-24 16:53:49 +02:00
|
|
|
checkValue(aElement, TYPE_ANY, true);
|
2009-05-29 15:19:40 +02:00
|
|
|
rtl::Reference< ChildAccess > child(
|
|
|
|
new ChildAccess(
|
2009-06-04 10:46:43 +02:00
|
|
|
getRootAccess(), this, aName,
|
2009-07-28 15:30:19 +02:00
|
|
|
new PropertyNode(NO_LAYER, TYPE_ANY, true, aElement, true)));
|
2009-06-24 16:10:18 +02:00
|
|
|
child->markAsModified();
|
2009-05-18 15:03:21 +02:00
|
|
|
//TODO notify change
|
2009-05-19 10:49:37 +02:00
|
|
|
} else if (SetNode * set = dynamic_cast< SetNode * >(p.get())) {
|
2009-05-18 15:03:21 +02:00
|
|
|
rtl::Reference< ChildAccess > freeAcc;
|
|
|
|
css::uno::Reference< css::lang::XUnoTunnel > tunnel;
|
|
|
|
aElement >>= tunnel;
|
|
|
|
if (tunnel.is()) {
|
|
|
|
freeAcc.set(
|
|
|
|
reinterpret_cast< ChildAccess * >(
|
|
|
|
tunnel->getSomething(ChildAccess::getTunnelId())));
|
|
|
|
}
|
2009-06-24 16:10:18 +02:00
|
|
|
if (!freeAcc.is() || freeAcc->getParentAccess().is() ||
|
|
|
|
(freeAcc->isInTransaction() &&
|
|
|
|
freeAcc->getRootAccess() != getRootAccess()))
|
2009-06-03 15:57:23 +02:00
|
|
|
{
|
|
|
|
throw css::lang::IllegalArgumentException(
|
|
|
|
rtl::OUString(
|
|
|
|
RTL_CONSTASCII_USTRINGPARAM(
|
|
|
|
"configmgr insertByName inappropriate set element")),
|
|
|
|
static_cast< cppu::OWeakObject * >(this), 1);
|
|
|
|
}
|
2009-05-19 17:32:24 +02:00
|
|
|
rtl::OUString tmplName;
|
2009-06-03 15:57:23 +02:00
|
|
|
if (GroupNode * freeGroup = dynamic_cast< GroupNode * >(
|
|
|
|
freeAcc->getNode().get()))
|
|
|
|
{
|
|
|
|
tmplName = freeGroup->getTemplateName();
|
|
|
|
} else if (SetNode * freeSet = dynamic_cast< SetNode * >(
|
|
|
|
freeAcc->getNode().get()))
|
|
|
|
{
|
|
|
|
tmplName = freeSet->getTemplateName();
|
2009-05-19 17:32:24 +02:00
|
|
|
}
|
2009-06-04 17:06:02 +02:00
|
|
|
OSL_ASSERT(tmplName.getLength() != 0);
|
2009-05-19 17:32:24 +02:00
|
|
|
if (!set->isValidTemplate(tmplName)) {
|
2009-05-18 15:03:21 +02:00
|
|
|
throw css::lang::IllegalArgumentException(
|
|
|
|
rtl::OUString(
|
|
|
|
RTL_CONSTASCII_USTRINGPARAM(
|
|
|
|
"configmgr insertByName inappropriate set element")),
|
|
|
|
static_cast< cppu::OWeakObject * >(this), 1);
|
|
|
|
}
|
2009-06-04 10:46:43 +02:00
|
|
|
rtl::Reference< RootAccess > root(getRootAccess());
|
2009-06-04 17:06:02 +02:00
|
|
|
freeAcc->bind(root, this, aName); // must not throw
|
2009-06-24 16:10:18 +02:00
|
|
|
freeAcc->markAsModified(); //TODO: must not throw
|
2009-05-18 15:03:21 +02:00
|
|
|
//TODO notify change
|
2009-07-08 13:48:15 +02:00
|
|
|
} else if (dynamic_cast< LocalizedPropertyNode * >(p.get()) != 0) {
|
2009-06-25 13:51:29 +02:00
|
|
|
insertLocalizedPropertyValueChild(aName, aElement);
|
2009-05-18 15:03:21 +02:00
|
|
|
} else {
|
|
|
|
OSL_ASSERT(false);
|
|
|
|
throw css::uno::RuntimeException(
|
|
|
|
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("this cannot happen")),
|
|
|
|
static_cast< cppu::OWeakObject * >(this));
|
2009-05-15 18:00:17 +02:00
|
|
|
}
|
2009-05-15 14:06:56 +02:00
|
|
|
}
|
|
|
|
|
2009-05-18 15:03:21 +02:00
|
|
|
void Access::removeByName(rtl::OUString const & aName)
|
2009-05-15 14:06:56 +02:00
|
|
|
throw (
|
|
|
|
css::container::NoSuchElementException,
|
|
|
|
css::lang::WrappedTargetException, css::uno::RuntimeException)
|
|
|
|
{
|
2009-06-23 17:46:49 +02:00
|
|
|
OSL_ASSERT(thisIs(IS_EXTENSIBLE|IS_UPDATE));
|
2009-05-18 15:03:21 +02:00
|
|
|
osl::MutexGuard g(lock);
|
2009-07-02 14:21:36 +02:00
|
|
|
checkLocalizedPropertyAccess();
|
2009-06-24 12:58:15 +02:00
|
|
|
rtl::Reference< ChildAccess > child(getChild(aName));
|
2009-07-29 15:30:40 +02:00
|
|
|
if (!child.is() || child->isFinalized() ||
|
|
|
|
child->getNode()->getMandatory() != NO_LAYER)
|
|
|
|
{
|
2009-06-24 12:58:15 +02:00
|
|
|
throw css::container::NoSuchElementException(
|
|
|
|
aName, static_cast< cppu::OWeakObject * >(this));
|
|
|
|
}
|
|
|
|
if (dynamic_cast< GroupNode * >(getNode().get()) != 0) {
|
2009-05-19 10:49:37 +02:00
|
|
|
rtl::Reference< PropertyNode > prop(
|
2009-05-26 17:25:36 +02:00
|
|
|
dynamic_cast< PropertyNode * >(child->getNode().get()));
|
2009-05-19 10:49:37 +02:00
|
|
|
if (!(prop.is() && prop->isExtension())) {
|
2009-05-18 15:03:21 +02:00
|
|
|
throw css::container::NoSuchElementException(
|
|
|
|
aName, static_cast< cppu::OWeakObject * >(this));
|
|
|
|
}
|
|
|
|
}
|
2009-07-13 14:54:09 +02:00
|
|
|
// unbind() modifies the parent chain that markAsModified() walks, so order
|
|
|
|
// is important:
|
|
|
|
child->markAsModified(); //TODO: must not throw
|
|
|
|
child->unbind();
|
2009-06-24 12:58:15 +02:00
|
|
|
//TODO notify change
|
2009-05-15 14:06:56 +02:00
|
|
|
}
|
|
|
|
|
2009-05-15 18:00:17 +02:00
|
|
|
css::uno::Reference< css::uno::XInterface > Access::createInstance()
|
|
|
|
throw (css::uno::Exception, css::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
OSL_ASSERT(thisIs(IS_SET|IS_UPDATE));
|
2009-05-18 15:03:21 +02:00
|
|
|
rtl::OUString tmplName(
|
2009-05-19 10:49:37 +02:00
|
|
|
dynamic_cast< SetNode * >(getNode().get())->getDefaultTemplateName());
|
2009-07-29 15:30:40 +02:00
|
|
|
rtl::Reference< Node > tmpl(
|
2009-07-28 15:30:19 +02:00
|
|
|
Components::singleton().getTemplate(NO_LAYER, tmplName));
|
2009-07-29 15:30:40 +02:00
|
|
|
if (!tmpl.is()) {
|
2009-05-15 18:00:17 +02:00
|
|
|
throw css::uno::Exception(
|
|
|
|
(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("unknown template ")) +
|
2009-05-18 15:03:21 +02:00
|
|
|
tmplName),
|
2009-05-15 18:00:17 +02:00
|
|
|
static_cast< cppu::OWeakObject * >(this));
|
|
|
|
}
|
2009-07-29 15:30:40 +02:00
|
|
|
rtl::Reference< Node > node(tmpl->clone());
|
|
|
|
node->setLayer(NO_LAYER);
|
2009-05-15 18:00:17 +02:00
|
|
|
return static_cast< cppu::OWeakObject * >(
|
2009-07-29 15:30:40 +02:00
|
|
|
new ChildAccess(getRootAccess(), node));
|
2009-05-15 18:00:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
css::uno::Reference< css::uno::XInterface > Access::createInstanceWithArguments(
|
|
|
|
css::uno::Sequence< css::uno::Any > const & aArguments)
|
|
|
|
throw (css::uno::Exception, css::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
OSL_ASSERT(thisIs(IS_SET|IS_UPDATE));
|
|
|
|
if (aArguments.getLength() != 0) {
|
|
|
|
throw css::uno::Exception(
|
|
|
|
rtl::OUString(
|
|
|
|
RTL_CONSTASCII_USTRINGPARAM(
|
|
|
|
"configuration SimpleSetUpdate createInstanceWithArguments"
|
|
|
|
" must not specify any arguments")),
|
|
|
|
static_cast< cppu::OWeakObject * >(this));
|
|
|
|
}
|
|
|
|
return createInstance();
|
|
|
|
}
|
|
|
|
|
2009-06-24 16:26:23 +02:00
|
|
|
NodeMap & Access::getMemberNodes() {
|
|
|
|
rtl::Reference< Node > p(getNode());
|
|
|
|
if (LocalizedPropertyNode * locprop =
|
|
|
|
dynamic_cast< LocalizedPropertyNode * >(p.get()))
|
|
|
|
{
|
|
|
|
return locprop->getMembers();
|
|
|
|
}
|
|
|
|
if (GroupNode * group = dynamic_cast< GroupNode * >(p.get())) {
|
|
|
|
return group->getMembers();
|
|
|
|
}
|
|
|
|
if (SetNode * set = dynamic_cast< SetNode * >(p.get())) {
|
|
|
|
return set->getMembers();
|
|
|
|
}
|
|
|
|
OSL_ASSERT(false);
|
|
|
|
throw css::uno::RuntimeException(
|
|
|
|
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("this cannot happen")),
|
|
|
|
static_cast< cppu::OWeakObject * >(this));
|
|
|
|
}
|
|
|
|
|
2009-06-23 17:14:12 +02:00
|
|
|
rtl::Reference< ChildAccess > Access::getModifiedChild(
|
2009-06-24 16:10:18 +02:00
|
|
|
HardChildMap::iterator const & childIterator)
|
2009-06-23 17:14:12 +02:00
|
|
|
{
|
2009-06-24 16:10:18 +02:00
|
|
|
return (childIterator->second->getParentAccess() == this &&
|
|
|
|
childIterator->second->getName() == childIterator->first)
|
|
|
|
? childIterator->second : rtl::Reference< ChildAccess >();
|
2009-06-23 17:14:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
rtl::Reference< ChildAccess > Access::getUnmodifiedChild(
|
|
|
|
rtl::OUString const & name)
|
|
|
|
{
|
|
|
|
OSL_ASSERT(modifiedChildren_.find(name) == modifiedChildren_.end());
|
|
|
|
rtl::Reference< Node > node(getNode()->getMember(name));
|
|
|
|
if (!node.is()) {
|
|
|
|
return rtl::Reference< ChildAccess >();
|
2009-06-04 18:08:16 +02:00
|
|
|
}
|
2009-06-23 17:14:12 +02:00
|
|
|
WeakChildMap::iterator i(cachedChildren_.find(name));
|
|
|
|
if (i != cachedChildren_.end()) {
|
2009-05-29 15:19:40 +02:00
|
|
|
rtl::Reference< ChildAccess > child;
|
2009-06-23 17:14:12 +02:00
|
|
|
if (i->second->acquireCounting() > 1) {
|
|
|
|
child.set(i->second); // must not throw
|
2009-05-29 15:19:40 +02:00
|
|
|
}
|
2009-06-23 17:14:12 +02:00
|
|
|
i->second->releaseNondeleting();
|
|
|
|
if (child.is()) {
|
|
|
|
child->setNode(node);
|
2009-06-04 14:38:04 +02:00
|
|
|
return child;
|
2009-05-29 15:19:40 +02:00
|
|
|
}
|
2009-05-20 13:33:52 +02:00
|
|
|
}
|
2009-05-29 16:48:52 +02:00
|
|
|
rtl::Reference< ChildAccess > child(
|
2009-06-04 10:46:43 +02:00
|
|
|
new ChildAccess(getRootAccess(), this, name, node));
|
2009-06-23 17:14:12 +02:00
|
|
|
cachedChildren_[name] = child.get();
|
2009-05-20 17:20:08 +02:00
|
|
|
return child;
|
|
|
|
}
|
|
|
|
|
|
|
|
rtl::Reference< ChildAccess > Access::getSubChild(rtl::OUString const & path) {
|
|
|
|
rtl::OUString name;
|
|
|
|
bool setElement;
|
|
|
|
rtl::OUString templateName;
|
2009-07-13 10:28:10 +02:00
|
|
|
sal_Int32 i = Components::parseSegment(
|
|
|
|
path, 0, &name, &setElement, &templateName);
|
|
|
|
if (i == -1 || (i != path.getLength() && path[i] != '/')) {
|
2009-05-20 17:20:08 +02:00
|
|
|
return rtl::Reference< ChildAccess >();
|
|
|
|
}
|
|
|
|
rtl::Reference< ChildAccess > child(getChild(name));
|
|
|
|
if (!child.is()) {
|
2009-05-26 10:41:14 +02:00
|
|
|
return rtl::Reference< ChildAccess >();
|
2009-05-20 13:33:52 +02:00
|
|
|
}
|
2009-05-20 17:20:08 +02:00
|
|
|
if (setElement) {
|
2009-05-26 10:41:14 +02:00
|
|
|
rtl::Reference< Node > p(getNode());
|
|
|
|
SetNode * set = dynamic_cast< SetNode * >(p.get());
|
|
|
|
LocalizedPropertyNode * locprop =
|
2009-06-04 10:46:43 +02:00
|
|
|
Components::allLocales(getRootAccess()->getLocale())
|
2009-05-26 10:41:14 +02:00
|
|
|
? dynamic_cast< LocalizedPropertyNode * >(p.get()) : 0;
|
|
|
|
if ((set == 0 && locprop == 0) ||
|
|
|
|
(set != 0 && templateName.getLength() != 0 &&
|
|
|
|
!set->isValidTemplate(templateName)) ||
|
|
|
|
(locprop != 0 && templateName.getLength() != 0))
|
2009-05-20 17:20:08 +02:00
|
|
|
{
|
|
|
|
return rtl::Reference< ChildAccess >();
|
|
|
|
}
|
2009-05-20 13:33:52 +02:00
|
|
|
}
|
2009-05-26 10:41:14 +02:00
|
|
|
// For backwards compatibility, ignore a final slash after non-value nodes:
|
|
|
|
return child->isValue()
|
2009-07-13 10:28:10 +02:00
|
|
|
? (i == path.getLength() ? child : rtl::Reference< ChildAccess >())
|
|
|
|
: (i >= path.getLength() - 1
|
2009-05-26 10:41:14 +02:00
|
|
|
? child : child->getSubChild(path.copy(i + 1)));
|
2009-05-20 17:20:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
css::beans::Property Access::asProperty() {
|
|
|
|
css::uno::Type type;
|
|
|
|
bool nillable;
|
|
|
|
bool removable;
|
|
|
|
rtl::Reference< Node > p(getNode());
|
2009-05-20 13:33:52 +02:00
|
|
|
if (PropertyNode * prop = dynamic_cast< PropertyNode * >(p.get())) {
|
2009-05-20 17:20:08 +02:00
|
|
|
type = mapType(prop->getType());
|
|
|
|
nillable = prop->isNillable();
|
|
|
|
removable = prop->isExtension();
|
2009-06-04 10:46:43 +02:00
|
|
|
} else if (dynamic_cast< LocalizedPropertyValueNode * >(p.get()) != 0) {
|
2009-05-26 10:41:14 +02:00
|
|
|
LocalizedPropertyNode * locprop =
|
2009-06-04 10:46:43 +02:00
|
|
|
dynamic_cast< LocalizedPropertyNode * >(getParentNode().get());
|
2009-05-26 10:41:14 +02:00
|
|
|
OSL_ASSERT(locprop != 0);
|
|
|
|
type = mapType(locprop->getType());
|
|
|
|
nillable = locprop->isNillable();
|
|
|
|
removable = false; //TODO ???
|
2009-05-20 17:20:08 +02:00
|
|
|
} else if (LocalizedPropertyNode * locprop =
|
|
|
|
dynamic_cast< LocalizedPropertyNode * >(p.get()))
|
2009-05-20 13:33:52 +02:00
|
|
|
{
|
2009-06-04 10:46:43 +02:00
|
|
|
if (Components::allLocales(getRootAccess()->getLocale())) {
|
2009-05-20 17:20:08 +02:00
|
|
|
type = cppu::UnoType< css::uno::XInterface >::get();
|
|
|
|
//TODO: correct?
|
|
|
|
removable = false;
|
|
|
|
} else {
|
|
|
|
type = mapType(locprop->getType());
|
|
|
|
removable = false; //TODO ???
|
2009-05-20 13:33:52 +02:00
|
|
|
}
|
2009-05-20 17:20:08 +02:00
|
|
|
nillable = locprop->isNillable();
|
2009-05-20 13:33:52 +02:00
|
|
|
} else {
|
2009-05-20 17:20:08 +02:00
|
|
|
OSL_ASSERT(
|
|
|
|
dynamic_cast< GroupNode * >(p.get()) != 0 ||
|
|
|
|
dynamic_cast< SetNode * >(p.get()) != 0);
|
|
|
|
type = cppu::UnoType< css::uno::XInterface >::get(); //TODO: correct?
|
|
|
|
nillable = false;
|
2009-06-04 10:46:43 +02:00
|
|
|
removable = dynamic_cast< SetNode * >(getParentNode().get()) != 0;
|
2009-05-20 13:33:52 +02:00
|
|
|
}
|
2009-05-20 17:20:08 +02:00
|
|
|
return css::beans::Property(
|
2009-05-29 16:48:52 +02:00
|
|
|
getName(), -1, type,
|
2009-05-20 17:20:08 +02:00
|
|
|
(css::beans::PropertyAttribute::BOUND | //TODO: correct for group/set?
|
|
|
|
css::beans::PropertyAttribute::CONSTRAINED |
|
|
|
|
(nillable ? css::beans::PropertyAttribute::MAYBEVOID : 0) |
|
2009-06-04 10:46:43 +02:00
|
|
|
(getRootAccess()->isUpdate()
|
2009-05-20 17:20:08 +02:00
|
|
|
? (removable ? css::beans::PropertyAttribute::REMOVEABLE : 0)
|
|
|
|
: css::beans::PropertyAttribute::READONLY))); //TODO: MAYBEDEFAULT
|
2009-05-20 13:33:52 +02:00
|
|
|
}
|
|
|
|
|
2009-07-29 15:30:40 +02:00
|
|
|
void Access::checkFinalized() {
|
|
|
|
if (isFinalized()) {
|
|
|
|
throw css::lang::IllegalArgumentException(
|
|
|
|
rtl::OUString(
|
|
|
|
RTL_CONSTASCII_USTRINGPARAM(
|
|
|
|
"configmgr modification of finalized item")),
|
|
|
|
static_cast< cppu::OWeakObject * >(this), -1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-05-15 14:06:56 +02:00
|
|
|
#if OSL_DEBUG_LEVEL > 0
|
|
|
|
bool Access::thisIs(int what) {
|
|
|
|
osl::MutexGuard g(lock);
|
2009-05-19 10:49:37 +02:00
|
|
|
rtl::Reference< Node > p(getNode());
|
2009-07-02 14:21:36 +02:00
|
|
|
return dynamic_cast< PropertyNode * >(p.get()) == 0 &&
|
|
|
|
dynamic_cast< LocalizedPropertyValueNode * >(p.get()) == 0 &&
|
2009-05-22 16:49:07 +02:00
|
|
|
((what & IS_GROUP) == 0 || dynamic_cast< GroupNode * >(p.get()) != 0) &&
|
2009-05-19 10:49:37 +02:00
|
|
|
((what & IS_SET) == 0 || dynamic_cast< SetNode * >(p.get()) != 0) &&
|
2009-06-23 17:46:49 +02:00
|
|
|
((what & IS_EXTENSIBLE) == 0 ||
|
|
|
|
dynamic_cast< GroupNode * >(p.get()) == 0 ||
|
|
|
|
dynamic_cast< GroupNode * >(p.get())->isExtensible()) &&
|
2009-05-19 17:32:24 +02:00
|
|
|
((what & IS_GROUP_MEMBER) == 0 ||
|
2009-06-04 10:46:43 +02:00
|
|
|
dynamic_cast< GroupNode * >(getParentNode().get()) != 0) ||
|
2009-05-19 17:32:24 +02:00
|
|
|
((what & IS_SET_MEMBER) == 0 ||
|
2009-06-04 10:46:43 +02:00
|
|
|
dynamic_cast< SetNode * >(getParentNode().get()) != 0) ||
|
|
|
|
((what & IS_UPDATE) == 0 || getRootAccess()->isUpdate());
|
2009-05-15 14:06:56 +02:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|