[Libreoffice-commits] core.git: Branch 'feature/orcus-odf-rebased2' - 19 commits - desktop/CppunitTest_desktop_lib.mk sc/CppunitTest_sc_subsequent_filters_test.mk sc/inc sc/Module_sc.mk sc/Package_res_xml.mk sc/qa sc/res sc/source

Markus Mohrhard markus.mohrhard at googlemail.com
Sat Sep 17 17:01:25 UTC 2016


Rebased ref, commits from common ancestor:
commit afcf0c199d3b1e86c084b1778ae7237f02db5848
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Sep 17 13:36:56 2016 +0200

    make sure the test is not executed before the libs have been built
    
    Change-Id: Idf9e638ac559e1135182811c2bc30465efe45d3d

diff --git a/desktop/CppunitTest_desktop_lib.mk b/desktop/CppunitTest_desktop_lib.mk
index 93b75f0..bfcbf56 100644
--- a/desktop/CppunitTest_desktop_lib.mk
+++ b/desktop/CppunitTest_desktop_lib.mk
@@ -20,6 +20,8 @@ $(eval $(call gb_CppunitTest_use_libraries,desktop_lib, \
 	cppu \
 	cppuhelper \
 	sal \
+	sc \
+	scfilt \
 	sfx \
 	sofficeapp \
 	subsequenttest \
commit 4e8299ce6530c3d076d8703db103b521e5afb8de
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Aug 23 00:51:47 2016 +0200

    place the calc default style file in the share folder
    
    Change-Id: I1b8bfee1abf82c5a55cbfc5c1674b115cdfe63b8

diff --git a/sc/Package_res_xml.mk b/sc/Package_res_xml.mk
index 1a25a66..383e8d5 100644
--- a/sc/Package_res_xml.mk
+++ b/sc/Package_res_xml.mk
@@ -9,7 +9,7 @@
 
 $(eval $(call gb_Package_Package,sc_res_xml,$(SRCDIR)/sc/res/xml))
 
-$(eval $(call gb_Package_add_files,sc_res_xml,$(LIBO_BIN_FOLDER),\
+$(eval $(call gb_Package_add_files,sc_res_xml,$(LIBO_SHARE_FOLDER)/calc,\
 	styles.xml \
 ))
 
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 62e2a8d..0992786 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -39,6 +39,7 @@
 #include <svl/documentlockfile.hxx>
 #include <svl/sharecontrolfile.hxx>
 #include <svl/urihelper.hxx>
+#include <osl/file.hxx>
 #include "chgtrack.hxx"
 #include "chgviset.hxx"
 #include <com/sun/star/awt/Key.hpp>
@@ -62,6 +63,8 @@
 #include <com/sun/star/frame/XStorable2.hpp>
 #include <com/sun/star/frame/Desktop.hpp>
 
+#include <config_folders.h>
+
 #include "scabstdlg.hxx"
 #include <sot/formats.hxx>
 
@@ -590,29 +593,21 @@ bool ScDocShell::Load( SfxMedium& rMedium )
             aDocument.GetStyleSheetPool()->CreateStandardStyles();
             aDocument.UpdStlShtPtrsFrmNms();
 
-            #if ENABLE_ORCUS
+#if ENABLE_ORCUS
             /* Create styles that are imported through Orcus */
 
-            OUString aPath("$BRAND_BASE_DIR/");  /* Read the comment below before changing this */
-            rtl::Bootstrap::expandMacros(aPath);
-            OUString aValidPath;
-
-            /* The Following loop trims 'file://' from start of string and
-             * '../' from the end of string. If you ever happen to change the above macro
-             * please consider changing the following range too, otherwise app would
-             * crash!!
-             */
-            for (sal_Int32 i = 7; i < aPath.getLength() - 3; ++i)
-                aValidPath += OUString(aPath[i]);
+            OUString aURL("$BRAND_BASE_DIR" LIBO_SHARE_FOLDER "/calc/styles.xml");
+            rtl::Bootstrap::expandMacros(aURL);
 
-            OUString aFileName = "styles.xml";
-            aValidPath += aFileName;
+            OUString aPath;
+            osl::FileBase::getSystemPathFromFileURL(aURL, aPath);
 
             ScOrcusFilters* pOrcus = ScFormatFilter::Get().GetOrcusFilters();
             if (!pOrcus)
                 return false;
-            pOrcus->importODS_Styles(aDocument, aValidPath);
-            #endif
+
+            pOrcus->importODS_Styles(aDocument, aPath);
+#endif
 
             bRet = LoadXML( &rMedium, nullptr );
         }
diff --git a/sc/source/ui/docshell/docsh2.cxx b/sc/source/ui/docshell/docsh2.cxx
index 46adfa8..358732a 100644
--- a/sc/source/ui/docshell/docsh2.cxx
+++ b/sc/source/ui/docshell/docsh2.cxx
@@ -19,6 +19,7 @@
 
 #include "scitems.hxx"
 #include <rtl/bootstrap.hxx>
+#include <osl/file.hxx>
 #include <svx/drawitem.hxx>
 #include <svl/asiancfg.hxx>
 #include <editeng/forbiddencharacterstable.hxx>
@@ -26,6 +27,7 @@
 #include <orcus/orcus_import_ods.hpp>
 #include <orcusfiltersimpl.hxx>
 #include <config_orcus.h>
+#include <config_folders.h>
 
 #include "drwlayer.hxx"
 #include "stlpool.hxx"
@@ -58,29 +60,20 @@ bool ScDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor )
     aDocument.GetStyleSheetPool()->CreateStandardStyles();
     aDocument.UpdStlShtPtrsFrmNms();
 
-    #if ENABLE_ORCUS
+#if ENABLE_ORCUS
     /* Create styles that are imported through Orcus */
 
-    OUString aPath("$BRAND_BASE_DIR/");  /* Read the comment below before changing this */
-    rtl::Bootstrap::expandMacros(aPath);
-    OUString aValidPath;
+    OUString aURL("$BRAND_BASE_DIR/" LIBO_SHARE_FOLDER "/calc/styles.xml");
+    rtl::Bootstrap::expandMacros(aURL);
 
-    /* The Following loop trims 'file://' from start of string and
-     * '../' from the end of string. If you ever happen to change the above macro
-     * please consider changing the following range too, otherwise app would
-     * crash!!
-     */
-    for (sal_Int32 i = 7; i < aPath.getLength() - 3; ++i)
-        aValidPath += OUString(aPath[i]);
-
-    OUString aFileName = "styles.xml";
-    aValidPath += aFileName;
+    OUString aPath;
+    osl::FileBase::getSystemPathFromFileURL(aURL, aPath);
 
     ScOrcusFilters* pOrcus = ScFormatFilter::Get().GetOrcusFilters();
     if (!pOrcus)
         return false;
-    pOrcus->importODS_Styles(aDocument, aValidPath);
-    #endif
+    pOrcus->importODS_Styles(aDocument, aPath);
+#endif
 
     //  SetDocumentModified is not allowed anymore in Load/InitNew!
     InitItems();
commit 6dc3aba0134950e020cfbe8ec96301a10870ba5a
Author: Jaskaran Singh <jvsg1303 at gmail.com>
Date:   Sat Aug 6 15:22:16 2016 +0530

    Enable cell alignment test in orcus interface
    
    Change-Id: I1078e29d6fa0c51a4457b43806340eaf10096a92

diff --git a/sc/qa/unit/data/xml/styles.xml b/sc/qa/unit/data/xml/styles.xml
index b481219..fa5cd27 100644
--- a/sc/qa/unit/data/xml/styles.xml
+++ b/sc/qa/unit/data/xml/styles.xml
@@ -29,6 +29,6 @@
   </style:style>
   <style:style style:name="Name10" style:family="table-cell" style:parent-style-name="Text">
     <style:table-cell-properties style:vertical-align="middle"/>
-    <style:paragraph-properties fo:text-align="start"/>
+    <style:paragraph-properties fo:text-align="end"/>
   </style:style>
 </office:styles>
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 25f9ea2..9adc1a0 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -2867,7 +2867,7 @@ void ScFiltersTest::testOrcusODSStyleInterface()
     /* Test for Style Name "10"
      * Has ver align, and hor align
      */
-    /*
+
     pStyleSheet = pStyleSheetPool->FindCaseIns("Name10", SfxStyleFamily::Para);
     CPPUNIT_ASSERT_MESSAGE("Style Name10 : Doesn't have Attribute hor justify, but it should have.",
         pStyleSheet->GetItemSet().HasItem(ATTR_HOR_JUSTIFY, &pItem));
@@ -2881,7 +2881,7 @@ void ScFiltersTest::testOrcusODSStyleInterface()
 
     const SvxVerJustifyItem* pVerJustify = static_cast<const SvxVerJustifyItem*>(pItem);
     CPPUNIT_ASSERT_MESSAGE("Style Name10 :Error with ver justify", pVerJustify->GetValue() == SVX_VER_JUSTIFY_CENTER);
-    */
+
 }
 #endif
 
commit e8eb470f6631ba57f67ccf9bfc0f39cadc7d65e2
Author: Jaskaran Singh <jvsg1303 at gmail.com>
Date:   Sat Aug 6 13:33:42 2016 +0530

    Add test for cell align in orcus interface(currently disabled)
    
    Change-Id: Icbb139cc520e4afd84986d245fab5f157431fc4e

diff --git a/sc/qa/unit/data/xml/styles.xml b/sc/qa/unit/data/xml/styles.xml
index ef9c337..b481219 100644
--- a/sc/qa/unit/data/xml/styles.xml
+++ b/sc/qa/unit/data/xml/styles.xml
@@ -27,7 +27,7 @@
   <style:style style:name="Name9" style:family="table-cell" style:parent-style-name="Default">
     <style:text-properties style:text-line-through-style="solid" style:text-line-through-type="single" style:text-line-through-text="/"/>
   </style:style>
-  <style:style style:name="Name23" style:family="table-cell" style:parent-style-name="Text">
+  <style:style style:name="Name10" style:family="table-cell" style:parent-style-name="Text">
     <style:table-cell-properties style:vertical-align="middle"/>
     <style:paragraph-properties fo:text-align="start"/>
   </style:style>
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index dc11d9b..25f9ea2 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -2864,6 +2864,24 @@ void ScFiltersTest::testOrcusODSStyleInterface()
     pCrossedOutItem = static_cast<const SvxCrossedOutItem*>(pItem);
     CPPUNIT_ASSERT_MESSAGE("Style Name9 :Error with Strikeout", pCrossedOutItem->GetStrikeout() == STRIKEOUT_SLASH);
 
+    /* Test for Style Name "10"
+     * Has ver align, and hor align
+     */
+    /*
+    pStyleSheet = pStyleSheetPool->FindCaseIns("Name10", SfxStyleFamily::Para);
+    CPPUNIT_ASSERT_MESSAGE("Style Name10 : Doesn't have Attribute hor justify, but it should have.",
+        pStyleSheet->GetItemSet().HasItem(ATTR_HOR_JUSTIFY, &pItem));
+
+    const SvxHorJustifyItem* pHorJustify = static_cast<const SvxHorJustifyItem*>(pItem);
+    CPPUNIT_ASSERT_MESSAGE("Style Name10 :Error with hor justify", pHorJustify->GetValue() == SVX_HOR_JUSTIFY_RIGHT);
+
+    pStyleSheet = pStyleSheetPool->FindCaseIns("Name10", SfxStyleFamily::Para);
+    CPPUNIT_ASSERT_MESSAGE("Style Name10 : Doesn't have Attribute ver justify, but it should have.",
+        pStyleSheet->GetItemSet().HasItem(ATTR_VER_JUSTIFY, &pItem));
+
+    const SvxVerJustifyItem* pVerJustify = static_cast<const SvxVerJustifyItem*>(pItem);
+    CPPUNIT_ASSERT_MESSAGE("Style Name10 :Error with ver justify", pVerJustify->GetValue() == SVX_VER_JUSTIFY_CENTER);
+    */
 }
 #endif
 
