diff options
-rw-r--r-- | configmgr/source/README | 1 | ||||
-rw-r--r-- | configmgr/source/access.cxx | 23 | ||||
-rw-r--r-- | configmgr/source/additions.hxx | 43 | ||||
-rw-r--r-- | configmgr/source/components.cxx | 134 | ||||
-rw-r--r-- | configmgr/source/components.hxx | 15 | ||||
-rw-r--r-- | configmgr/source/data.cxx | 44 | ||||
-rw-r--r-- | configmgr/source/data.hxx | 23 | ||||
-rw-r--r-- | configmgr/source/update.cxx | 17 | ||||
-rw-r--r-- | configmgr/source/xcdparser.cxx | 2 | ||||
-rw-r--r-- | configmgr/source/xcuparser.cxx | 30 | ||||
-rw-r--r-- | configmgr/source/xcuparser.hxx | 6 | ||||
-rw-r--r-- | desktop/source/deployment/registry/configuration/dp_configuration.cxx | 26 |
12 files changed, 307 insertions, 57 deletions
diff --git a/configmgr/source/README b/configmgr/source/README index b731043d34ed..b00990d1eeb2 100644 --- a/configmgr/source/README +++ b/configmgr/source/README @@ -70,6 +70,7 @@ writemodfile.cxx broadcaster.cxx Notification management. +additions.hxx update.cxx Extension manager interface. diff --git a/configmgr/source/access.cxx b/configmgr/source/access.cxx index 190db364cdfe..eda60e6d612a 100644 --- a/configmgr/source/access.cxx +++ b/configmgr/source/access.cxx @@ -798,13 +798,22 @@ void Access::initBroadcasterAndChanges( css::uno::Any(), css::uno::Any())); //TODO: non-void ReplacedElement } - //TODO: if (allChanges != 0) { - // allChanges->push_back( - // css::util::ElementChange( - // css::uno::makeAny(...), - // css::uno::Any(), css::uno::Any())); - // //TODO: non-void ReplacedElement - //} + if (allChanges != 0) { + rtl::OUStringBuffer path( + getRelativePathRepresentation()); + if (path.getLength() != 0) { + path.append(sal_Unicode('/')); + } + path.append( + Data::createSegment( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("*")), + i->first)); + allChanges->push_back( + css::util::ElementChange( + css::uno::makeAny(path.makeStringAndClear()), + css::uno::Any(), css::uno::Any())); + //TODO: non-void ReplacedElement + } } // else: spurious Modifications::Node not representing a change break; diff --git a/configmgr/source/additions.hxx b/configmgr/source/additions.hxx new file mode 100644 index 000000000000..f34373c7f742 --- /dev/null +++ b/configmgr/source/additions.hxx @@ -0,0 +1,43 @@ +/************************************************************************* +* +* 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_ADDITIONS_HXX +#define INCLUDED_CONFIGMGR_SOURCE_ADDITIONS_HXX + +#include "sal/config.h" + +#include <list> + +#include "path.hxx" + +namespace configmgr { + +typedef std::list< Path > Additions; + +} + +#endif diff --git a/configmgr/source/components.cxx b/configmgr/source/components.cxx index 04e6317c959d..733ca05bc147 100644 --- a/configmgr/source/components.cxx +++ b/configmgr/source/components.cxx @@ -54,10 +54,12 @@ #include "rtl/ustring.hxx" #include "sal/types.h" +#include "additions.hxx" #include "components.hxx" #include "data.hxx" #include "modifications.hxx" #include "node.hxx" +#include "nodemap.hxx" #include "parsemanager.hxx" #include "partial.hxx" #include "rootaccess.hxx" @@ -86,12 +88,12 @@ typedef std::list< UnresolvedListItem > UnresolvedList; void parseXcsFile( rtl::OUString const & url, int layer, Data & data, Partial const * partial, - Modifications * modifications) + Modifications * modifications, Additions * additions) SAL_THROW(( css::container::NoSuchElementException, css::uno::RuntimeException)) { - OSL_ASSERT(partial == 0 && modifications == 0); - (void) partial; (void) modifications; + OSL_ASSERT(partial == 0 && modifications == 0 && additions == 0); + (void) partial; (void) modifications; (void) additions; OSL_VERIFY( rtl::Reference< ParseManager >( new ParseManager(url, new XcsParser(layer, data)))->parse()); @@ -99,14 +101,16 @@ void parseXcsFile( void parseXcuFile( rtl::OUString const & url, int layer, Data & data, Partial const * partial, - Modifications * modifications) + Modifications * modifications, Additions * additions) SAL_THROW(( css::container::NoSuchElementException, css::uno::RuntimeException)) { OSL_VERIFY( rtl::Reference< ParseManager >( new ParseManager( - url, new XcuParser(layer, data, partial, modifications)))-> + url, + new XcuParser( + layer, data, partial, modifications, additions)))-> parse()); } @@ -116,6 +120,29 @@ rtl::OUString expand(rtl::OUString const & str) { return s; } +bool hasOnlyEmptySets(rtl::Reference< Node > const & node) { + OSL_ASSERT(node.is()); + switch (node->kind()) { + default: // Node::KIND_LOCALIZED_VALUE + OSL_ASSERT(false); + // fall through + case Node::KIND_PROPERTY: + case Node::KIND_LOCALIZED_PROPERTY: + return true; + case Node::KIND_GROUP: + for (NodeMap::iterator i(node->getMembers().begin()); + i != node->getMembers().end(); ++i) + { + if (!hasOnlyEmptySets(i->second)) { + return false; + } + } + return true; + case Node::KIND_SET: + return node->getMembers().empty(); + } +} + static bool singletonCreated = false; static Components * singleton = 0; @@ -218,7 +245,7 @@ void Components::insertExtensionXcsFile( bool shared, rtl::OUString const & fileUri) { try { - parseXcsFile(fileUri, shared ? 9 : 13, data_, 0, 0); + parseXcsFile(fileUri, shared ? 9 : 13, data_, 0, 0, 0); } catch (css::container::NoSuchElementException & e) { throw css::uno::RuntimeException( (rtl::OUString( @@ -233,9 +260,12 @@ void Components::insertExtensionXcuFile( bool shared, rtl::OUString const & fileUri, Modifications * modifications) { OSL_ASSERT(modifications != 0); + int layer = shared ? 10 : 14; + Additions * adds = data_.addExtensionXcuAdditions(fileUri, layer); try { - parseXcuFile(fileUri, shared ? 10 : 14, data_, 0, modifications); + parseXcuFile(fileUri, layer, data_, 0, modifications, adds); } catch (css::container::NoSuchElementException & e) { + data_.removeExtensionXcuAdditions(fileUri); throw css::uno::RuntimeException( (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( @@ -245,6 +275,54 @@ void Components::insertExtensionXcuFile( } } +void Components::removeExtensionXcuFile( + rtl::OUString const & fileUri, Modifications * modifications) +{ + //TODO: Ideally, exactly the data coming from the specified xcu file would + // be removed. However, not enough information is recorded in the in-memory + // data structures to do so. So, as a workaround, all those set elements + // that were freshly added by the xcu and have afterwards been left + // unchanged are removed (and nothing else). The heuristic to determine + // whether a node has been left unchanged is to check the layer ID (as + // usual) and additionally to check that the node does not recursively + // contain any non-empty sets (multiple extension xcu files are merged into + // one layer, so checking layer ID alone is not enough). Since + // item->additions records all additions of set members in textual order, + // the latter check works well when iterating through item->additions in + // reverse order. + rtl::Reference< Data::ExtensionXcu > item( + data_.removeExtensionXcuAdditions(fileUri)); + if (item.is()) { + for (Additions::reverse_iterator i(item->additions.rbegin()); + i != item->additions.rend(); ++i) + { + rtl::Reference< Node > parent; + NodeMap const * map = &data_.components; + rtl::Reference< Node > node; + for (Path::const_iterator j(i->begin()); j != i->end(); ++j) { + parent = node; + node = Data::findNode(item->layer, *map, *j); + if (!node.is()) { + break; + } + map = &node->getMembers(); + } + if (node.is()) { + OSL_ASSERT(parent.is()); + if (parent->kind() == Node::KIND_SET) { + OSL_ASSERT( + node->kind() == Node::KIND_GROUP || + node->kind() == Node::KIND_SET); + if (hasOnlyEmptySets(node)) { + parent->getMembers().erase(i->back()); + modifications->add(*i); + } + } + } + } + } +} + void Components::insertModificationXcuFile( rtl::OUString const & fileUri, std::set< rtl::OUString > const & includedPaths, @@ -254,7 +332,7 @@ void Components::insertModificationXcuFile( OSL_ASSERT(modifications != 0); try { Partial part(includedPaths, excludedPaths); - parseXcuFile(fileUri, Data::NO_LAYER, data_, &part, modifications); + parseXcuFile(fileUri, Data::NO_LAYER, data_, &part, modifications, 0); } catch (css::uno::Exception & e) { //TODO: more specific exception catching OSL_TRACE( "configmgr error inserting %s: %s", @@ -377,7 +455,8 @@ Components::Components( "${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("uno") ":BUNDLED_EXTENSIONS_USER}/registry/" "com.sun.star.comp.deployment.configuration." - "PackageRegistryBackend/configmgr.ini")))); + "PackageRegistryBackend/configmgr.ini"))), + false); parseXcsXcuIniLayer( 9, expand( @@ -386,8 +465,9 @@ Components::Components( "${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("uno") ":SHARED_EXTENSIONS_USER}/registry/" "com.sun.star.comp.deployment.configuration." - "PackageRegistryBackend/configmgr.ini")))); - parseXcsXcuLayer( //TODO: migrate + "PackageRegistryBackend/configmgr.ini"))), + true); + parseXcsXcuLayer( 11, expand( rtl::OUString( @@ -396,6 +476,8 @@ Components::Components( ":UNO_USER_PACKAGES_CACHE}/registry/" "com.sun.star.comp.deployment.configuration." "PackageRegistryBackend/registry")))); + // can be dropped once old UserInstallation format can no longer exist + // (probably OOo 4) parseXcsXcuIniLayer( 13, expand( @@ -404,7 +486,8 @@ Components::Components( "${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("uno") ":UNO_USER_PACKAGES_CACHE}/registry/" "com.sun.star.comp.deployment.configuration." - "PackageRegistryBackend/configmgr.ini")))); + "PackageRegistryBackend/configmgr.ini"))), + true); try { parseModificationLayer(); } catch (css::uno::Exception & e) { //TODO: more specific exception catching @@ -470,7 +553,7 @@ void Components::parseFiles( file.match(extension, file.getLength() - extension.getLength())) { try { - (*parseFile)(stat.getFileURL(), layer, data_, 0, 0); + (*parseFile)(stat.getFileURL(), layer, data_, 0, 0, 0); } catch (css::container::NoSuchElementException & e) { throw css::uno::RuntimeException( (rtl::OUString( @@ -486,19 +569,26 @@ void Components::parseFiles( void Components::parseFileList( int layer, FileParser * parseFile, rtl::OUString const & urls, - rtl::Bootstrap const & ini) + rtl::Bootstrap const & ini, bool recordAdditions) { for (sal_Int32 i = 0;;) { rtl::OUString url(urls.getToken(0, ' ', i)); if (url.getLength() != 0) { ini.expandMacrosFrom(url); //TODO: detect failure + Additions * adds = 0; + if (recordAdditions) { + adds = data_.addExtensionXcuAdditions(url, layer); + } try { - (*parseFile)(url, layer, data_, 0, 0); + (*parseFile)(url, layer, data_, 0, 0, adds); } catch (css::container::NoSuchElementException & e) { OSL_TRACE( "configmgr file does not exist: %s", rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8).getStr()); + if (adds != 0) { + data_.removeExtensionXcuAdditions(url); + } } } if (i == -1) { @@ -610,18 +700,20 @@ void Components::parseXcsXcuLayer(int layer, rtl::OUString const & url) { url + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/data")), false); } -void Components::parseXcsXcuIniLayer(int layer, rtl::OUString const & url) { +void Components::parseXcsXcuIniLayer( + int layer, rtl::OUString const & url, bool recordAdditions) +{ //TODO: rtl::Bootstrap::getFrom "first trie[s] to retrieve the value via the // global function" rtl::Bootstrap ini(url); rtl::OUString urls; if (ini.getFrom(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SCHEMA")), urls)) { - parseFileList(layer, &parseXcsFile, urls, ini); + parseFileList(layer, &parseXcsFile, urls, ini, false); } if (ini.getFrom(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DATA")), urls)) { - parseFileList(layer + 1, &parseXcuFile, urls, ini); + parseFileList(layer + 1, &parseXcuFile, urls, ini, recordAdditions); } } @@ -650,13 +742,13 @@ rtl::OUString Components::getModificationFileUrl() const { void Components::parseModificationLayer() { try { - parseXcuFile(getModificationFileUrl(), Data::NO_LAYER, data_, 0, 0); + parseXcuFile(getModificationFileUrl(), Data::NO_LAYER, data_, 0, 0, 0); } catch (css::container::NoSuchElementException &) { OSL_TRACE( "configmgr user registrymodifications.xcu does not (yet) exist"); // Migrate old user layer data (can be removed once migration is no - // longer relevant; also see hack for xsi namespace in XmlReader - // constructor): + // longer relevant, probably OOo 4; also see hack for xsi namespace in + // XmlReader constructor): parseFiles( Data::NO_LAYER, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".xcu")), &parseXcuFile, diff --git a/configmgr/source/components.hxx b/configmgr/source/components.hxx index 2e635680c1ce..880ac95d34a8 100644 --- a/configmgr/source/components.hxx +++ b/configmgr/source/components.hxx @@ -38,7 +38,10 @@ #include "com/sun/star/uno/Reference.hxx" #include "rtl/ref.hxx" +#include "additions.hxx" #include "data.hxx" +#include "modifications.hxx" +#include "nodemap.hxx" #include "path.hxx" namespace com { namespace sun { namespace star { @@ -56,7 +59,6 @@ namespace rtl { namespace configmgr { class Broadcaster; -class Modifications; class Node; class Partial; class RootAccess; @@ -98,6 +100,9 @@ public: bool shared, rtl::OUString const & fileUri, Modifications * modifications); + void removeExtensionXcuFile( + rtl::OUString const & fileUri, Modifications * modifications); + void insertModificationXcuFile( rtl::OUString const & fileUri, std::set< rtl::OUString > const & includedPaths, @@ -109,7 +114,8 @@ public: private: typedef void FileParser( - rtl::OUString const &, int, Data &, Partial const *, Modifications *); + rtl::OUString const &, int, Data &, Partial const *, Modifications *, + Additions *); Components( com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > @@ -123,13 +129,14 @@ private: void parseFileList( int layer, FileParser * parseFile, rtl::OUString const & urls, - rtl::Bootstrap const & ini); + rtl::Bootstrap const & ini, bool recordAdditions); void parseXcdFiles(int layer, rtl::OUString const & url); void parseXcsXcuLayer(int layer, rtl::OUString const & url); - void parseXcsXcuIniLayer(int layer, rtl::OUString const & url); + void parseXcsXcuIniLayer( + int layer, rtl::OUString const & url, bool recordAdditions); void parseModuleLayer(int layer, rtl::OUString const & url); diff --git a/configmgr/source/data.cxx b/configmgr/source/data.cxx index e12f9596940b..50466ca0532c 100644 --- a/configmgr/source/data.cxx +++ b/configmgr/source/data.cxx @@ -36,11 +36,13 @@ #include "osl/diagnose.h" #include "rtl/ref.hxx" #include "rtl/string.h" +#include "rtl/textenc.h" #include "rtl/ustrbuf.hxx" #include "rtl/ustring.h" #include "rtl/ustring.hxx" #include "sal/types.h" +#include "additions.hxx" #include "data.hxx" #include "groupnode.hxx" #include "node.hxx" @@ -325,4 +327,46 @@ rtl::Reference< Node > Data::getTemplate( return findNode(layer, templates, fullName); } +Additions * Data::addExtensionXcuAdditions( + rtl::OUString const & url, int layer) +{ + rtl::Reference< ExtensionXcu > item(new ExtensionXcu); + ExtensionXcuAdditions::iterator i( + extensionXcuAdditions_.insert( + ExtensionXcuAdditions::value_type( + url, rtl::Reference< ExtensionXcu >())).first); + if (i->second.is()) { + throw css::uno::RuntimeException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "already added extension xcu ")) + + url), + css::uno::Reference< css::uno::XInterface >()); + } + i->second = item; + item->layer = layer; + return &item->additions; +} + +rtl::Reference< Data::ExtensionXcu > Data::removeExtensionXcuAdditions( + rtl::OUString const & url) +{ + ExtensionXcuAdditions::iterator i(extensionXcuAdditions_.find(url)); + if (i == extensionXcuAdditions_.end()) { + // This can happen, as migration of pre OOo 3.3 UserInstallation + // extensions in dp_registry::backend::configuration::BackendImpl:: + // PackageImpl::processPackage_ can cause just-in-time creation of + // extension xcu files that are never added via addExtensionXcuAdditions + // (also, there might be url spelling differences between calls to + // addExtensionXcuAdditions and removeExtensionXcuAdditions?): + OSL_TRACE( + "unknown configmgr::Data::removeExtensionXcuAdditions(%s)", + rtl::OUStringToOString(url, RTL_TEXTENCODING_UTF8).getStr()); + return rtl::Reference< ExtensionXcu >(); + } + rtl::Reference< ExtensionXcu > item(i->second); + extensionXcuAdditions_.erase(i); + return item; +} + } diff --git a/configmgr/source/data.hxx b/configmgr/source/data.hxx index 52353d066b67..8f5f7af0d86e 100644 --- a/configmgr/source/data.hxx +++ b/configmgr/source/data.hxx @@ -31,18 +31,20 @@ #include "sal/config.h" #include <climits> +#include <map> #include <vector> #include "boost/noncopyable.hpp" #include "rtl/ref.hxx" +#include "rtl/ustring.hxx" #include "sal/types.h" +#include "salhelper/simplereferenceobject.hxx" +#include "additions.hxx" #include "modifications.hxx" #include "nodemap.hxx" #include "path.hxx" -namespace rtl { class OUString; } - namespace configmgr { class Node; @@ -50,6 +52,11 @@ class Node; struct Data: private boost::noncopyable { enum { NO_LAYER = INT_MAX }; + struct ExtensionXcu: public salhelper::SimpleReferenceObject { + int layer; + Additions additions; + }; + NodeMap templates; NodeMap components; @@ -80,6 +87,18 @@ struct Data: private boost::noncopyable { rtl::Reference< Node > getTemplate( int layer, rtl::OUString const & fullName) const; + + Additions * addExtensionXcuAdditions( + rtl::OUString const & url, int layer); + + rtl::Reference< ExtensionXcu > removeExtensionXcuAdditions( + rtl::OUString const & url); + +private: + typedef std::map< rtl::OUString, rtl::Reference< ExtensionXcu > > + ExtensionXcuAdditions; + + ExtensionXcuAdditions extensionXcuAdditions_; }; } diff --git a/configmgr/source/update.cxx b/configmgr/source/update.cxx index 4c1d59d5d054..403b761a5abd 100644 --- a/configmgr/source/update.cxx +++ b/configmgr/source/update.cxx @@ -89,6 +89,9 @@ private: sal_Bool shared, rtl::OUString const & fileUri) throw (css::uno::RuntimeException); + virtual void SAL_CALL removeExtensionXcuFile(rtl::OUString const & fileUri) + throw (css::uno::RuntimeException); + virtual void SAL_CALL insertModificationXcuFile( rtl::OUString const & fileUri, css::uno::Sequence< rtl::OUString > const & includedPaths, @@ -120,6 +123,20 @@ void Service::insertExtensionXcuFile( bc.send(); } +void Service::removeExtensionXcuFile(rtl::OUString const & fileUri) + throw (css::uno::RuntimeException) +{ + Broadcaster bc; + { + osl::MutexGuard g(lock); + Modifications mods; + Components::getSingleton().removeExtensionXcuFile(fileUri, &mods); + Components::getSingleton().initGlobalBroadcaster( + mods, rtl::Reference< RootAccess >(), &bc); + } + bc.send(); +} + void Service::insertModificationXcuFile( rtl::OUString const & fileUri, css::uno::Sequence< rtl::OUString > const & includedPaths, diff --git a/configmgr/source/xcdparser.cxx b/configmgr/source/xcdparser.cxx index 498254b35644..ad774d5ca3e3 100644 --- a/configmgr/source/xcdparser.cxx +++ b/configmgr/source/xcdparser.cxx @@ -137,7 +137,7 @@ bool XcdParser::startElement( if (ns == XmlReader::NAMESPACE_OOR && name.equals(RTL_CONSTASCII_STRINGPARAM("component-data"))) { - nestedParser_ = new XcuParser(layer_ + 1, data_, 0, 0); + nestedParser_ = new XcuParser(layer_ + 1, data_, 0, 0, 0); nesting_ = 1; return nestedParser_->startElement(reader, ns, name); } diff --git a/configmgr/source/xcuparser.cxx b/configmgr/source/xcuparser.cxx index cd1e6e55d085..91f3b244c5a8 100644 --- a/configmgr/source/xcuparser.cxx +++ b/configmgr/source/xcuparser.cxx @@ -68,12 +68,13 @@ namespace css = com::sun::star; XcuParser::XcuParser( int layer, Data & data, Partial const * partial, - Modifications * broadcastModifications): + Modifications * broadcastModifications, Additions * additions): valueParser_(layer), data_(data), partial_(partial), broadcastModifications_(broadcastModifications), - recordModifications_(layer == Data::NO_LAYER), + additions_(additions), recordModifications_(layer == Data::NO_LAYER), trackPath_( - partial_ != 0 || broadcastModifications_ != 0 || recordModifications_) + partial_ != 0 || broadcastModifications_ != 0 || additions_ != 0 || + recordModifications_) {} XcuParser::~XcuParser() {} @@ -624,7 +625,7 @@ void XcuParser::handleLocpropValue( pop = true; } if (trackPath_) { - recordModification(); + recordModification(false); if (pop) { path_.pop_back(); } @@ -638,7 +639,7 @@ void XcuParser::handleLocpropValue( locprop->getMembers().erase(i); } state_.push(State(true)); - recordModification(); + recordModification(false); break; default: throw css::uno::RuntimeException( @@ -750,7 +751,7 @@ void XcuParser::handleUnknownGroupProp( prop->setFinalized(valueParser_.getLayer()); } state_.push(State(prop, name, state_.top().locked)); - recordModification(); + recordModification(false); break; } // fall through @@ -800,7 +801,7 @@ void XcuParser::handlePlainGroupProp( property, (state_.top().locked || finalizedLayer < valueParser_.getLayer()))); - recordModification(); + recordModification(false); break; case OPERATION_REMOVE: if (!property->isExtension()) { @@ -814,7 +815,7 @@ void XcuParser::handlePlainGroupProp( } group->getMembers().erase(propertyIndex); state_.push(State(true)); // ignore children - recordModification(); + recordModification(false); break; } } @@ -863,7 +864,7 @@ void XcuParser::handleLocalizedGroupProp( replacement, name, (state_.top().locked || finalizedLayer < valueParser_.getLayer()))); - recordModification(); + recordModification(false); } break; case OPERATION_REMOVE: @@ -1070,7 +1071,7 @@ void XcuParser::handleSetNode(XmlReader & reader, SetNode * set) { member->setFinalized(finalizedLayer); member->setMandatory(mandatoryLayer); state_.push(State(member, name, false)); - recordModification(); + recordModification(i == set->getMembers().end()); } break; case OPERATION_FUSE: @@ -1084,7 +1085,7 @@ void XcuParser::handleSetNode(XmlReader & reader, SetNode * set) { member->setFinalized(finalizedLayer); member->setMandatory(mandatoryLayer); state_.push(State(member, name, false)); - recordModification(); + recordModification(true); } } else { state_.push( @@ -1104,15 +1105,18 @@ void XcuParser::handleSetNode(XmlReader & reader, SetNode * set) { set->getMembers().erase(i); } state_.push(State(true)); - recordModification(); + recordModification(false); break; } } -void XcuParser::recordModification() { +void XcuParser::recordModification(bool addition) { if (broadcastModifications_ != 0) { broadcastModifications_->add(path_); } + if (addition && additions_ != 0) { + additions_->push_back(path_); + } if (recordModifications_) { data_.modifications.add(path_); } diff --git a/configmgr/source/xcuparser.hxx b/configmgr/source/xcuparser.hxx index 64108451b4ef..02ef4e5ff117 100644 --- a/configmgr/source/xcuparser.hxx +++ b/configmgr/source/xcuparser.hxx @@ -35,6 +35,7 @@ #include "rtl/ref.hxx" #include "rtl/ustring.hxx" +#include "additions.hxx" #include "node.hxx" #include "nodemap.hxx" #include "parser.hxx" @@ -59,7 +60,7 @@ class XcuParser: public Parser { public: XcuParser( int layer, Data & data, Partial const * partial, - Modifications * broadcastModifications); + Modifications * broadcastModifications, Additions * additions); private: virtual ~XcuParser(); @@ -108,7 +109,7 @@ private: void handleSetNode(XmlReader & reader, SetNode * set); - void recordModification(); + void recordModification(bool addition); struct State { rtl::Reference< Node > node; // empty iff ignore or <items> @@ -141,6 +142,7 @@ private: Data & data_; Partial const * partial_; Modifications * broadcastModifications_; + Additions * additions_; bool recordModifications_; bool trackPath_; rtl::OUString componentName_; diff --git a/desktop/source/deployment/registry/configuration/dp_configuration.cxx b/desktop/source/deployment/registry/configuration/dp_configuration.cxx index 9ea6e8227340..22cbcacc9e9d 100644 --- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx +++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx @@ -139,7 +139,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend void addDataToDb(OUString const & url, ConfigurationBackendDb::Data const & data); ::boost::optional<ConfigurationBackendDb::Data> readDataFromDb(OUString const & url); - void deleteDataFromDb(OUString const & url); + OUString deleteDataFromDb(OUString const & url); ::std::list<OUString> getAllIniEntries(); public: @@ -240,10 +240,18 @@ void BackendImpl::addDataToDb( return data; } -void BackendImpl::deleteDataFromDb(OUString const & url) +OUString BackendImpl::deleteDataFromDb(OUString const & url) { - if (m_backendDb.get()) + OUString url2(url); + if (m_backendDb.get()) { + boost::optional< ConfigurationBackendDb::Data > data( + m_backendDb->getEntry(url)); + if (data) { + url2 = expandUnoRcTerm(data->iniEntry); + } m_backendDb->removeEntry(url); + } + return url2; } ::std::list<OUString> BackendImpl::getAllIniEntries() @@ -736,11 +744,11 @@ void BackendImpl::PackageImpl::processPackage_( //rebuilding the directory structure. rtl::OUString url2( rtl::OStringToOUString(i->first, RTL_TEXTENCODING_UTF8)); - ConfigurationBackendDb::Data data; if (url2 != url) { bool schema = i->second.equalsIgnoreAsciiCase( "vnd.sun.star.configuration-schema"); OUString url_replaced(url2); + ConfigurationBackendDb::Data data; if (!schema) { const OUString sModFolder = that->createFolder(OUString(), xCmdEnv); @@ -753,6 +761,7 @@ void BackendImpl::PackageImpl::processPackage_( deleteTempFolder(sModFolder); } that->addToConfigmgrIni(schema, url_replaced, xCmdEnv); + data.iniEntry = dp_misc::makeRcTerm(url_replaced); that->addDataToDb(url2, data); } that->m_registeredPackages->erase(i->first); @@ -762,9 +771,12 @@ void BackendImpl::PackageImpl::processPackage_( xCmdEnv ).executeCommand( OUSTR("delete"), Any( true /* delete physically */ ) ); } - that->deleteDataFromDb(getURL()); - - //TODO: revoking at runtime, possible, sensible? + url = that->deleteDataFromDb(url); + if (!m_isSchema) { + com::sun::star::configuration::Update::get( + that->m_xComponentContext)->removeExtensionXcuFile( + expandUnoRcUrl(url)); + } } } |