[Libreoffice-commits] core.git: sw/qa writerfilter/source

Justin Luth justin_luth at sil.org
Mon May 29 07:40:11 UTC 2017


 sw/qa/extras/ooxmlexport/data/tdf82173_footnoteStyle.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx                 |    7 ++
 writerfilter/source/dmapper/StyleSheetTable.cxx           |   33 +++++---------
 3 files changed, 19 insertions(+), 21 deletions(-)

New commits:
commit e8714e3451282218e34d2ded472c9a5a44bd0bd2
Author: Justin Luth <justin_luth at sil.org>
Date:   Mon May 22 16:42:35 2017 +0300

    related tdf#82173 writerfilter: ignore case when mapping style name
    
    Depends on unit test modifications in commits
    71229da3cb05fc8f3e94fe6a6a5d9ad43cdf8702
    a9118665637dafddd41ca549d0f73948cf1d332c
    
    One known effect is that Word's "footnote reference" formatting in docx
    will now affect Writer's "Footnote anchor".
    
    Change-Id: I84f21dcff86f727869a49fa4b53727c24337f63f
    Reviewed-on: https://gerrit.libreoffice.org/37936
    Reviewed-by: Justin Luth <justin_luth at sil.org>
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf82173_footnoteStyle.docx b/sw/qa/extras/ooxmlexport/data/tdf82173_footnoteStyle.docx
new file mode 100644
index 000000000000..4fa7b0a24d8d
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf82173_footnoteStyle.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 6ef5dd2db10b..038fb7a510bf 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -464,6 +464,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf99227, "tdf99227.docx")
     assertXPath(pXmlDoc, "//w:footnote/w:p/w:r/w:drawing", 1);
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf82173_footnoteStyle, "tdf82173_footnoteStyle.docx")
+{
+    uno::Reference<beans::XPropertySet> xPageStyle(getStyles("CharacterStyles")->getByName("Footnote anchor"), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL( sal_Int32(58),       getProperty< sal_Int32 >(xPageStyle, "CharEscapementHeight") );
+    CPPUNIT_ASSERT_EQUAL( sal_Int32(0x00FF00), getProperty< sal_Int32 >(xPageStyle, "CharColor") );
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf104162, "tdf104162.docx")
 {
     // This crashed: the comment field contained a table with a <w:hideMark/>.
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx
index 1a25933a8dc6..804940d84285 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -46,11 +46,22 @@
 
 using namespace ::com::sun::star;
 
+namespace {
+
+/** Functor for case-insensitive string comparison, usable in maps etc. */
+struct IgnoreCaseCompare
+{
+    bool operator()( const OUString& rName1, const OUString& rName2 ) const
+        { return rName1.compareToIgnoreAsciiCase( rName2 ) < 0; }
+};
+
+} // namespace
+
 namespace writerfilter {
 namespace dmapper
 {
 
-typedef ::std::map< OUString, OUString> StringPairMap_t;
+typedef ::std::map< OUString, OUString, IgnoreCaseCompare> StringPairMap_t;
 
 
 StyleSheetEntry::StyleSheetEntry() :
@@ -1299,15 +1310,6 @@ const StyleSheetEntryPtr StyleSheetTable::FindParentStyleSheet(const OUString& _
 static const sal_Char* const aStyleNamePairs[] =
 {
     "Normal",                     "Standard",
-    "heading 1",                  "Heading 1",
-    "heading 2",                  "Heading 2",
-    "heading 3",                  "Heading 3",
-    "heading 4",                  "Heading 4",
-    "heading 5",                  "Heading 5",
-    "heading 6",                  "Heading 6",
-    "heading 7",                  "Heading 7",
-    "heading 8",                  "Heading 8",
-    "heading 9",                  "Heading 9",
     "Heading1",                   "Heading 1",
     "Heading2",                   "Heading 2",
     "Heading3",                   "Heading 3",
@@ -1345,15 +1347,6 @@ static const sal_Char* const aStyleNamePairs[] =
     "TOC 8",                     "Contents 8",
     "TOC 9",                     "Contents 9",
     "TOCHeading",                "Contents Heading",
-    "toc 1",                     "Contents 1",
-    "toc 2",                     "Contents 2",
-    "toc 3",                     "Contents 3",
-    "toc 4",                     "Contents 4",
-    "toc 5",                     "Contents 5",
-    "toc 6",                     "Contents 6",
-    "toc 7",                     "Contents 7",
-    "toc 8",                     "Contents 8",
-    "toc 9",                     "Contents 9",
     "TOC1",                     "Contents 1",
     "TOC2",                     "Contents 2",
     "TOC3",                     "Contents 3",
@@ -1367,9 +1360,7 @@ static const sal_Char* const aStyleNamePairs[] =
     "Footnote Text",             "Footnote",
     "Annotation Text",           "",
     "Header",                    "Header",
-    "header",                    "Header",
     "Footer",                    "Footer",
-    "footer",                    "Footer",
     "Index Heading",             "Index Heading",
     "Caption",                   "",
     "Table of Figures",          "",


More information about the Libreoffice-commits mailing list