summaryrefslogtreecommitdiff
path: root/writerperfect
diff options
context:
space:
mode:
Diffstat (limited to 'writerperfect')
-rw-r--r--writerperfect/qa/unit/EPUBExportTest.cxx14
-rw-r--r--writerperfect/qa/unit/data/writer/epubexport/char-namedstyle.fodt16
-rw-r--r--writerperfect/source/writer/exp/txtparai.cxx20
3 files changed, 45 insertions, 5 deletions
diff --git a/writerperfect/qa/unit/EPUBExportTest.cxx b/writerperfect/qa/unit/EPUBExportTest.cxx
index 8ab03f6df48e..1b57655180b0 100644
--- a/writerperfect/qa/unit/EPUBExportTest.cxx
+++ b/writerperfect/qa/unit/EPUBExportTest.cxx
@@ -55,6 +55,7 @@ public:
void testParaAutostyleCharProps();
void testMeta();
void testParaNamedstyle();
+ void testCharNamedstyle();
CPPUNIT_TEST_SUITE(EPUBExportTest);
CPPUNIT_TEST(testOutlineLevel);
@@ -65,6 +66,7 @@ public:
CPPUNIT_TEST(testParaAutostyleCharProps);
CPPUNIT_TEST(testMeta);
CPPUNIT_TEST(testParaNamedstyle);
+ CPPUNIT_TEST(testCharNamedstyle);
CPPUNIT_TEST_SUITE_END();
};
@@ -232,6 +234,18 @@ void EPUBExportTest::testParaNamedstyle()
assertXPath(mpXmlDoc, "//xhtml:p[2]/xhtml:span", "class", "span1");
}
+void EPUBExportTest::testCharNamedstyle()
+{
+ createDoc("char-namedstyle.fodt", {});
+
+ mpXmlDoc = parseExport("OEBPS/sections/section0001.xhtml");
+
+ // Test character properties from named text style.
+ assertXPath(mpXmlDoc, "//xhtml:p/xhtml:span[1]", "class", "span0");
+ // This failed, character properties from text style were not exported.
+ assertXPath(mpXmlDoc, "//xhtml:p/xhtml:span[2]", "class", "span1");
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(EPUBExportTest);
}
diff --git a/writerperfect/qa/unit/data/writer/epubexport/char-namedstyle.fodt b/writerperfect/qa/unit/data/writer/epubexport/char-namedstyle.fodt
new file mode 100644
index 000000000000..5a1b3823dd18
--- /dev/null
+++ b/writerperfect/qa/unit/data/writer/epubexport/char-namedstyle.fodt
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text">
+ <office:font-face-decls>
+ <style:font-face style:name="Liberation Mono" svg:font-family="&apos;Liberation Mono&apos;" style:font-family-generic="modern" style:font-pitch="fixed"/>
+ </office:font-face-decls>
+ <office:styles>
+ <style:style style:name="Source_20_Text" style:display-name="Source Text" style:family="text">
+ <style:text-properties style:font-name="Liberation Mono" fo:font-family="&apos;Liberation Mono&apos;" style:font-family-generic="modern" style:font-pitch="fixed"/>
+ </style:style>
+ </office:styles>
+ <office:body>
+ <office:text>
+ <text:p>Foo<text:span text:style-name="Source_20_Text">bar</text:span></text:p>
+ </office:text>
+ </office:body>
+</office:document>
diff --git a/writerperfect/source/writer/exp/txtparai.cxx b/writerperfect/source/writer/exp/txtparai.cxx
index 932ae744f4e9..31ab25f43cad 100644
--- a/writerperfect/source/writer/exp/txtparai.cxx
+++ b/writerperfect/source/writer/exp/txtparai.cxx
@@ -55,13 +55,23 @@ void XMLSpanContext::startElement(const OUString &/*rName*/, const css::uno::Ref
{
// Reference to an automatic text style, try to look it up.
auto itStyle = mrImport.GetAutomaticTextStyles().find(rAttributeValue);
- if (itStyle == mrImport.GetAutomaticTextStyles().end())
+ if (itStyle != mrImport.GetAutomaticTextStyles().end())
+ {
+ // 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());
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());
+ itStyle = mrImport.GetTextStyles().find(rAttributeValue);
+ if (itStyle != mrImport.GetTextStyles().end())
+ {
+ // Apply properties from text style.
+ librevenge::RVNGPropertyList::Iter itProp(itStyle->second);
+ for (itProp.rewind(); itProp.next();)
+ aPropertyList.insert(itProp.key(), itProp()->clone());
+ }
}
else
{