diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-11-21 21:19:58 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-11-28 13:28:32 -0500 |
commit | 343538e2cca56393e6ee8ded07f1074c0b995c71 (patch) | |
tree | 55462870a9db74b4a36004b3cd0d12e943f0816b /sc | |
parent | 9d6ed5dd8ba3824ba0f1a9d179cfd9b2f8ba75b3 (diff) |
Use the method from orcus to get the short version of xml namespace name.
Change-Id: I5d64ae380982c09f53dacb1eac721430674e9a31
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/orcusxml.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/tool/orcusxml.cxx | 8 | ||||
-rw-r--r-- | sc/source/filter/orcus/xmlcontext.cxx | 20 |
3 files changed, 7 insertions, 23 deletions
diff --git a/sc/inc/orcusxml.hxx b/sc/inc/orcusxml.hxx index 87be8a2b32c9..36c41dd9eb9f 100644 --- a/sc/inc/orcusxml.hxx +++ b/sc/inc/orcusxml.hxx @@ -76,8 +76,6 @@ struct ScOrcusImportXMLParam std::vector<size_t> maNamespaces; CellLinksType maCellLinks; RangeLinksType maRangeLinks; - - SC_DLLPUBLIC static rtl::OString getShortNamespaceName(size_t nIndex); }; #endif diff --git a/sc/source/core/tool/orcusxml.cxx b/sc/source/core/tool/orcusxml.cxx index cef0333440d1..b3cbd467b6d5 100644 --- a/sc/source/core/tool/orcusxml.cxx +++ b/sc/source/core/tool/orcusxml.cxx @@ -28,12 +28,4 @@ const ScOrcusXMLTreeParam::EntryData* ScOrcusXMLTreeParam::getUserData(const SvT ScOrcusImportXMLParam::CellLink::CellLink(const ScAddress& rPos, const OString& rPath) : maPos(rPos), maPath(rPath) {} -OString ScOrcusImportXMLParam::getShortNamespaceName(size_t nIndex) -{ - OStringBuffer aBuf; - aBuf.append("ns"); - aBuf.append(static_cast<sal_Int32>(nIndex)); - return aBuf.makeStringAndClear(); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/filter/orcus/xmlcontext.cxx b/sc/source/filter/orcus/xmlcontext.cxx index 3ad6951227fc..c62d39bb70a2 100644 --- a/sc/source/filter/orcus/xmlcontext.cxx +++ b/sc/source/filter/orcus/xmlcontext.cxx @@ -21,6 +21,8 @@ #include <orcus/orcus_xml.hpp> #include <orcus/global.hpp> +#include <string> + namespace { ScOrcusXMLTreeParam::EntryData& setUserDataToEntry( @@ -43,17 +45,9 @@ OUString toString(const orcus::xml_structure_tree::entity_name& entity, const or OUStringBuffer aBuf; if (entity.ns) { - // Namespace exists. Namespaces are displayed as ns0, ns1, ns2, .... - size_t index = walker.get_xmlns_index(entity.ns); - if (index == orcus::xml_structure_tree::walker::index_not_found) - // This namespace doesn't exist in this context. Something has gone wrong. - aBuf.append("???"); - else - { - OString aName = ScOrcusImportXMLParam::getShortNamespaceName(index); - aBuf.append(OUString(aName.getStr(), aName.getLength(), RTL_TEXTENCODING_UTF8)); - } - + // Namespace exists. Use the short version of the xml namespace name for display. + std::string aShortName = walker.get_xmlns_short_name(entity.ns); + aBuf.appendAscii(aShortName.c_str()); aBuf.append(':'); } aBuf.append(OUString(entity.name.get(), entity.name.size(), RTL_TEXTENCODING_UTF8)); @@ -212,8 +206,8 @@ public: if (nsid == orcus::XMLNS_UNKNOWN_ID) return; - OString aAlias = ScOrcusImportXMLParam::getShortNamespaceName(index); - mrFilter.set_namespace_alias(aAlias.getStr(), nsid); + std::string alias = mrNsRepo.get_short_name(index); + mrFilter.set_namespace_alias(alias.c_str(), nsid); } }; |