commit 977aa5a3db24a1826d3e9f79d60266d1d8319959
Author: Jaskaran Singh <jvsg1303 at gmail.com>
Date:   Sat Aug 6 13:32:26 2016 +0530

    Correct initial values for cell align in orcus interface
    
    Change-Id: I54b7def1d1d1a5b518abc6774495dd371a928ef3

diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
index c07ecb2..a94b6f7 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -941,8 +941,8 @@ ScOrcusStyles::xf::xf():
     mnNumberFormatId(0),
     mnStyleXf(0),
     mbAlignment(false),
-    meHor_alignment(SVX_HOR_JUSTIFY_LEFT),
-    meVer_alignment(SVX_VER_JUSTIFY_CENTER)
+    meHor_alignment(SVX_HOR_JUSTIFY_RIGHT),
+    meVer_alignment(SVX_VER_JUSTIFY_BOTTOM)
 {
 }
 
commit 304b4e56998a7946a75883f0950ba0dd51f331db
Author: Jaskaran Singh <jvsg1303 at gmail.com>
Date:   Sat Aug 6 00:03:50 2016 +0530

    Add test for strikeout in orcus interface
    
    Change-Id: I72e917934919ddf5cc2cdd188a692c3fba94433e

diff --git a/sc/qa/unit/data/xml/styles.xml b/sc/qa/unit/data/xml/styles.xml
index 118561f..ef9c337 100644
--- a/sc/qa/unit/data/xml/styles.xml
+++ b/sc/qa/unit/data/xml/styles.xml
@@ -18,13 +18,13 @@
   <style:style style:name="Name6" style:family="table-cell" style:parent-style-name="Text">
     <style:text-properties style:font-name="Liberation Sans" style:text-underline-style="solid" fo:font-size="24pt" fo:color="#808080" fo:font-style="italic" style:text-underline-color="font-color" fo:font-weight="bold"/>
   </style:style>
