summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsb <sb@openoffice.org>2010-03-26 11:06:19 +0100
committersb <sb@openoffice.org>2010-03-26 11:06:19 +0100
commit7ff56983823047120541f724dfd2fb80b2a6432d (patch)
treefeb0ff2c881834155ec9c7c8185f2c5fa4472a17
parent41b28993173f98f858a90fb7d8f259e24207ccbe (diff)
sb121: #i110203# added configmgr::update::insertModificationXcuFile and adapted old configuration data migration to it; some cleanup
-rw-r--r--configmgr/inc/configmgr/update.hxx7
-rw-r--r--configmgr/source/README1
-rw-r--r--configmgr/source/components.cxx50
-rw-r--r--configmgr/source/components.hxx18
-rw-r--r--configmgr/source/makefile.mk1
-rw-r--r--configmgr/source/partial.cxx137
-rw-r--r--configmgr/source/partial.hxx71
-rw-r--r--configmgr/source/update.cxx19
-rw-r--r--configmgr/source/xcdparser.cxx4
-rw-r--r--configmgr/source/xcdparser.hxx4
-rw-r--r--configmgr/source/xcsparser.cxx16
-rw-r--r--configmgr/source/xcsparser.hxx4
-rw-r--r--configmgr/source/xcuparser.cxx234
-rw-r--r--configmgr/source/xcuparser.hxx27
-rw-r--r--desktop/source/app/makefile.mk1
-rw-r--r--desktop/source/migration/migration.cxx195
-rw-r--r--desktop/source/migration/migration_impl.hxx5
-rw-r--r--desktop/source/splash/makefile.mk1
-rw-r--r--officecfg/registry/data/org/openoffice/Setup.xcu128
-rw-r--r--officecfg/registry/schema/org/openoffice/Setup.xcs6
20 files changed, 594 insertions, 335 deletions
diff --git a/configmgr/inc/configmgr/update.hxx b/configmgr/inc/configmgr/update.hxx
index b27a32487400..3a152959342b 100644
--- a/configmgr/inc/configmgr/update.hxx
+++ b/configmgr/inc/configmgr/update.hxx
@@ -30,6 +30,8 @@
#include "sal/config.h"
+#include <set>
+
#include "configmgr/detail/configmgrdllapi.hxx"
namespace rtl { class OUString; }
@@ -44,6 +46,11 @@ OOO_DLLPUBLIC_CONFIGMGR void insertExtensionXcsFile(
OOO_DLLPUBLIC_CONFIGMGR void insertExtensionXcuFile(
bool shared, rtl::OUString const & fileUri);
+OOO_DLLPUBLIC_CONFIGMGR void insertModificationXcuFile(
+ rtl::OUString const & fileUri,
+ std::set< rtl::OUString > const & includedPaths,
+ std::set< rtl::OUString > const & excludedPaths);
+
}
}
diff --git a/configmgr/source/README b/configmgr/source/README
index 6d19a3b78610..b731043d34ed 100644
--- a/configmgr/source/README
+++ b/configmgr/source/README
@@ -76,6 +76,7 @@ update.cxx
data.cxx
lock.cxx
nodemap.cxx
+partial.cxx
path.hxx
type.cxx
Utilities.
diff --git a/configmgr/source/components.cxx b/configmgr/source/components.cxx
index cb8fb261e60e..6d97971e1a2c 100644
--- a/configmgr/source/components.cxx
+++ b/configmgr/source/components.cxx
@@ -59,6 +59,7 @@
#include "modifications.hxx"
#include "node.hxx"
#include "parsemanager.hxx"
+#include "partial.hxx"
#include "rootaccess.hxx"
#include "writemodfile.hxx"
#include "xcdparser.hxx"
@@ -83,26 +84,29 @@ struct UnresolvedListItem {
typedef std::list< UnresolvedListItem > UnresolvedList;
-void parseXcsFile(rtl::OUString const & url, int layer, Data * data,
+void parseXcsFile(
+ rtl::OUString const & url, int layer, Data & data, Partial const * partial,
Modifications * modifications)
SAL_THROW((
css::container::NoSuchElementException, css::uno::RuntimeException))
{
- OSL_ASSERT(modifications == 0); (void) modifications;
+ OSL_ASSERT(partial == 0 && modifications == 0);
+ (void) partial; (void) modifications;
OSL_VERIFY(
rtl::Reference< ParseManager >(
new ParseManager(url, new XcsParser(layer, data)))->parse());
}
void parseXcuFile(
- rtl::OUString const & url, int layer, Data * data,
+ rtl::OUString const & url, int layer, Data & data, Partial const * partial,
Modifications * modifications)
SAL_THROW((
css::container::NoSuchElementException, css::uno::RuntimeException))
{
OSL_VERIFY(
rtl::Reference< ParseManager >(
- new ParseManager(url, new XcuParser(layer, data, modifications)))->
+ new ParseManager(
+ url, new XcuParser(layer, data, partial, modifications)))->
parse());
}
@@ -213,7 +217,7 @@ void Components::insertExtensionXcsFile(
bool shared, rtl::OUString const & fileUri)
{
try {
- parseXcsFile(fileUri, shared ? 9 : 13, &data_, 0);
+ parseXcsFile(fileUri, shared ? 9 : 13, data_, 0, 0);
} catch (css::container::NoSuchElementException & e) {
throw css::uno::RuntimeException(
(rtl::OUString(
@@ -229,7 +233,7 @@ void Components::insertExtensionXcuFile(
{
OSL_ASSERT(modifications != 0);
try {
- parseXcuFile(fileUri, shared ? 10 : 14, &data_, modifications);
+ parseXcuFile(fileUri, shared ? 10 : 14, data_, 0, modifications);
} catch (css::container::NoSuchElementException & e) {
throw css::uno::RuntimeException(
(rtl::OUString(
@@ -240,6 +244,24 @@ void Components::insertExtensionXcuFile(
}
}
+void Components::insertModificationXcuFile(
+ rtl::OUString const & fileUri,
+ std::set< rtl::OUString > const & includedPaths,
+ std::set< rtl::OUString > const & excludedPaths,
+ Modifications * modifications)
+{
+ OSL_ASSERT(modifications != 0);
+ try {
+ Partial part(includedPaths, excludedPaths);
+ parseXcuFile(fileUri, Data::NO_LAYER, data_, &part, modifications);
+ } catch (css::uno::Exception & e) { //TODO: more specific exception catching
+ OSL_TRACE(
+ "configmgr error inserting %s: %s",
+ rtl::OUStringToOString(fileUri, RTL_TEXTENCODING_UTF8).getStr(),
+ rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr());
+ }
+}
+
css::beans::Optional< css::uno::Any > Components::getExternalValue(
rtl::OUString const & descriptor)
{
@@ -397,8 +419,7 @@ Components::Components(
Components::~Components() {}
void Components::parseFiles(
- int layer, rtl::OUString const & extension,
- void (* parseFile)(rtl::OUString const &, int, Data *, Modifications *),
+ int layer, rtl::OUString const & extension, FileParser * parseFile,
rtl::OUString const & url, bool recursive)
{
osl::Directory dir(url);
@@ -448,7 +469,7 @@ void Components::parseFiles(
file.match(extension, file.getLength() - extension.getLength()))
{
try {
- (*parseFile)(stat.getFileURL(), layer, &data_, 0);
+ (*parseFile)(stat.getFileURL(), layer, data_, 0, 0);
} catch (css::container::NoSuchElementException & e) {
throw css::uno::RuntimeException(
(rtl::OUString(
@@ -463,16 +484,15 @@ void Components::parseFiles(
}
void Components::parseFileList(
- int layer,
- void (* parseFile)(rtl::OUString const &, int, Data *, Modifications *),
- rtl::OUString const & urls, rtl::Bootstrap const & ini)
+ int layer, FileParser * parseFile, rtl::OUString const & urls,
+ rtl::Bootstrap const & ini)
{
for (sal_Int32 i = 0;;) {
rtl::OUString url(urls.getToken(0, ' ', i));
if (url.getLength() != 0) {
ini.expandMacrosFrom(url); //TODO: detect failure
try {
- (*parseFile)(url, layer, &data_, 0);
+ (*parseFile)(url, layer, data_, 0, 0);
} catch (css::container::NoSuchElementException & e) {
throw css::uno::RuntimeException(
(rtl::OUString(
@@ -540,7 +560,7 @@ void Components::parseXcdFiles(int layer, rtl::OUString const & url) {
rtl::Reference< ParseManager > manager;
try {
manager = new ParseManager(
- stat.getFileURL(), new XcdParser(layer, deps, &data_));
+ stat.getFileURL(), new XcdParser(layer, deps, data_));
} catch (css::container::NoSuchElementException & e) {
throw css::uno::RuntimeException(
(rtl::OUString(
@@ -631,7 +651,7 @@ rtl::OUString Components::getModificationFileUrl() const {
void Components::parseModificationLayer() {
try {
- parseXcuFile(getModificationFileUrl(), Data::NO_LAYER, &data_, 0);
+ parseXcuFile(getModificationFileUrl(), Data::NO_LAYER, data_, 0, 0);
} catch (css::container::NoSuchElementException &) {
OSL_TRACE(
"configmgr user registrymodifications.xcu does not (yet) exist");
diff --git a/configmgr/source/components.hxx b/configmgr/source/components.hxx
index 8523b02cbbaf..a78ed325969d 100644
--- a/configmgr/source/components.hxx
+++ b/configmgr/source/components.hxx
@@ -58,6 +58,7 @@ namespace configmgr {
class Broadcaster;
class Modifications;
class Node;
+class Partial;
class RootAccess;
class Components: private boost::noncopyable {
@@ -96,10 +97,19 @@ public:
bool shared, rtl::OUString const & fileUri,
Modifications * modifications);
+ void insertModificationXcuFile(
+ rtl::OUString const & fileUri,
+ std::set< rtl::OUString > const & includedPaths,
+ std::set< rtl::OUString > const & excludedPaths,
+ Modifications * modifications);
+
com::sun::star::beans::Optional< com::sun::star::uno::Any >
getExternalValue(rtl::OUString const & descriptor);
private:
+ typedef void FileParser(
+ rtl::OUString const &, int, Data &, Partial const *, Modifications *);
+
Components(
com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
const & context);
@@ -107,14 +117,12 @@ private:
~Components();
void parseFiles(
- int layer, rtl::OUString const & extension,
- void (* parseFile)(rtl::OUString const &, int, Data *, Modifications *),
+ int layer, rtl::OUString const & extension, FileParser * parseFile,
rtl::OUString const & url, bool recursive);
void parseFileList(
- int layer,
- void (* parseFile)(rtl::OUString const &, int, Data *, Modifications *),
- rtl::OUString const & urls, rtl::Bootstrap const & ini);
+ int layer, FileParser * parseFile, rtl::OUString const & urls,
+ rtl::Bootstrap const & ini);
void parseXcdFiles(int layer, rtl::OUString const & url);
diff --git a/configmgr/source/makefile.mk b/configmgr/source/makefile.mk
index d6972e12b9d8..317e08bdf49c 100644
--- a/configmgr/source/makefile.mk
+++ b/configmgr/source/makefile.mk
@@ -54,6 +54,7 @@ SLOFILES = \
$(SLO)/nodemap.obj \
$(SLO)/pad.obj \
$(SLO)/parsemanager.obj \
+ $(SLO)/partial.obj \
$(SLO)/propertynode.obj \
$(SLO)/rootaccess.obj \
$(SLO)/services.obj \
diff --git a/configmgr/source/partial.cxx b/configmgr/source/partial.cxx
new file mode 100644
index 000000000000..4c9189ed05c4
--- /dev/null
+++ b/configmgr/source/partial.cxx
@@ -0,0 +1,137 @@
+/*************************************************************************
+*
+* 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.
+*
+************************************************************************/
+
+#include "precompiled_configmgr.hxx"
+#include "sal/config.h"
+
+#include <map>
+#include <set>
+
+#include "com/sun/star/uno/Reference.hxx"
+#include "com/sun/star/uno/RuntimeException.hpp"
+#include "com/sun/star/uno/XInterface.hpp"
+#include "osl/diagnose.h"
+#include "rtl/ustring.h"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+
+#include "data.hxx"
+#include "partial.hxx"
+
+namespace configmgr {
+
+namespace {
+
+namespace css = com::sun::star;
+
+bool parseSegment(
+ rtl::OUString const & path, sal_Int32 * index, rtl::OUString * segment)
+{
+ OSL_ASSERT(
+ index != 0 && *index >= 0 && *index <= path.getLength() &&
+ segment != 0);
+ if (path[(*index)++] == '/') {
+ rtl::OUString name;
+ bool setElement;
+ rtl::OUString templateName;
+ *index = Data::parseSegment(
+ path, *index, &name, &setElement, &templateName);
+ if (*index != -1) {
+ *segment = Data::createSegment(templateName, name);
+ return *index == path.getLength();
+ }
+ }
+ throw css::uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bad path ")) + path,
+ css::uno::Reference< css::uno::XInterface >());
+}
+
+}
+
+Partial::Partial(
+ std::set< rtl::OUString > const & includedPaths,
+ std::set< rtl::OUString > const & excludedPaths)
+{
+ for (std::set< rtl::OUString >::const_iterator i(includedPaths.begin());
+ i != includedPaths.end(); ++i)
+ {
+ sal_Int32 n = 0;
+ for (Node * p = &root_;;) {
+ rtl::OUString seg;
+ bool end = parseSegment(*i, &n, &seg);
+ p = &p->children[seg];
+ if (p->startInclude) {
+ break;
+ }
+ if (end) {
+ p->children.clear();
+ p->startInclude = true;
+ break;
+ }
+ }
+ }
+ for (std::set< rtl::OUString >::const_iterator i(excludedPaths.begin());
+ i != excludedPaths.end(); ++i)
+ {
+ sal_Int32 n = 0;
+ for (Node * p = &root_;;) {
+ rtl::OUString seg;
+ bool end = parseSegment(*i, &n, &seg);
+ if (end) {
+ p->children[seg] = Node();
+ break;
+ }
+ Node::Children::iterator j(p->children.find(seg));
+ if (j == p->children.end()) {
+ break;
+ }
+ p = &j->second;
+ }
+ }
+}
+
+Partial::~Partial() {}
+
+Partial::Containment Partial::contains(Path const & path) const {
+ //TODO: For set elements, the segment names recorded in the node tree need
+ // not match the corresponding path segments, so this function can fail.
+ Node const * p = &root_;
+ bool includes = false;
+ for (Path::const_iterator i(path.begin()); i != path.end(); ++i) {
+ Node::Children::const_iterator j(p->children.find(*i));
+ if (j == p->children.end()) {
+ break;
+ }
+ p = &j->second;
+ includes |= p->startInclude;
+ }
+ return p->children.empty() && !p->startInclude
+ ? CONTAINS_NOT
+ : includes ? CONTAINS_NODE : CONTAINS_SUBNODES;
+}
+
+}
diff --git a/configmgr/source/partial.hxx b/configmgr/source/partial.hxx
new file mode 100644
index 000000000000..39931448c66d
--- /dev/null
+++ b/configmgr/source/partial.hxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+*
+* 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_PARTIAL_HXX
+#define INCLUDED_CONFIGMGR_SOURCE_PARTIAL_HXX
+
+#include "sal/config.h"
+
+#include <map>
+#include <set>
+
+#include "boost/noncopyable.hpp"
+
+#include "path.hxx"
+
+namespace rtl { class OUString; }
+
+namespace configmgr {
+
+class Partial: private boost::noncopyable {
+public:
+ enum Containment { CONTAINS_NOT, CONTAINS_SUBNODES, CONTAINS_NODE };
+
+ Partial(
+ std::set< rtl::OUString > const & includedPaths,
+ std::set< rtl::OUString > const & excludedPaths);
+
+ ~Partial();
+
+ Containment contains(Path const & path) const;
+
+private:
+ struct Node {
+ typedef std::map< rtl::OUString, Node > Children;
+
+ Node(): startInclude(false) {}
+
+ Children children;
+ bool startInclude;
+ };
+
+ Node root_;
+};
+
+}
+
+#endif
diff --git a/configmgr/source/update.cxx b/configmgr/source/update.cxx
index ab711c3bec10..57f45068d954 100644
--- a/configmgr/source/update.cxx
+++ b/configmgr/source/update.cxx
@@ -28,6 +28,8 @@
#include "precompiled_configmgr.hxx"
#include "sal/config.h"
+#include <set>
+
#include "configmgr/update.hxx"
#include "osl/mutex.hxx"
#include "rtl/ref.hxx"
@@ -61,6 +63,23 @@ void insertExtensionXcuFile(bool shared, rtl::OUString const & fileUri) {
bc.send();
}
+void insertModificationXcuFile(
+ rtl::OUString const & fileUri,
+ std::set< rtl::OUString > const & includedPaths,
+ std::set< rtl::OUString > const & excludedPaths)
+{
+ Broadcaster bc;
+ {
+ osl::MutexGuard g(lock);
+ Modifications mods;
+ Components::getSingleton().insertModificationXcuFile(
+ fileUri, includedPaths, excludedPaths, &mods);
+ Components::getSingleton().initGlobalBroadcaster(
+ mods, rtl::Reference< RootAccess >(), &bc);
+ }
+ bc.send();
+}
+
}
}
diff --git a/configmgr/source/xcdparser.cxx b/configmgr/source/xcdparser.cxx
index 8306c692c30f..498254b35644 100644
--- a/configmgr/source/xcdparser.cxx
+++ b/configmgr/source/xcdparser.cxx
@@ -53,7 +53,7 @@ namespace css = com::sun::star;
}
-XcdParser::XcdParser(int layer, Dependencies const & dependencies, Data * data):
+XcdParser::XcdParser(int layer, Dependencies const & dependencies, Data & data):
layer_(layer), dependencies_(dependencies), data_(data), state_(STATE_START)
{}
@@ -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);
+ nestedParser_ = new XcuParser(layer_ + 1, data_, 0, 0);
nesting_ = 1;
return nestedParser_->startElement(reader, ns, name);
}
diff --git a/configmgr/source/xcdparser.hxx b/configmgr/source/xcdparser.hxx
index 2e35b3686e60..2ad8ecea7f93 100644
--- a/configmgr/source/xcdparser.hxx
+++ b/configmgr/source/xcdparser.hxx
@@ -47,7 +47,7 @@ class XcdParser: public Parser {
public:
typedef std::set< rtl::OUString > Dependencies;
- XcdParser(int layer, Dependencies const & dependencies, Data * data);
+ XcdParser(int layer, Dependencies const & dependencies, Data & data);
private:
virtual ~XcdParser();
@@ -66,7 +66,7 @@ private:
int layer_;
Dependencies const & dependencies_;
- Data * data_;
+ Data & data_;
State state_;
rtl::OUString dependency_;
rtl::Reference< Parser > nestedParser_;
diff --git a/configmgr/source/xcsparser.cxx b/configmgr/source/xcsparser.cxx
index 3fc719f00fe9..12e64ebbe171 100644
--- a/configmgr/source/xcsparser.cxx
+++ b/configmgr/source/xcsparser.cxx
@@ -119,7 +119,7 @@ void merge(
}
-XcsParser::XcsParser(int layer, Data * data):
+XcsParser::XcsParser(int layer, Data & data):
valueParser_(layer), data_(data), state_(STATE_START)
{}
@@ -279,9 +279,9 @@ void XcsParser::endElement(XmlReader const & reader) {
switch (state_) {
case STATE_TEMPLATES:
{
- NodeMap::iterator i(data_->templates.find(top.name));
- if (i == data_->templates.end()) {
- data_->templates.insert(
+ NodeMap::iterator i(data_.templates.find(top.name));
+ if (i == data_.templates.end()) {
+ data_.templates.insert(
NodeMap::value_type(top.name, top.node));
} else {
merge(i->second, top.node);
@@ -290,9 +290,9 @@ void XcsParser::endElement(XmlReader const & reader) {
break;
case STATE_COMPONENT:
{
- NodeMap::iterator i(data_->components.find(top.name));
- if (i == data_->components.end()) {
- data_->components.insert(
+ NodeMap::iterator i(data_.components.find(top.name));
+ if (i == data_.components.end()) {
+ data_.components.insert(
NodeMap::value_type(top.name, top.node));
} else {
merge(i->second, top.node);
@@ -443,7 +443,7 @@ void XcsParser::handleNodeRef(XmlReader & reader) {
css::uno::Reference< css::uno::XInterface >());
}
rtl::Reference< Node > tmpl(
- data_->getTemplate(
+ data_.getTemplate(
valueParser_.getLayer(),
xmldata::parseTemplateReference(
component, hasNodeType, nodeType, 0)));
diff --git a/configmgr/source/xcsparser.hxx b/configmgr/source/xcsparser.hxx
index 21a124945a2e..196add9a826a 100644
--- a/configmgr/source/xcsparser.hxx
+++ b/configmgr/source/xcsparser.hxx
@@ -48,7 +48,7 @@ struct Span;
class XcsParser: public Parser {
public:
- XcsParser(int layer, Data * data);
+ XcsParser(int layer, Data & data);
private:
virtual ~XcsParser();
@@ -94,7 +94,7 @@ private:
typedef std::stack< Element > ElementStack;
ValueParser valueParser_;
- Data * data_;
+ Data & data_;
rtl::OUString componentName_;
State state_;
long ignoring_;
diff --git a/configmgr/source/xcuparser.cxx b/configmgr/source/xcuparser.cxx
index 80dc501e9435..77b0f747f313 100644
--- a/configmgr/source/xcuparser.cxx
+++ b/configmgr/source/xcuparser.cxx
@@ -49,6 +49,7 @@
#include "modifications.hxx"
#include "node.hxx"
#include "nodemap.hxx"
+#include "partial.hxx"
#include "path.hxx"
#include "propertynode.hxx"
#include "setnode.hxx"
@@ -65,14 +66,15 @@ namespace css = com::sun::star;
}
-XcuParser::XcuParser(int layer, Data * data, Modifications * modifications):
- valueParser_(layer), data_(data), modifications_(modifications)
-{
- if (layer == Data::NO_LAYER) {
- OSL_ASSERT(modifications_ == 0);
- modifications_ = &data_->modifications;
- }
-}
+XcuParser::XcuParser(
+ int layer, Data & data, Partial const * partial,
+ Modifications * broadcastModifications):
+ valueParser_(layer), data_(data),
+ partial_(partial), broadcastModifications_(broadcastModifications),
+ recordModifications_(layer == Data::NO_LAYER),
+ trackPath_(
+ partial_ != 0 || broadcastModifications_ != 0 || recordModifications_)
+{}
XcuParser::~XcuParser() {}
@@ -105,7 +107,7 @@ bool XcuParser::startElement(
css::uno::Reference< css::uno::XInterface >());
}
} else if (state_.top().ignore) {
- state_.push(state_.top());
+ state_.push(State(false));
} else if (!state_.top().node.is()) {
if (ns == XmlReader::NAMESPACE_NONE &&
name.equals(RTL_CONSTASCII_STRINGPARAM("item")))
@@ -214,7 +216,7 @@ void XcuParser::endElement(XmlReader const &) {
return;
}
OSL_ASSERT(!state_.empty());
- bool ignore = state_.top().ignore;
+ bool pop = state_.top().pop;
rtl::Reference< Node > insert;
rtl::OUString name;
if (state_.top().insert) {
@@ -227,10 +229,10 @@ void XcuParser::endElement(XmlReader const &) {
OSL_ASSERT(!state_.empty() && state_.top().node.is());
state_.top().node->getMembers()[name] = insert;
}
- if (!ignore && !modificationPath_.empty()) {
- modificationPath_.pop_back();
+ if (pop && !path_.empty()) {
+ path_.pop_back();
// </item> will pop less than <item> pushed, but that is harmless,
- // as the next <item> will reset modificationPath_
+ // as the next <item> will reset path_
}
}
@@ -328,9 +330,18 @@ void XcuParser::handleComponentData(XmlReader & reader) {
}
componentName_ = xmldata::convertFromUtf8(
Span(buf.getStr(), buf.getLength()));
+ if (trackPath_) {
+ OSL_ASSERT(path_.empty());
+ path_.push_back(componentName_);
+ if (partial_ != 0 && partial_->contains(path_) == Partial::CONTAINS_NOT)
+ {
+ state_.push(State(true)); // ignored
+ return;
+ }
+ }
rtl::Reference< Node > node(
Data::findNode(
- valueParser_.getLayer(), data_->components, componentName_));
+ valueParser_.getLayer(), data_.components, componentName_));
if (!node.is()) {
OSL_TRACE(
"configmgr unknown component %s in %s",
@@ -338,7 +349,7 @@ void XcuParser::handleComponentData(XmlReader & reader) {
componentName_, RTL_TEXTENCODING_UTF8).getStr(),
rtl::OUStringToOString(
reader.getUrl(), RTL_TEXTENCODING_UTF8).getStr());
- state_.push(State()); // ignored
+ state_.push(State(true)); // ignored
return;
}
switch (op) {
@@ -358,10 +369,6 @@ void XcuParser::handleComponentData(XmlReader & reader) {
node->getFinalized());
node->setFinalized(finalizedLayer);
state_.push(State(node, finalizedLayer < valueParser_.getLayer()));
- if (modifications_ != 0) {
- OSL_ASSERT(modificationPath_.empty());
- modificationPath_.push_back(componentName_);
- }
}
void XcuParser::handleItem(XmlReader & reader) {
@@ -388,17 +395,27 @@ void XcuParser::handleItem(XmlReader & reader) {
rtl::OUString path(xmldata::convertFromUtf8(attrPath));
int finalizedLayer;
rtl::Reference< Node > node(
- data_->resolvePathRepresentation(
- path, &modificationPath_, &finalizedLayer));
+ data_.resolvePathRepresentation(path, &path_, &finalizedLayer));
if (!node.is()) {
OSL_TRACE(
"configmgr unknown item %s in %s",
rtl::OUStringToOString(path, RTL_TEXTENCODING_UTF8).getStr(),
rtl::OUStringToOString(
reader.getUrl(), RTL_TEXTENCODING_UTF8).getStr());
- state_.push(State()); // ignored
+ state_.push(State(true)); // ignored
return;
}
+ OSL_ASSERT(!path_.empty());
+ componentName_ = path_.front();
+ if (trackPath_) {
+ if (partial_ != 0 && partial_->contains(path_) == Partial::CONTAINS_NOT)
+ {
+ state_.push(State(true)); // ignored
+ return;
+ }
+ } else {
+ path_.clear();
+ }
switch (node->kind()) {
case Node::KIND_PROPERTY:
case Node::KIND_LOCALIZED_VALUE:
@@ -407,7 +424,7 @@ void XcuParser::handleItem(XmlReader & reader) {
rtl::OUStringToOString(path, RTL_TEXTENCODING_UTF8).getStr(),
rtl::OUStringToOString(
reader.getUrl(), RTL_TEXTENCODING_UTF8).getStr());
- state_.push(State()); // ignored
+ state_.push(State(true)); // ignored
return;
case Node::KIND_LOCALIZED_PROPERTY:
valueParser_.type_ = dynamic_cast< LocalizedPropertyNode * >(
@@ -416,11 +433,6 @@ void XcuParser::handleItem(XmlReader & reader) {
default:
break;
}
- OSL_ASSERT(!modificationPath_.empty());
- componentName_ = modificationPath_.front();
- if (modifications_ == 0) {
- modificationPath_.clear();
- }
state_.push(State(node, finalizedLayer < valueParser_.getLayer()));
}
@@ -496,13 +508,13 @@ void XcuParser::handlePropValue(XmlReader & reader, PropertyNode * prop) {
css::uno::Reference< css::uno::XInterface >());
}
prop->setValue(valueParser_.getLayer(), css::uno::Any());
- state_.push(State());
+ state_.push(State(false));
} else if (external.getLength() == 0) {
valueParser_.separator_ = separator;
valueParser_.start(prop);
} else {
prop->setExternal(valueParser_.getLayer(), external);
- state_.push(State());
+ state_.push(State(false));
}
}
@@ -559,11 +571,20 @@ void XcuParser::handleLocpropValue(
op = parseOperation(reader.getAttributeValue(true));
}
}
+ if (trackPath_) {
+ path_.push_back(name);
+ if (partial_ != 0 &&
+ partial_->contains(path_) != Partial::CONTAINS_NODE)
+ {
+ state_.push(State(true)); // ignored
+ return;
+ }
+ }
NodeMap::iterator i(locprop->getMembers().find(name));
if (i != locprop->getMembers().end() &&
i->second->getLayer() > valueParser_.getLayer())
{
- state_.push(State()); // ignored
+ state_.push(State(true)); // ignored
return;
}
if (nil && !locprop->isNillable()) {
@@ -576,23 +597,29 @@ void XcuParser::handleLocpropValue(
}
switch (op) {
case OPERATION_FUSE:
- if (nil) {
- if (i == locprop->getMembers().end()) {
- locprop->getMembers()[name] = new LocalizedValueNode(
- valueParser_.getLayer(), css::uno::Any());
+ {
+ bool pop = false;
+ if (nil) {
+ if (i == locprop->getMembers().end()) {
+ locprop->getMembers()[name] = new LocalizedValueNode(
+ valueParser_.getLayer(), css::uno::Any());
+ } else {
+ dynamic_cast< LocalizedValueNode * >(
+ i->second.get())->setValue(
+ valueParser_.getLayer(), css::uno::Any());
+ }
+ state_.push(State(true));
} else {
- dynamic_cast< LocalizedValueNode * >(i->second.get())->setValue(
- valueParser_.getLayer(), css::uno::Any());
+ valueParser_.separator_ = separator;
+ valueParser_.start(locprop, name);
+ pop = true;
+ }
+ if (trackPath_) {
+ recordModification();
+ if (pop) {
+ path_.pop_back();
+ }
}
- state_.push(State());
- } else {
- valueParser_.separator_ = separator;
- valueParser_.start(locprop, name);
- }
- if (modifications_ != 0) {
- modificationPath_.push_back(name);
- modifications_->add(modificationPath_);
- modificationPath_.pop_back();
}
break;
case OPERATION_REMOVE:
@@ -601,12 +628,8 @@ void XcuParser::handleLocpropValue(
if (i != locprop->getMembers().end()) {
locprop->getMembers().erase(i);
}
- state_.push(State());
- if (modifications_ != 0) {
- modificationPath_.push_back(name);
- modifications_->add(modificationPath_);
- modificationPath_.pop_back();
- }
+ state_.push(State(true));
+ recordModification();
break;
default:
throw css::uno::RuntimeException(
@@ -656,6 +679,17 @@ void XcuParser::handleGroupProp(XmlReader & reader, GroupNode * group) {
reader.getUrl()),
css::uno::Reference< css::uno::XInterface >());
}
+ if (trackPath_) {
+ path_.push_back(name);
+ //TODO: This ignores locprop values for which specific include paths
+ // exist (i.e., for which contains(locprop path) = CONTAINS_SUBNODES):
+ if (partial_ != 0 &&
+ partial_->contains(path_) != Partial::CONTAINS_NODE)
+ {
+ state_.push(State(true)); // ignored
+ return;
+ }
+ }
NodeMap::iterator i(group->getMembers().find(name));
if (i == group->getMembers().end()) {
handleUnknownGroupProp(reader, group, name, type, op, finalized);
@@ -707,10 +741,7 @@ void XcuParser::handleUnknownGroupProp(
prop->setFinalized(valueParser_.getLayer());
}
state_.push(State(prop, name, state_.top().locked));
- if (modifications_ != 0) {
- modificationPath_.push_back(name);
- modifications_->add(modificationPath_);
- }
+ recordModification();
break;
}
// fall through
@@ -720,7 +751,7 @@ void XcuParser::handleUnknownGroupProp(
rtl::OUStringToOString(name, RTL_TEXTENCODING_UTF8).getStr(),
rtl::OUStringToOString(
reader.getUrl(), RTL_TEXTENCODING_UTF8).getStr());
- state_.push(State());
+ state_.push(State(true)); // ignored
break;
}
}
@@ -733,7 +764,7 @@ void XcuParser::handlePlainGroupProp(
PropertyNode * property = dynamic_cast< PropertyNode * >(
propertyIndex->second.get());
if (property->getLayer() > valueParser_.getLayer()) {
- state_.push(State()); // ignored
+ state_.push(State(true)); // ignored
return;
}
int finalizedLayer = std::min(
@@ -760,10 +791,7 @@ void XcuParser::handlePlainGroupProp(
property,
(state_.top().locked ||
finalizedLayer < valueParser_.getLayer())));
- if (modifications_ != 0) {
- modificationPath_.push_back(name);
- modifications_->add(modificationPath_);
- }
+ recordModification();
break;
case OPERATION_REMOVE:
if (!property->isExtension()) {
@@ -776,12 +804,8 @@ void XcuParser::handlePlainGroupProp(
css::uno::Reference< css::uno::XInterface >());
}
group->getMembers().erase(propertyIndex);
- state_.push(State()); // ignore children
- if (modifications_ != 0) {
- modificationPath_.push_back(name);
- modifications_->add(modificationPath_);
- modificationPath_.pop_back();
- }
+ state_.push(State(true)); // ignore children
+ recordModification();
break;
}
}
@@ -791,7 +815,7 @@ void XcuParser::handleLocalizedGroupProp(
rtl::OUString const & name, Type type, Operation operation, bool finalized)
{
if (property->getLayer() > valueParser_.getLayer()) {
- state_.push(State()); // ignored
+ state_.push(State(true)); // ignored
return;
}
int finalizedLayer = std::min(
@@ -817,9 +841,6 @@ void XcuParser::handleLocalizedGroupProp(
property,
(state_.top().locked ||
finalizedLayer < valueParser_.getLayer())));
- if (modifications_ != 0) {
- modificationPath_.push_back(name);
- }
break;
case OPERATION_REPLACE:
{
@@ -833,10 +854,7 @@ void XcuParser::handleLocalizedGroupProp(
replacement, name,
(state_.top().locked ||
finalizedLayer < valueParser_.getLayer())));
- if (modifications_ != 0) {
- modificationPath_.push_back(name);
- modifications_->add(modificationPath_);
- }
+ recordModification();
}
break;
case OPERATION_REMOVE:
@@ -885,6 +903,14 @@ void XcuParser::handleGroupNode(
reader.getUrl()),
css::uno::Reference< css::uno::XInterface >());
}
+ if (trackPath_) {
+ path_.push_back(name);
+ if (partial_ != 0 && partial_->contains(path_) == Partial::CONTAINS_NOT)
+ {
+ state_.push(State(true)); // ignored
+ return;
+ }
+ }
rtl::Reference< Node > child(
Data::findNode(valueParser_.getLayer(), group->getMembers(), name));
if (!child.is()) {
@@ -893,7 +919,7 @@ void XcuParser::handleGroupNode(
rtl::OUStringToOString(name, RTL_TEXTENCODING_UTF8).getStr(),
rtl::OUStringToOString(
reader.getUrl(), RTL_TEXTENCODING_UTF8).getStr());
- state_.push(State()); // ignored
+ state_.push(State(true)); // ignored
return;
}
if (op != OPERATION_MODIFY && op != OPERATION_FUSE) {
@@ -912,9 +938,6 @@ void XcuParser::handleGroupNode(
State(
child,
state_.top().locked || finalizedLayer < valueParser_.getLayer()));
- if (modifications_ != 0) {
- modificationPath_.push_back(name);
- }
}
void XcuParser::handleSetNode(XmlReader & reader, SetNode * set) {
@@ -969,6 +992,14 @@ void XcuParser::handleSetNode(XmlReader & reader, SetNode * set) {
reader.getUrl()),
css::uno::Reference< css::uno::XInterface >());
}
+ if (trackPath_) {
+ path_.push_back(name);
+ if (partial_ != 0 && partial_->contains(path_) == Partial::CONTAINS_NOT)
+ {
+ state_.push(State(true)); // ignored
+ return;
+ }
+ }
rtl::OUString templateName(
xmldata::parseTemplateReference(
component, hasNodeType, nodeType, &set->getDefaultTemplateName()));
@@ -983,7 +1014,7 @@ void XcuParser::handleSetNode(XmlReader & reader, SetNode * set) {
css::uno::Reference< css::uno::XInterface >());
}
rtl::Reference< Node > tmpl(
- data_->getTemplate(valueParser_.getLayer(), templateName));
+ data_.getTemplate(valueParser_.getLayer(), templateName));
if (!tmpl.is()) {
throw css::uno::RuntimeException(
(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("set member node ")) +
@@ -1004,7 +1035,7 @@ void XcuParser::handleSetNode(XmlReader & reader, SetNode * set) {
mandatoryLayer = std::min(mandatoryLayer, i->second->getMandatory());
i->second->setMandatory(mandatoryLayer);
if (i->second->getLayer() > valueParser_.getLayer()) {
- state_.push(State()); // ignored
+ state_.push(State(true)); // ignored
return;
}
}
@@ -1012,48 +1043,39 @@ void XcuParser::handleSetNode(XmlReader & reader, SetNode * set) {
case OPERATION_MODIFY:
if (i == set->getMembers().end()) {
OSL_TRACE("ignoring modify of unknown set member node");
- state_.push(State());
+ state_.push(State(true)); // ignored
} else {
state_.push(
State(
i->second,
(state_.top().locked ||
finalizedLayer < valueParser_.getLayer())));
- if (modifications_ != 0) {
- modificationPath_.push_back(name);
- }
}
break;
case OPERATION_REPLACE:
if (state_.top().locked || finalizedLayer < valueParser_.getLayer()) {
- state_.push(State()); // ignored
+ state_.push(State(true)); // ignored
} else {
rtl::Reference< Node > member(tmpl->clone());
member->setLayer(valueParser_.getLayer());
member->setFinalized(finalizedLayer);
member->setMandatory(mandatoryLayer);
state_.push(State(member, name, false));
- if (modifications_ != 0) {
- modificationPath_.push_back(name);
- modifications_->add(modificationPath_);
- }
+ recordModification();
}
break;
case OPERATION_FUSE:
if (i == set->getMembers().end()) {
if (state_.top().locked || finalizedLayer < valueParser_.getLayer())
{
- state_.push(State()); // ignored
+ state_.push(State(true)); // ignored
} else {
rtl::Reference< Node > member(tmpl->clone());
member->setLayer(valueParser_.getLayer());
member->setFinalized(finalizedLayer);
member->setMandatory(mandatoryLayer);
state_.push(State(member, name, false));
- if (modifications_ != 0) {
- modificationPath_.push_back(name);
- modifications_->add(modificationPath_);
- }
+ recordModification();
}
} else {
state_.push(
@@ -1061,9 +1083,6 @@ void XcuParser::handleSetNode(XmlReader & reader, SetNode * set) {
i->second,
(state_.top().locked ||
finalizedLayer < valueParser_.getLayer())));
- if (modifications_ != 0) {
- modificationPath_.push_back(name);
- }
}
break;
case OPERATION_REMOVE:
@@ -1075,14 +1094,19 @@ void XcuParser::handleSetNode(XmlReader & reader, SetNode * set) {
{
set->getMembers().erase(i);
}
- state_.push(State());
- if (modifications_ != 0) {
- modificationPath_.push_back(name);
- modifications_->add(modificationPath_);
- modificationPath_.pop_back();
- }
+ state_.push(State(true));
+ recordModification();
break;
}
}
+void XcuParser::recordModification() {
+ if (broadcastModifications_ != 0) {
+ broadcastModifications_->add(path_);
+ }
+ if (recordModifications_) {
+ data_.modifications.add(path_);
+ }
+}
+
}
diff --git a/configmgr/source/xcuparser.hxx b/configmgr/source/xcuparser.hxx
index 21806edebe9c..64108451b4ef 100644
--- a/configmgr/source/xcuparser.hxx
+++ b/configmgr/source/xcuparser.hxx
@@ -49,6 +49,7 @@ namespace configmgr {
class GroupNode;
class LocalizedPropertyNode;
class Modifications;
+class Partial;
class PropertyNode;
class SetNode;
struct Data;
@@ -56,7 +57,9 @@ struct Span;
class XcuParser: public Parser {
public:
- XcuParser(int layer, Data * data, Modifications * modifications);
+ XcuParser(
+ int layer, Data & data, Partial const * partial,
+ Modifications * broadcastModifications);
private:
virtual ~XcuParser();
@@ -105,36 +108,44 @@ private:
void handleSetNode(XmlReader & reader, SetNode * set);
+ void recordModification();
+
struct State {
rtl::Reference< Node > node; // empty iff ignore or <items>
rtl::OUString name; // empty and ignored if !insert
bool ignore;
bool insert;
bool locked;
+ bool pop;
- inline State(): ignore(true), insert(false), locked(false) {}
+ inline State(bool thePop):
+ ignore(true), insert(false), locked(false), pop(thePop)
+ {}
inline State(rtl::Reference< Node > const & theNode, bool theLocked):
- node(theNode), ignore(false), insert(false), locked(theLocked)
+ node(theNode), ignore(false), insert(false), locked(theLocked),
+ pop(true)
{}
inline State(
rtl::Reference< Node > const & theNode,
rtl::OUString const & theName, bool theLocked):
node(theNode), name(theName), ignore(false), insert(true),
- locked(theLocked)
+ locked(theLocked), pop(true)
{}
};
typedef std::stack< State > StateStack;
ValueParser valueParser_;
- Data * data_;
- Modifications * modifications_;
+ Data & data_;
+ Partial const * partial_;
+ Modifications * broadcastModifications_;
+ bool recordModifications_;
+ bool trackPath_;
rtl::OUString componentName_;
StateStack state_;
- Path modificationPath_;
- rtl::OUString path_;
+ Path path_;
};
}
diff --git a/desktop/source/app/makefile.mk b/desktop/source/app/makefile.mk
index d9db7c163481..83bec9011283 100644
--- a/desktop/source/app/makefile.mk
+++ b/desktop/source/app/makefile.mk
@@ -65,6 +65,7 @@ SHL1LIBS = $(SLB)$/mig.lib
SHL1STDLIBS = \
$(COMPHELPERLIB) \
+ $(CONFIGMGRLIB) \
$(CPPUHELPERLIB) \
$(CPPULIB) \
$(I18NISOLANGLIB) \
diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx
index 250fe58841f8..fd6193187402 100644
--- a/desktop/source/migration/migration.cxx
+++ b/desktop/source/migration/migration.cxx
@@ -28,14 +28,19 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_desktop.hxx"
+#include <map>
+#include <set>
+
#include "migration.hxx"
#include "migration_impl.hxx"
#include "cfgfilter.hxx"
#include <unotools/textsearch.hxx>
#include <comphelper/processfactory.hxx>
+#include <configmgr/update.hxx>
#include <unotools/bootstrap.hxx>
#include <rtl/bootstrap.hxx>
+#include <rtl/uri.hxx>
#include <tools/config.hxx>
#include <i18npool/lang.h>
#include <tools/urlobj.hxx>
@@ -143,7 +148,6 @@ MigrationImpl::MigrationImpl(const uno::Reference< XMultiServiceFactory >& xFact
, m_vrMigrations(readMigrationSteps())
, m_aInfo(findInstallation())
, m_vrFileList(compileFileList())
- , m_vrServiceList(compileServiceList())
{
}
@@ -159,9 +163,7 @@ sal_Bool MigrationImpl::doMigration()
copyFiles();
// execute the migration items from Setup.xcu
- // and refresh the cache
copyConfig();
- refresh();
// execute custom migration services from Setup.xcu
// and refresh the cache
@@ -273,14 +275,6 @@ migrations_vr MigrationImpl::readMigrationSteps()
tmpStep.excludeConfig.push_back(tmpSeq[j]);
}
- // config components
- if (tmpAccess->getByName(OUString::createFromAscii("ServiceConfigComponents")) >>= tmpSeq)
- {
- for (sal_Int32 j=0; j<tmpSeq.getLength(); j++)
- tmpStep.configComponents.push_back(tmpSeq[j]);
- }
-
-
// generic service
tmpAccess->getByName(OUString::createFromAscii("MigrationService")) >>= tmpStep.service;
@@ -445,80 +439,88 @@ strings_vr MigrationImpl::compileFileList()
return vrResult;
}
+namespace {
-void MigrationImpl::copyConfig()
-{
- try {
- // 1. get a list of all components from hierachy browser
- uno::Reference< XJob > xBrowser(m_xFactory->createInstance(
- OUString::createFromAscii("com.sun.star.configuration.backend.LocalHierarchyBrowser")), uno::UNO_QUERY_THROW);
-
- uno::Sequence< NamedValue > seqArgs(2);
- seqArgs[0] = NamedValue(
- OUString::createFromAscii("LayerDataUrl"),
- uno::makeAny(m_aInfo.userdata + OUString::createFromAscii("/user/registry")));
- seqArgs[1] = NamedValue(
- OUString::createFromAscii("FetchComponentNames"),
- uno::makeAny(sal_True));
-
- // execute the search
- uno::Any aResult = xBrowser->execute(seqArgs);
- uno::Sequence< OUString > seqComponents;
- aResult >>= seqComponents;
- OSL_ENSURE(seqComponents.getLength()>0, "MigrationImpl::copyConfig(): no config components available");
-
- // 2. create an importer
- uno::Reference< XJob > xImporter(m_xFactory->createInstance(
- OUString::createFromAscii("com.sun.star.configuration.backend.LocalDataImporter")), uno::UNO_QUERY_THROW);
-
- // 3. for each migration step...
- uno::Sequence< NamedValue > importerArgs(3);
- importerArgs[0] = NamedValue(
- OUString::createFromAscii("LayerDataUrl"),
- uno::makeAny(m_aInfo.userdata + OUString::createFromAscii("/user/registry")));
- importerArgs[1] = NamedValue(
- OUString::createFromAscii("LayerFilter"),
- uno::Any());
- importerArgs[2] = NamedValue(
- OUString::createFromAscii("Component"),
- uno::Any());
-
- migrations_v::const_iterator i_mig = m_vrMigrations->begin();
- while (i_mig != m_vrMigrations->end())
- {
- // a. create config filter for step
- uno::Reference< XInitialization > xFilter(
- new CConfigFilter(&(i_mig->includeConfig), &(i_mig->excludeConfig)));
- importerArgs[1].Value = uno::makeAny(xFilter);
+struct componentParts {
+ std::set< rtl::OUString > includedPaths;
+ std::set< rtl::OUString > excludedPaths;
+};
- // b. run each importer with config filter
- for (sal_Int32 i=0; i<seqComponents.getLength(); i++)
- {
- OUString component = seqComponents[i];
- importerArgs[2].Value = uno::makeAny(seqComponents[i]);
- try {
- aResult = xImporter->execute(importerArgs);
- Exception myException;
- if (aResult >>= myException) throw myException;
- } catch(Exception& aException) {
- OString aMsg("Exception in config layer import.\ncomponent: ");
- aMsg += OUStringToOString(seqComponents[i], RTL_TEXTENCODING_ASCII_US);
- aMsg += "\nmessage: ";
- aMsg += OUStringToOString(aException.Message, RTL_TEXTENCODING_ASCII_US);
- OSL_ENSURE(sal_False, aMsg.getStr());
- }
+typedef std::map< rtl::OUString, componentParts > Components;
+
+bool getComponent(rtl::OUString const & path, rtl::OUString * component) {
+ OSL_ASSERT(component != 0);
+ if (path.getLength() == 0 || path[0] != '/') {
+ OSL_TRACE(
+ ("configuration migration in/exclude path %s ignored (does not"
+ " start with slash)"),
+ rtl::OUStringToOString(path, RTL_TEXTENCODING_UTF8).getStr());
+ return false;
+ }
+ sal_Int32 i = path.indexOf('/', 1);
+ *component = i < 0 ? path.copy(1) : path.copy(1, i - 1);
+ return true;
+}
+
+}
+
+void MigrationImpl::copyConfig() {
+ Components comps;
+ for (migrations_v::const_iterator i(m_vrMigrations->begin());
+ i != m_vrMigrations->end(); ++i)
+ {
+ for (strings_v::const_iterator j(i->includeConfig.begin());
+ j != i->includeConfig.end(); ++j)
+ {
+ rtl::OUString comp;
+ if (getComponent(*j, &comp)) {
+ comps[comp].includedPaths.insert(*j);
+ }
+ }
+ for (strings_v::const_iterator j(i->excludeConfig.begin());
+ j != i->excludeConfig.end(); ++j)
+ {
+ rtl::OUString comp;
+ if (getComponent(*j, &comp)) {
+ comps[comp].excludedPaths.insert(*j);
}
- i_mig++;
}
}
- catch (Exception& e)
- {
- OString aMsg("Exception in config layer import.\nmessage: ");
- aMsg += OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US);
- OSL_ENSURE(sal_False, aMsg.getStr());
+ for (Components::const_iterator i(comps.begin()); i != comps.end(); ++i) {
+ if (!i->second.includedPaths.empty()) {
+ rtl::OUStringBuffer buf(m_aInfo.userdata);
+ buf.appendAscii(RTL_CONSTASCII_STRINGPARAM("/user/registry/data"));
+ sal_Int32 n = 0;
+ do {
+ rtl::OUString seg(i->first.getToken(0, '.', n));
+ rtl::OUString enc(
+ rtl::Uri::encode(
+ seg, rtl_UriCharClassPchar, rtl_UriEncodeStrict,
+ RTL_TEXTENCODING_UTF8));
+ if (enc.getLength() == 0 && seg.getLength() != 0) {
+ OSL_TRACE(
+ ("configuration migration component %s ignored (cannot"
+ " be encoded as file path)"),
+ rtl::OUStringToOString(
+ i->first, RTL_TEXTENCODING_UTF8).getStr());
+ goto next;
+ }
+ buf.append(sal_Unicode('/'));
+ buf.append(enc);
+ } while (n >= 0);
+ buf.appendAscii(RTL_CONSTASCII_STRINGPARAM(".xcu"));
+ configmgr::update::insertModificationXcuFile(
+ buf.makeStringAndClear(), i->second.includedPaths,
+ i->second.excludedPaths);
+ } else {
+ OSL_TRACE(
+ ("configuration migration component %s ignored (only excludes,"
+ " no includes)"),
+ rtl::OUStringToOString(
+ i->first, RTL_TEXTENCODING_UTF8).getStr());
+ }
+ next:;
}
-
-
}
// removes elements of vector 2 in vector 1
@@ -637,7 +639,7 @@ void MigrationImpl::runServices()
aStratumSvc, stratumArgs), uno::UNO_QUERY);
// Build argument array
- uno::Sequence< uno::Any > seqArguments(3);
+ uno::Sequence< uno::Any > seqArguments(2);
seqArguments[0] = uno::makeAny(NamedValue(
OUString::createFromAscii("Productname"),
uno::makeAny(m_aInfo.productname)));
@@ -658,26 +660,6 @@ void MigrationImpl::runServices()
try
{
- // create access to old configuration components in the user layer
- // that were requested by the migration service
- uno::Sequence< NamedValue > seqComponents(i_mig->configComponents.size());
- strings_v::const_iterator i_comp = i_mig->configComponents.begin();
- sal_Int32 i = 0;
- while (i_comp != i_mig->configComponents.end() && xStartum.is())
- {
- // create Layer for i_comp
- seqComponents[i] = NamedValue(
- *i_comp, uno::makeAny(xStartum->getLayer(*i_comp, OUString())));
-
- // next component
- i_comp++;
- i++;
- }
- // set old config argument
- seqArguments[2] = uno::makeAny(NamedValue(
- OUString::createFromAscii("OldConfiguration"),
- uno::makeAny(seqComponents)));
-
xMigrationJob = uno::Reference< XJob >(m_xFactory->createInstanceWithArguments(
i_mig->service, seqArguments), uno::UNO_QUERY_THROW);
@@ -703,17 +685,4 @@ void MigrationImpl::runServices()
}
}
-
-strings_vr MigrationImpl::compileServiceList()
-{
- strings_vr vrResult(new strings_v);
- migrations_v::const_iterator i_migr = m_vrMigrations->begin();
- while (i_migr != m_vrMigrations->end())
- {
- vrResult->push_back(i_migr->service);
- i_migr++;
- }
- return vrResult;
-}
-
} // namespace desktop
diff --git a/desktop/source/migration/migration_impl.hxx b/desktop/source/migration/migration_impl.hxx
index 95b0c3535a80..8077f92a6d19 100644
--- a/desktop/source/migration/migration_impl.hxx
+++ b/desktop/source/migration/migration_impl.hxx
@@ -64,7 +64,6 @@ struct migration_step
strings_v excludeFiles;
strings_v includeConfig;
strings_v excludeConfig;
- strings_v configComponents;
rtl::OUString service;
};
@@ -80,15 +79,11 @@ private:
migrations_vr m_vrMigrations; // list of all migration specs from config
install_info m_aInfo; // info about the version being migrated
strings_vr m_vrFileList; // final list of files to be copied
- strings_vr m_vrConfigList; // final list of nodes to be copied
- strings_vr m_vrServiceList; // final list of services to be called
// initializer functions...
migrations_vr readMigrationSteps();
install_info findInstallation();
strings_vr compileFileList();
- strings_vr compileConfigList();
- strings_vr compileServiceList();
// helpers
void substract(strings_v& va, const strings_v& vb_c) const;
diff --git a/desktop/source/splash/makefile.mk b/desktop/source/splash/makefile.mk
index 518ccc11ad0c..d91c9f3d83ba 100644
--- a/desktop/source/splash/makefile.mk
+++ b/desktop/source/splash/makefile.mk
@@ -63,6 +63,7 @@ SHL1STDLIBS= \
$(SVLLIB) \
$(SVTOOLLIB) \
$(COMPHELPERLIB) \
+ $(CONFIGMGRLIB) \
$(UNOTOOLSLIB) \
$(TOOLSLIB) \
$(UCBHELPERLIB) \
diff --git a/officecfg/registry/data/org/openoffice/Setup.xcu b/officecfg/registry/data/org/openoffice/Setup.xcu
index 6720ab5c37a3..bc34875bc47d 100644
--- a/officecfg/registry/data/org/openoffice/Setup.xcu
+++ b/officecfg/registry/data/org/openoffice/Setup.xcu
@@ -762,14 +762,14 @@
<prop oor:name="ExcludedFiles">
</prop>
<prop oor:name="IncludedNodes">
- <value>org.openoffice.Office.DataAccess</value>
+ <value>/org.openoffice.Office.DataAccess</value>
</prop>
<prop oor:name="ExcludedNodes">
<value>
- <it>org.openoffice.Office.DataAccess/Bibliography</it>
- <it>org.openoffice.Office.DataAccess/ConnectionPool</it>
- <it>org.openoffice.Office.DataAccess/DataSources</it>
- <it>org.openoffice.Office.DataAccess/DriverManager</it>
+ <it>/org.openoffice.Office.DataAccess/Bibliography</it>
+ <it>/org.openoffice.Office.DataAccess/ConnectionPool</it>
+ <it>/org.openoffice.Office.DataAccess/DataSources</it>
+ <it>/org.openoffice.Office.DataAccess/DriverManager</it>
</value>
</prop>
</node>
@@ -780,7 +780,7 @@
</node>
<node oor:name="Inet" oor:op="replace">
<prop oor:name="IncludedNodes">
- <value>org.openoffice.Inet</value>
+ <value>/org.openoffice.Inet</value>
</prop>
</node>
<node oor:name="Basic" oor:op="replace">
@@ -790,7 +790,7 @@
</node>
<node oor:name="UserProfile" oor:op="replace">
<prop oor:name="IncludedNodes">
- <value>org.openoffice.UserProfile</value>
+ <value>/org.openoffice.UserProfile</value>
</prop>
</node>
<node oor:name="Common" oor:op="replace">
@@ -807,77 +807,77 @@
</prop>
<prop oor:name="IncludedNodes">
<value>
- <it>org.openoffice.Office.Compatibility</it>
- <it>org.openoffice.Office.Custom</it>
- <it>org.openoffice.Office.Embedding</it>
- <it>org.openoffice.Office.Events</it>
- <it>org.openoffice.Office.ExtendedColorScheme</it>
- <it>org.openoffice.Office.Common/Accessibility</it>
- <it>org.openoffice.Office.Common/Accessibility/AutoDetectSystemHC</it>
- <it>org.openoffice.Office.Common/AsianLayout</it>
- <it>org.openoffice.Office.Common/AutoCorrect</it>
- <it>org.openoffice.Office.Common/Cache</it>
- <it>org.openoffice.Office.Common/DateFormat</it>
- <it>org.openoffice.Office.Common/ExternalMailer/Program</it>
- <it>org.openoffice.Office.Common/Filter</it>
- <it>org.openoffice.Office.Common/Font</it>
- <it>org.openoffice.Office.Common/Forms</it>
- <it>org.openoffice.Office.Common/Gallery</it>
- <it>org.openoffice.Office.Common/Help</it>
- <it>org.openoffice.Office.Common/History</it>
- <it>org.openoffice.Office.Common/I18N</it>
- <it>org.openoffice.Office.Common/InternalMSExport</it>
- <it>org.openoffice.Office.Common/Load</it>
- <it>org.openoffice.Office.Common/Misc/FormControlPilotsEnabled</it>
- <it>org.openoffice.Office.Common/Misc/PluginsEnabled</it>
- <it>org.openoffice.Office.Common/Misc/SymbolSet</it>
- <it>org.openoffice.Office.Common/Misc/UseSystemFileDialog</it>
- <it>org.openoffice.Office.Common/Misc/UseSystemPrintDialog</it>
- <it>org.openoffice.Office.Common/Misc/SymbolStyle</it>
- <it>org.openoffice.Office.Common/Passwords</it>
- <it>org.openoffice.Office.Common/Print/PrintingModifiesDocument</it>
- <it>org.openoffice.Office.Common/Print/Warning</it>
- <it>org.openoffice.Office.Common/Vectorize</it>
- <it>org.openoffice.Office.Common/Save</it>
- <it>org.openoffice.Office.Common/SearchOptions</it>
- <it>org.openoffice.Office.Common/Undo</it>
- <it>org.openoffice.Office.Common/View/Dialog/Dialog/MiddleMouseButton</it>
- <it>org.openoffice.Office.Common/View/Dialog/MousePositioning</it>
- <it>org.openoffice.Office.Common/View/Localization</it>
- <it>org.openoffice.Office.Common/View/Menu</it>
- <it>org.openoffice.Office.Common/_3D_Engine</it>
+ <it>/org.openoffice.Office.Compatibility</it>
+ <it>/org.openoffice.Office.Custom</it>
+ <it>/org.openoffice.Office.Embedding</it>
+ <it>/org.openoffice.Office.Events</it>
+ <it>/org.openoffice.Office.ExtendedColorScheme</it>
+ <it>/org.openoffice.Office.Common/Accessibility</it>
+ <it>/org.openoffice.Office.Common/Accessibility/AutoDetectSystemHC</it>
+ <it>/org.openoffice.Office.Common/AsianLayout</it>
+ <it>/org.openoffice.Office.Common/AutoCorrect</it>
+ <it>/org.openoffice.Office.Common/Cache</it>
+ <it>/org.openoffice.Office.Common/DateFormat</it>
+ <it>/org.openoffice.Office.Common/ExternalMailer/Program</it>
+ <it>/org.openoffice.Office.Common/Filter</it>
+ <it>/org.openoffice.Office.Common/Font</it>
+ <it>/org.openoffice.Office.Common/Forms</it>
+ <it>/org.openoffice.Office.Common/Gallery</it>
+ <it>/org.openoffice.Office.Common/Help</it>
+ <it>/org.openoffice.Office.Common/History</it>
+ <it>/org.openoffice.Office.Common/I18N</it>
+ <it>/org.openoffice.Office.Common/InternalMSExport</it>
+ <it>/org.openoffice.Office.Common/Load</it>
+ <it>/org.openoffice.Office.Common/Misc/FormControlPilotsEnabled</it>
+ <it>/org.openoffice.Office.Common/Misc/PluginsEnabled</it>
+ <it>/org.openoffice.Office.Common/Misc/SymbolSet</it>
+ <it>/org.openoffice.Office.Common/Misc/UseSystemFileDialog</it>
+ <it>/org.openoffice.Office.Common/Misc/UseSystemPrintDialog</it>
+ <it>/org.openoffice.Office.Common/Misc/SymbolStyle</it>
+ <it>/org.openoffice.Office.Common/Passwords</it>
+ <it>/org.openoffice.Office.Common/Print/PrintingModifiesDocument</it>
+ <it>/org.openoffice.Office.Common/Print/Warning</it>
+ <it>/org.openoffice.Office.Common/Vectorize</it>
+ <it>/org.openoffice.Office.Common/Save</it>
+ <it>/org.openoffice.Office.Common/SearchOptions</it>
+ <it>/org.openoffice.Office.Common/Undo</it>
+ <it>/org.openoffice.Office.Common/View/Dialog/Dialog/MiddleMouseButton</it>
+ <it>/org.openoffice.Office.Common/View/Dialog/MousePositioning</it>
+ <it>/org.openoffice.Office.Common/View/Localization</it>
+ <it>/org.openoffice.Office.Common/View/Menu</it>
+ <it>/org.openoffice.Office.Common/_3D_Engine</it>
</value>
</prop>
<prop oor:name="ExcludedNodes">
<value>
- <it>org.openoffice.Office.Common/_3D_Engine/OpenGL</it>
- <it>org.openoffice.Office.Common/Help/Registration</it>
+ <it>/org.openoffice.Office.Common/_3D_Engine/OpenGL</it>
+ <it>/org.openoffice.Office.Common/Help/Registration</it>
</value>
</prop>
</node>
<node oor:name="Calc" oor:op="replace">
<prop oor:name="IncludedNodes">
- <value>org.openoffice.Office.Calc</value>
+ <value>/org.openoffice.Office.Calc</value>
</prop>
</node>
<node oor:name="Chart" oor:op="replace">
<prop oor:name="IncludedNodes">
- <value>org.openoffice.Office.Chart</value>
+ <value>/org.openoffice.Office.Chart</value>
</prop>
</node>
<node oor:name="Draw" oor:op="replace">
<prop oor:name="IncludedNodes">
- <value>org.openoffice.Office.Draw</value>
+ <value>/org.openoffice.Office.Draw</value>
</prop>
</node>
<node oor:name="Impress" oor:op="replace">
<prop oor:name="IncludedNodes">
- <value>org.openoffice.Office.Impress</value>
+ <value>/org.openoffice.Office.Impress</value>
</prop>
</node>
<node oor:name="Labels" oor:op="replace">
<prop oor:name="IncludedNodes">
- <value>org.openoffice.Office.Labels</value>
+ <value>/org.openoffice.Office.Labels</value>
</prop>
</node>
<node oor:name="Linguistic" oor:op="replace">
@@ -885,37 +885,37 @@
<value>com.sun.star.migration.Wordbooks</value>
</prop>
<prop oor:name="IncludedNodes">
- <value>org.openoffice.Office.Linguistic</value>
- </prop>
- <prop oor:name="ExcludedNodes">
- <value>org.openoffice.Office.Linguistic/ServiceManager</value>
+ <value>/org.openoffice.Office.Linguistic</value>
+ </prop>
+ <prop oor:name="ExcludedNodes">
+ <value>/org.openoffice.Office.Linguistic/ServiceManager</value>
</prop>
</node>
<node oor:name="Math" oor:op="replace">
<prop oor:name="IncludedNodes">
- <value>org.openoffice.Office.Math</value>
+ <value>/org.openoffice.Office.Math</value>
</prop>
</node>
<node oor:name="Security" oor:op="replace">
<prop oor:name="IncludedNodes">
- <value>org.openoffice.Office.Security</value>
+ <value>/org.openoffice.Office.Security</value>
</prop>
</node>
<node oor:name="UI" oor:op="replace">
<prop oor:name="IncludedNodes">
- <value>org.openoffice.Office.UI/ColorScheme</value>
+ <value>/org.openoffice.Office.UI/ColorScheme</value>
</prop>
</node>
<node oor:name="Writer" oor:op="replace">
<prop oor:name="IncludedNodes">
<value>
- <it>org.openoffice.Office.Writer</it>
- <it>org.openoffice.Office.WriterWeb</it>
+ <it>/org.openoffice.Office.Writer</it>
+ <it>/org.openoffice.Office.WriterWeb</it>
</value>
</prop>
<prop oor:name="ExcludedNodes">
- <value>org.openoffice.Office.Writer/Wizard</value>
- </prop>
+ <value>/org.openoffice.Office.Writer/Wizard</value>
+ </prop>
</node>
</node>
</node>
diff --git a/officecfg/registry/schema/org/openoffice/Setup.xcs b/officecfg/registry/schema/org/openoffice/Setup.xcs
index 9e5551bda18a..69e54c347a31 100644
--- a/officecfg/registry/schema/org/openoffice/Setup.xcs
+++ b/officecfg/registry/schema/org/openoffice/Setup.xcs
@@ -55,12 +55,6 @@
<desc>an optional uno service that is called after files and nodes have been copied in order to perform custom migration actions. The service needs to support XInitializable and XJob interfaces according do http://specs.openoffice.org/appwide/migration/spec_migration.sxw</desc>
</info>
</prop>
- <prop oor:name="ServiceConfigComponents" oor:type="oor:string-list">
- <info>
- <author>LO</author>
- <desc>a list of config components that are to be passed to service</desc>
- </info>
- </prop>
<prop oor:name="IncludedFiles" oor:type="oor:string-list">
<info>
<author>LO</author>