diff options
Diffstat (limited to 'configmgr/source')
67 files changed, 621 insertions, 845 deletions
diff --git a/configmgr/source/README b/configmgr/source/README index b00990d1eeb2..f26c68ecf7c0 100644..100755 --- a/configmgr/source/README +++ b/configmgr/source/README @@ -51,16 +51,13 @@ propertynode.cxx setnode.cxx Internal representations of data nodes. -pad.cxx parsemanager.cxx parser.hxx -span.hxx valueparser.cxx xcdparser.cxx xcsparser.cxx xcuparser.cxx xmldata.cxx -xmlreader.cxx XML file reading. modifications.cxx diff --git a/configmgr/source/access.cxx b/configmgr/source/access.cxx index 7fcd7a1c3402..ef7ba869cf94 100644..100755 --- a/configmgr/source/access.cxx +++ b/configmgr/source/access.cxx @@ -912,7 +912,8 @@ rtl::OUString Access::getImplementationName() throw (css::uno::RuntimeException) OSL_ASSERT(thisIs(IS_ANY)); osl::MutexGuard g(*lock_); checkLocalizedPropertyAccess(); - return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "configmgr.Access" ) ); + return rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("org.openoffice-configmgr::Access")); } sal_Bool Access::supportsService(rtl::OUString const & ServiceName) @@ -1995,45 +1996,83 @@ rtl::Reference< ChildAccess > Access::getUnmodifiedChild( } rtl::Reference< ChildAccess > Access::getSubChild(rtl::OUString const & path) { - rtl::OUString name; - bool setElement; - rtl::OUString templateName; - sal_Int32 i = Data::parseSegment( - path, 0, &name, &setElement, &templateName); - if (i == -1 || (i != path.getLength() && path[i] != '/')) { - return rtl::Reference< ChildAccess >(); - } - rtl::Reference< ChildAccess > child(getChild(name)); - if (!child.is()) { - return rtl::Reference< ChildAccess >(); - } - if (setElement) { - rtl::Reference< Node > p(getNode()); - switch (p->kind()) { - case Node::KIND_LOCALIZED_PROPERTY: - if (!Components::allLocales(getRootAccess()->getLocale()) || - templateName.getLength() != 0) - { + sal_Int32 i = 0; + // For backwards compatibility, allow absolute paths where meaningful: + if (path.getLength() != 0 && path[0] == '/') { + ++i; + if (!getRootAccess().is()) { + return rtl::Reference< ChildAccess >(); + } + Path abs(getAbsolutePath()); + for (Path::iterator j(abs.begin()); j != abs.end(); ++j) { + rtl::OUString name1; + bool setElement1; + rtl::OUString templateName1; + i = Data::parseSegment( + path, i, &name1, &setElement1, &templateName1); + if (i == -1 || (i != path.getLength() && path[i] != '/')) { return rtl::Reference< ChildAccess >(); } - break; - case Node::KIND_SET: - if (templateName.getLength() != 0 && - !dynamic_cast< SetNode * >(p.get())->isValidTemplate( - templateName)) + rtl::OUString name2; + bool setElement2; + rtl::OUString templateName2; + Data::parseSegment(*j, 0, &name2, &setElement2, &templateName2); + if (name1 != name2 || setElement1 != setElement2 || + (setElement1 && + !Data::equalTemplateNames(templateName1, templateName2))) { return rtl::Reference< ChildAccess >(); } - break; - default: + if (i != path.getLength()) { + ++i; + } + } + } + for (rtl::Reference< Access > parent(this);;) { + rtl::OUString name; + bool setElement; + rtl::OUString templateName; + i = Data::parseSegment(path, i, &name, &setElement, &templateName); + if (i == -1 || (i != path.getLength() && path[i] != '/')) { return rtl::Reference< ChildAccess >(); } + rtl::Reference< ChildAccess > child(parent->getChild(name)); + if (!child.is()) { + return rtl::Reference< ChildAccess >(); + } + if (setElement) { + rtl::Reference< Node > p(parent->getNode()); + switch (p->kind()) { + case Node::KIND_LOCALIZED_PROPERTY: + if (!Components::allLocales(getRootAccess()->getLocale()) || + templateName.getLength() != 0) + { + return rtl::Reference< ChildAccess >(); + } + break; + case Node::KIND_SET: + if (templateName.getLength() != 0 && + !dynamic_cast< SetNode * >(p.get())->isValidTemplate( + templateName)) + { + return rtl::Reference< ChildAccess >(); + } + break; + default: + return rtl::Reference< ChildAccess >(); + } + } + // For backwards compatibility, ignore a final slash after non-value + // nodes: + if (child->isValue()) { + return i == path.getLength() + ? child : rtl::Reference< ChildAccess >(); + } else if (i >= path.getLength() - 1) { + return child; + } + ++i; + parent = child.get(); } - // For backwards compatibility, ignore a final slash after non-value nodes: - return child->isValue() - ? (i == path.getLength() ? child : rtl::Reference< ChildAccess >()) - : (i >= path.getLength() - 1 - ? child : child->getSubChild(path.copy(i + 1))); } bool Access::setChildProperty( @@ -2091,9 +2130,8 @@ css::beans::Property Access::asProperty() { default: type = cppu::UnoType< css::uno::XInterface >::get(); //TODO: correct? nillable = false; - removable = false; - if ( getParentNode() != NULL ) - removable = getParentNode()->kind() == Node::KIND_SET; + rtl::Reference< Node > parent(getParentNode()); + removable = parent.is() && parent->kind() == Node::KIND_SET; break; } return css::beans::Property( diff --git a/configmgr/source/access.hxx b/configmgr/source/access.hxx index bf314f2f6aca..bf314f2f6aca 100644..100755 --- a/configmgr/source/access.hxx +++ b/configmgr/source/access.hxx diff --git a/configmgr/source/additions.hxx b/configmgr/source/additions.hxx index 5278dec2995f..5278dec2995f 100644..100755 --- a/configmgr/source/additions.hxx +++ b/configmgr/source/additions.hxx diff --git a/configmgr/source/broadcaster.cxx b/configmgr/source/broadcaster.cxx index 8634dfa08bc3..8634dfa08bc3 100644..100755 --- a/configmgr/source/broadcaster.cxx +++ b/configmgr/source/broadcaster.cxx diff --git a/configmgr/source/broadcaster.hxx b/configmgr/source/broadcaster.hxx index 75db85ec015d..75db85ec015d 100644..100755 --- a/configmgr/source/broadcaster.hxx +++ b/configmgr/source/broadcaster.hxx diff --git a/configmgr/source/childaccess.cxx b/configmgr/source/childaccess.cxx index 3d9c40bc072b..3d9c40bc072b 100644..100755 --- a/configmgr/source/childaccess.cxx +++ b/configmgr/source/childaccess.cxx diff --git a/configmgr/source/childaccess.hxx b/configmgr/source/childaccess.hxx index 77fd5190aae8..77fd5190aae8 100644..100755 --- a/configmgr/source/childaccess.hxx +++ b/configmgr/source/childaccess.hxx diff --git a/configmgr/source/components.cxx b/configmgr/source/components.cxx index 44c2d32a924e..108e08fa7a12 100644..100755 --- a/configmgr/source/components.cxx +++ b/configmgr/source/components.cxx @@ -217,7 +217,7 @@ void Components::WriteThread::run() { reference_->clear(); } -void Components::initSingleton( +Components & Components::getSingleton( css::uno::Reference< css::uno::XComponentContext > const & context) { OSL_ASSERT(context.is()); @@ -226,10 +226,6 @@ void Components::initSingleton( singleton = &theSingleton; singletonCreated = true; } -} - -Components & Components::getSingleton() { - OSL_ASSERT(singletonCreated); if (singleton == 0) { throw css::uno::RuntimeException( rtl::OUString( @@ -869,7 +865,7 @@ void Components::parseModificationLayer() { "configmgr user registrymodifications.xcu does not (yet) exist"); // Migrate old user layer data (can be removed once migration is no // longer relevant, probably OOo 4; also see hack for xsi namespace in - // XmlReader constructor): + // xmlreader::XmlReader::registerNamespaceIri): parseFiles( Data::NO_LAYER, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".xcu")), &parseXcuFile, diff --git a/configmgr/source/components.hxx b/configmgr/source/components.hxx index e810c6aee2db..9d216e1bb915 100644..100755 --- a/configmgr/source/components.hxx +++ b/configmgr/source/components.hxx @@ -67,12 +67,10 @@ class RootAccess; class Components: private boost::noncopyable { public: - static void initSingleton( + static Components & getSingleton( com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const & context); - static Components & getSingleton(); - static bool allLocales(rtl::OUString const & locale); rtl::Reference< Node > resolvePathRepresentation( diff --git a/configmgr/source/pad.hxx b/configmgr/source/configmgr.component index 1e86a0af91d2..6ed51257005d 100644..100755 --- a/configmgr/source/pad.hxx +++ b/configmgr/source/configmgr.component @@ -1,5 +1,5 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -24,41 +24,22 @@ * <http://www.openoffice.org/license.html> * for a copy of the LGPLv3 License. * -************************************************************************/ - -#ifndef INCLUDED_CONFIGMGR_SOURCE_PAD_HXX -#define INCLUDED_CONFIGMGR_SOURCE_PAD_HXX - -#include "sal/config.h" - -#include "rtl/strbuf.hxx" -#include "sal/types.h" - -#include "span.hxx" - -namespace configmgr { - -class Pad { -public: - void add(char const * begin, sal_Int32 length); - - void addEphemeral(char const * begin, sal_Int32 length); - - void clear(); - - bool is() const; - - Span get() const; - -private: - void flushSpan(); - - Span span_; - rtl::OStringBuffer buffer_; -}; - -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.configuration.ConfigurationProvider"> + <service name="com.sun.star.configuration.ConfigurationProvider"/> + </implementation> + <implementation name="com.sun.star.comp.configuration.ConfigurationRegistry"> + <service name="com.sun.star.configuration.ConfigurationRegistry"/> + </implementation> + <implementation name="com.sun.star.comp.configuration.DefaultProvider"> + <service name="com.sun.star.configuration.DefaultProvider"/> + <singleton name="com.sun.star.configuration.theDefaultProvider"/> + </implementation> + <implementation name="com.sun.star.comp.configuration.Update"> + <service name="com.sun.star.configuration.Update_Service"/> + <singleton name="com.sun.star.configuration.Update"/> + </implementation> +</component> diff --git a/configmgr/source/configurationprovider.cxx b/configmgr/source/configurationprovider.cxx index cccb74658c11..6b8d967e92b9 100644..100755 --- a/configmgr/source/configurationprovider.cxx +++ b/configmgr/source/configurationprovider.cxx @@ -56,7 +56,7 @@ #include "cppu/unotype.hxx" #include "cppuhelper/compbase5.hxx" #include "cppuhelper/factory.hxx" -#include "cppuhelper/implbase1.hxx" +#include "cppuhelper/implbase2.hxx" #include "cppuhelper/interfacecontainer.hxx" #include "cppuhelper/weak.hxx" #include "osl/diagnose.h" @@ -129,7 +129,6 @@ private: virtual css::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() throw (css::uno::RuntimeException) { return configuration_provider::getSupportedServiceNames(); } - //TODO: DefaultProvider? virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( rtl::OUString const & aServiceSpecifier) @@ -279,8 +278,7 @@ Service::createInstanceWithArguments( static_cast< cppu::OWeakObject * >(this)); } osl::MutexGuard guard(*lock_); - Components::initSingleton(context_); - Components & components = Components::getSingleton(); + Components & components = Components::getSingleton(context_); rtl::Reference< RootAccess > root( new RootAccess(components, nodepath, locale, update)); if (root->isValue()) { @@ -391,14 +389,14 @@ void Service::flushModifications() const { Components * components; { osl::MutexGuard guard(*lock_); - Components::initSingleton(context_); - components = &Components::getSingleton(); + components = &Components::getSingleton(context_); } components->flushModifications(); } class Factory: - public cppu::WeakImplHelper1< css::lang::XSingleComponentFactory >, + public cppu::WeakImplHelper2< + css::lang::XSingleComponentFactory, css::lang::XServiceInfo >, private boost::noncopyable { public: @@ -417,6 +415,18 @@ private: css::uno::Sequence< css::uno::Any > const & Arguments, css::uno::Reference< css::uno::XComponentContext > const & Context) throw (css::uno::Exception, css::uno::RuntimeException); + + virtual rtl::OUString SAL_CALL getImplementationName() + throw (css::uno::RuntimeException) + { return configuration_provider::getImplementationName(); } + + virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & ServiceName) + throw (css::uno::RuntimeException) + { return ServiceName == getSupportedServiceNames()[0]; } //TODO + + virtual css::uno::Sequence< rtl::OUString > SAL_CALL + getSupportedServiceNames() throw (css::uno::RuntimeException) + { return configuration_provider::getSupportedServiceNames(); } }; css::uno::Reference< css::uno::XInterface > Factory::createInstanceWithContext( diff --git a/configmgr/source/configurationprovider.hxx b/configmgr/source/configurationprovider.hxx index a55e99809d79..a55e99809d79 100644..100755 --- a/configmgr/source/configurationprovider.hxx +++ b/configmgr/source/configurationprovider.hxx diff --git a/configmgr/source/configurationregistry.cxx b/configmgr/source/configurationregistry.cxx index f4fe588d01a7..a46d5ceb2e13 100644..100755 --- a/configmgr/source/configurationregistry.cxx +++ b/configmgr/source/configurationregistry.cxx @@ -37,7 +37,6 @@ #include "com/sun/star/lang/XMultiComponentFactory.hpp" #include "com/sun/star/lang/XMultiServiceFactory.hpp" #include "com/sun/star/lang/XServiceInfo.hpp" -#include "com/sun/star/lang/XSingleComponentFactory.hpp" #include "com/sun/star/registry/InvalidRegistryException.hpp" #include "com/sun/star/registry/InvalidValueException.hpp" #include "com/sun/star/registry/MergeConflictException.hpp" @@ -57,13 +56,11 @@ #include "com/sun/star/uno/XInterface.hpp" #include "com/sun/star/util/XFlushable.hpp" #include "cppu/unotype.hxx" -#include "cppuhelper/factory.hxx" #include "cppuhelper/implbase1.hxx" #include "cppuhelper/implbase3.hxx" #include "cppuhelper/weak.hxx" #include "osl/diagnose.h" #include "osl/mutex.hxx" -#include "rtl/unload.h" #include "rtl/ustring.h" #include "rtl/ustring.hxx" #include "sal/types.h" @@ -878,53 +875,12 @@ rtl::OUString RegistryKey::getResolvedName(rtl::OUString const & aKeyName) return aKeyName; } -class Factory: - public cppu::WeakImplHelper1< css::lang::XSingleComponentFactory >, - private boost::noncopyable -{ -public: - Factory() {} - -private: - virtual ~Factory() {} - - virtual css::uno::Reference< css::uno::XInterface > SAL_CALL - createInstanceWithContext( - css::uno::Reference< css::uno::XComponentContext > const & Context) - throw (css::uno::Exception, css::uno::RuntimeException); - - virtual css::uno::Reference< css::uno::XInterface > SAL_CALL - createInstanceWithArgumentsAndContext( - css::uno::Sequence< css::uno::Any > const & Arguments, - css::uno::Reference< css::uno::XComponentContext > const & Context) - throw (css::uno::Exception, css::uno::RuntimeException); -}; - -css::uno::Reference< css::uno::XInterface > Factory::createInstanceWithContext( - css::uno::Reference< css::uno::XComponentContext > const & Context) - throw (css::uno::Exception, css::uno::RuntimeException) -{ - return createInstanceWithArgumentsAndContext( - css::uno::Sequence< css::uno::Any >(), Context); } -css::uno::Reference< css::uno::XInterface > -Factory::createInstanceWithArgumentsAndContext( - css::uno::Sequence< css::uno::Any > const & Arguments, - css::uno::Reference< css::uno::XComponentContext > const & Context) - throw (css::uno::Exception, css::uno::RuntimeException) +css::uno::Reference< css::uno::XInterface > create( + css::uno::Reference< css::uno::XComponentContext > const & context) { - if (Arguments.getLength() != 0) { - throw css::uno::Exception( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.configuration.ConfigurationRegistry must be" - " instantiated without arguments")), - static_cast< cppu::OWeakObject * >(this)); - } - return static_cast< cppu::OWeakObject * >(new Service(Context)); -} - + return static_cast< cppu::OWeakObject * >(new Service(context)); } rtl::OUString getImplementationName() { @@ -940,14 +896,6 @@ css::uno::Sequence< rtl::OUString > getSupportedServiceNames() { return css::uno::Sequence< rtl::OUString >(&name, 1); } -css::uno::Reference< css::lang::XSingleComponentFactory > createFactory( - cppu::ComponentFactoryFunc, rtl::OUString const &, - css::uno::Sequence< rtl::OUString > const &, rtl_ModuleCount *) - SAL_THROW(()) -{ - return new Factory; -} - } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/configmgr/source/configurationregistry.hxx b/configmgr/source/configurationregistry.hxx index 459fcc4535bc..fdba8f51e583 100644..100755 --- a/configmgr/source/configurationregistry.hxx +++ b/configmgr/source/configurationregistry.hxx @@ -31,28 +31,28 @@ #include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/Sequence.hxx" -#include "cppuhelper/factory.hxx" -#include "rtl/unload.h" #include "sal/types.h" -namespace com { namespace sun { namespace star { namespace lang { - class XSingleComponentFactory; -} } } } +namespace com { namespace sun { namespace star { + namespace uno { + class XComponentContext; + class XInterface; + } +} } } namespace rtl { class OUString; } namespace configmgr { namespace configuration_registry { +com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL +create( + com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > + const & context); + rtl::OUString SAL_CALL getImplementationName(); com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(); -com::sun::star::uno::Reference< com::sun::star::lang::XSingleComponentFactory > -SAL_CALL createFactory( - cppu::ComponentFactoryFunc, rtl::OUString const &, - com::sun::star::uno::Sequence< rtl::OUString > const &, rtl_ModuleCount *) - SAL_THROW(()); - } } #endif diff --git a/configmgr/source/data.cxx b/configmgr/source/data.cxx index 989f543b197d..989f543b197d 100644..100755 --- a/configmgr/source/data.cxx +++ b/configmgr/source/data.cxx diff --git a/configmgr/source/data.hxx b/configmgr/source/data.hxx index f60ecfa1e807..f60ecfa1e807 100644..100755 --- a/configmgr/source/data.hxx +++ b/configmgr/source/data.hxx diff --git a/configmgr/source/defaultprovider.cxx b/configmgr/source/defaultprovider.cxx index 16cf66df0d55..6e65301e8c82 100644..100755 --- a/configmgr/source/defaultprovider.cxx +++ b/configmgr/source/defaultprovider.cxx @@ -29,25 +29,16 @@ #include "precompiled_configmgr.hxx" #include "sal/config.h" -#include "boost/noncopyable.hpp" -#include "boost/shared_ptr.hpp" -#include "com/sun/star/lang/XSingleComponentFactory.hpp" -#include "com/sun/star/uno/Any.hxx" -#include "com/sun/star/uno/Exception.hpp" #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/XComponentContext.hpp" #include "com/sun/star/uno/XInterface.hpp" -#include "cppuhelper/factory.hxx" -#include "cppuhelper/implbase1.hxx" -#include "cppuhelper/weak.hxx" -#include "sal/types.h" -#include "rtl/unload.h" +#include "osl/mutex.hxx" #include "rtl/ustring.h" #include "rtl/ustring.hxx" #include "configurationprovider.hxx" +#include "defaultprovider.hxx" #include "lock.hxx" namespace configmgr { namespace default_provider { @@ -56,63 +47,15 @@ namespace { namespace css = com::sun::star; -class Factory: - public cppu::WeakImplHelper1< css::lang::XSingleComponentFactory >, - private boost::noncopyable +css::uno::Reference< css::uno::XInterface > create( + css::uno::Reference< css::uno::XComponentContext > const & context) { -public: - Factory() - { - lock_ = lock(); - } - -private: - virtual ~Factory() {} - - virtual css::uno::Reference< css::uno::XInterface > SAL_CALL - createInstanceWithContext( - css::uno::Reference< css::uno::XComponentContext > const & Context) - throw (css::uno::Exception, css::uno::RuntimeException); - - virtual css::uno::Reference< css::uno::XInterface > SAL_CALL - createInstanceWithArgumentsAndContext( - css::uno::Sequence< css::uno::Any > const & Arguments, - css::uno::Reference< css::uno::XComponentContext > const & Context) - throw (css::uno::Exception, css::uno::RuntimeException); - - boost::shared_ptr<osl::Mutex> lock_; -}; - -css::uno::Reference< css::uno::XInterface > Factory::createInstanceWithContext( - css::uno::Reference< css::uno::XComponentContext > const & Context) - throw (css::uno::Exception, css::uno::RuntimeException) -{ - return createInstanceWithArgumentsAndContext( - css::uno::Sequence< css::uno::Any >(), Context); -} - -css::uno::Reference< css::uno::XInterface > -Factory::createInstanceWithArgumentsAndContext( - css::uno::Sequence< css::uno::Any > const & Arguments, - css::uno::Reference< css::uno::XComponentContext > const & Context) - throw (css::uno::Exception, css::uno::RuntimeException) -{ - if (Arguments.getLength() != 0) { - throw css::uno::Exception( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.configuration.DefaultProvider must be" - " instantiated without arguments")), - static_cast< cppu::OWeakObject * >(this)); - } osl::MutexGuard guard(*lock_); static css::uno::Reference< css::uno::XInterface > singleton( - configuration_provider::createDefault(Context)); + configuration_provider::createDefault(context)); return singleton; } -} - rtl::OUString getImplementationName() { return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( @@ -126,15 +69,6 @@ css::uno::Sequence< rtl::OUString > getSupportedServiceNames() { return css::uno::Sequence< rtl::OUString >(&name, 1); } -css::uno::Reference< css::lang::XSingleComponentFactory > -SAL_CALL createFactory( - cppu::ComponentFactoryFunc, rtl::OUString const &, - css::uno::Sequence< rtl::OUString > const &, rtl_ModuleCount *) - SAL_THROW(()) -{ - return new Factory; -} - } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/configmgr/source/defaultprovider.hxx b/configmgr/source/defaultprovider.hxx index 5202148fa34e..1dbc44d525e0 100644..100755 --- a/configmgr/source/defaultprovider.hxx +++ b/configmgr/source/defaultprovider.hxx @@ -33,28 +33,28 @@ #include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/Sequence.hxx" -#include "cppuhelper/factory.hxx" -#include "rtl/unload.h" #include "sal/types.h" -namespace com { namespace sun { namespace star { namespace lang { - class XSingleComponentFactory; -} } } } +namespace com { namespace sun { namespace star { + namespace uno { + class XComponentContext; + class XInterface; + } +} } } namespace rtl { class OUString; } namespace configmgr { namespace default_provider { +com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL +create( + com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > + const & context); + rtl::OUString SAL_CALL getImplementationName(); com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(); -com::sun::star::uno::Reference< com::sun::star::lang::XSingleComponentFactory > -SAL_CALL createFactory( - cppu::ComponentFactoryFunc, rtl::OUString const &, - com::sun::star::uno::Sequence< rtl::OUString > const &, rtl_ModuleCount *) - SAL_THROW(()); - } } #endif diff --git a/configmgr/source/groupnode.cxx b/configmgr/source/groupnode.cxx index fa56afa1a29c..fa56afa1a29c 100644..100755 --- a/configmgr/source/groupnode.cxx +++ b/configmgr/source/groupnode.cxx diff --git a/configmgr/source/groupnode.hxx b/configmgr/source/groupnode.hxx index 02f1679998a2..02f1679998a2 100644..100755 --- a/configmgr/source/groupnode.hxx +++ b/configmgr/source/groupnode.hxx diff --git a/configmgr/source/localizedpropertynode.cxx b/configmgr/source/localizedpropertynode.cxx index c03f552de1d3..c03f552de1d3 100644..100755 --- a/configmgr/source/localizedpropertynode.cxx +++ b/configmgr/source/localizedpropertynode.cxx diff --git a/configmgr/source/localizedpropertynode.hxx b/configmgr/source/localizedpropertynode.hxx index bbe934e36bcd..bbe934e36bcd 100644..100755 --- a/configmgr/source/localizedpropertynode.hxx +++ b/configmgr/source/localizedpropertynode.hxx diff --git a/configmgr/source/localizedvaluenode.cxx b/configmgr/source/localizedvaluenode.cxx index ac6346f09227..ac6346f09227 100644..100755 --- a/configmgr/source/localizedvaluenode.cxx +++ b/configmgr/source/localizedvaluenode.cxx diff --git a/configmgr/source/localizedvaluenode.hxx b/configmgr/source/localizedvaluenode.hxx index 23139bec4029..23139bec4029 100644..100755 --- a/configmgr/source/localizedvaluenode.hxx +++ b/configmgr/source/localizedvaluenode.hxx diff --git a/configmgr/source/lock.cxx b/configmgr/source/lock.cxx index 3950a2d5e3e0..3950a2d5e3e0 100644..100755 --- a/configmgr/source/lock.cxx +++ b/configmgr/source/lock.cxx diff --git a/configmgr/source/lock.hxx b/configmgr/source/lock.hxx index b37e83a44ee2..b37e83a44ee2 100644..100755 --- a/configmgr/source/lock.hxx +++ b/configmgr/source/lock.hxx diff --git a/configmgr/source/makefile.mk b/configmgr/source/makefile.mk index 777fed3323d8..94747d9dd803 100644..100755 --- a/configmgr/source/makefile.mk +++ b/configmgr/source/makefile.mk @@ -52,7 +52,6 @@ SLOFILES = \ $(SLO)/modifications.obj \ $(SLO)/node.obj \ $(SLO)/nodemap.obj \ - $(SLO)/pad.obj \ $(SLO)/parsemanager.obj \ $(SLO)/partial.obj \ $(SLO)/propertynode.obj \ @@ -66,8 +65,7 @@ SLOFILES = \ $(SLO)/xcdparser.obj \ $(SLO)/xcsparser.obj \ $(SLO)/xcuparser.obj \ - $(SLO)/xmldata.obj \ - $(SLO)/xmlreader.obj + $(SLO)/xmldata.obj SHL1IMPLIB = i$(SHL1TARGET) SHL1OBJS = $(SLOFILES) @@ -76,9 +74,18 @@ SHL1STDLIBS = \ $(CPPUHELPERLIB) \ $(CPPULIB) \ $(SALHELPERLIB) \ - $(SALLIB) + $(SALLIB) \ + $(XMLREADERLIB) SHL1TARGET = configmgr.uno SHL1USE_EXPORTS = name DEF1NAME = $(SHL1TARGET) .INCLUDE: target.mk + +ALLTAR : $(MISC)/configmgr.component + +$(MISC)/configmgr.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + configmgr.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt configmgr.component diff --git a/configmgr/source/modifications.cxx b/configmgr/source/modifications.cxx index e83d4a501af6..e83d4a501af6 100644..100755 --- a/configmgr/source/modifications.cxx +++ b/configmgr/source/modifications.cxx diff --git a/configmgr/source/modifications.hxx b/configmgr/source/modifications.hxx index fa4f08a157fd..fa4f08a157fd 100644..100755 --- a/configmgr/source/modifications.hxx +++ b/configmgr/source/modifications.hxx diff --git a/configmgr/source/node.cxx b/configmgr/source/node.cxx index 69f53e28b1d9..58d13c4fee55 100644..100755 --- a/configmgr/source/node.cxx +++ b/configmgr/source/node.cxx @@ -102,10 +102,6 @@ Node::~Node() {} void Node::clear() {} -rtl::Reference< Node > Node::findMember(rtl::OUString const &) { - return rtl::Reference< Node >(); -} - } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/configmgr/source/node.hxx b/configmgr/source/node.hxx index 27eea9c4642e..932d11cf3744 100644..100755 --- a/configmgr/source/node.hxx +++ b/configmgr/source/node.hxx @@ -32,11 +32,12 @@ #include "sal/config.h" #include "rtl/ref.hxx" -#include "rtl/ustring.hxx" #include "salhelper/simplereferenceobject.hxx" #include "nodemap.hxx" +namespace rtl { class OUString; } + namespace configmgr { class Node: public salhelper::SimpleReferenceObject { @@ -70,8 +71,6 @@ protected: virtual ~Node(); virtual void clear(); - virtual rtl::Reference< Node > findMember(rtl::OUString const & name); - int layer_; int finalized_; }; diff --git a/configmgr/source/nodemap.cxx b/configmgr/source/nodemap.cxx index 432aa64e7991..432aa64e7991 100644..100755 --- a/configmgr/source/nodemap.cxx +++ b/configmgr/source/nodemap.cxx diff --git a/configmgr/source/nodemap.hxx b/configmgr/source/nodemap.hxx index 5e9e501e9fc7..5e9e501e9fc7 100644..100755 --- a/configmgr/source/nodemap.hxx +++ b/configmgr/source/nodemap.hxx diff --git a/configmgr/source/pad.cxx b/configmgr/source/pad.cxx index 68a92b5aa741..68a92b5aa741 100644..100755 --- a/configmgr/source/pad.cxx +++ b/configmgr/source/pad.cxx diff --git a/configmgr/source/parsemanager.cxx b/configmgr/source/parsemanager.cxx index b6fe53f17126..d5a2d2ddd5b0 100644..100755 --- a/configmgr/source/parsemanager.cxx +++ b/configmgr/source/parsemanager.cxx @@ -33,10 +33,11 @@ #include "com/sun/star/uno/RuntimeException.hpp" #include "osl/diagnose.h" #include "sal/types.h" +#include "xmlreader/span.hxx" +#include "xmlreader/xmlreader.hxx" #include "parsemanager.hxx" #include "parser.hxx" -#include "xmlreader.hxx" namespace configmgr { @@ -53,28 +54,42 @@ ParseManager::ParseManager( reader_(url), parser_(parser) { OSL_ASSERT(parser.is()); + int id; + id = reader_.registerNamespaceIri( + xmlreader::Span( + RTL_CONSTASCII_STRINGPARAM("http://openoffice.org/2001/registry"))); + OSL_ASSERT(id == NAMESPACE_OOR); + id = reader_.registerNamespaceIri( + xmlreader::Span( + RTL_CONSTASCII_STRINGPARAM("http://www.w3.org/2001/XMLSchema"))); + OSL_ASSERT(id == NAMESPACE_XS); + id = reader_.registerNamespaceIri( + xmlreader::Span( + RTL_CONSTASCII_STRINGPARAM( + "http://www.w3.org/2001/XMLSchema-instance"))); + OSL_ASSERT(id == NAMESPACE_XSI); } bool ParseManager::parse() { for (;;) { switch (itemData_.is() - ? XmlReader::RESULT_BEGIN + ? xmlreader::XmlReader::RESULT_BEGIN : reader_.nextItem( - parser_->getTextMode(), &itemData_, &itemNamespace_)) + parser_->getTextMode(), &itemData_, &itemNamespaceId_)) { - case XmlReader::RESULT_BEGIN: - if (!parser_->startElement(reader_, itemNamespace_, itemData_)) + case xmlreader::XmlReader::RESULT_BEGIN: + if (!parser_->startElement(reader_, itemNamespaceId_, itemData_)) { return false; } break; - case XmlReader::RESULT_END: + case xmlreader::XmlReader::RESULT_END: parser_->endElement(reader_); break; - case XmlReader::RESULT_TEXT: + case xmlreader::XmlReader::RESULT_TEXT: parser_->characters(itemData_); break; - case XmlReader::RESULT_DONE: + case xmlreader::XmlReader::RESULT_DONE: return true; } itemData_.clear(); diff --git a/configmgr/source/parsemanager.hxx b/configmgr/source/parsemanager.hxx index 47719fce8a89..a6a238b0a0ec 100644..100755 --- a/configmgr/source/parsemanager.hxx +++ b/configmgr/source/parsemanager.hxx @@ -36,9 +36,8 @@ #include "rtl/ref.hxx" #include "sal/types.h" #include "salhelper/simplereferenceobject.hxx" - -#include "span.hxx" -#include "xmlreader.hxx" +#include "xmlreader/span.hxx" +#include "xmlreader/xmlreader.hxx" namespace rtl { class OUString; } @@ -56,13 +55,15 @@ public: bool parse(); + enum { NAMESPACE_OOR = 1, NAMESPACE_XS = 2, NAMESPACE_XSI = 3 }; + private: virtual ~ParseManager(); - XmlReader reader_; + xmlreader::XmlReader reader_; rtl::Reference< Parser > parser_; - Span itemData_; - XmlReader::Namespace itemNamespace_; + xmlreader::Span itemData_; + int itemNamespaceId_; }; } diff --git a/configmgr/source/parser.hxx b/configmgr/source/parser.hxx index 0c2435ed19bd..a7151b71c616 100644..100755 --- a/configmgr/source/parser.hxx +++ b/configmgr/source/parser.hxx @@ -34,23 +34,23 @@ #include <memory> #include "salhelper/simplereferenceobject.hxx" +#include "xmlreader/xmlreader.hxx" -#include "xmlreader.hxx" +namespace xmlreader { struct Span; } namespace configmgr { -struct Span; - class Parser: public salhelper::SimpleReferenceObject { public: - virtual XmlReader::Text getTextMode() = 0; + virtual xmlreader::XmlReader::Text getTextMode() = 0; virtual bool startElement( - XmlReader & reader, XmlReader::Namespace ns, Span const & name) = 0; + xmlreader::XmlReader & reader, int nsId, xmlreader::Span const & name) + = 0; - virtual void endElement(XmlReader const & reader) = 0; + virtual void endElement(xmlreader::XmlReader const & reader) = 0; - virtual void characters(Span const & text) = 0; + virtual void characters(xmlreader::Span const & text) = 0; protected: Parser() {} diff --git a/configmgr/source/partial.cxx b/configmgr/source/partial.cxx index f3f91a4c05a6..f3f91a4c05a6 100644..100755 --- a/configmgr/source/partial.cxx +++ b/configmgr/source/partial.cxx diff --git a/configmgr/source/partial.hxx b/configmgr/source/partial.hxx index 135aa5d66355..135aa5d66355 100644..100755 --- a/configmgr/source/partial.hxx +++ b/configmgr/source/partial.hxx diff --git a/configmgr/source/path.hxx b/configmgr/source/path.hxx index 2de401099d00..2de401099d00 100644..100755 --- a/configmgr/source/path.hxx +++ b/configmgr/source/path.hxx diff --git a/configmgr/source/propertynode.cxx b/configmgr/source/propertynode.cxx index 8e2eec660d2b..8e2eec660d2b 100644..100755 --- a/configmgr/source/propertynode.cxx +++ b/configmgr/source/propertynode.cxx diff --git a/configmgr/source/propertynode.hxx b/configmgr/source/propertynode.hxx index 6e0edc895f29..6e0edc895f29 100644..100755 --- a/configmgr/source/propertynode.hxx +++ b/configmgr/source/propertynode.hxx diff --git a/configmgr/source/rootaccess.cxx b/configmgr/source/rootaccess.cxx index ef5982e3a56d..ef5982e3a56d 100644..100755 --- a/configmgr/source/rootaccess.cxx +++ b/configmgr/source/rootaccess.cxx diff --git a/configmgr/source/rootaccess.hxx b/configmgr/source/rootaccess.hxx index c1751210c50c..c1751210c50c 100644..100755 --- a/configmgr/source/rootaccess.hxx +++ b/configmgr/source/rootaccess.hxx diff --git a/configmgr/source/services.cxx b/configmgr/source/services.cxx index 6dc4b92c8b33..d274cd8973ca 100644..100755 --- a/configmgr/source/services.cxx +++ b/configmgr/source/services.cxx @@ -29,17 +29,14 @@ #include "precompiled_configmgr.hxx" #include "sal/config.h" -#include "com/sun/star/registry/XRegistryKey.hpp" #include "com/sun/star/uno/Exception.hpp" #include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/XComponentContext.hpp" #include "com/sun/star/uno/XInterface.hpp" +#include "cppuhelper/factory.hxx" #include "cppuhelper/implementationentry.hxx" #include "osl/diagnose.h" #include "uno/lbnames.h" -#include "rtl/textenc.h" -#include "rtl/ustring.h" -#include "rtl/ustring.hxx" #include "sal/types.h" #include "configurationprovider.hxx" @@ -63,15 +60,17 @@ static cppu::ImplementationEntry const services[] = { { &dummy, &configmgr::configuration_provider::getImplementationName, &configmgr::configuration_provider::getSupportedServiceNames, &configmgr::configuration_provider::createFactory, 0, 0 }, - { &dummy, &configmgr::default_provider::getImplementationName, + { &configmgr::default_provider::create, + &configmgr::default_provider::getImplementationName, &configmgr::default_provider::getSupportedServiceNames, - &configmgr::default_provider::createFactory, 0, 0 }, - { &dummy, &configmgr::configuration_registry::getImplementationName, + &cppu::createSingleComponentFactory, 0, 0 }, + { &configmgr::configuration_registry::create, + &configmgr::configuration_registry::getImplementationName, &configmgr::configuration_registry::getSupportedServiceNames, - &configmgr::configuration_registry::createFactory, 0, 0 }, - { &dummy, &configmgr::update::getImplementationName, + &cppu::createSingleComponentFactory, 0, 0 }, + { &configmgr::update::create, &configmgr::update::getImplementationName, &configmgr::update::getSupportedServiceNames, - &configmgr::update::createFactory, 0, 0 }, + &cppu::createSingleComponentFactory, 0, 0 }, { 0, 0, 0, 0, 0, 0 } }; @@ -91,48 +90,4 @@ component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey) -{ - if (!component_writeInfoHelper(pServiceManager, pRegistryKey, services)) { - return false; - } - try { - css::uno::Reference< css::registry::XRegistryKey >( - (css::uno::Reference< css::registry::XRegistryKey >( - static_cast< css::registry::XRegistryKey * >(pRegistryKey))-> - createKey( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "/com.sun.star.comp.configuration.DefaultProvider/UNO/" - "SINGLETONS/" - "com.sun.star.configuration.theDefaultProvider")))), - css::uno::UNO_SET_THROW)-> - setStringValue( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.configuration.DefaultProvider"))); - css::uno::Reference< css::registry::XRegistryKey >( - (css::uno::Reference< css::registry::XRegistryKey >( - static_cast< css::registry::XRegistryKey * >(pRegistryKey))-> - createKey( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "/com.sun.star.comp.configuration.Update/UNO/" - "SINGLETONS/com.sun.star.configuration.Update")))), - css::uno::UNO_SET_THROW)-> - setStringValue( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.configuration.Update_Service"))); - } catch (css::uno::Exception & e) { - (void) e; - OSL_TRACE( - "configmgr component_writeInfo exception: %s", - rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr()); - return false; - } - return true; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/configmgr/source/setnode.cxx b/configmgr/source/setnode.cxx index 52b117bb0154..52b117bb0154 100644..100755 --- a/configmgr/source/setnode.cxx +++ b/configmgr/source/setnode.cxx diff --git a/configmgr/source/setnode.hxx b/configmgr/source/setnode.hxx index 00bcab2a55a1..00bcab2a55a1 100644..100755 --- a/configmgr/source/setnode.hxx +++ b/configmgr/source/setnode.hxx diff --git a/configmgr/source/span.hxx b/configmgr/source/span.hxx deleted file mode 100644 index 20843be31efb..000000000000 --- a/configmgr/source/span.hxx +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* -* -* 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_SPAN_HXX -#define INCLUDED_CONFIGMGR_SOURCE_SPAN_HXX - -#include "sal/config.h" - -#include "rtl/string.h" -#include "sal/types.h" - -namespace configmgr { - -struct Span { - char const * begin; - sal_Int32 length; - - inline Span(): begin(0), length(0) {} - // init length to avoid compiler warnings - - inline Span(char const * theBegin, sal_Int32 theLength): - begin(theBegin), length(theLength) {} - - inline void clear() throw() { begin = 0; } - - inline bool is() const { return begin != 0; } - - inline bool equals(Span const & text) const { - return rtl_str_compare_WithLength( - begin, length, text.begin, text.length) == 0; - } - - inline bool equals(char const * textBegin, sal_Int32 textLength) const { - return equals(Span(textBegin, textLength)); - } -}; - -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/configmgr/source/type.cxx b/configmgr/source/type.cxx index b3bfd72d3e8d..b3bfd72d3e8d 100644..100755 --- a/configmgr/source/type.cxx +++ b/configmgr/source/type.cxx diff --git a/configmgr/source/type.hxx b/configmgr/source/type.hxx index 91e335de1e44..91e335de1e44 100644..100755 --- a/configmgr/source/type.hxx +++ b/configmgr/source/type.hxx diff --git a/configmgr/source/update.cxx b/configmgr/source/update.cxx index 7208eb3f8c69..d63ff05841ab 100644..100755 --- a/configmgr/source/update.cxx +++ b/configmgr/source/update.cxx @@ -34,20 +34,15 @@ #include "boost/noncopyable.hpp" #include "boost/shared_ptr.hpp" #include "com/sun/star/configuration/XUpdate.hpp" -#include "com/sun/star/lang/XSingleComponentFactory.hpp" -#include "com/sun/star/uno/Any.hxx" -#include "com/sun/star/uno/Exception.hpp" #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/XComponentContext.hpp" #include "com/sun/star/uno/XInterface.hpp" -#include "cppuhelper/factory.hxx" #include "cppuhelper/implbase1.hxx" #include "cppuhelper/weak.hxx" #include "osl/mutex.hxx" #include "rtl/ref.hxx" -#include "rtl/unload.h" #include "rtl/ustring.h" #include "rtl/ustring.hxx" #include "sal/types.h" @@ -78,8 +73,10 @@ class Service: private boost::noncopyable { public: - Service() + Service(css::uno::Reference< css::uno::XComponentContext > const context): + context_(context) { + OSL_ASSERT(context.is()); lock_ = lock(); } @@ -104,6 +101,7 @@ private: throw (css::uno::RuntimeException); boost::shared_ptr<osl::Mutex> lock_; + css::uno::Reference< css::uno::XComponentContext > context_; }; void Service::insertExtensionXcsFile( @@ -111,7 +109,7 @@ void Service::insertExtensionXcsFile( throw (css::uno::RuntimeException) { osl::MutexGuard g(*lock_); - Components::getSingleton().insertExtensionXcsFile(shared, fileUri); + Components::getSingleton(context_).insertExtensionXcsFile(shared, fileUri); } void Service::insertExtensionXcuFile( @@ -121,10 +119,10 @@ void Service::insertExtensionXcuFile( Broadcaster bc; { osl::MutexGuard g(*lock_); + Components & components = Components::getSingleton(context_); Modifications mods; - Components::getSingleton().insertExtensionXcuFile( - shared, fileUri, &mods); - Components::getSingleton().initGlobalBroadcaster( + components.insertExtensionXcuFile(shared, fileUri, &mods); + components.initGlobalBroadcaster( mods, rtl::Reference< RootAccess >(), &bc); } bc.send(); @@ -136,9 +134,10 @@ void Service::removeExtensionXcuFile(rtl::OUString const & fileUri) Broadcaster bc; { osl::MutexGuard g(*lock_); + Components & components = Components::getSingleton(context_); Modifications mods; - Components::getSingleton().removeExtensionXcuFile(fileUri, &mods); - Components::getSingleton().initGlobalBroadcaster( + components.removeExtensionXcuFile(fileUri, &mods); + components.initGlobalBroadcaster( mods, rtl::Reference< RootAccess >(), &bc); } bc.send(); @@ -153,62 +152,22 @@ void Service::insertModificationXcuFile( Broadcaster bc; { osl::MutexGuard g(*lock_); + Components & components = Components::getSingleton(context_); Modifications mods; - Components::getSingleton().insertModificationXcuFile( + components.insertModificationXcuFile( fileUri, seqToSet(includedPaths), seqToSet(excludedPaths), &mods); - Components::getSingleton().initGlobalBroadcaster( + components.initGlobalBroadcaster( mods, rtl::Reference< RootAccess >(), &bc); } bc.send(); } -class Factory: - public cppu::WeakImplHelper1< css::lang::XSingleComponentFactory >, - private boost::noncopyable -{ -public: - Factory() {} - -private: - virtual ~Factory() {} - - virtual css::uno::Reference< css::uno::XInterface > SAL_CALL - createInstanceWithContext( - css::uno::Reference< css::uno::XComponentContext > const & Context) - throw (css::uno::Exception, css::uno::RuntimeException); - - virtual css::uno::Reference< css::uno::XInterface > SAL_CALL - createInstanceWithArgumentsAndContext( - css::uno::Sequence< css::uno::Any > const & Arguments, - css::uno::Reference< css::uno::XComponentContext > const & Context) - throw (css::uno::Exception, css::uno::RuntimeException); -}; - -css::uno::Reference< css::uno::XInterface > Factory::createInstanceWithContext( - css::uno::Reference< css::uno::XComponentContext > const & Context) - throw (css::uno::Exception, css::uno::RuntimeException) -{ - return createInstanceWithArgumentsAndContext( - css::uno::Sequence< css::uno::Any >(), Context); } -css::uno::Reference< css::uno::XInterface > -Factory::createInstanceWithArgumentsAndContext( - css::uno::Sequence< css::uno::Any > const & Arguments, - css::uno::Reference< css::uno::XComponentContext > const &) - throw (css::uno::Exception, css::uno::RuntimeException) +css::uno::Reference< css::uno::XInterface > create( + css::uno::Reference< css::uno::XComponentContext > const & context) { - if (Arguments.getLength() != 0) { - throw css::uno::Exception( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.comp.configuration.Update must be" - " instantiated without arguments")), - static_cast< cppu::OWeakObject * >(this)); - } - return static_cast< cppu::OWeakObject * >(new Service); -} - + return static_cast< cppu::OWeakObject * >(new Service(context)); } rtl::OUString getImplementationName() { @@ -223,14 +182,6 @@ css::uno::Sequence< rtl::OUString > getSupportedServiceNames() { return css::uno::Sequence< rtl::OUString >(&name, 1); } -css::uno::Reference< css::lang::XSingleComponentFactory > createFactory( - cppu::ComponentFactoryFunc, rtl::OUString const &, - css::uno::Sequence< rtl::OUString > const &, rtl_ModuleCount *) - SAL_THROW(()) -{ - return new Factory; -} - } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/configmgr/source/update.hxx b/configmgr/source/update.hxx index 77b7affb48ac..3e423679d327 100644..100755 --- a/configmgr/source/update.hxx +++ b/configmgr/source/update.hxx @@ -33,28 +33,28 @@ #include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/Sequence.hxx" -#include "cppuhelper/factory.hxx" -#include "rtl/unload.h" #include "sal/types.h" -namespace com { namespace sun { namespace star { namespace lang { - class XSingleComponentFactory; -} } } } +namespace com { namespace sun { namespace star { + namespace uno { + class XComponentContext; + class XInterface; + } +} } } namespace rtl { class OUString; } namespace configmgr { namespace update { +com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL +create( + com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > + const &); + rtl::OUString SAL_CALL getImplementationName(); com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(); -com::sun::star::uno::Reference< com::sun::star::lang::XSingleComponentFactory > -SAL_CALL createFactory( - cppu::ComponentFactoryFunc, rtl::OUString const &, - com::sun::star::uno::Sequence< rtl::OUString > const &, rtl_ModuleCount *) - SAL_THROW(()); - } } #endif diff --git a/configmgr/source/valueparser.cxx b/configmgr/source/valueparser.cxx index 03201d26f9dc..8488531019cb 100644..100755 --- a/configmgr/source/valueparser.cxx +++ b/configmgr/source/valueparser.cxx @@ -41,16 +41,17 @@ #include "rtl/ustring.h" #include "rtl/ustring.hxx" #include "sal/types.h" +#include "xmlreader/span.hxx" +#include "xmlreader/xmlreader.hxx" #include "localizedvaluenode.hxx" #include "node.hxx" #include "nodemap.hxx" +#include "parsemanager.hxx" #include "propertynode.hxx" -#include "span.hxx" #include "type.hxx" #include "valueparser.hxx" #include "xmldata.hxx" -#include "xmlreader.hxx" namespace configmgr { @@ -75,7 +76,7 @@ bool parseHexDigit(char c, int * value) { return false; } -bool parseValue(Span const & text, sal_Bool * value) { +bool parseValue(xmlreader::Span const & text, sal_Bool * value) { OSL_ASSERT(text.is() && value != 0); if (text.equals(RTL_CONSTASCII_STRINGPARAM("true")) || text.equals(RTL_CONSTASCII_STRINGPARAM("1"))) @@ -92,7 +93,7 @@ bool parseValue(Span const & text, sal_Bool * value) { return false; } -bool parseValue(Span const & text, sal_Int16 * value) { +bool parseValue(xmlreader::Span const & text, sal_Int16 * value) { OSL_ASSERT(text.is() && value != 0); // For backwards compatibility, support hexadecimal values: sal_Int32 n = @@ -111,7 +112,7 @@ bool parseValue(Span const & text, sal_Int16 * value) { return false; } -bool parseValue(Span const & text, sal_Int32 * value) { +bool parseValue(xmlreader::Span const & text, sal_Int32 * value) { OSL_ASSERT(text.is() && value != 0); // For backwards compatibility, support hexadecimal values: *value = @@ -126,7 +127,7 @@ bool parseValue(Span const & text, sal_Int32 * value) { return true; } -bool parseValue(Span const & text, sal_Int64 * value) { +bool parseValue(xmlreader::Span const & text, sal_Int64 * value) { OSL_ASSERT(text.is() && value != 0); // For backwards compatibility, support hexadecimal values: *value = @@ -141,20 +142,22 @@ bool parseValue(Span const & text, sal_Int64 * value) { return true; } -bool parseValue(Span const & text, double * value) { +bool parseValue(xmlreader::Span const & text, double * value) { OSL_ASSERT(text.is() && value != 0); *value = rtl::OString(text.begin, text.length).toDouble(); //TODO: check valid lexical representation return true; } -bool parseValue(Span const & text, rtl::OUString * value) { +bool parseValue(xmlreader::Span const & text, rtl::OUString * value) { OSL_ASSERT(text.is() && value != 0); - *value = xmldata::convertFromUtf8(text); + *value = text.convertFromUtf8(); return true; } -bool parseValue(Span const & text, css::uno::Sequence< sal_Int8 > * value) { +bool parseValue( + xmlreader::Span const & text, css::uno::Sequence< sal_Int8 > * value) +{ OSL_ASSERT(text.is() && value != 0); if ((text.length & 1) != 0) { return false; @@ -174,7 +177,9 @@ bool parseValue(Span const & text, css::uno::Sequence< sal_Int8 > * value) { return true; } -template< typename T > css::uno::Any parseSingleValue(Span const & text) { +template< typename T > css::uno::Any parseSingleValue( + xmlreader::Span const & text) +{ T val; if (!parseValue(text, &val)) { throw css::uno::RuntimeException( @@ -185,21 +190,23 @@ template< typename T > css::uno::Any parseSingleValue(Span const & text) { } template< typename T > css::uno::Any parseListValue( - rtl::OString const & separator, Span const & text) + rtl::OString const & separator, xmlreader::Span const & text) { comphelper::SequenceAsVector< T > seq; - Span sep; + xmlreader::Span sep; if (separator.getLength() == 0) { - sep = Span(RTL_CONSTASCII_STRINGPARAM(" ")); + sep = xmlreader::Span(RTL_CONSTASCII_STRINGPARAM(" ")); } else { - sep = Span(separator.getStr(), separator.getLength()); + sep = xmlreader::Span(separator.getStr(), separator.getLength()); } if (text.length != 0) { - for (Span t(text);;) { + for (xmlreader::Span t(text);;) { sal_Int32 i = rtl_str_indexOfStr_WithLength( t.begin, t.length, sep.begin, sep.length); T val; - if (!parseValue(Span(t.begin, i == -1 ? t.length : i), &val)) { + if (!parseValue( + xmlreader::Span(t.begin, i == -1 ? t.length : i), &val)) + { throw css::uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("invalid value")), css::uno::Reference< css::uno::XInterface >()); @@ -216,7 +223,7 @@ template< typename T > css::uno::Any parseListValue( } css::uno::Any parseValue( - rtl::OString const & separator, Span const & text, Type type) + rtl::OString const & separator, xmlreader::Span const & text, Type type) { switch (type) { case TYPE_ANY: @@ -267,7 +274,7 @@ ValueParser::ValueParser(int layer): layer_(layer) {} ValueParser::~ValueParser() {} -XmlReader::Text ValueParser::getTextMode() const { +xmlreader::XmlReader::Text ValueParser::getTextMode() const { if (node_.is()) { switch (state_) { case STATE_TEXT: @@ -279,23 +286,24 @@ XmlReader::Text ValueParser::getTextMode() const { return (type_ == TYPE_STRING || type_ == TYPE_STRING_LIST || separator_.getLength() != 0) - ? XmlReader::TEXT_RAW : XmlReader::TEXT_NORMALIZED; + ? xmlreader::XmlReader::TEXT_RAW + : xmlreader::XmlReader::TEXT_NORMALIZED; default: break; } } - return XmlReader::TEXT_NONE; + return xmlreader::XmlReader::TEXT_NONE; } bool ValueParser::startElement( - XmlReader & reader, XmlReader::Namespace ns, Span const & name) + xmlreader::XmlReader & reader, int nsId, xmlreader::Span const & name) { if (!node_.is()) { return false; } switch (state_) { case STATE_TEXT: - if (ns == XmlReader::NAMESPACE_NONE && + if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && name.equals(RTL_CONSTASCII_STRINGPARAM("it")) && isListType(type_) && separator_.getLength() == 0) { @@ -307,18 +315,18 @@ bool ValueParser::startElement( } // fall through case STATE_IT: - if (ns == XmlReader::NAMESPACE_NONE && + if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && name.equals(RTL_CONSTASCII_STRINGPARAM("unicode")) && (type_ == TYPE_STRING || type_ == TYPE_STRING_LIST)) { sal_Int32 scalar = -1; for (;;) { - XmlReader::Namespace attrNs; - Span attrLn; - if (!reader.nextAttribute(&attrNs, &attrLn)) { + int attrNsId; + xmlreader::Span attrLn; + if (!reader.nextAttribute(&attrNsId, &attrLn)) { break; } - if (attrNs == XmlReader::NAMESPACE_OOR && + if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("scalar"))) { if (!parseValue(reader.getAttributeValue(true), &scalar)) { @@ -353,7 +361,7 @@ bool ValueParser::startElement( } throw css::uno::RuntimeException( (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bad member <")) + - xmldata::convertFromUtf8(name) + + name.convertFromUtf8() + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("> in ")) + reader.getUrl()), css::uno::Reference< css::uno::XInterface >()); } @@ -440,7 +448,7 @@ bool ValueParser::endElement() { return true; } -void ValueParser::characters(Span const & text) { +void ValueParser::characters(xmlreader::Span const & text) { if (node_.is()) { OSL_ASSERT(state_ == STATE_TEXT || state_ == STATE_IT); pad_.add(text.begin, text.length); diff --git a/configmgr/source/valueparser.hxx b/configmgr/source/valueparser.hxx index 66f3fafd82af..a3ee2310ea35 100644..100755 --- a/configmgr/source/valueparser.hxx +++ b/configmgr/source/valueparser.hxx @@ -37,19 +37,19 @@ #include "rtl/ref.hxx" #include "rtl/string.hxx" #include "rtl/ustring.hxx" +#include "xmlreader/pad.hxx" +#include "xmlreader/xmlreader.hxx" -#include "pad.hxx" #include "type.hxx" -#include "xmlreader.hxx" namespace com { namespace sun { namespace star { namespace uno { class Any; } } } } +namespace xmlreader { struct Span; } namespace configmgr { class Node; -struct Span; class ValueParser: private boost::noncopyable { public: @@ -57,14 +57,14 @@ public: ~ValueParser(); - XmlReader::Text getTextMode() const; + xmlreader::XmlReader::Text getTextMode() const; bool startElement( - XmlReader & reader, XmlReader::Namespace ns, Span const & name); + xmlreader::XmlReader & reader, int nsId, xmlreader::Span const & name); bool endElement(); - void characters(Span const & text); + void characters(xmlreader::Span const & text); void start( rtl::Reference< Node > const & property, @@ -84,7 +84,7 @@ private: rtl::Reference< Node > node_; rtl::OUString localizedName_; State state_; - Pad pad_; + xmlreader::Pad pad_; std::vector< com::sun::star::uno::Any > items_; }; diff --git a/configmgr/source/writemodfile.cxx b/configmgr/source/writemodfile.cxx index 7e01aabeb5da..fcb1129bba1e 100644..100755 --- a/configmgr/source/writemodfile.cxx +++ b/configmgr/source/writemodfile.cxx @@ -46,6 +46,7 @@ #include "rtl/ustring.h" #include "rtl/ustring.hxx" #include "sal/types.h" +#include "xmlreader/span.hxx" #include "data.hxx" #include "groupnode.hxx" @@ -55,7 +56,6 @@ #include "node.hxx" #include "nodemap.hxx" #include "propertynode.hxx" -#include "span.hxx" #include "type.hxx" #include "writemodfile.hxx" @@ -342,22 +342,23 @@ void writeNode( rtl::Reference< Node > const & parent, rtl::OUString const & name, rtl::Reference< Node > const & node) { - static Span const typeNames[] = { - Span(), Span(), Span(), // TYPE_ERROR, TYPE_NIL, TYPE_ANY - Span(RTL_CONSTASCII_STRINGPARAM("xs:boolean")), - Span(RTL_CONSTASCII_STRINGPARAM("xs:short")), - Span(RTL_CONSTASCII_STRINGPARAM("xs:int")), - Span(RTL_CONSTASCII_STRINGPARAM("xs:long")), - Span(RTL_CONSTASCII_STRINGPARAM("xs:double")), - Span(RTL_CONSTASCII_STRINGPARAM("xs:string")), - Span(RTL_CONSTASCII_STRINGPARAM("xs:hexBinary")), - Span(RTL_CONSTASCII_STRINGPARAM("oor:boolean-list")), - Span(RTL_CONSTASCII_STRINGPARAM("oor:short-list")), - Span(RTL_CONSTASCII_STRINGPARAM("oor:int-list")), - Span(RTL_CONSTASCII_STRINGPARAM("oor:long-list")), - Span(RTL_CONSTASCII_STRINGPARAM("oor:double-list")), - Span(RTL_CONSTASCII_STRINGPARAM("oor:string-list")), - Span(RTL_CONSTASCII_STRINGPARAM("oor:hexBinary-list")) }; + static xmlreader::Span const typeNames[] = { + xmlreader::Span(), xmlreader::Span(), xmlreader::Span(), + // TYPE_ERROR, TYPE_NIL, TYPE_ANY + xmlreader::Span(RTL_CONSTASCII_STRINGPARAM("xs:boolean")), + xmlreader::Span(RTL_CONSTASCII_STRINGPARAM("xs:short")), + xmlreader::Span(RTL_CONSTASCII_STRINGPARAM("xs:int")), + xmlreader::Span(RTL_CONSTASCII_STRINGPARAM("xs:long")), + xmlreader::Span(RTL_CONSTASCII_STRINGPARAM("xs:double")), + xmlreader::Span(RTL_CONSTASCII_STRINGPARAM("xs:string")), + xmlreader::Span(RTL_CONSTASCII_STRINGPARAM("xs:hexBinary")), + xmlreader::Span(RTL_CONSTASCII_STRINGPARAM("oor:boolean-list")), + xmlreader::Span(RTL_CONSTASCII_STRINGPARAM("oor:short-list")), + xmlreader::Span(RTL_CONSTASCII_STRINGPARAM("oor:int-list")), + xmlreader::Span(RTL_CONSTASCII_STRINGPARAM("oor:long-list")), + xmlreader::Span(RTL_CONSTASCII_STRINGPARAM("oor:double-list")), + xmlreader::Span(RTL_CONSTASCII_STRINGPARAM("oor:string-list")), + xmlreader::Span(RTL_CONSTASCII_STRINGPARAM("oor:hexBinary-list")) }; switch (node->kind()) { case Node::KIND_PROPERTY: { diff --git a/configmgr/source/writemodfile.hxx b/configmgr/source/writemodfile.hxx index 0277bacdc477..0277bacdc477 100644..100755 --- a/configmgr/source/writemodfile.hxx +++ b/configmgr/source/writemodfile.hxx diff --git a/configmgr/source/xcdparser.cxx b/configmgr/source/xcdparser.cxx index 06bb88858d93..7c2e21d6c6bb 100644..100755 --- a/configmgr/source/xcdparser.cxx +++ b/configmgr/source/xcdparser.cxx @@ -38,13 +38,14 @@ #include "rtl/string.h" #include "rtl/ustring.h" #include "rtl/ustring.hxx" +#include "xmlreader/span.hxx" +#include "xmlreader/xmlreader.hxx" -#include "span.hxx" +#include "parsemanager.hxx" #include "xcdparser.hxx" #include "xcsparser.hxx" #include "xcuparser.hxx" #include "xmldata.hxx" -#include "xmlreader.hxx" namespace configmgr { @@ -60,22 +61,22 @@ XcdParser::XcdParser(int layer, Dependencies const & dependencies, Data & data): XcdParser::~XcdParser() {} -XmlReader::Text XcdParser::getTextMode() { +xmlreader::XmlReader::Text XcdParser::getTextMode() { return nestedParser_.is() - ? nestedParser_->getTextMode() : XmlReader::TEXT_NONE; + ? nestedParser_->getTextMode() : xmlreader::XmlReader::TEXT_NONE; } bool XcdParser::startElement( - XmlReader & reader, XmlReader::Namespace ns, Span const & name) + xmlreader::XmlReader & reader, int nsId, xmlreader::Span const & name) { if (nestedParser_.is()) { OSL_ASSERT(nesting_ != LONG_MAX); ++nesting_; - return nestedParser_->startElement(reader, ns, name); + return nestedParser_->startElement(reader, nsId, name); } switch (state_) { case STATE_START: - if (ns == XmlReader::NAMESPACE_OOR && + if (nsId == ParseManager::NAMESPACE_OOR && name.equals(RTL_CONSTASCII_STRINGPARAM("data"))) { state_ = STATE_DEPENDENCIES; @@ -83,18 +84,19 @@ bool XcdParser::startElement( } break; case STATE_DEPENDENCIES: - if (ns == XmlReader::NAMESPACE_NONE && + if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && name.equals(RTL_CONSTASCII_STRINGPARAM("dependency"))) { if (dependency_.getLength() == 0) { - Span attrFile; + xmlreader::Span attrFile; for (;;) { - XmlReader::Namespace attrNs; - Span attrLn; - if (!reader.nextAttribute(&attrNs, &attrLn)) { + int attrNsId; + xmlreader::Span attrLn; + if (!reader.nextAttribute(&attrNsId, &attrLn)) { break; } - if (attrNs == XmlReader::NAMESPACE_NONE && //TODO: _OOR + if (attrNsId == xmlreader::XmlReader::NAMESPACE_NONE && + //TODO: _OOR attrLn.equals(RTL_CONSTASCII_STRINGPARAM("file"))) { attrFile = reader.getAttributeValue(false); @@ -108,7 +110,7 @@ bool XcdParser::startElement( reader.getUrl()), css::uno::Reference< css::uno::XInterface >()); } - dependency_ = xmldata::convertFromUtf8(attrFile); + dependency_ = attrFile.convertFromUtf8(); if (dependency_.getLength() == 0) { throw css::uno::RuntimeException( (rtl::OUString( @@ -128,19 +130,19 @@ bool XcdParser::startElement( state_ = STATE_COMPONENTS; // fall through case STATE_COMPONENTS: - if (ns == XmlReader::NAMESPACE_OOR && + if (nsId == ParseManager::NAMESPACE_OOR && name.equals(RTL_CONSTASCII_STRINGPARAM("component-schema"))) { nestedParser_ = new XcsParser(layer_, data_); nesting_ = 1; - return nestedParser_->startElement(reader, ns, name); + return nestedParser_->startElement(reader, nsId, name); } - if (ns == XmlReader::NAMESPACE_OOR && + if (nsId == ParseManager::NAMESPACE_OOR && name.equals(RTL_CONSTASCII_STRINGPARAM("component-data"))) { nestedParser_ = new XcuParser(layer_ + 1, data_, 0, 0, 0); nesting_ = 1; - return nestedParser_->startElement(reader, ns, name); + return nestedParser_->startElement(reader, nsId, name); } break; default: // STATE_DEPENDENCY @@ -149,12 +151,12 @@ bool XcdParser::startElement( } throw css::uno::RuntimeException( (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bad member <")) + - xmldata::convertFromUtf8(name) + + name.convertFromUtf8() + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("> in ")) + reader.getUrl()), css::uno::Reference< css::uno::XInterface >()); } -void XcdParser::endElement(XmlReader const & reader) { +void XcdParser::endElement(xmlreader::XmlReader const & reader) { if (nestedParser_.is()) { nestedParser_->endElement(reader); if (--nesting_ == 0) { @@ -175,7 +177,7 @@ void XcdParser::endElement(XmlReader const & reader) { } } -void XcdParser::characters(Span const & text) { +void XcdParser::characters(xmlreader::Span const & text) { if (nestedParser_.is()) { nestedParser_->characters(text); } diff --git a/configmgr/source/xcdparser.hxx b/configmgr/source/xcdparser.hxx index a57646a5379d..6e98160dfeff 100644..100755 --- a/configmgr/source/xcdparser.hxx +++ b/configmgr/source/xcdparser.hxx @@ -35,14 +35,15 @@ #include "rtl/ref.hxx" #include "rtl/ustring.hxx" +#include "xmlreader/xmlreader.hxx" #include "parser.hxx" -#include "xmlreader.hxx" + +namespace xmlreader { struct Span; } namespace configmgr { struct Data; -struct Span; class XcdParser: public Parser { public: @@ -53,14 +54,14 @@ public: private: virtual ~XcdParser(); - virtual XmlReader::Text getTextMode(); + virtual xmlreader::XmlReader::Text getTextMode(); virtual bool startElement( - XmlReader & reader, XmlReader::Namespace ns, Span const & name); + xmlreader::XmlReader & reader, int nsId, xmlreader::Span const & name); - virtual void endElement(XmlReader const & reader); + virtual void endElement(xmlreader::XmlReader const & reader); - virtual void characters(Span const & text); + virtual void characters(xmlreader::Span const & text); enum State { STATE_START, STATE_DEPENDENCIES, STATE_DEPENDENCY, STATE_COMPONENTS }; diff --git a/configmgr/source/xcsparser.cxx b/configmgr/source/xcsparser.cxx index 7d28718ff805..c558bd9864b7 100644..100755 --- a/configmgr/source/xcsparser.cxx +++ b/configmgr/source/xcsparser.cxx @@ -42,18 +42,19 @@ #include "rtl/string.hxx" #include "rtl/ustring.h" #include "rtl/ustring.hxx" +#include "xmlreader/span.hxx" +#include "xmlreader/xmlreader.hxx" #include "data.hxx" #include "localizedpropertynode.hxx" #include "groupnode.hxx" #include "node.hxx" #include "nodemap.hxx" +#include "parsemanager.hxx" #include "propertynode.hxx" #include "setnode.hxx" -#include "span.hxx" #include "xcsparser.hxx" #include "xmldata.hxx" -#include "xmlreader.hxx" namespace configmgr { @@ -126,18 +127,18 @@ XcsParser::XcsParser(int layer, Data & data): XcsParser::~XcsParser() {} -XmlReader::Text XcsParser::getTextMode() { +xmlreader::XmlReader::Text XcsParser::getTextMode() { return valueParser_.getTextMode(); } bool XcsParser::startElement( - XmlReader & reader, XmlReader::Namespace ns, Span const & name) + xmlreader::XmlReader & reader, int nsId, xmlreader::Span const & name) { - if (valueParser_.startElement(reader, ns, name)) { + if (valueParser_.startElement(reader, nsId, name)) { return true; } if (state_ == STATE_START) { - if (ns == XmlReader::NAMESPACE_OOR && + if (nsId == ParseManager::NAMESPACE_OOR && name.equals(RTL_CONSTASCII_STRINGPARAM("component-schema"))) { handleComponentSchema(reader); state_ = STATE_COMPONENT_SCHEMA; @@ -149,7 +150,7 @@ bool XcsParser::startElement( // prop constraints; accepting all four at illegal places (and with // illegal content): if (ignoring_ > 0 || - (ns == XmlReader::NAMESPACE_NONE && + (nsId == xmlreader::XmlReader::NAMESPACE_NONE && (name.equals(RTL_CONSTASCII_STRINGPARAM("info")) || name.equals(RTL_CONSTASCII_STRINGPARAM("import")) || name.equals(RTL_CONSTASCII_STRINGPARAM("uses")) || @@ -161,7 +162,7 @@ bool XcsParser::startElement( } switch (state_) { case STATE_COMPONENT_SCHEMA: - if (ns == XmlReader::NAMESPACE_NONE && + if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && name.equals(RTL_CONSTASCII_STRINGPARAM("templates"))) { state_ = STATE_TEMPLATES; @@ -169,7 +170,7 @@ bool XcsParser::startElement( } // fall through case STATE_TEMPLATES_DONE: - if (ns == XmlReader::NAMESPACE_NONE && + if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && name.equals(RTL_CONSTASCII_STRINGPARAM("component"))) { state_ = STATE_COMPONENT; @@ -184,13 +185,13 @@ bool XcsParser::startElement( break; case STATE_TEMPLATES: if (elements_.empty()) { - if (ns == XmlReader::NAMESPACE_NONE && + if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && name.equals(RTL_CONSTASCII_STRINGPARAM("group"))) { handleGroup(reader, true); return true; } - if (ns == XmlReader::NAMESPACE_NONE && + if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && name.equals(RTL_CONSTASCII_STRINGPARAM("set"))) { handleSet(reader, true); @@ -204,7 +205,7 @@ bool XcsParser::startElement( switch (elements_.top().node->kind()) { case Node::KIND_PROPERTY: case Node::KIND_LOCALIZED_PROPERTY: - if (ns == XmlReader::NAMESPACE_NONE && + if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && name.equals(RTL_CONSTASCII_STRINGPARAM("value"))) { handlePropValue(reader, elements_.top().node); @@ -212,25 +213,25 @@ bool XcsParser::startElement( } break; case Node::KIND_GROUP: - if (ns == XmlReader::NAMESPACE_NONE && + if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && name.equals(RTL_CONSTASCII_STRINGPARAM("prop"))) { handleProp(reader); return true; } - if (ns == XmlReader::NAMESPACE_NONE && + if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && name.equals(RTL_CONSTASCII_STRINGPARAM("node-ref"))) { handleNodeRef(reader); return true; } - if (ns == XmlReader::NAMESPACE_NONE && + if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && name.equals(RTL_CONSTASCII_STRINGPARAM("group"))) { handleGroup(reader, false); return true; } - if (ns == XmlReader::NAMESPACE_NONE && + if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && name.equals(RTL_CONSTASCII_STRINGPARAM("set"))) { handleSet(reader, false); @@ -238,7 +239,7 @@ bool XcsParser::startElement( } break; case Node::KIND_SET: - if (ns == XmlReader::NAMESPACE_NONE && + if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && name.equals(RTL_CONSTASCII_STRINGPARAM("item"))) { handleSetItem( @@ -261,12 +262,12 @@ bool XcsParser::startElement( } throw css::uno::RuntimeException( (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bad member <")) + - xmldata::convertFromUtf8(name) + + name.convertFromUtf8() + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("> in ")) + reader.getUrl()), css::uno::Reference< css::uno::XInterface >()); } -void XcsParser::endElement(XmlReader const & reader) { +void XcsParser::endElement(xmlreader::XmlReader const & reader) { if (valueParser_.endElement()) { return; } @@ -343,23 +344,23 @@ void XcsParser::endElement(XmlReader const & reader) { } } -void XcsParser::characters(Span const & text) { +void XcsParser::characters(xmlreader::Span const & text) { valueParser_.characters(text); } -void XcsParser::handleComponentSchema(XmlReader & reader) { +void XcsParser::handleComponentSchema(xmlreader::XmlReader & reader) { //TODO: oor:version, xml:lang attributes rtl::OStringBuffer buf; buf.append('.'); bool hasPackage = false; bool hasName = false; for (;;) { - XmlReader::Namespace attrNs; - Span attrLn; - if (!reader.nextAttribute(&attrNs, &attrLn)) { + int attrNsId; + xmlreader::Span attrLn; + if (!reader.nextAttribute(&attrNsId, &attrLn)) { break; } - if (attrNs == XmlReader::NAMESPACE_OOR && + if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("package"))) { if (hasPackage) { @@ -372,9 +373,9 @@ void XcsParser::handleComponentSchema(XmlReader & reader) { css::uno::Reference< css::uno::XInterface >()); } hasPackage = true; - Span s(reader.getAttributeValue(false)); + xmlreader::Span s(reader.getAttributeValue(false)); buf.insert(0, s.begin, s.length); - } else if (attrNs == XmlReader::NAMESPACE_OOR && + } else if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("name"))) { if (hasName) { @@ -386,7 +387,7 @@ void XcsParser::handleComponentSchema(XmlReader & reader) { css::uno::Reference< css::uno::XInterface >()); } hasName = true; - Span s(reader.getAttributeValue(false)); + xmlreader::Span s(reader.getAttributeValue(false)); buf.append(s.begin, s.length); } } @@ -406,38 +407,36 @@ void XcsParser::handleComponentSchema(XmlReader & reader) { reader.getUrl()), css::uno::Reference< css::uno::XInterface >()); } - componentName_ = xmldata::convertFromUtf8( - Span(buf.getStr(), buf.getLength())); + componentName_ = xmlreader::Span(buf.getStr(), buf.getLength()). + convertFromUtf8(); } -void XcsParser::handleNodeRef(XmlReader & reader) { +void XcsParser::handleNodeRef(xmlreader::XmlReader & reader) { bool hasName = false; rtl::OUString name; rtl::OUString component(componentName_); bool hasNodeType = false; rtl::OUString nodeType; for (;;) { - XmlReader::Namespace attrNs; - Span attrLn; - if (!reader.nextAttribute(&attrNs, &attrLn)) { + int attrNsId; + xmlreader::Span attrLn; + if (!reader.nextAttribute(&attrNsId, &attrLn)) { break; } - if (attrNs == XmlReader::NAMESPACE_OOR && + if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("name"))) { hasName = true; - name = xmldata::convertFromUtf8(reader.getAttributeValue(false)); - } else if (attrNs == XmlReader::NAMESPACE_OOR && + name = reader.getAttributeValue(false).convertFromUtf8(); + } else if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("component"))) { - component = xmldata::convertFromUtf8( - reader.getAttributeValue(false)); - } else if (attrNs == XmlReader::NAMESPACE_OOR && + component = reader.getAttributeValue(false).convertFromUtf8(); + } else if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("node-type"))) { hasNodeType = true; - nodeType = xmldata::convertFromUtf8( - reader.getAttributeValue(false)); + nodeType = reader.getAttributeValue(false).convertFromUtf8(); } } if (!hasName) { @@ -466,33 +465,33 @@ void XcsParser::handleNodeRef(XmlReader & reader) { elements_.push(Element(node, name)); } -void XcsParser::handleProp(XmlReader & reader) { +void XcsParser::handleProp(xmlreader::XmlReader & reader) { bool hasName = false; rtl::OUString name; valueParser_.type_ = TYPE_ERROR; bool localized = false; bool nillable = true; for (;;) { - XmlReader::Namespace attrNs; - Span attrLn; - if (!reader.nextAttribute(&attrNs, &attrLn)) { + int attrNsId; + xmlreader::Span attrLn; + if (!reader.nextAttribute(&attrNsId, &attrLn)) { break; } - if (attrNs == XmlReader::NAMESPACE_OOR && + if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("name"))) { hasName = true; - name = xmldata::convertFromUtf8(reader.getAttributeValue(false)); - } else if (attrNs == XmlReader::NAMESPACE_OOR && + name = reader.getAttributeValue(false).convertFromUtf8(); + } else if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("type"))) { valueParser_.type_ = xmldata::parseType( reader, reader.getAttributeValue(true)); - } else if (attrNs == XmlReader::NAMESPACE_OOR && + } else if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("localized"))) { localized = xmldata::parseBoolean(reader.getAttributeValue(true)); - } else if (attrNs == XmlReader::NAMESPACE_OOR && + } else if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("nillable"))) { nillable = xmldata::parseBoolean(reader.getAttributeValue(true)); @@ -526,16 +525,16 @@ void XcsParser::handleProp(XmlReader & reader) { } void XcsParser::handlePropValue( - XmlReader & reader, rtl::Reference< Node > const & property) + xmlreader::XmlReader & reader, rtl::Reference< Node > const & property) { - Span attrSeparator; + xmlreader::Span attrSeparator; for (;;) { - XmlReader::Namespace attrNs; - Span attrLn; - if (!reader.nextAttribute(&attrNs, &attrLn)) { + int attrNsId; + xmlreader::Span attrLn; + if (!reader.nextAttribute(&attrNsId, &attrLn)) { break; } - if (attrNs == XmlReader::NAMESPACE_OOR && + if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("separator"))) { attrSeparator = reader.getAttributeValue(false); @@ -554,22 +553,22 @@ void XcsParser::handlePropValue( valueParser_.start(property); } -void XcsParser::handleGroup(XmlReader & reader, bool isTemplate) { +void XcsParser::handleGroup(xmlreader::XmlReader & reader, bool isTemplate) { bool hasName = false; rtl::OUString name; bool extensible = false; for (;;) { - XmlReader::Namespace attrNs; - Span attrLn; - if (!reader.nextAttribute(&attrNs, &attrLn)) { + int attrNsId; + xmlreader::Span attrLn; + if (!reader.nextAttribute(&attrNsId, &attrLn)) { break; } - if (attrNs == XmlReader::NAMESPACE_OOR && + if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("name"))) { hasName = true; - name = xmldata::convertFromUtf8(reader.getAttributeValue(false)); - } else if (attrNs == XmlReader::NAMESPACE_OOR && + name = reader.getAttributeValue(false).convertFromUtf8(); + } else if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("extensible"))) { extensible = xmldata::parseBoolean(reader.getAttributeValue(true)); @@ -593,34 +592,32 @@ void XcsParser::handleGroup(XmlReader & reader, bool isTemplate) { name)); } -void XcsParser::handleSet(XmlReader & reader, bool isTemplate) { +void XcsParser::handleSet(xmlreader::XmlReader & reader, bool isTemplate) { bool hasName = false; rtl::OUString name; rtl::OUString component(componentName_); bool hasNodeType = false; rtl::OUString nodeType; for (;;) { - XmlReader::Namespace attrNs; - Span attrLn; - if (!reader.nextAttribute(&attrNs, &attrLn)) { + int attrNsId; + xmlreader::Span attrLn; + if (!reader.nextAttribute(&attrNsId, &attrLn)) { break; } - if (attrNs == XmlReader::NAMESPACE_OOR && + if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("name"))) { hasName = true; - name = xmldata::convertFromUtf8(reader.getAttributeValue(false)); - } else if (attrNs == XmlReader::NAMESPACE_OOR && + name = reader.getAttributeValue(false).convertFromUtf8(); + } else if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("component"))) { - component = xmldata::convertFromUtf8( - reader.getAttributeValue(false)); - } else if (attrNs == XmlReader::NAMESPACE_OOR && + component = reader.getAttributeValue(false).convertFromUtf8(); + } else if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("node-type"))) { hasNodeType = true; - nodeType = xmldata::convertFromUtf8( - reader.getAttributeValue(false)); + nodeType = reader.getAttributeValue(false).convertFromUtf8(); } } if (!hasName) { @@ -643,27 +640,25 @@ void XcsParser::handleSet(XmlReader & reader, bool isTemplate) { name)); } -void XcsParser::handleSetItem(XmlReader & reader, SetNode * set) { +void XcsParser::handleSetItem(xmlreader::XmlReader & reader, SetNode * set) { rtl::OUString component(componentName_); bool hasNodeType = false; rtl::OUString nodeType; for (;;) { - XmlReader::Namespace attrNs; - Span attrLn; - if (!reader.nextAttribute(&attrNs, &attrLn)) { + int attrNsId; + xmlreader::Span attrLn; + if (!reader.nextAttribute(&attrNsId, &attrLn)) { break; } - if (attrNs == XmlReader::NAMESPACE_OOR && + if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("component"))) { - component = xmldata::convertFromUtf8( - reader.getAttributeValue(false)); - } else if (attrNs == XmlReader::NAMESPACE_OOR && + component = reader.getAttributeValue(false).convertFromUtf8(); + } else if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("node-type"))) { hasNodeType = true; - nodeType = xmldata::convertFromUtf8( - reader.getAttributeValue(false)); + nodeType = reader.getAttributeValue(false).convertFromUtf8(); } } set->getAdditionalTemplateNames().push_back( diff --git a/configmgr/source/xcsparser.hxx b/configmgr/source/xcsparser.hxx index 43d65a93b49a..c259a02eaec8 100644..100755 --- a/configmgr/source/xcsparser.hxx +++ b/configmgr/source/xcsparser.hxx @@ -35,17 +35,18 @@ #include "rtl/ref.hxx" #include "rtl/ustring.hxx" +#include "xmlreader/xmlreader.hxx" #include "node.hxx" #include "parser.hxx" #include "valueparser.hxx" -#include "xmlreader.hxx" + +namespace xmlreader { struct Span; } namespace configmgr { class SetNode; struct Data; -struct Span; class XcsParser: public Parser { public: @@ -54,29 +55,29 @@ public: private: virtual ~XcsParser(); - virtual XmlReader::Text getTextMode(); + virtual xmlreader::XmlReader::Text getTextMode(); virtual bool startElement( - XmlReader & reader, XmlReader::Namespace ns, Span const & name); + xmlreader::XmlReader & reader, int nsId, xmlreader::Span const & name); - virtual void endElement(XmlReader const & reader); + virtual void endElement(xmlreader::XmlReader const & reader); - virtual void characters(Span const & text); + virtual void characters(xmlreader::Span const & text); - void handleComponentSchema(XmlReader & reader); + void handleComponentSchema(xmlreader::XmlReader & reader); - void handleNodeRef(XmlReader & reader); + void handleNodeRef(xmlreader::XmlReader & reader); - void handleProp(XmlReader & reader); + void handleProp(xmlreader::XmlReader & reader); void handlePropValue( - XmlReader & reader, rtl::Reference< Node > const & property); + xmlreader::XmlReader & reader, rtl::Reference< Node > const & property); - void handleGroup(XmlReader & reader, bool isTemplate); + void handleGroup(xmlreader::XmlReader & reader, bool isTemplate); - void handleSet(XmlReader & reader, bool isTemplate); + void handleSet(xmlreader::XmlReader & reader, bool isTemplate); - void handleSetItem(XmlReader & reader, SetNode * set); + void handleSetItem(xmlreader::XmlReader & reader, SetNode * set); enum State { STATE_START, STATE_COMPONENT_SCHEMA, STATE_TEMPLATES, diff --git a/configmgr/source/xcuparser.cxx b/configmgr/source/xcuparser.cxx index 44eb4453332c..3a81ea4e3673 100644..100755 --- a/configmgr/source/xcuparser.cxx +++ b/configmgr/source/xcuparser.cxx @@ -42,6 +42,8 @@ #include "rtl/string.hxx" #include "rtl/ustring.h" #include "rtl/ustring.hxx" +#include "xmlreader/span.hxx" +#include "xmlreader/xmlreader.hxx" #include "data.hxx" #include "localizedpropertynode.hxx" @@ -50,14 +52,13 @@ #include "modifications.hxx" #include "node.hxx" #include "nodemap.hxx" +#include "parsemanager.hxx" #include "partial.hxx" #include "path.hxx" #include "propertynode.hxx" #include "setnode.hxx" -#include "span.hxx" #include "xcuparser.hxx" #include "xmldata.hxx" -#include "xmlreader.hxx" namespace configmgr { @@ -80,22 +81,22 @@ XcuParser::XcuParser( XcuParser::~XcuParser() {} -XmlReader::Text XcuParser::getTextMode() { +xmlreader::XmlReader::Text XcuParser::getTextMode() { return valueParser_.getTextMode(); } bool XcuParser::startElement( - XmlReader & reader, XmlReader::Namespace ns, Span const & name) + xmlreader::XmlReader & reader, int nsId, xmlreader::Span const & name) { - if (valueParser_.startElement(reader, ns, name)) { + if (valueParser_.startElement(reader, nsId, name)) { return true; } if (state_.empty()) { - if (ns == XmlReader::NAMESPACE_OOR && + if (nsId == ParseManager::NAMESPACE_OOR && name.equals(RTL_CONSTASCII_STRINGPARAM("component-data"))) { handleComponentData(reader); - } else if (ns == XmlReader::NAMESPACE_OOR && + } else if (nsId == ParseManager::NAMESPACE_OOR && name.equals(RTL_CONSTASCII_STRINGPARAM("items"))) { state_.push(State(rtl::Reference< Node >(), false)); @@ -103,7 +104,7 @@ bool XcuParser::startElement( throw css::uno::RuntimeException( (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("bad root element <")) + - xmldata::convertFromUtf8(name) + + name.convertFromUtf8() + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("> in ")) + reader.getUrl()), css::uno::Reference< css::uno::XInterface >()); @@ -111,7 +112,7 @@ bool XcuParser::startElement( } else if (state_.top().ignore) { state_.push(State(false)); } else if (!state_.top().node.is()) { - if (ns == XmlReader::NAMESPACE_NONE && + if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && name.equals(RTL_CONSTASCII_STRINGPARAM("item"))) { handleItem(reader); @@ -119,7 +120,7 @@ bool XcuParser::startElement( throw css::uno::RuntimeException( (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("bad items node member <")) + - xmldata::convertFromUtf8(name) + + name.convertFromUtf8() + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("> in ")) + reader.getUrl()), css::uno::Reference< css::uno::XInterface >()); @@ -127,7 +128,7 @@ bool XcuParser::startElement( } else { switch (state_.top().node->kind()) { case Node::KIND_PROPERTY: - if (ns == XmlReader::NAMESPACE_NONE && + if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && name.equals(RTL_CONSTASCII_STRINGPARAM("value"))) { handlePropValue( @@ -138,14 +139,14 @@ bool XcuParser::startElement( (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "bad property node member <")) + - xmldata::convertFromUtf8(name) + + name.convertFromUtf8() + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("> in ")) + reader.getUrl()), css::uno::Reference< css::uno::XInterface >()); } break; case Node::KIND_LOCALIZED_PROPERTY: - if (ns == XmlReader::NAMESPACE_NONE && + if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && name.equals(RTL_CONSTASCII_STRINGPARAM("value"))) { handleLocpropValue( @@ -157,7 +158,7 @@ bool XcuParser::startElement( (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "bad localized property node member <")) + - xmldata::convertFromUtf8(name) + + name.convertFromUtf8() + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("> in ")) + reader.getUrl()), css::uno::Reference< css::uno::XInterface >()); @@ -166,18 +167,18 @@ bool XcuParser::startElement( case Node::KIND_LOCALIZED_VALUE: throw css::uno::RuntimeException( (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bad member <")) + - xmldata::convertFromUtf8(name) + + name.convertFromUtf8() + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("> in ")) + reader.getUrl()), css::uno::Reference< css::uno::XInterface >()); case Node::KIND_GROUP: - if (ns == XmlReader::NAMESPACE_NONE && + if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && name.equals(RTL_CONSTASCII_STRINGPARAM("prop"))) { handleGroupProp( reader, dynamic_cast< GroupNode * >(state_.top().node.get())); - } else if (ns == XmlReader::NAMESPACE_NONE && + } else if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && name.equals(RTL_CONSTASCII_STRINGPARAM("node"))) { handleGroupNode(reader, state_.top().node); @@ -186,19 +187,19 @@ bool XcuParser::startElement( (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "bad group node member <")) + - xmldata::convertFromUtf8(name) + + name.convertFromUtf8() + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("> in ")) + reader.getUrl()), css::uno::Reference< css::uno::XInterface >()); } break; case Node::KIND_SET: - if (ns == XmlReader::NAMESPACE_NONE && + if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && name.equals(RTL_CONSTASCII_STRINGPARAM("node"))) { handleSetNode( reader, dynamic_cast< SetNode * >(state_.top().node.get())); - } else if (ns == XmlReader::NAMESPACE_NONE && + } else if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && name.equals(RTL_CONSTASCII_STRINGPARAM("prop"))) { OSL_TRACE( @@ -210,7 +211,7 @@ bool XcuParser::startElement( throw css::uno::RuntimeException( (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("bad set node member <")) + - xmldata::convertFromUtf8(name) + + name.convertFromUtf8() + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("> in ")) + reader.getUrl()), css::uno::Reference< css::uno::XInterface >()); @@ -221,7 +222,7 @@ bool XcuParser::startElement( return true; } -void XcuParser::endElement(XmlReader const &) { +void XcuParser::endElement(xmlreader::XmlReader const &) { if (valueParser_.endElement()) { return; } @@ -246,11 +247,11 @@ void XcuParser::endElement(XmlReader const &) { } } -void XcuParser::characters(Span const & text) { +void XcuParser::characters(xmlreader::Span const & text) { valueParser_.characters(text); } -XcuParser::Operation XcuParser::parseOperation(Span const & text) { +XcuParser::Operation XcuParser::parseOperation(xmlreader::Span const & text) { OSL_ASSERT(text.is()); if (text.equals(RTL_CONSTASCII_STRINGPARAM("modify"))) { return OPERATION_MODIFY; @@ -266,11 +267,11 @@ XcuParser::Operation XcuParser::parseOperation(Span const & text) { } throw css::uno::RuntimeException( (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("invalid op ")) + - xmldata::convertFromUtf8(text)), + text.convertFromUtf8()), css::uno::Reference< css::uno::XInterface >()); } -void XcuParser::handleComponentData(XmlReader & reader) { +void XcuParser::handleComponentData(xmlreader::XmlReader & reader) { rtl::OStringBuffer buf; buf.append('.'); bool hasPackage = false; @@ -278,12 +279,12 @@ void XcuParser::handleComponentData(XmlReader & reader) { Operation op = OPERATION_MODIFY; bool finalized = false; for (;;) { - XmlReader::Namespace attrNs; - Span attrLn; - if (!reader.nextAttribute(&attrNs, &attrLn)) { + int attrNsId; + xmlreader::Span attrLn; + if (!reader.nextAttribute(&attrNsId, &attrLn)) { break; } - if (attrNs == XmlReader::NAMESPACE_OOR && + if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("package"))) { if (hasPackage) { @@ -296,9 +297,9 @@ void XcuParser::handleComponentData(XmlReader & reader) { css::uno::Reference< css::uno::XInterface >()); } hasPackage = true; - Span s(reader.getAttributeValue(false)); + xmlreader::Span s(reader.getAttributeValue(false)); buf.insert(0, s.begin, s.length); - } else if (attrNs == XmlReader::NAMESPACE_OOR && + } else if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("name"))) { if (hasName) { @@ -310,13 +311,13 @@ void XcuParser::handleComponentData(XmlReader & reader) { css::uno::Reference< css::uno::XInterface >()); } hasName = true; - Span s(reader.getAttributeValue(false)); + xmlreader::Span s(reader.getAttributeValue(false)); buf.append(s.begin, s.length); - } else if (attrNs == XmlReader::NAMESPACE_OOR && + } else if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("op"))) { op = parseOperation(reader.getAttributeValue(true)); - } else if (attrNs == XmlReader::NAMESPACE_OOR && + } else if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("finalized"))) { finalized = xmldata::parseBoolean(reader.getAttributeValue(true)); @@ -338,8 +339,8 @@ void XcuParser::handleComponentData(XmlReader & reader) { reader.getUrl()), css::uno::Reference< css::uno::XInterface >()); } - componentName_ = xmldata::convertFromUtf8( - Span(buf.getStr(), buf.getLength())); + componentName_ = xmlreader::Span(buf.getStr(), buf.getLength()). + convertFromUtf8(); if (trackPath_) { OSL_ASSERT(path_.empty()); path_.push_back(componentName_); @@ -381,15 +382,15 @@ void XcuParser::handleComponentData(XmlReader & reader) { state_.push(State(node, finalizedLayer < valueParser_.getLayer())); } -void XcuParser::handleItem(XmlReader & reader) { - Span attrPath; +void XcuParser::handleItem(xmlreader::XmlReader & reader) { + xmlreader::Span attrPath; for (;;) { - XmlReader::Namespace attrNs; - Span attrLn; - if (!reader.nextAttribute(&attrNs, &attrLn)) { + int attrNsId; + xmlreader::Span attrLn; + if (!reader.nextAttribute(&attrNsId, &attrLn)) { break; } - if (attrNs == XmlReader::NAMESPACE_OOR && + if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("path"))) { attrPath = reader.getAttributeValue(false); @@ -402,7 +403,7 @@ void XcuParser::handleItem(XmlReader & reader) { reader.getUrl()), css::uno::Reference< css::uno::XInterface >()); } - rtl::OUString path(xmldata::convertFromUtf8(attrPath)); + rtl::OUString path(attrPath.convertFromUtf8()); int finalizedLayer; rtl::Reference< Node > node( data_.resolvePathRepresentation( @@ -447,21 +448,23 @@ void XcuParser::handleItem(XmlReader & reader) { state_.push(State(node, finalizedLayer < valueParser_.getLayer())); } -void XcuParser::handlePropValue(XmlReader & reader, PropertyNode * prop) { +void XcuParser::handlePropValue( + xmlreader::XmlReader & reader, PropertyNode * prop) + { bool nil = false; rtl::OString separator; rtl::OUString external; for (;;) { - XmlReader::Namespace attrNs; - Span attrLn; - if (!reader.nextAttribute(&attrNs, &attrLn)) { + int attrNsId; + xmlreader::Span attrLn; + if (!reader.nextAttribute(&attrNsId, &attrLn)) { break; } - if (attrNs == XmlReader::NAMESPACE_XSI && + if (attrNsId == ParseManager::NAMESPACE_XSI && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("nil"))) { nil = xmldata::parseBoolean(reader.getAttributeValue(true)); - } else if (attrNs == XmlReader::NAMESPACE_OOR && + } else if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("type"))) { Type type = xmldata::parseType( @@ -474,10 +477,10 @@ void XcuParser::handlePropValue(XmlReader & reader, PropertyNode * prop) { css::uno::Reference< css::uno::XInterface >()); } valueParser_.type_ = type; - } else if (attrNs == XmlReader::NAMESPACE_OOR && + } else if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("separator"))) { - Span s(reader.getAttributeValue(false)); + xmlreader::Span s(reader.getAttributeValue(false)); if (s.length == 0) { throw css::uno::RuntimeException( (rtl::OUString( @@ -487,10 +490,10 @@ void XcuParser::handlePropValue(XmlReader & reader, PropertyNode * prop) { css::uno::Reference< css::uno::XInterface >()); } separator = rtl::OString(s.begin, s.length); - } else if (attrNs == XmlReader::NAMESPACE_OOR && + } else if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("external"))) { - external = xmldata::convertFromUtf8(reader.getAttributeValue(true)); + external = reader.getAttributeValue(true).convertFromUtf8(); if (external.getLength() == 0) { throw css::uno::RuntimeException( (rtl::OUString( @@ -530,27 +533,27 @@ void XcuParser::handlePropValue(XmlReader & reader, PropertyNode * prop) { } void XcuParser::handleLocpropValue( - XmlReader & reader, LocalizedPropertyNode * locprop) + xmlreader::XmlReader & reader, LocalizedPropertyNode * locprop) { rtl::OUString name; bool nil = false; rtl::OString separator; Operation op = OPERATION_FUSE; for (;;) { - XmlReader::Namespace attrNs; - Span attrLn; - if (!reader.nextAttribute(&attrNs, &attrLn)) { + int attrNsId; + xmlreader::Span attrLn; + if (!reader.nextAttribute(&attrNsId, &attrLn)) { break; } - if (attrNs == XmlReader::NAMESPACE_XML && + if (attrNsId == xmlreader::XmlReader::NAMESPACE_XML && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("lang"))) { - name = xmldata::convertFromUtf8(reader.getAttributeValue(false)); - } else if (attrNs == XmlReader::NAMESPACE_XSI && + name = reader.getAttributeValue(false).convertFromUtf8(); + } else if (attrNsId == ParseManager::NAMESPACE_XSI && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("nil"))) { nil = xmldata::parseBoolean(reader.getAttributeValue(true)); - } else if (attrNs == XmlReader::NAMESPACE_OOR && + } else if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("type"))) { Type type = xmldata::parseType( @@ -563,10 +566,10 @@ void XcuParser::handleLocpropValue( css::uno::Reference< css::uno::XInterface >()); } valueParser_.type_ = type; - } else if (attrNs == XmlReader::NAMESPACE_OOR && + } else if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("separator"))) { - Span s(reader.getAttributeValue(false)); + xmlreader::Span s(reader.getAttributeValue(false)); if (s.length == 0) { throw css::uno::RuntimeException( (rtl::OUString( @@ -576,7 +579,7 @@ void XcuParser::handleLocpropValue( css::uno::Reference< css::uno::XInterface >()); } separator = rtl::OString(s.begin, s.length); - } else if (attrNs == XmlReader::NAMESPACE_OOR && + } else if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("op"))) { op = parseOperation(reader.getAttributeValue(true)); @@ -652,32 +655,34 @@ void XcuParser::handleLocpropValue( } } -void XcuParser::handleGroupProp(XmlReader & reader, GroupNode * group) { +void XcuParser::handleGroupProp( + xmlreader::XmlReader & reader, GroupNode * group) +{ bool hasName = false; rtl::OUString name; Type type = TYPE_ERROR; Operation op = OPERATION_MODIFY; bool finalized = false; for (;;) { - XmlReader::Namespace attrNs; - Span attrLn; - if (!reader.nextAttribute(&attrNs, &attrLn)) { + int attrNsId; + xmlreader::Span attrLn; + if (!reader.nextAttribute(&attrNsId, &attrLn)) { break; } - if (attrNs == XmlReader::NAMESPACE_OOR && + if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("name"))) { hasName = true; - name = xmldata::convertFromUtf8(reader.getAttributeValue(false)); - } else if (attrNs == XmlReader::NAMESPACE_OOR && + name = reader.getAttributeValue(false).convertFromUtf8(); + } else if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("type"))) { type = xmldata::parseType(reader, reader.getAttributeValue(true)); - } else if (attrNs == XmlReader::NAMESPACE_OOR && + } else if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("op"))) { op = parseOperation(reader.getAttributeValue(true)); - } else if (attrNs == XmlReader::NAMESPACE_OOR && + } else if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("finalized"))) { finalized = xmldata::parseBoolean(reader.getAttributeValue(true)); @@ -727,8 +732,8 @@ void XcuParser::handleGroupProp(XmlReader & reader, GroupNode * group) { } void XcuParser::handleUnknownGroupProp( - XmlReader const & reader, GroupNode * group, rtl::OUString const & name, - Type type, Operation operation, bool finalized) + xmlreader::XmlReader const & reader, GroupNode * group, + rtl::OUString const & name, Type type, Operation operation, bool finalized) { switch (operation) { case OPERATION_REPLACE: @@ -768,7 +773,7 @@ void XcuParser::handleUnknownGroupProp( } void XcuParser::handlePlainGroupProp( - XmlReader const & reader, GroupNode * group, + xmlreader::XmlReader const & reader, GroupNode * group, NodeMap::iterator const & propertyIndex, rtl::OUString const & name, Type type, Operation operation, bool finalized) { @@ -822,7 +827,7 @@ void XcuParser::handlePlainGroupProp( } void XcuParser::handleLocalizedGroupProp( - XmlReader const & reader, LocalizedPropertyNode * property, + xmlreader::XmlReader const & reader, LocalizedPropertyNode * property, rtl::OUString const & name, Type type, Operation operation, bool finalized) { if (property->getLayer() > valueParser_.getLayer()) { @@ -880,28 +885,28 @@ void XcuParser::handleLocalizedGroupProp( } void XcuParser::handleGroupNode( - XmlReader & reader, rtl::Reference< Node > const & group) + xmlreader::XmlReader & reader, rtl::Reference< Node > const & group) { bool hasName = false; rtl::OUString name; Operation op = OPERATION_MODIFY; bool finalized = false; for (;;) { - XmlReader::Namespace attrNs; - Span attrLn; - if (!reader.nextAttribute(&attrNs, &attrLn)) { + int attrNsId; + xmlreader::Span attrLn; + if (!reader.nextAttribute(&attrNsId, &attrLn)) { break; } - if (attrNs == XmlReader::NAMESPACE_OOR && + if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("name"))) { hasName = true; - name = xmldata::convertFromUtf8(reader.getAttributeValue(false)); - } else if (attrNs == XmlReader::NAMESPACE_OOR && + name = reader.getAttributeValue(false).convertFromUtf8(); + } else if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("op"))) { op = parseOperation(reader.getAttributeValue(true)); - } else if (attrNs == XmlReader::NAMESPACE_OOR && + } else if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("finalized"))) { finalized = xmldata::parseBoolean(reader.getAttributeValue(true)); @@ -951,7 +956,7 @@ void XcuParser::handleGroupNode( state_.top().locked || finalizedLayer < valueParser_.getLayer())); } -void XcuParser::handleSetNode(XmlReader & reader, SetNode * set) { +void XcuParser::handleSetNode(xmlreader::XmlReader & reader, SetNode * set) { bool hasName = false; rtl::OUString name; rtl::OUString component(componentName_); @@ -961,36 +966,34 @@ void XcuParser::handleSetNode(XmlReader & reader, SetNode * set) { bool finalized = false; bool mandatory = false; for (;;) { - XmlReader::Namespace attrNs; - Span attrLn; - if (!reader.nextAttribute(&attrNs, &attrLn)) { + int attrNsId; + xmlreader::Span attrLn; + if (!reader.nextAttribute(&attrNsId, &attrLn)) { break; } - if (attrNs == XmlReader::NAMESPACE_OOR && + if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("name"))) { hasName = true; - name = xmldata::convertFromUtf8(reader.getAttributeValue(false)); - } else if (attrNs == XmlReader::NAMESPACE_OOR && + name = reader.getAttributeValue(false).convertFromUtf8(); + } else if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("component"))) { - component = xmldata::convertFromUtf8( - reader.getAttributeValue(false)); - } else if (attrNs == XmlReader::NAMESPACE_OOR && + component = reader.getAttributeValue(false).convertFromUtf8(); + } else if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("node-type"))) { hasNodeType = true; - nodeType = xmldata::convertFromUtf8( - reader.getAttributeValue(false)); - } else if (attrNs == XmlReader::NAMESPACE_OOR && + nodeType = reader.getAttributeValue(false).convertFromUtf8(); + } else if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("op"))) { op = parseOperation(reader.getAttributeValue(true)); - } else if (attrNs == XmlReader::NAMESPACE_OOR && + } else if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("finalized"))) { finalized = xmldata::parseBoolean(reader.getAttributeValue(true)); - } else if (attrNs == XmlReader::NAMESPACE_OOR && + } else if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals(RTL_CONSTASCII_STRINGPARAM("mandatory"))) { mandatory = xmldata::parseBoolean(reader.getAttributeValue(true)); @@ -1097,17 +1100,25 @@ void XcuParser::handleSetNode(XmlReader & reader, SetNode * set) { } break; case OPERATION_REMOVE: - // Ignore removal of unknown members, members finalized in a lower - // layer, and members made mandatory in this or a lower layer: - if (i != set->getMembers().end() && !state_.top().locked && - finalizedLayer >= valueParser_.getLayer() && - mandatoryLayer > valueParser_.getLayer()) { - set->getMembers().erase(i); + // Ignore removal of unknown members, members finalized in a lower + // layer, and members made mandatory in this or a lower layer; + // forget about user-layer removals that no longer remove anything + // (so that paired additions/removals in the user layer do not grow + // registrymodifications.xcu unbounded): + bool known = i != set->getMembers().end(); + if (known && !state_.top().locked && + finalizedLayer >= valueParser_.getLayer() && + mandatoryLayer > valueParser_.getLayer()) + { + set->getMembers().erase(i); + } + state_.push(State(true)); + if (known) { + recordModification(false); + } + break; } - state_.push(State(true)); - recordModification(false); - break; } } diff --git a/configmgr/source/xcuparser.hxx b/configmgr/source/xcuparser.hxx index e4d91d3093b3..dda51d254f37 100644..100755 --- a/configmgr/source/xcuparser.hxx +++ b/configmgr/source/xcuparser.hxx @@ -35,6 +35,7 @@ #include "rtl/ref.hxx" #include "rtl/ustring.hxx" +#include "xmlreader/xmlreader.hxx" #include "additions.hxx" #include "node.hxx" @@ -44,7 +45,8 @@ #include "type.hxx" #include "valueparser.hxx" #include "xmldata.hxx" -#include "xmlreader.hxx" + +namespace xmlreader { struct Span; } namespace configmgr { @@ -55,7 +57,6 @@ class Partial; class PropertyNode; class SetNode; struct Data; -struct Span; class XcuParser: public Parser { public: @@ -66,49 +67,50 @@ public: private: virtual ~XcuParser(); - virtual XmlReader::Text getTextMode(); + virtual xmlreader::XmlReader::Text getTextMode(); virtual bool startElement( - XmlReader & reader, XmlReader::Namespace ns, Span const & name); + xmlreader::XmlReader & reader, int nsId, xmlreader::Span const & name); - virtual void endElement(XmlReader const & reader); + virtual void endElement(xmlreader::XmlReader const & reader); - virtual void characters(Span const & span); + virtual void characters(xmlreader::Span const & span); enum Operation { OPERATION_MODIFY, OPERATION_REPLACE, OPERATION_FUSE, OPERATION_REMOVE }; - static Operation parseOperation(Span const & text); + static Operation parseOperation(xmlreader::Span const & text); - void handleComponentData(XmlReader & reader); + void handleComponentData(xmlreader::XmlReader & reader); - void handleItem(XmlReader & reader); + void handleItem(xmlreader::XmlReader & reader); - void handlePropValue(XmlReader & reader, PropertyNode * prop); + void handlePropValue(xmlreader::XmlReader & reader, PropertyNode * prop); void handleLocpropValue( - XmlReader & reader, LocalizedPropertyNode * locprop); + xmlreader::XmlReader & reader, LocalizedPropertyNode * locprop); - void handleGroupProp(XmlReader & reader, GroupNode * group); + void handleGroupProp(xmlreader::XmlReader & reader, GroupNode * group); void handleUnknownGroupProp( - XmlReader const & reader, GroupNode * group, rtl::OUString const & name, - Type type, Operation operation, bool finalized); + xmlreader::XmlReader const & reader, GroupNode * group, + rtl::OUString const & name, Type type, Operation operation, + bool finalized); void handlePlainGroupProp( - XmlReader const & reader, GroupNode * group, + xmlreader::XmlReader const & reader, GroupNode * group, NodeMap::iterator const & propertyIndex, rtl::OUString const & name, Type type, Operation operation, bool finalized); void handleLocalizedGroupProp( - XmlReader const & reader, LocalizedPropertyNode * property, + xmlreader::XmlReader const & reader, LocalizedPropertyNode * property, rtl::OUString const & name, Type type, Operation operation, bool finalized); void handleGroupNode( - XmlReader & reader, rtl::Reference< Node > const & group); + xmlreader::XmlReader & reader, rtl::Reference< Node > const & group); - void handleSetNode(XmlReader & reader, SetNode * set); + void handleSetNode(xmlreader::XmlReader & reader, SetNode * set); void recordModification(bool addition); diff --git a/configmgr/source/xmldata.cxx b/configmgr/source/xmldata.cxx index 07cbd6f2c8e5..5120506bfbb4 100644..100755 --- a/configmgr/source/xmldata.cxx +++ b/configmgr/source/xmldata.cxx @@ -41,12 +41,12 @@ #include "rtl/ref.hxx" #include "rtl/strbuf.hxx" #include "rtl/string.h" -#include "rtl/textcvt.h" -#include "rtl/textenc.h" #include "rtl/ustrbuf.hxx" #include "rtl/ustring.h" #include "rtl/ustring.hxx" #include "sal/types.h" +#include "xmlreader/span.hxx" +#include "xmlreader/xmlreader.hxx" #include "data.hxx" #include "groupnode.hxx" @@ -58,9 +58,7 @@ #include "parser.hxx" #include "propertynode.hxx" #include "setnode.hxx" -#include "span.hxx" #include "type.hxx" -#include "xmlreader.hxx" namespace configmgr { @@ -72,90 +70,88 @@ namespace css = com::sun::star; } -rtl::OUString convertFromUtf8(Span const & text) { - OSL_ASSERT(text.is()); - rtl_uString * s = 0; - if (!rtl_convertStringToUString( - &s, text.begin, text.length, RTL_TEXTENCODING_UTF8, - (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR | - RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR | - RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR))) - { - throw css::uno::RuntimeException( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("cannot convert from UTF-8")), - css::uno::Reference< css::uno::XInterface >()); - } - return rtl::OUString(s, SAL_NO_ACQUIRE); -} - -Type parseType(XmlReader const & reader, Span const & text) { +Type parseType( + xmlreader::XmlReader const & reader, xmlreader::Span const & text) +{ OSL_ASSERT(text.is()); sal_Int32 i = rtl_str_indexOfChar_WithLength(text.begin, text.length, ':'); if (i >= 0) { - switch (reader.getNamespace(Span(text.begin, i))) { - case XmlReader::NAMESPACE_OOR: - if (Span(text.begin + i + 1, text.length - (i + 1)).equals( - RTL_CONSTASCII_STRINGPARAM("any"))) + switch (reader.getNamespaceId(xmlreader::Span(text.begin, i))) { + case ParseManager::NAMESPACE_OOR: + if (xmlreader::Span(text.begin + i + 1, text.length - (i + 1)). + equals(RTL_CONSTASCII_STRINGPARAM("any"))) { return TYPE_ANY; - } else if (Span(text.begin + i + 1, text.length - (i + 1)).equals( - RTL_CONSTASCII_STRINGPARAM("boolean-list"))) + } else if (xmlreader::Span( + text.begin + i + 1, text.length - (i + 1)). + equals(RTL_CONSTASCII_STRINGPARAM("boolean-list"))) { return TYPE_BOOLEAN_LIST; - } else if (Span(text.begin + i + 1, text.length - (i + 1)).equals( - RTL_CONSTASCII_STRINGPARAM("short-list"))) + } else if (xmlreader::Span( + text.begin + i + 1, text.length - (i + 1)). + equals(RTL_CONSTASCII_STRINGPARAM("short-list"))) { return TYPE_SHORT_LIST; - } else if (Span(text.begin + i + 1, text.length - (i + 1)).equals( - RTL_CONSTASCII_STRINGPARAM("int-list"))) + } else if (xmlreader::Span( + text.begin + i + 1, text.length - (i + 1)). + equals(RTL_CONSTASCII_STRINGPARAM("int-list"))) { return TYPE_INT_LIST; - } else if (Span(text.begin + i + 1, text.length - (i + 1)).equals( - RTL_CONSTASCII_STRINGPARAM("long-list"))) + } else if (xmlreader::Span( + text.begin + i + 1, text.length - (i + 1)). + equals(RTL_CONSTASCII_STRINGPARAM("long-list"))) { return TYPE_LONG_LIST; - } else if (Span(text.begin + i + 1, text.length - (i + 1)).equals( - RTL_CONSTASCII_STRINGPARAM("double-list"))) + } else if (xmlreader::Span( + text.begin + i + 1, text.length - (i + 1)). + equals(RTL_CONSTASCII_STRINGPARAM("double-list"))) { return TYPE_DOUBLE_LIST; - } else if (Span(text.begin + i + 1, text.length - (i + 1)).equals( - RTL_CONSTASCII_STRINGPARAM("string-list"))) + } else if (xmlreader::Span( + text.begin + i + 1, text.length - (i + 1)). + equals(RTL_CONSTASCII_STRINGPARAM("string-list"))) { return TYPE_STRING_LIST; - } else if (Span(text.begin + i + 1, text.length - (i + 1)).equals( - RTL_CONSTASCII_STRINGPARAM("hexBinary-list"))) + } else if (xmlreader::Span( + text.begin + i + 1, text.length - (i + 1)). + equals(RTL_CONSTASCII_STRINGPARAM("hexBinary-list"))) { return TYPE_HEXBINARY_LIST; } break; - case XmlReader::NAMESPACE_XS: - if (Span(text.begin + i + 1, text.length - (i + 1)).equals( - RTL_CONSTASCII_STRINGPARAM("boolean"))) + case ParseManager::NAMESPACE_XS: + if (xmlreader::Span(text.begin + i + 1, text.length - (i + 1)). + equals(RTL_CONSTASCII_STRINGPARAM("boolean"))) { return TYPE_BOOLEAN; - } else if (Span(text.begin + i + 1, text.length - (i + 1)).equals( - RTL_CONSTASCII_STRINGPARAM("short"))) + } else if (xmlreader::Span( + text.begin + i + 1, text.length - (i + 1)). + equals(RTL_CONSTASCII_STRINGPARAM("short"))) { return TYPE_SHORT; - } else if (Span(text.begin + i + 1, text.length - (i + 1)).equals( - RTL_CONSTASCII_STRINGPARAM("int"))) + } else if (xmlreader::Span( + text.begin + i + 1, text.length - (i + 1)). + equals(RTL_CONSTASCII_STRINGPARAM("int"))) { return TYPE_INT; - } else if (Span(text.begin + i + 1, text.length - (i + 1)).equals( - RTL_CONSTASCII_STRINGPARAM("long"))) + } else if (xmlreader::Span( + text.begin + i + 1, text.length - (i + 1)). + equals(RTL_CONSTASCII_STRINGPARAM("long"))) { return TYPE_LONG; - } else if (Span(text.begin + i + 1, text.length - (i + 1)).equals( - RTL_CONSTASCII_STRINGPARAM("double"))) + } else if (xmlreader::Span( + text.begin + i + 1, text.length - (i + 1)). + equals(RTL_CONSTASCII_STRINGPARAM("double"))) { return TYPE_DOUBLE; - } else if (Span(text.begin + i + 1, text.length - (i + 1)).equals( - RTL_CONSTASCII_STRINGPARAM("string"))) + } else if (xmlreader::Span( + text.begin + i + 1, text.length - (i + 1)). + equals(RTL_CONSTASCII_STRINGPARAM("string"))) { return TYPE_STRING; - } else if (Span(text.begin + i + 1, text.length - (i + 1)).equals( - RTL_CONSTASCII_STRINGPARAM("hexBinary"))) + } else if (xmlreader::Span( + text.begin + i + 1, text.length - (i + 1)). + equals(RTL_CONSTASCII_STRINGPARAM("hexBinary"))) { return TYPE_HEXBINARY; } @@ -166,11 +162,11 @@ Type parseType(XmlReader const & reader, Span const & text) { } throw css::uno::RuntimeException( (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("invalid type ")) + - convertFromUtf8(text)), + text.convertFromUtf8()), css::uno::Reference< css::uno::XInterface >()); } -bool parseBoolean(Span const & text) { +bool parseBoolean(xmlreader::Span const & text) { OSL_ASSERT(text.is()); if (text.equals(RTL_CONSTASCII_STRINGPARAM("true"))) { return true; @@ -180,7 +176,7 @@ bool parseBoolean(Span const & text) { } throw css::uno::RuntimeException( (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("invalid boolean ")) + - convertFromUtf8(text)), + text.convertFromUtf8()), css::uno::Reference< css::uno::XInterface >()); } diff --git a/configmgr/source/xmldata.hxx b/configmgr/source/xmldata.hxx index 36034f3f962b..2b35adaae4f9 100644..100755 --- a/configmgr/source/xmldata.hxx +++ b/configmgr/source/xmldata.hxx @@ -34,19 +34,19 @@ #include "type.hxx" namespace rtl { class OUString; } +namespace xmlreader { + class XmlReader; + struct Span; +} namespace configmgr { -class XmlReader; -struct Span; - namespace xmldata { -rtl::OUString convertFromUtf8(Span const & text); - -Type parseType(XmlReader const & reader, Span const & text); +Type parseType( + xmlreader::XmlReader const & reader, xmlreader::Span const & text); -bool parseBoolean(Span const & text); +bool parseBoolean(xmlreader::Span const & text); rtl::OUString parseTemplateReference( rtl::OUString const & component, bool hasNodeType, diff --git a/configmgr/source/xmlreader.cxx b/configmgr/source/xmlreader.cxx index 49963ca3188a..49963ca3188a 100644..100755 --- a/configmgr/source/xmlreader.cxx +++ b/configmgr/source/xmlreader.cxx diff --git a/configmgr/source/xmlreader.hxx b/configmgr/source/xmlreader.hxx index c5436fea81f7..c5436fea81f7 100644..100755 --- a/configmgr/source/xmlreader.hxx +++ b/configmgr/source/xmlreader.hxx |