-  <style:style style:name="Name20" style:family="table-cell" style:parent-style-name="Default">
+  <style:style style:name="Name7" style:family="table-cell" style:parent-style-name="Default">
     <style:text-properties style:text-line-through-style="solid" style:text-line-through-type="single"/>
   </style:style>
-  <style:style style:name="Name21" style:family="table-cell" style:parent-style-name="Default">
+  <style:style style:name="Name8" style:family="table-cell" style:parent-style-name="Default">
     <style:text-properties style:text-line-through-style="solid" style:text-line-through-type="single" style:text-line-through-width="bold"/>
   </style:style>
-  <style:style style:name="Name22" style:family="table-cell" style:parent-style-name="Default">
+  <style:style style:name="Name9" style:family="table-cell" style:parent-style-name="Default">
     <style:text-properties style:text-line-through-style="solid" style:text-line-through-type="single" style:text-line-through-text="/"/>
   </style:style>
   <style:style style:name="Name23" style:family="table-cell" style:parent-style-name="Text">
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 24fdfa3..dc11d9b 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -2834,6 +2834,35 @@ void ScFiltersTest::testOrcusODSStyleInterface()
     CPPUNIT_ASSERT_MESSAGE("Style Name6 :Error with Font Underline Style", pUnderlineItem->GetLineStyle() == LINESTYLE_SINGLE);
     CPPUNIT_ASSERT_MESSAGE("Style Name6 :Error with Font Underline Color", pUnderlineItem->GetColor() == Color(128, 128, 128));
 
+    /* Test for Style Name "7"
+     * Has strikethrough single
+     */
+    pStyleSheet = pStyleSheetPool->FindCaseIns("Name7", SfxStyleFamily::Para);
+    CPPUNIT_ASSERT_MESSAGE("Style Name7 : Doesn't have Attribute Strikeout, but it should have.",
+        pStyleSheet->GetItemSet().HasItem(ATTR_FONT_CROSSEDOUT, &pItem));
+
+    const SvxCrossedOutItem* pCrossedOutItem = static_cast<const SvxCrossedOutItem*>(pItem);
+    CPPUNIT_ASSERT_MESSAGE("Style Name7 :Error with Strikeout", pCrossedOutItem->GetStrikeout() == STRIKEOUT_SINGLE);
+
+    /* Test for Style Name "8"
+     * Has strikethrough bold
+     */
+    pStyleSheet = pStyleSheetPool->FindCaseIns("Name8", SfxStyleFamily::Para);
+    CPPUNIT_ASSERT_MESSAGE("Style Name8 : Doesn't have Attribute Strikeout, but it should have.",
+        pStyleSheet->GetItemSet().HasItem(ATTR_FONT_CROSSEDOUT, &pItem));
+
+    pCrossedOutItem = static_cast<const SvxCrossedOutItem*>(pItem);
+    CPPUNIT_ASSERT_MESSAGE("Style Name7 :Error with Strikeout", pCrossedOutItem->GetStrikeout() == STRIKEOUT_BOLD);
+
+    /* Test for Style Name "9"
+     * Has strikethrough slash
+     */
+    pStyleSheet = pStyleSheetPool->FindCaseIns("Name9", SfxStyleFamily::Para);
+    CPPUNIT_ASSERT_MESSAGE("Style Name9 : Doesn't have Attribute Strikeout, but it should have.",
+        pStyleSheet->GetItemSet().HasItem(ATTR_FONT_CROSSEDOUT, &pItem));
+
+    pCrossedOutItem = static_cast<const SvxCrossedOutItem*>(pItem);
+    CPPUNIT_ASSERT_MESSAGE("Style Name9 :Error with Strikeout", pCrossedOutItem->GetStrikeout() == STRIKEOUT_SLASH);
 
 }
 #endif
commit 947dcb4bcc9ca2cbe09e169d2d316fa055536448
Author: Jaskaran Singh <jvsg1303 at gmail.com>
Date:   Fri Aug 5 23:24:24 2016 +0530

    Add test for font in orcus interface
    
    Change-Id: Ibe2b5ef344a8f1ca27d3b59be9ac53e2c6f5b3b0

diff --git a/sc/qa/unit/data/xml/styles.xml b/sc/qa/unit/data/xml/styles.xml
index 19eeff5..118561f 100644
--- a/sc/qa/unit/data/xml/styles.xml
+++ b/sc/qa/unit/data/xml/styles.xml
@@ -15,11 +15,8 @@
   <style:style style:name="Name5" style:family="table-cell" style:parent-style-name="Text">
     <style:table-cell-properties style:cell-protect="none" style:print-content="true"/>
   </style:style>
-  <style:style style:name="Name8" style:family="table-cell" style:parent-style-name="Text">
-    <style:text-properties style:font-name="Liberation Sans" style:text-underline-style="solid" fo:font-size="24pt" fo:color="#808080" fo:font-style="italic" style:text-underline-color="font-color" fo:font-weight="bold" style:text-underline-width="thick"/>
-  </style:style>
-  <style:style style:name="Name9" style:family="table-cell" style:parent-style-name="Text">
-    <style:text-properties style:font-name="Tahoma" style:text-underline-style="dash" fo:font-size="00pt" style:text-underline-color="#1856ff" fo:font-weight="bold" style:text-underline-width="bold"/>
+  <style:style style:name="Name6" style:family="table-cell" style:parent-style-name="Text">
+    <style:text-properties style:font-name="Liberation Sans" style:text-underline-style="solid" fo:font-size="24pt" fo:color="#808080" fo:font-style="italic" style:text-underline-color="font-color" fo:font-weight="bold"/>
   </style:style>
   <style:style style:name="Name20" style:family="table-cell" style:parent-style-name="Default">
     <style:text-properties style:text-line-through-style="solid" style:text-line-through-type="single"/>
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index d57cd6b..24fdfa3 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -38,6 +38,7 @@
 #include <editeng/flditem.hxx>
 #include <editeng/justifyitem.hxx>
 #include <editeng/lineitem.hxx>
