diff options
Diffstat (limited to 'writerperfect/source/writer/exp/txtparai.cxx')
-rw-r--r-- | writerperfect/source/writer/exp/txtparai.cxx | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/writerperfect/source/writer/exp/txtparai.cxx b/writerperfect/source/writer/exp/txtparai.cxx index e669cf89edf8..50ff36352ad5 100644 --- a/writerperfect/source/writer/exp/txtparai.cxx +++ b/writerperfect/source/writer/exp/txtparai.cxx @@ -44,9 +44,34 @@ XMLImportContext *XMLSpanContext::CreateChildContext(const OUString &rName, cons return nullptr; } -void XMLSpanContext::startElement(const OUString &/*rName*/, const css::uno::Reference<css::xml::sax::XAttributeList> &/*xAttribs*/) +void XMLSpanContext::startElement(const OUString &/*rName*/, const css::uno::Reference<css::xml::sax::XAttributeList> &xAttribs) { - mrImport.GetGenerator().openSpan(librevenge::RVNGPropertyList()); + librevenge::RVNGPropertyList aPropertyList; + for (sal_Int16 i = 0; i < xAttribs->getLength(); ++i) + { + const OUString &rAttributeName = xAttribs->getNameByIndex(i); + const OUString &rAttributeValue = xAttribs->getValueByIndex(i); + if (rAttributeName == "text:style-name") + { + // Reference to an automatic style, try to look it up. + auto itStyle = mrImport.GetAutomaticStyles().find(rAttributeValue); + if (itStyle == mrImport.GetAutomaticStyles().end()) + continue; + + // Apply properties directly, librevenge has no notion of automatic styles. + librevenge::RVNGPropertyList::Iter itProp(itStyle->second); + for (itProp.rewind(); itProp.next();) + aPropertyList.insert(itProp.key(), itProp()->clone()); + } + else + { + OString sName = OUStringToOString(rAttributeName, RTL_TEXTENCODING_UTF8); + OString sValue = OUStringToOString(rAttributeValue, RTL_TEXTENCODING_UTF8); + aPropertyList.insert(sName.getStr(), sValue.getStr()); + } + } + + mrImport.GetGenerator().openSpan(aPropertyList); } void XMLSpanContext::endElement(const OUString &/*rName*/) |