diff options
author | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2010-04-16 11:36:30 +0200 |
---|---|---|
committer | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2010-04-16 11:36:30 +0200 |
commit | a316cdf1969aa6893870d8907841bcf077d5148a (patch) | |
tree | ff6a75663b7544183b3b3b60585871a65dbf42e3 /configmgr/source | |
parent | 943c96d6d68cb78b9621be5d860d9d841fbb059b (diff) |
slidecopy: (patch by SB) for compatibility with the old implementation, let getHierarchicalName return the absolute node path
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 | 2 |
8 files changed, 47 insertions, 13 deletions
diff --git a/configmgr/source/access.cxx b/configmgr/source/access.cxx index 7af9c1f8d9c0..e8c6f835e83b 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 51a1a6547d9b..187eeee2e45c 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 8523b02cbbaf..cdf4bdbaeb8f 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 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 220168c62725..5f0223dde6ee 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 |