+#include <editeng/colritem.hxx>
 #include <dbdata.hxx>
 #include "validat.hxx"
 #include "formulacell.hxx"
@@ -2792,6 +2793,48 @@ void ScFiltersTest::testOrcusODSStyleInterface()
     CPPUNIT_ASSERT_MESSAGE("Style Name5 : Has Attribute number format, but it shouldn't.",
         !pStyleSheet->GetItemSet().HasItem(ATTR_VALUE_FORMAT, &pItem));
 
+    /* Test for Style "Name6"
+     * Has Font name, posture, weight, color, height
+     */
+    pStyleSheet = pStyleSheetPool->FindCaseIns("Name6", SfxStyleFamily::Para);
+    CPPUNIT_ASSERT_MESSAGE("Style Name6 : Doesn't have Attribute Font, but it should have.",
+        pStyleSheet->GetItemSet().HasItem(ATTR_FONT, &pItem));
+
+    const SvxFontItem* pFontItem= static_cast<const SvxFontItem*>(pItem);
+    CPPUNIT_ASSERT_MESSAGE("Style Name6 :Error with Font name", pFontItem->GetStyleName() == "Liberation Sans");
+
+    CPPUNIT_ASSERT_MESSAGE("Style Name6 : Doesn't have Attribute Font Height, but it should have.",
+        pStyleSheet->GetItemSet().HasItem(ATTR_FONT_HEIGHT, &pItem));
+
+    const SvxFontHeightItem* pFontHeightItem= static_cast<const SvxFontHeightItem*>(pItem);
+    CPPUNIT_ASSERT_MESSAGE("Style Name6 :Error with Font Height", pFontHeightItem->GetHeight() == 480);
+
+    CPPUNIT_ASSERT_MESSAGE("Style Name6 : Doesn't have Attribute Font Posture, but it should have.",
+        pStyleSheet->GetItemSet().HasItem(ATTR_FONT_POSTURE, &pItem));
+
+    const SvxPostureItem* pFontPostureItem= static_cast<const SvxPostureItem*>(pItem);
+    CPPUNIT_ASSERT_MESSAGE("Style Name6 :Error with Font Posture", pFontPostureItem->GetPosture() == ITALIC_NORMAL);
+
+    CPPUNIT_ASSERT_MESSAGE("Style Name6 : Doesn't have Attribute Font Weight, but it should have.",
+        pStyleSheet->GetItemSet().HasItem(ATTR_FONT_WEIGHT, &pItem));
+
+    const SvxWeightItem* pFontWeightItem= static_cast<const SvxWeightItem*>(pItem);
+    CPPUNIT_ASSERT_MESSAGE("Style Name6 :Error with Font Weight", pFontWeightItem->GetWeight() == WEIGHT_BOLD);
+
+    CPPUNIT_ASSERT_MESSAGE("Style Name6 : Doesn't have Attribute Font Color, but it should have.",
+        pStyleSheet->GetItemSet().HasItem(ATTR_FONT_COLOR, &pItem));
+
+    const SvxColorItem* pFontColorItem= static_cast<const SvxColorItem*>(pItem);
+    CPPUNIT_ASSERT_MESSAGE("Style Name6 :Error with Font Color", pFontColorItem->GetValue() == Color(128, 128, 128));
+
+    CPPUNIT_ASSERT_MESSAGE("Style Name6 : Doesn't have Attribute Underline, but it should have.",
+        pStyleSheet->GetItemSet().HasItem(ATTR_FONT_UNDERLINE, &pItem));
+
+    const SvxUnderlineItem* pUnderlineItem= static_cast<const SvxUnderlineItem*>(pItem);
+    CPPUNIT_ASSERT_MESSAGE("Style Name6 :Error with Font Underline Style", pUnderlineItem->GetLineStyle() == LINESTYLE_SINGLE);
+    CPPUNIT_ASSERT_MESSAGE("Style Name6 :Error with Font Underline Color", pUnderlineItem->GetColor() == Color(128, 128, 128));
+
+
 }
 #endif
 
commit d84997ae4935d8275895a95036f723cf3f96820a
Author: Jaskaran Singh <jvsg1303 at gmail.com>
Date:   Fri Aug 5 14:36:53 2016 +0530

    Add test for cell protection in orcus interface
    
    Change-Id: I952b5897bf3f728d103c43d93cadeffb92d1c3a9

diff --git a/sc/qa/unit/data/xml/styles.xml b/sc/qa/unit/data/xml/styles.xml
index 85c1e49..19eeff5 100644
--- a/sc/qa/unit/data/xml/styles.xml
+++ b/sc/qa/unit/data/xml/styles.xml
@@ -6,16 +6,13 @@
   <style:style style:name="Name2" 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 #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"/>
-  </style:style>
-  <style:style style:name="Name5" style:family="table-cell" style:parent-style-name="Text">
+  <style:style style:name="Name3" style:family="table-cell" style:parent-style-name="Text">
     <style:table-cell-properties style:cell-protect="hidden-and-protected" style:print-content="true"/>
   </style:style>
-  <style:style style:name="Name6" style:family="table-cell" style:parent-style-name="Text">
+  <style:style style:name="Name4" style:family="table-cell" style:parent-style-name="Text">
     <style:table-cell-properties style:cell-protect="protected formula-hidden" style:print-content="false"/>
   </style:style>
-  <style:style style:name="Name7" style:family="table-cell" style:parent-style-name="Text">
+  <style:style style:name="Name5" style:family="table-cell" style:parent-style-name="Text">
     <style:table-cell-properties style:cell-protect="none" style:print-content="true"/>
   </style:style>
   <style:style style:name="Name8" style:family="table-cell" style:parent-style-name="Text">
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 8c1b490..d57cd6b 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -65,6 +65,7 @@
 #include "externalrefmgr.hxx"
 #include <stlpool.hxx>
 #include <config_orcus.h>
+#include <attrib.hxx>
 
 #if ENABLE_ORCUS
 #include <orcusfiltersimpl.hxx>
@@ -2709,7 +2710,7 @@ void ScFiltersTest::testOrcusODSStyleInterface()
     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.",
+    CPPUNIT_ASSERT_MESSAGE("Style Name1 : Has Attribute Protection, 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));
@@ -2754,6 +2755,43 @@ void ScFiltersTest::testOrcusODSStyleInterface()
         !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));
