summaryrefslogtreecommitdiff
path: root/configmgr
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-04-16 11:36:30 +0200
committerFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-04-16 11:36:30 +0200
commit7562a4ff0ce5f3778f91edc1e2d20a9537dea5fd (patch)
tree99a0fa64a82c3b077f749bf19b14e97554aecce5 /configmgr
parentc7041d330ec2115a9f2252cc04070e3485a1d6c9 (diff)
slidecopy: (patch by SB) for compatibility with the old implementation, let getHierarchicalName return the absolute node path
Diffstat (limited to 'configmgr')
-rw-r--r--configmgr/source/access.cxx14
-rw-r--r--configmgr/source/components.cxx7
-rw-r--r--configmgr/source/components.hxx5
-rw-r--r--configmgr/source/data.cxx14
-rw-r--r--configmgr/source/data.hxx5
-rw-r--r--configmgr/source/rootaccess.cxx11
-rw-r--r--configmgr/source/rootaccess.hxx2
-rw-r--r--configmgr/source/xcuparser.cxx2
8 files changed, 47 insertions, 13 deletions
diff --git a/configmgr/source/access.cxx b/configmgr/source/access.cxx
index 7af9c1f8d9..e8c6f835e8 100644
--- a/configmgr/source/access.cxx
+++ b/configmgr/source/access.cxx
@@ -1229,7 +1229,19 @@ rtl::OUString Access::getHierarchicalName() throw (css::uno::RuntimeException) {
OSL_ASSERT(thisIs(IS_ANY));
osl::MutexGuard g(lock);
checkLocalizedPropertyAccess();
- return getRelativePathRepresentation();
+ // For backwards compatibility, return an absolute path representation where
+ // available:
+ rtl::OUStringBuffer path;
+ rtl::Reference< RootAccess > root(getRootAccess());
+ if (root.is()) {
+ path.append(root->getAbsolutePathRepresentation());
+ }
+ rtl::OUString rel(getRelativePathRepresentation());
+ if (path.getLength() != 0 && rel.getLength() != 0) {
+ path.append(sal_Unicode('/'));
+ }
+ path.append(rel);
+ return path.makeStringAndClear();
}
rtl::OUString Access::composeHierarchicalName(
diff --git a/configmgr/source/components.cxx b/configmgr/source/components.cxx
index 51a1a6547d..187eeee2e4 100644
--- a/configmgr/source/components.cxx
+++ b/configmgr/source/components.cxx
@@ -143,11 +143,12 @@ bool Components::allLocales(rtl::OUString const & locale) {
}
rtl::Reference< Node > Components::resolvePathRepresentation(
- rtl::OUString const & pathRepresentation, Path * path,
- int * finalizedLayer) const
+ rtl::OUString const & pathRepresentation,
+ rtl::OUString * canonicRepresentation, Path * path, int * finalizedLayer)
+ const
{
return data_.resolvePathRepresentation(
- pathRepresentation, path, finalizedLayer);
+ pathRepresentation, canonicRepresentation, path, finalizedLayer);
}
rtl::Reference< Node > Components::getTemplate(
diff --git a/configmgr/source/components.hxx b/configmgr/source/components.hxx
index 8523b02cbb..cdf4bdbaeb 100644
--- a/configmgr/source/components.hxx
+++ b/configmgr/source/components.hxx
@@ -71,8 +71,9 @@ public:
static bool allLocales(rtl::OUString const & locale);
rtl::Reference< Node > resolvePathRepresentation(
- rtl::OUString const & pathRepresentation, Path * path,
- int * finalizedLayer) const;
+ rtl::OUString const & pathRepresentation,
+ rtl::OUString * canonicRepresenation, Path * path, int * finalizedLayer)
+ const;
rtl::Reference< Node > getTemplate(
int layer, rtl::OUString const & fullName) const;
diff --git a/configmgr/source/data.cxx b/configmgr/source/data.cxx
index 5540a40fd5..e12f959694 100644
--- a/configmgr/source/data.cxx
+++ b/configmgr/source/data.cxx
@@ -205,7 +205,8 @@ rtl::Reference< Node > Data::findNode(
}
rtl::Reference< Node > Data::resolvePathRepresentation(
- rtl::OUString const & pathRepresentation, Path * path, int * finalizedLayer)
+ rtl::OUString const & pathRepresentation,
+ rtl::OUString * canonicRepresentation, Path * path, int * finalizedLayer)
const
{
if (pathRepresentation.getLength() == 0 || pathRepresentation[0] != '/') {
@@ -216,6 +217,7 @@ rtl::Reference< Node > Data::resolvePathRepresentation(
}
rtl::OUString seg;
bool setElement;
+ rtl::OUString templateName;
sal_Int32 n = parseSegment(pathRepresentation, 1, &seg, &setElement, 0);
if (n == -1 || setElement)
{
@@ -225,6 +227,7 @@ rtl::Reference< Node > Data::resolvePathRepresentation(
css::uno::Reference< css::uno::XInterface >());
}
NodeMap::const_iterator i(components.find(seg));
+ rtl::OUStringBuffer canonic;
if (path != 0) {
path->clear();
}
@@ -234,6 +237,10 @@ rtl::Reference< Node > Data::resolvePathRepresentation(
if (!p.is()) {
return p;
}
+ if (canonicRepresentation != 0) {
+ canonic.append(sal_Unicode('/'));
+ canonic.append(createSegment(templateName, seg));
+ }
if (path != 0) {
path->push_back(seg);
}
@@ -248,13 +255,16 @@ rtl::Reference< Node > Data::resolvePathRepresentation(
}
// for backwards compatibility, ignore a final slash
if (n == pathRepresentation.getLength()) {
+ if (canonicRepresentation != 0) {
+ *canonicRepresentation = canonic.makeStringAndClear();
+ }
if (finalizedLayer != 0) {
*finalizedLayer = finalized;
}
return p;
}
parent = p;
- rtl::OUString templateName;
+ templateName = rtl::OUString();
n = parseSegment(
pathRepresentation, n, &seg, &setElement, &templateName);
if (n == -1) {
diff --git a/configmgr/source/data.hxx b/configmgr/source/data.hxx
index 495ca12338..52353d066b 100644
--- a/configmgr/source/data.hxx
+++ b/configmgr/source/data.hxx
@@ -74,8 +74,9 @@ struct Data: private boost::noncopyable {
int layer, NodeMap const & map, rtl::OUString const & name);
rtl::Reference< Node > resolvePathRepresentation(
- rtl::OUString const & pathRepresentation, Path * path,
- int * finalizedLayer) const;
+ rtl::OUString const & pathRepresentation,
+ rtl::OUString * canonicRepresenation, Path * path, int * finalizedLayer)
+ const;
rtl::Reference< Node > getTemplate(
int layer, rtl::OUString const & fullName) const;
diff --git a/configmgr/source/rootaccess.cxx b/configmgr/source/rootaccess.cxx
index f8ccc6a315..95a346d720 100644
--- a/configmgr/source/rootaccess.cxx
+++ b/configmgr/source/rootaccess.cxx
@@ -113,6 +113,11 @@ void RootAccess::release() throw () {
Access::release();
}
+rtl::OUString RootAccess::getAbsolutePathRepresentation() {
+ getNode(); // turn pathRepresentation_ into canonic form
+ return pathRepresentation_;
+}
+
rtl::OUString RootAccess::getLocale() const {
return locale_;
}
@@ -136,9 +141,10 @@ rtl::OUString RootAccess::getRelativePathRepresentation() {
rtl::Reference< Node > RootAccess::getNode() {
if (!node_.is()) {
+ rtl::OUString canonic;
int finalizedLayer;
node_ = getComponents().resolvePathRepresentation(
- pathRepresentation_, &path_, &finalizedLayer);
+ pathRepresentation_, &canonic, &path_, &finalizedLayer);
if (!node_.is()) {
throw css::uno::RuntimeException(
(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("cannot find ")) +
@@ -150,6 +156,7 @@ rtl::Reference< Node > RootAccess::getNode() {
// queryInterface on it would cause trouble; therefore,
// RuntimeException.Context is left null here
}
+ pathRepresentation_ = canonic;
OSL_ASSERT(!path_.empty());
name_ = path_.back();
finalized_ = finalizedLayer != Data::NO_LAYER;
@@ -285,7 +292,7 @@ void RootAccess::commitChanges()
Modifications globalMods;
commitChildChanges(
((getComponents().resolvePathRepresentation(
- pathRepresentation_, 0, &finalizedLayer)
+ pathRepresentation_, 0, 0, &finalizedLayer)
== node_) &&
finalizedLayer == Data::NO_LAYER),
&globalMods);
diff --git a/configmgr/source/rootaccess.hxx b/configmgr/source/rootaccess.hxx
index 45d4193d70..77d945cdbb 100644
--- a/configmgr/source/rootaccess.hxx
+++ b/configmgr/source/rootaccess.hxx
@@ -78,6 +78,8 @@ public:
virtual void SAL_CALL release() throw ();
+ rtl::OUString getAbsolutePathRepresentation();
+
rtl::OUString getLocale() const;
bool isUpdate() const;
diff --git a/configmgr/source/xcuparser.cxx b/configmgr/source/xcuparser.cxx
index 220168c627..5f0223dde6 100644
--- a/configmgr/source/xcuparser.cxx
+++ b/configmgr/source/xcuparser.cxx
@@ -387,7 +387,7 @@ void XcuParser::handleItem(XmlReader & reader) {
int finalizedLayer;
rtl::Reference< Node > node(
data_->resolvePathRepresentation(
- path, &modificationPath_, &finalizedLayer));
+ path, 0, &modificationPath_, &finalizedLayer));
if (!node.is()) {
//TODO: Within Components::parseModificationLayer (but only there) it
// can rightly happen that data is read that does not match a schema