[Libreoffice-commits] core.git: sc/qa sc/source
Tibor Nagy (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jul 27 11:39:49 UTC 2020
sc/qa/unit/data/xlsx/tdf134826.xlsx |binary
sc/qa/unit/subsequent_export-test.cxx | 32 ++++++++++++++++++++++++++++++++
sc/source/filter/oox/pagesettings.cxx | 6 ++++--
3 files changed, 36 insertions(+), 2 deletions(-)
New commits:
commit 055735fa8589670f67e016bc3b7835d4cf81641f
Author: Tibor Nagy <nagy.tibor2 at nisz.hu>
AuthorDate: Fri Jul 17 13:23:41 2020 +0200
Commit: László Németh <nemeth at numbertext.org>
CommitDate: Mon Jul 27 13:39:09 2020 +0200
tdf#134826 XLSX import: extend localized bold/italic footer/header
OOXML formatting code support with Hungarian "félkövér" (semibold)
and "dőlt" (italic), similar to German, according to formatting
code standard of OOXML 18.3.1.46 headerFooter (Header Footer
Settings): "Both font-name and font-type can be localized values."
Co-authored-by: Attila Szűcs (NISZ)
Change-Id: I95de548fe27d4a6c4e9504dc1f746c8d4419222b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99016
Tested-by: László Németh <nemeth at numbertext.org>
Reviewed-by: László Németh <nemeth at numbertext.org>
diff --git a/sc/qa/unit/data/xlsx/tdf134826.xlsx b/sc/qa/unit/data/xlsx/tdf134826.xlsx
new file mode 100644
index 000000000000..dd86afea2cd5
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf134826.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index b645979f6b84..f0e4b5c44c55 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -254,6 +254,7 @@ public:
void testTdf83779();
void testTdf134459_HeaderFooterColorXLSX();
void testTdf134817_HeaderFooterTextWith2SectionXLSX();
+ void testHeaderFontStyleXLSX();
CPPUNIT_TEST_SUITE(ScExportTest);
CPPUNIT_TEST(test);
@@ -406,6 +407,7 @@ public:
CPPUNIT_TEST(testTdf83779);
CPPUNIT_TEST(testTdf134459_HeaderFooterColorXLSX);
CPPUNIT_TEST(testTdf134817_HeaderFooterTextWith2SectionXLSX);
+ CPPUNIT_TEST(testHeaderFontStyleXLSX);
CPPUNIT_TEST_SUITE_END();
@@ -5182,6 +5184,36 @@ void ScExportTest::testTdf134817_HeaderFooterTextWith2SectionXLSX()
xDocSh->DoClose();
}
+void ScExportTest::testHeaderFontStyleXLSX()
+{
+ ScDocShellRef xShell = loadDoc("tdf134826.", FORMAT_XLSX);
+ CPPUNIT_ASSERT(xShell.is());
+
+ ScDocument& rDoc = xShell->GetDocument();
+ SfxStyleSheetBase* pStyleSheet = rDoc.GetStyleSheetPool()->Find(rDoc.GetPageStyle(0), SfxStyleFamily::Page);
+ const SfxItemSet& rItemSet = pStyleSheet->GetItemSet();
+ const ScPageHFItem& rHFItem = rItemSet.Get(ATTR_PAGE_HEADERRIGHT);
+ const EditTextObject* pTextObj = rHFItem.GetLeftArea();
+
+ std::vector<EECharAttrib> rLst;
+
+ // first line is bold.
+ pTextObj->GetCharAttribs(0, rLst);
+ bool bHasBold = std::any_of(rLst.begin(), rLst.end(), [](const EECharAttrib& rAttrib) {
+ return rAttrib.pAttr->Which() == EE_CHAR_WEIGHT &&
+ static_cast<const SvxWeightItem&>(*rAttrib.pAttr).GetWeight() == WEIGHT_BOLD; });
+ CPPUNIT_ASSERT_MESSAGE("First line should be bold.", bHasBold);
+
+ // second line is italic.
+ pTextObj->GetCharAttribs(1, rLst);
+ bool bHasItalic = std::any_of(rLst.begin(), rLst.end(), [](const EECharAttrib& rAttrib) {
+ return rAttrib.pAttr->Which() == EE_CHAR_ITALIC &&
+ static_cast<const SvxPostureItem&>(*rAttrib.pAttr).GetPosture() == ITALIC_NORMAL; });
+ CPPUNIT_ASSERT_MESSAGE("Second line should be italic.", bHasItalic);
+
+ xShell->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sc/source/filter/oox/pagesettings.cxx b/sc/source/filter/oox/pagesettings.cxx
index d2baf2b92354..b1854659f4ac 100644
--- a/sc/source/filter/oox/pagesettings.cxx
+++ b/sc/source/filter/oox/pagesettings.cxx
@@ -453,7 +453,8 @@ const char* const sppcBoldNames[] =
"demibold",
"halbfett", // German 'demibold'
"black",
- "heavy"
+ "heavy",
+ "f\303\251lk\303\266v\303\251r" // Hungarian 'bold'
};
// different names for italic font style (lowercase)
@@ -463,7 +464,8 @@ const char* const sppcItalicNames[] =
"kursiv", // German 'italic'
"oblique",
"schr\303\204g", // German 'oblique' with uppercase A umlaut
- "schr\303\244g" // German 'oblique' with lowercase A umlaut
+ "schr\303\244g", // German 'oblique' with lowercase A umlaut
+ "d\305\221lt" // Hungarian 'italic'
};
} // namespace
More information about the Libreoffice-commits
mailing list