+
+    /* Test for Style "Name3"
+     * Hidden, protected and content is printed.
+     */
+    pStyleSheet = pStyleSheetPool->FindCaseIns("Name3", SfxStyleFamily::Para);
+    CPPUNIT_ASSERT_MESSAGE("Style Name3 : Doesn't have Attribute Protection, but it should have.",
+        pStyleSheet->GetItemSet().HasItem(ATTR_PROTECTION, &pItem));
+
+    CPPUNIT_ASSERT_MESSAGE("Style Name 3 : Error with Protection attribute." ,ScProtectionAttr(true, false, true, true) == *pItem);
+
+    /* Test for Style "Name4"
+     * Hidden, protected and content is printed.
+     */
+    pStyleSheet = pStyleSheetPool->FindCaseIns("Name4", SfxStyleFamily::Para);
+    CPPUNIT_ASSERT_MESSAGE("Style Name4 : Doesn't have Attribute Protection, but it should have.",
+        pStyleSheet->GetItemSet().HasItem(ATTR_PROTECTION, &pItem));
+
+    CPPUNIT_ASSERT_MESSAGE("Style Name 4 : Error with Protection attribute." ,ScProtectionAttr(true, true, false, false) == *pItem);
+
+    /* Test for Style "Name3"
+     * Hidden, protected and content is printed.
+     */
+    pStyleSheet = pStyleSheetPool->FindCaseIns("Name5", SfxStyleFamily::Para);
+    CPPUNIT_ASSERT_MESSAGE("Style Name5 : Doesn't have Attribute Protection, but it should have.",
+        pStyleSheet->GetItemSet().HasItem(ATTR_PROTECTION, &pItem));
+
+    CPPUNIT_ASSERT_MESSAGE("Style Name 5 : Error with Protection attribute." ,ScProtectionAttr(false, false, false, true) == *pItem);
+
+    CPPUNIT_ASSERT_MESSAGE("Style Name5 : Has Attribute Border, but it shouldn't.",
+        !pStyleSheet->GetItemSet().HasItem(ATTR_BORDER, &pItem));
+    CPPUNIT_ASSERT_MESSAGE("Style Name5: Has Attribute background, but it shouldn't.",
+        !pStyleSheet->GetItemSet().HasItem(ATTR_BACKGROUND, &pItem));
+    CPPUNIT_ASSERT_MESSAGE("Style Name5 : Has Attribute font, but it shouldn't.",
+        !pStyleSheet->GetItemSet().HasItem(ATTR_FONT, &pItem));
+    CPPUNIT_ASSERT_MESSAGE("Style Name5 : Has Attribute number format, but it shouldn't.",
+        !pStyleSheet->GetItemSet().HasItem(ATTR_VALUE_FORMAT, &pItem));
+
 }
 #endif
 
commit 6f1d688aff7c4c97fda42eed0fc5104ce512a3d3
Author: Jaskaran Singh <jvsg1303 at 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 80e13fc..8c1b490 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"
@@ -2681,6 +2682,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;
 
