sc/qa/unit/data/xml/styles.xml | 5 --- sc/qa/unit/subsequent_filters-test.cxx | 50 ++++++++++++++++++++++++++++++++ sc/source/filter/inc/orcusinterface.hxx | 2 + sc/source/filter/orcus/interface.cxx | 14 +++++++- 4 files changed, 64 insertions(+), 7 deletions(-)
New commits: commit 2ec19dbd744cbc27f31f603fe9f05bffbfd047e3 Author: Jaskaran Singh <jvsg1...@gmail.com> Date: Fri Aug 5 00:13:37 2016 +0530 Add diagonal border test for orcus interface Change-Id: I762e3b5f634b96664a3687e89b1a117895265bee diff --git a/sc/qa/unit/data/xml/styles.xml b/sc/qa/unit/data/xml/styles.xml index f6f9183..85c1e49 100644 --- a/sc/qa/unit/data/xml/styles.xml +++ b/sc/qa/unit/data/xml/styles.xml @@ -4,10 +4,7 @@ <style:table-cell-properties fo:background-color="#feffcc" fo:border="0.06pt dotted #ffcc12"/> </style:style> <style:style style:name="Name2" style:family="table-cell" style:parent-style-name="Text"> - <style:table-cell-properties fo:border-top="0.74pt fine-dashed #ffee11" fo:border-bottom="1.74pt double-thin #aeee11" fo:border-left="0.74pt none #11ee11" fo:border-right="0.22pt dash-dot-dot #05ee11"/> - </style:style> - <style:style style:name="Name3" style:family="table-cell" style:parent-style-name="Text"> - <style:table-cell-properties fo:diagonal-bl-tr="1.74pt dashed #ffccee" fo:diagonal-tl-br="0.74pt dash-dot #120000" fo:border-left="none" fo:border-right="0.74pt dotted #000000"/> + <style:table-cell-properties fo:diagonal-bl-tr="1.74pt dashed #ffccee" fo:diagonal-tl-br="0.74pt dash-dot #120000" fo:border-left="none" fo:border-right="0.74pt dotted #ff0000"/> </style:style> <style:style style:name="Name4" style:family="table-cell" style:parent-style-name="Text"> <style:table-cell-properties fo:border-top="0.74pt double-border #000000" fo:border-bottom="none" fo:border-left="0.74pt solid #000000" fo:border-right="0.74pt dotted #000000"/> diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 1f7780a..7ce70ee 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -37,6 +37,7 @@ #include <editeng/fontitem.hxx> #include <editeng/flditem.hxx> #include <editeng/justifyitem.hxx> +#include <editeng/lineitem.hxx> #include <dbdata.hxx> #include "validat.hxx" #include "formulacell.hxx" @@ -2677,6 +2678,9 @@ void ScFiltersTest::testOrcusODSStyleInterface() pOrcus->importODS_Styles(aDoc, aValidPath); ScStyleSheetPool* pStyleSheetPool = aDoc.GetStyleSheetPool(); + /* Test cases for Style "Name1" + * Has Border and Fill. + */ ScStyleSheet* pStyleSheet = pStyleSheetPool->FindCaseIns("Name1", SfxStyleFamily::Para); const SfxPoolItem* pItem = nullptr; @@ -2700,6 +2704,52 @@ void ScFiltersTest::testOrcusODSStyleInterface() ASSERT_DOUBLES_EQUAL_MESSAGE("Error with right width", 1, pBoxItem->GetRight()->GetWidth()); ASSERT_DOUBLES_EQUAL_MESSAGE("Error with top width", 1, pBoxItem->GetTop()->GetWidth()); ASSERT_DOUBLES_EQUAL_MESSAGE("Error with bottom width", 1, pBoxItem->GetBottom()->GetWidth()); + + CPPUNIT_ASSERT_MESSAGE("Style Name1 : Has Attribute border, but it shouldn't.", + !pStyleSheet->GetItemSet().HasItem(ATTR_PROTECTION, &pItem)); + CPPUNIT_ASSERT_MESSAGE("Style Name1 : Has Attribute font, but it shouldn't.", + !pStyleSheet->GetItemSet().HasItem(ATTR_FONT, &pItem)); + CPPUNIT_ASSERT_MESSAGE("Style Name1 : Has Attribute number format, but it shouldn't.", + !pStyleSheet->GetItemSet().HasItem(ATTR_VALUE_FORMAT, &pItem)); + + /* Test for Style "Name2" + * Has 4 sided borders + Diagonal borders. + */ + pStyleSheet = pStyleSheetPool->FindCaseIns("Name2", SfxStyleFamily::Para); + + CPPUNIT_ASSERT_MESSAGE("Style Name2 : Doesn't have Attribute background, but it should have.", + pStyleSheet->GetItemSet().HasItem(ATTR_BORDER, &pItem)); + + pBoxItem = static_cast<const SvxBoxItem*>(pItem); + CPPUNIT_ASSERT_EQUAL(Color(0, 0, 0), pBoxItem->GetLeft()->GetColor()); + CPPUNIT_ASSERT_EQUAL(Color(255, 0, 0), pBoxItem->GetRight()->GetColor()); + CPPUNIT_ASSERT_EQUAL(pBoxItem->GetLeft()->GetBorderLineStyle(), ::com::sun::star::table::BorderLineStyle::SOLID); + CPPUNIT_ASSERT_EQUAL(pBoxItem->GetRight()->GetBorderLineStyle(), ::com::sun::star::table::BorderLineStyle::DOTTED); + ASSERT_DOUBLES_EQUAL_MESSAGE("Error with left width", 0, pBoxItem->GetLeft()->GetWidth()); + ASSERT_DOUBLES_EQUAL_MESSAGE("Error with right width", 14, pBoxItem->GetRight()->GetWidth()); + + CPPUNIT_ASSERT_MESSAGE("Style Name2 : Doesn't have Attribute diagonal(tl-br) border, but it should have.", + pStyleSheet->GetItemSet().HasItem(ATTR_BORDER_TLBR, &pItem)); + + const SvxLineItem* pTLBR= static_cast<const SvxLineItem*>(pItem); + CPPUNIT_ASSERT_EQUAL(Color(18, 0, 0), pTLBR->GetLine()->GetColor()); + CPPUNIT_ASSERT_EQUAL(pTLBR->GetLine()->GetBorderLineStyle(), ::com::sun::star::table::BorderLineStyle::DASH_DOT); + ASSERT_DOUBLES_EQUAL_MESSAGE("Error with diagonal tl-br width", 14, pTLBR->GetLine()->GetWidth()); + + CPPUNIT_ASSERT_MESSAGE("Style Name2 : Doesn't have Attribute diagonal(bl-tr) border, but it should have.", + pStyleSheet->GetItemSet().HasItem(ATTR_BORDER_BLTR, &pItem)); + + const SvxLineItem* pBLTR= static_cast<const SvxLineItem*>(pItem); + CPPUNIT_ASSERT_EQUAL(Color(255, 204, 238), pBLTR->GetLine()->GetColor()); + CPPUNIT_ASSERT_EQUAL(pBLTR->GetLine()->GetBorderLineStyle(), ::com::sun::star::table::BorderLineStyle::DASHED); + ASSERT_DOUBLES_EQUAL_MESSAGE("Error with diagonal tl-br width", 34, pBLTR->GetLine()->GetWidth()); + + CPPUNIT_ASSERT_MESSAGE("Style Name2 : Has Attribute background, but it shouldn't.", + !pStyleSheet->GetItemSet().HasItem(ATTR_BACKGROUND, &pItem)); + CPPUNIT_ASSERT_MESSAGE("Style Name2 : Has Attribute font, but it shouldn't.", + !pStyleSheet->GetItemSet().HasItem(ATTR_FONT, &pItem)); + CPPUNIT_ASSERT_MESSAGE("Style Name2 : Has Attribute number format, but it shouldn't.", + !pStyleSheet->GetItemSet().HasItem(ATTR_VALUE_FORMAT, &pItem)); } #endif commit 5b01704f51ec389b05fc979d452fc26963685cca Author: Jaskaran Singh <jvsg1...@gmail.com> Date: Fri Aug 5 00:12:11 2016 +0530 Fix a bug in border import in orcus interface Change-Id: Ic058787b1779f7731c0fe60d73b221011abe2b6c diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx index f2d3b7c..342a59f 100644 --- a/sc/source/filter/orcus/interface.cxx +++ b/sc/source/filter/orcus/interface.cxx @@ -898,7 +898,7 @@ void ScOrcusStyles::border::applyToItemSet(SfxItemSet& rSet) const editeng::SvxBorderLine aLine(¤t_border_line.second.maColor, current_border_line.second.mnWidth, current_border_line.second.mestyle); aDiagonal_TLBR.SetLine(&aLine); } - if (current_border_line.first == orcus::spreadsheet::border_direction_t::diagonal_bl_tr) + else if (current_border_line.first == orcus::spreadsheet::border_direction_t::diagonal_bl_tr) { editeng::SvxBorderLine aLine(¤t_border_line.second.maColor, current_border_line.second.mnWidth, current_border_line.second.mestyle); aDiagonal_BLTR.SetLine(&aLine); commit 7f37769a2b84f6ea5be35b71120f2ad7bbf60b46 Author: Jaskaran Singh <jvsg1...@gmail.com> Date: Fri Aug 5 00:10:43 2016 +0530 Fix a typo in border style import in orcus interface Change-Id: Ib8dcf0cb031ed39987b14706026f658bbea0a080 diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx index 0151045..f2d3b7c 100644 --- a/sc/source/filter/orcus/interface.cxx +++ b/sc/source/filter/orcus/interface.cxx @@ -896,12 +896,12 @@ void ScOrcusStyles::border::applyToItemSet(SfxItemSet& rSet) const if (current_border_line.first == orcus::spreadsheet::border_direction_t::diagonal_tl_br) { editeng::SvxBorderLine aLine(¤t_border_line.second.maColor, current_border_line.second.mnWidth, current_border_line.second.mestyle); - aDiagonal_BLTR.SetLine(&aLine); + aDiagonal_TLBR.SetLine(&aLine); } if (current_border_line.first == orcus::spreadsheet::border_direction_t::diagonal_bl_tr) { editeng::SvxBorderLine aLine(¤t_border_line.second.maColor, current_border_line.second.mnWidth, current_border_line.second.mestyle); - aDiagonal_TLBR.SetLine(&aLine); + aDiagonal_BLTR.SetLine(&aLine); } else { commit fa262141e2370d3335a0010bd5465a9a72ecf29f Author: Jaskaran Singh <jvsg1...@gmail.com> Date: Fri Aug 5 00:09:10 2016 +0530 Initialize border attributes in orcus interface Change-Id: I99994147830e96bea07f52fc6f2575f05cb0a40f diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx index 8359ca4..c7676ca 100644 --- a/sc/source/filter/inc/orcusinterface.hxx +++ b/sc/source/filter/inc/orcusinterface.hxx @@ -299,6 +299,8 @@ private: SvxBorderStyle mestyle; Color maColor; double mnWidth; + + border_line(); }; std::map<orcus::spreadsheet::border_direction_t, border_line> border_lines; diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx index 1d95b66..0151045 100644 --- a/sc/source/filter/orcus/interface.cxx +++ b/sc/source/filter/orcus/interface.cxx @@ -847,6 +847,14 @@ void ScOrcusStyles::protection::applyToItemSet(SfxItemSet& rSet) const ScOrcusStyles::border::border(): mbHasBorderAttr(false) { + border_line(); +} + +ScOrcusStyles::border::border_line::border_line(): + mestyle(::com::sun::star::table::BorderLineStyle::SOLID), + maColor(COL_WHITE), + mnWidth(0) +{ } namespace { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits