diff options
Diffstat (limited to 'configmgr/source')
-rw-r--r-- | configmgr/source/access.cxx | 14 | ||||
-rw-r--r-- | configmgr/source/components.cxx | 7 | ||||
-rw-r--r-- | configmgr/source/components.hxx | 5 | ||||
-rw-r--r-- | configmgr/source/data.cxx | 14 | ||||
-rw-r--r-- | configmgr/source/data.hxx | 5 | ||||
-rw-r--r-- | configmgr/source/rootaccess.cxx | 11 | ||||
-rw-r--r-- | configmgr/source/rootaccess.hxx | 2 | ||||
-rw-r--r-- | configmgr/source/xcuparser.cxx | 3 |
8 files changed, 48 insertions, 13 deletions
diff --git a/configmgr/source/access.cxx b/configmgr/source/access.cxx index 60f6a4a54e46..190db364cdfe 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 48f90fa8382e..5b30e9491eb4 100644 --- a/configmgr/source/components.cxx +++ b/configmgr/source/components.cxx @@ -149,11 +149,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 a78ed325969d..2e635680c1ce 100644 --- a/configmgr/source/components.hxx +++ b/configmgr/source/components.hxx @@ -72,8 +72,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 5540a40fd5f4..e12f9596940b 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 495ca1233878..52353d066b67 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 f8ccc6a31546..95a346d720c2 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 45d4193d70de..77d945cdbbed 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 f9f439c98916..eda478b18b70 100644 --- a/configmgr/source/xcuparser.cxx +++ b/configmgr/source/xcuparser.cxx @@ -395,7 +395,8 @@ void XcuParser::handleItem(XmlReader & reader) { rtl::OUString path(xmldata::convertFromUtf8(attrPath)); int finalizedLayer; rtl::Reference< Node > node( - data_.resolvePathRepresentation(path, &path_, &finalizedLayer)); + data_.resolvePathRepresentation( + path, 0, &path_, &finalizedLayer)); if (!node.is()) { OSL_TRACE( "configmgr unknown item %s in %s", |