@@ -2704,6 +2708,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 a54099378f9900ee623c679334a93d43b6dce5b0
Author: Jaskaran Singh <jvsg1303 at 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 72a2f4e..c07ecb2 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(&current_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(&current_border_line.second.maColor, current_border_line.second.mnWidth, current_border_line.second.mestyle);
             aDiagonal_BLTR.SetLine(&aLine);
commit f3b306c7e721e9c617db72f6ebb993e8789400ca
Author: Jaskaran Singh <jvsg1303 at 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 c5569a5..72a2f4e 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(&current_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(&current_border_line.second.maColor, current_border_line.second.mnWidth, current_border_line.second.mestyle);
-            aDiagonal_TLBR.SetLine(&aLine);
+            aDiagonal_BLTR.SetLine(&aLine);
         }
         else
         {
commit 8533b9fa22c96b90df0e5edc38b277099d0f34f8
Author: Jaskaran Singh <jvsg1303 at 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 c6d3d5a..e467b85 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 e6dedef..c5569a5 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 {
commit 9316c0a6f19886bbba9fd8e98f7f02f4df31c041
Author: Jaskaran Singh <jvsg1303 at gmail.com>
Date:   Mon Aug 1 21:00:03 2016 +0530

    Disable printing default protection in imported styles
    
    Change-Id: Iba85a8a401542496f2313af576344d8ffdf768fe

diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
index b9d8f66..e6dedef 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -835,7 +835,7 @@ ScOrcusStyles::protection::protection():
     mbLocked(true),
     mbPrintContent(false),
     mbFormulaHidden(false),
-    mbHasProtectionAttr(true)
+    mbHasProtectionAttr(false)
 {
 }
 
commit b66e71b02d5128931b3a0d4a0aed47a4503f9d0d
Author: Jaskaran Singh <jvsg1303 at gmail.com>
Date:   Mon Aug 1 19:20:26 2016 +0530

    Make sc/res/xml/styles.xml install on every build
    
    Change-Id: I1656a24057d9aae513cd9e7e736bfb7b258ba733

diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index 642c6b8..cdba1fe 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -16,6 +16,7 @@ $(eval $(call gb_Module_add_targets,sc,\
 	Library_scfilt \
 	$(call gb_Helper_optional,DESKTOP,Library_scui) \
 	$(call gb_Helper_optional,OPENCL,Package_opencl) \
+	Package_res_xml \
 ))
 
 $(eval $(call gb_Module_add_l10n_targets,sc,\
diff --git a/sc/Package_res_xml.mk b/sc/Package_res_xml.mk
new file mode 100644
index 0000000..1a25a66
--- /dev/null
+++ b/sc/Package_res_xml.mk
@@ -0,0 +1,16 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Package_Package,sc_res_xml,$(SRCDIR)/sc/res/xml))
+
+$(eval $(call gb_Package_add_files,sc_res_xml,$(LIBO_BIN_FOLDER),\
+	styles.xml \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sc/res/xml/styles.xml b/sc/res/xml/styles.xml
new file mode 100644
index 0000000..f6f9183
--- /dev/null
+++ b/sc/res/xml/styles.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+<office:styles xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0">
+  <style:style style:name="Name1" style:family="table-cell" style:parent-style-name="Text">
+    <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: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"/>
+  </style:style>
+  <style:style style:name="Name5" style:family="table-cell" style:parent-style-name="Text">
+    <style:table-cell-properties style:cell-protect="hidden-and-protected" style:print-content="true"/>
+  </style:style>
+  <style:style style:name="Name6" style:family="table-cell" style:parent-style-name="Text">
+    <style:table-cell-properties style:cell-protect="protected formula-hidden" style:print-content="false"/>
+  </style:style>
+  <style:style style:name="Name7" style:family="table-cell" style:parent-style-name="Text">
+    <style:table-cell-properties style:cell-protect="none" style:print-content="true"/>
+  </style:style>
+  <style:style style:name="Name8" style:family="table-cell" style:parent-style-name="Text">
+    <style:text-properties style:font-name="Liberation Sans" style:text-underline-style="solid" fo:font-size="24pt" fo:color="#808080" fo:font-style="italic" style:text-underline-color="font-color" fo:font-weight="bold" style:text-underline-width="thick"/>
+  </style:style>
+  <style:style style:name="Name9" style:family="table-cell" style:parent-style-name="Text">
+    <style:text-properties style:font-name="Tahoma" style:text-underline-style="dash" fo:font-size="00pt" style:text-underline-color="#1856ff" fo:font-weight="bold" style:text-underline-width="bold"/>
+  </style:style>
+  <style:style style:name="Name20" style:family="table-cell" style:parent-style-name="Default">
+    <style:text-properties style:text-line-through-style="solid" style:text-line-through-type="single"/>
+  </style:style>
+  <style:style style:name="Name21" style:family="table-cell" style:parent-style-name="Default">
+    <style:text-properties style:text-line-through-style="solid" style:text-line-through-type="single" style:text-line-through-width="bold"/>
+  </style:style>
+  <style:style style:name="Name22" style:family="table-cell" style:parent-style-name="Default">
+    <style:text-properties style:text-line-through-style="solid" style:text-line-through-type="single" style:text-line-through-text="/"/>
+  </style:style>
+  <style:style style:name="Name23" style:family="table-cell" style:parent-style-name="Text">
+    <style:table-cell-properties style:vertical-align="middle"/>
+    <style:paragraph-properties fo:text-align="start"/>
+  </style:style>
+</office:styles>
commit c8a451bd9433316297aacf782912ece9a374cf62
Author: Jaskaran Singh <jvsg1303 at gmail.com>
Date:   Mon Aug 1 09:37:19 2016 +0530

    Add Test File for Orcus ODF styles import
    
    Change-Id: I3131fe598b1af4731214d02e1ef09e7ab10f4761

diff --git a/sc/qa/unit/data/xml/styles.xml b/sc/qa/unit/data/xml/styles.xml
new file mode 100644
index 0000000..f6f9183
--- /dev/null
+++ b/sc/qa/unit/data/xml/styles.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+<office:styles xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0">
+  <style:style style:name="Name1" style:family="table-cell" style:parent-style-name="Text">
+    <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: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"/>
+  </style:style>
+  <style:style style:name="Name5" style:family="table-cell" style:parent-style-name="Text">
+    <style:table-cell-properties style:cell-protect="hidden-and-protected" style:print-content="true"/>
+  </style:style>
+  <style:style style:name="Name6" style:family="table-cell" style:parent-style-name="Text">
+    <style:table-cell-properties style:cell-protect="protected formula-hidden" style:print-content="false"/>
+  </style:style>
+  <style:style style:name="Name7" style:family="table-cell" style:parent-style-name="Text">
+    <style:table-cell-properties style:cell-protect="none" style:print-content="true"/>
+  </style:style>
+  <style:style style:name="Name8" style:family="table-cell" style:parent-style-name="Text">
+    <style:text-properties style:font-name="Liberation Sans" style:text-underline-style="solid" fo:font-size="24pt" fo:color="#808080" fo:font-style="italic" style:text-underline-color="font-color" fo:font-weight="bold" style:text-underline-width="thick"/>
+  </style:style>
+  <style:style style:name="Name9" style:family="table-cell" style:parent-style-name="Text">
+    <style:text-properties style:font-name="Tahoma" style:text-underline-style="dash" fo:font-size="00pt" style:text-underline-color="#1856ff" fo:font-weight="bold" style:text-underline-width="bold"/>
+  </style:style>
+  <style:style style:name="Name20" style:family="table-cell" style:parent-style-name="Default">
+    <style:text-properties style:text-line-through-style="solid" style:text-line-through-type="single"/>
+  </style:style>
+  <style:style style:name="Name21" style:family="table-cell" style:parent-style-name="Default">
+    <style:text-properties style:text-line-through-style="solid" style:text-line-through-type="single" style:text-line-through-width="bold"/>
+  </style:style>
+  <style:style style:name="Name22" style:family="table-cell" style:parent-style-name="Default">
+    <style:text-properties style:text-line-through-style="solid" style:text-line-through-type="single" style:text-line-through-text="/"/>
+  </style:style>
+  <style:style style:name="Name23" style:family="table-cell" style:parent-style-name="Text">
+    <style:table-cell-properties style:vertical-align="middle"/>
+    <style:paragraph-properties fo:text-align="start"/>
+  </style:style>
+</office:styles>
commit 7b902916ac8a7dfec9e398456ce9127f138b71ba
Author: Jaskaran Singh <jvsg1303 at gmail.com>
Date:   Mon Aug 1 00:37:03 2016 +0530

    Add test for orcus style import
    
    Change-Id: I4731ed1854f854651b828ae4cb27e6b040660bdf

diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 42aa391..80e13fc 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -31,6 +31,7 @@
 #include <editeng/udlnitem.hxx>
 #include <editeng/editobj.hxx>
 #include <editeng/borderline.hxx>
+#include <editeng/boxitem.hxx>
 #include <editeng/fhgtitem.hxx>
 #include <editeng/brushitem.hxx>
 #include <editeng/fontitem.hxx>
@@ -61,6 +62,15 @@
 #include <tokenstringcontext.hxx>
 #include <formula/errorcodes.hxx>
 #include "externalrefmgr.hxx"
+#include <stlpool.hxx>
+#include <config_orcus.h>
+
+#if ENABLE_ORCUS
+#include <orcusfiltersimpl.hxx>
+#include "orcusfilters.hxx"
+#include "filter.hxx"
+#include "orcusinterface.hxx"
+#endif
 
 
 #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
@@ -149,6 +159,10 @@ public:
     void testCondFormatParentXLSX();
     void testColorScaleNumWithRefXLSX();
 
+    #if ENABLE_ORCUS
+    void testOrcusODSStyleInterface();
+    #endif
+
     void testLiteralInFormulaXLS();
 
     //change this test file only in excel and not in calc
@@ -271,6 +285,11 @@ public:
     CPPUNIT_TEST(testComplexIconSetsXLSX);
     CPPUNIT_TEST(testCondFormatParentXLSX);
     CPPUNIT_TEST(testColorScaleNumWithRefXLSX);
+
+    #if ENABLE_ORCUS
+    CPPUNIT_TEST(testOrcusODSStyleInterface);
+    #endif
+
     CPPUNIT_TEST(testLiteralInFormulaXLS);
 
     CPPUNIT_TEST(testNumberFormatHTML);
@@ -2646,6 +2665,48 @@ void ScFiltersTest::testColorScaleNumWithRefXLSX()
     xDocSh->DoClose();
 }
 
+#if ENABLE_ORCUS
+void ScFiltersTest::testOrcusODSStyleInterface()
+{
+    ScDocument aDoc;
+    OUString aFullUrl = m_directories.getURLFromSrc("sc/qa/unit/data/xml/styles.xml");
+
+    /* This loop below trims file:// from the start because orcus doesn't accept such a url */
+    OUString aValidPath;
+    osl::FileBase::getSystemPathFromFileURL(aFullUrl, aValidPath);
+
+    ScOrcusFilters* pOrcus = ScFormatFilter::Get().GetOrcusFilters();
+    CPPUNIT_ASSERT(pOrcus);
+
+    pOrcus->importODS_Styles(aDoc, aValidPath);
+    ScStyleSheetPool* pStyleSheetPool = aDoc.GetStyleSheetPool();
+
+    ScStyleSheet* pStyleSheet = pStyleSheetPool->FindCaseIns("Name1", SfxStyleFamily::Para);
+    const SfxPoolItem* pItem = nullptr;
+
+    CPPUNIT_ASSERT_MESSAGE("Style Name1 : Doesn't have Attribute background, but it should have.",
+        pStyleSheet->GetItemSet().HasItem(ATTR_BACKGROUND, &pItem));
+    const SvxBrushItem* pBackground = static_cast<const SvxBrushItem*>(pItem);
+    CPPUNIT_ASSERT_EQUAL(Color(254, 255, 204), pBackground->GetColor());
+
+    CPPUNIT_ASSERT_MESSAGE("Style Name1 : Doesn't have Attribute border, but it should have.",
+        pStyleSheet->GetItemSet().HasItem(ATTR_BORDER, &pItem));
+    const SvxBoxItem* pBoxItem = static_cast<const SvxBoxItem*>(pItem);
+    CPPUNIT_ASSERT_EQUAL(Color(255, 204, 18), pBoxItem->GetLeft()->GetColor());
+    CPPUNIT_ASSERT_EQUAL(Color(255, 204, 18), pBoxItem->GetRight()->GetColor());
+    CPPUNIT_ASSERT_EQUAL(Color(255, 204, 18), pBoxItem->GetTop()->GetColor());
+    CPPUNIT_ASSERT_EQUAL(Color(255, 204, 18), pBoxItem->GetBottom()->GetColor());
+    CPPUNIT_ASSERT_EQUAL(pBoxItem->GetLeft()->GetBorderLineStyle(), ::com::sun::star::table::BorderLineStyle::DOTTED);
+    CPPUNIT_ASSERT_EQUAL(pBoxItem->GetRight()->GetBorderLineStyle(), ::com::sun::star::table::BorderLineStyle::DOTTED);
+    CPPUNIT_ASSERT_EQUAL(pBoxItem->GetTop()->GetBorderLineStyle(), ::com::sun::star::table::BorderLineStyle::DOTTED);
+    CPPUNIT_ASSERT_EQUAL(pBoxItem->GetBottom()->GetBorderLineStyle(), ::com::sun::star::table::BorderLineStyle::DOTTED);
+    ASSERT_DOUBLES_EQUAL_MESSAGE("Error with left width", 1, pBoxItem->GetLeft()->GetWidth());
+    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());
+}
+#endif
+
 void ScFiltersTest::testLiteralInFormulaXLS()
 {
     ScDocShellRef xDocSh = loadDoc("shared-string/literal-in-formula.", FORMAT_XLS);
commit e4b848d7767b14b8f7176d26399cd67f253ca9bf
Author: Jaskaran Singh <jvsg1303 at gmail.com>
Date:   Mon Aug 1 00:35:48 2016 +0530

    Change the way url is handled for orcus style import
    
    Change-Id: I6d5f9059f8a83ae5b148ff0498d8af0777acfac8

diff --git a/sc/source/filter/orcus/orcusfiltersimpl.cxx b/sc/source/filter/orcus/orcusfiltersimpl.cxx
index e16cc7f..66a9ca2 100644
--- a/sc/source/filter/orcus/orcusfiltersimpl.cxx
+++ b/sc/source/filter/orcus/orcusfiltersimpl.cxx
@@ -147,22 +147,9 @@ bool ScOrcusFiltersImpl::importODS(ScDocument& rDoc, SfxMedium& rMedium) const
     return true;
 }
 
-bool ScOrcusFiltersImpl::importODS_Styles(ScDocument& rDoc, OUString& aFileName) const
+bool ScOrcusFiltersImpl::importODS_Styles(ScDocument& rDoc, OUString& aPath) const
 {
-    OUString aPath("$BRAND_BASE_DIR/");  /* Read the comment below before changing this */
-    rtl::Bootstrap::expandMacros(aPath);
-    OUString aValidPath;
-
-    /* The Following loop trims 'file://' from start of string and
-     * '../' from the end of string. If you ever happen to change the above macro
-     * please consider changing the following range too, otherwise app would
-     * crash!!
-     */
-    for (sal_Int32 i = 7; i < aPath.getLength() - 3; ++i)
-        aValidPath += OUString(aPath[i]);
-
-    aValidPath += aFileName;
-    OString aUrl = OUStringToOString(aValidPath, RTL_TEXTENCODING_UTF8);
+    OString aUrl = OUStringToOString(aPath, RTL_TEXTENCODING_UTF8);
     const char* path = aUrl.getStr();
 
     try
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index c364896..62e2a8d 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -27,6 +27,7 @@
 #include <vcl/msgbox.hxx>
 #include <vcl/virdev.hxx>
 #include <vcl/waitobj.hxx>
+#include <rtl/bootstrap.hxx>
 #include <svl/PasswordHelper.hxx>
 #include <sfx2/app.hxx>
 #include <sfx2/bindings.hxx>
@@ -111,6 +112,7 @@
 #include "refreshtimerprotector.hxx"
 #include <orcus/orcus_import_ods.hpp>
 #include <orcusfiltersimpl.hxx>
+#include <config_orcus.h>
 
 #include <officecfg/Office/Calc.hxx>
 #include <comphelper/processfactory.hxx>
@@ -588,13 +590,29 @@ bool ScDocShell::Load( SfxMedium& rMedium )
             aDocument.GetStyleSheetPool()->CreateStandardStyles();
             aDocument.UpdStlShtPtrsFrmNms();
 
+            #if ENABLE_ORCUS
             /* Create styles that are imported through Orcus */
 
+            OUString aPath("$BRAND_BASE_DIR/");  /* Read the comment below before changing this */
+            rtl::Bootstrap::expandMacros(aPath);
+            OUString aValidPath;
+
+            /* The Following loop trims 'file://' from start of string and
+             * '../' from the end of string. If you ever happen to change the above macro
+             * please consider changing the following range too, otherwise app would
+             * crash!!
+             */
+            for (sal_Int32 i = 7; i < aPath.getLength() - 3; ++i)
+                aValidPath += OUString(aPath[i]);
+
             OUString aFileName = "styles.xml";
+            aValidPath += aFileName;
+
             ScOrcusFilters* pOrcus = ScFormatFilter::Get().GetOrcusFilters();
             if (!pOrcus)
                 return false;
-            pOrcus->importODS_Styles(aDocument, aFileName);
+            pOrcus->importODS_Styles(aDocument, aValidPath);
+            #endif
 
             bRet = LoadXML( &rMedium, nullptr );
         }
diff --git a/sc/source/ui/docshell/docsh2.cxx b/sc/source/ui/docshell/docsh2.cxx
index 04989b09..46adfa8 100644
--- a/sc/source/ui/docshell/docsh2.cxx
+++ b/sc/source/ui/docshell/docsh2.cxx
@@ -18,12 +18,14 @@
  */
 
 #include "scitems.hxx"
+#include <rtl/bootstrap.hxx>
 #include <svx/drawitem.hxx>
 #include <svl/asiancfg.hxx>
 #include <editeng/forbiddencharacterstable.hxx>
 #include <editeng/unolingu.hxx>
 #include <orcus/orcus_import_ods.hpp>
 #include <orcusfiltersimpl.hxx>
+#include <config_orcus.h>
 
 #include "drwlayer.hxx"
 #include "stlpool.hxx"
@@ -56,13 +58,29 @@ bool ScDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor )
     aDocument.GetStyleSheetPool()->CreateStandardStyles();
     aDocument.UpdStlShtPtrsFrmNms();
 
+    #if ENABLE_ORCUS
     /* Create styles that are imported through Orcus */
 
+    OUString aPath("$BRAND_BASE_DIR/");  /* Read the comment below before changing this */
+    rtl::Bootstrap::expandMacros(aPath);
+    OUString aValidPath;
+
+    /* The Following loop trims 'file://' from start of string and
+     * '../' from the end of string. If you ever happen to change the above macro
+     * please consider changing the following range too, otherwise app would
+     * crash!!
+     */
+    for (sal_Int32 i = 7; i < aPath.getLength() - 3; ++i)
+        aValidPath += OUString(aPath[i]);
+
     OUString aFileName = "styles.xml";
+    aValidPath += aFileName;
+
     ScOrcusFilters* pOrcus = ScFormatFilter::Get().GetOrcusFilters();
     if (!pOrcus)
         return false;
-    pOrcus->importODS_Styles(aDocument, aFileName);
+    pOrcus->importODS_Styles(aDocument, aValidPath);
+    #endif
 
     //  SetDocumentModified is not allowed anymore in Load/InitNew!
     InitItems();
commit d80b44a4d188652d6003044f6b86f22db77eba08
Author: Jaskaran Singh <jvsg1303 at gmail.com>
Date:   Mon Aug 1 00:33:11 2016 +0530

    Link orcus headers and libs to subsequent filters test
    
    Change-Id: If036666f16dec23539e0e5a78f3a28d9cdc8be53

diff --git a/sc/CppunitTest_sc_subsequent_filters_test.mk b/sc/CppunitTest_sc_subsequent_filters_test.mk
index 47df0c0..ef3e197 100644
--- a/sc/CppunitTest_sc_subsequent_filters_test.mk
+++ b/sc/CppunitTest_sc_subsequent_filters_test.mk
@@ -59,6 +59,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_subsequent_filters_test, \
 $(eval $(call gb_CppunitTest_set_include,sc_subsequent_filters_test,\
     -I$(SRCDIR)/sc/source/ui/inc \
     -I$(SRCDIR)/sc/inc \
+	-I$(SRCDIR)/sc/source/filter/inc \
     $$(INCLUDE) \
 ))
 
@@ -118,6 +119,18 @@ $(eval $(call gb_CppunitTest_use_components,sc_subsequent_filters_test,\
 ))
 endif
 
+ifeq ($(ENABLE_ORCUS),TRUE)
+$(eval $(call gb_CppunitTest_use_externals,sc_subsequent_filters_test,\
+	orcus \
+	orcus-parser \
+	boost_filesystem \
+	boost_system \
+	boost_iostreams \
+	zlib \
+))
+
+endif
+
 $(eval $(call gb_CppunitTest_use_configuration,sc_subsequent_filters_test))
 
 # vim: set noet sw=4 ts=4:
commit 407d7a2eaa0089d424bfc4eb355ce0734b0acff2
Author: Jaskaran Singh <jvsg1303 at gmail.com>
Date:   Mon Aug 1 00:31:14 2016 +0530

    Export ScStyleSheetPool Symbol out of its lib
    
    Change-Id: I7fe0842be5e3c07b3d0b8936b276d3107e8daa14

diff --git a/sc/inc/stlpool.hxx b/sc/inc/stlpool.hxx
index 7155255..2b7f1f0 100644
--- a/sc/inc/stlpool.hxx
+++ b/sc/inc/stlpool.hxx
@@ -26,7 +26,7 @@
 class ScStyleSheet;
 class ScDocument;
 
-class ScStyleSheetPool : public SfxStyleSheetPool
+class SC_DLLPUBLIC ScStyleSheetPool : public SfxStyleSheetPool
 {
 public:
                         ScStyleSheetPool( SfxItemPool&  rPool,
@@ -43,7 +43,7 @@ public:
     SfxStyleSheetBase*  GetActualStyleSheet ()
                                 { return pActualStyleSheet; }
 
-    void SC_DLLPUBLIC CreateStandardStyles();
+    void                CreateStandardStyles();
     void                CopyStdStylesFrom( ScStyleSheetPool* pSrcPool );
 
     void                CopyStyleFrom( ScStyleSheetPool* pSrcPool,


More information about the Libreoffice-commits mailing list