[Libreoffice-commits] core.git: Branch 'feature/orcus-odf' - 3 commits - sc/source

Jaskaran Singh jvsg1303 at gmail.com
Mon Jun 27 06:52:33 UTC 2016


 sc/source/filter/inc/orcusinterface.hxx |    6 ++
 sc/source/filter/orcus/interface.cxx    |   73 ++++++++++++++++++++++++++------
 2 files changed, 66 insertions(+), 13 deletions(-)

New commits:
commit d98dc61dbd97dedc2a1a18cf1b41c5fc91e30886
Author: Jaskaran Singh <jvsg1303 at gmail.com>
Date:   Mon Jun 27 11:53:57 2016 +0530

    Add functions for cell protection in orcus interface
    
    Change-Id: I86111e9584e9d629d5fbb6a17c8936de719d190b

diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx
index d5765da..8457eb2 100644
--- a/sc/source/filter/inc/orcusinterface.hxx
+++ b/sc/source/filter/inc/orcusinterface.hxx
@@ -303,6 +303,8 @@ private:
     {
         bool mbHidden;
         bool mbLocked;
+        bool mbPrintContent;
+        bool mbFormulaHidden;
 
         protection();
         void applyToItemSet(SfxItemSet& rSet) const;
diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
index 9a65cd53..db0c439 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -31,6 +31,9 @@
 #include <editeng/boxitem.hxx>
 #include <editeng/borderline.hxx>
 #include <editeng/lcolitem.hxx>
+#include <editeng/charhiddenitem.hxx>
+#include <editeng/protitem.hxx>
+#include <editeng/prntitem.hxx>
 
 #include <formula/token.hxx>
 #include <tools/datetime.hxx>
@@ -786,9 +789,13 @@ ScOrcusStyles::protection::protection():
 {
 }
 
-void ScOrcusStyles::protection::applyToItemSet(SfxItemSet& /*rSet*/) const
+void ScOrcusStyles::protection::applyToItemSet(SfxItemSet& rSet) const
 {
-    (void)this; // loplugin:staticmethods
+    rSet.Put(SvxCharHiddenItem(mbHidden, ATTR_PROTECTION));
+
+    if (mbLocked)
+        rSet.Put(SvxProtectItem(ATTR_PROTECTION));
+    rSet.Put(SvxPrintItem(ATTR_PROTECTION, mbPrintContent));
 }
 
 ScOrcusStyles::border::border()
@@ -1188,14 +1195,14 @@ void ScOrcusStyles::set_cell_locked(bool b)
     maCurrentProtection.mbLocked = b;
 }
 
-void ScOrcusStyles::set_cell_print_content(bool /* b */)
+void ScOrcusStyles::set_cell_print_content(bool b )
 {
-
+    maCurrentProtection.mbPrintContent = b;
 }
 
-void ScOrcusStyles::set_cell_formula_hidden(bool /* b */)
+void ScOrcusStyles::set_cell_formula_hidden(bool b )
 {
-
+    maCurrentProtection.mbFormulaHidden = b;
 }
 
 size_t ScOrcusStyles::commit_cell_protection()
commit 79355b229ed10b59c08316f3a76b5148d55901f9
Author: Jaskaran Singh <jvsg1303 at gmail.com>
Date:   Mon Jun 27 11:52:15 2016 +0530

    Add functions for border width and style to orcus interface
    
    Change-Id: Ia707c7bf110f67f6537841999d0b1504fb24eab5

diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx
index 604159c..d5765da 100644
--- a/sc/source/filter/inc/orcusinterface.hxx
+++ b/sc/source/filter/inc/orcusinterface.hxx
@@ -37,6 +37,8 @@ class ScOrcusFactory;
 class ScRangeData;
 class SfxItemSet;
 
+typedef sal_Int16 SvxBorderStyle;
+
 namespace com { namespace sun { namespace star { namespace task {
 
 class XStatusIndicator;
@@ -283,7 +285,9 @@ private:
     {
         struct border_line
         {
+            SvxBorderStyle mestyle;
             Color maColor;
+            double mnWidth;
         };
         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 f5e3080..9a65cd53 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -1109,9 +1109,48 @@ void ScOrcusStyles::set_border_style(orcus::spreadsheet::border_direction_t /*di
 }
 
 void ScOrcusStyles::set_border_style(
-    orcus::spreadsheet::border_direction_t /*dir*/, orcus::spreadsheet::border_style_t /*style*/)
+    orcus::spreadsheet::border_direction_t dir, orcus::spreadsheet::border_style_t style)
 {
-    // implement later
+    border::border_line& current_line = maCurrentBorder.border_lines[dir];
+    switch (style)
+    {
+        case orcus::spreadsheet::border_style_t::unknown:
+        case orcus::spreadsheet::border_style_t::none:
+        case orcus::spreadsheet::border_style_t::solid:
+        case orcus::spreadsheet::border_style_t::hair:
+        case orcus::spreadsheet::border_style_t::medium:
+        case orcus::spreadsheet::border_style_t::thick:
+        case orcus::spreadsheet::border_style_t::thin:
+            current_line.mestyle = ::com::sun::star::table::BorderLineStyle::SOLID;
+            break;
+        case orcus::spreadsheet::border_style_t::dash_dot:
+            current_line.mestyle = ::com::sun::star::table::BorderLineStyle::DASH_DOT;
+            break;
+        case orcus::spreadsheet::border_style_t::dash_dot_dot:
+            current_line.mestyle = ::com::sun::star::table::BorderLineStyle::DASH_DOT_DOT;
+            break;
+        case orcus::spreadsheet::border_style_t::dashed:
+            current_line.mestyle = ::com::sun::star::table::BorderLineStyle::DASHED;
+            break;
+        case orcus::spreadsheet::border_style_t::dotted:
+            current_line.mestyle = ::com::sun::star::table::BorderLineStyle::DOTTED;
+            break;
+        case orcus::spreadsheet::border_style_t::double_border:
+            current_line.mestyle = ::com::sun::star::table::BorderLineStyle::DOUBLE;
+            break;
+        case orcus::spreadsheet::border_style_t::medium_dash_dot:
+        case orcus::spreadsheet::border_style_t::slant_dash_dot:
+            current_line.mestyle = ::com::sun::star::table::BorderLineStyle::DASH_DOT;
+            break;
+        case orcus::spreadsheet::border_style_t::medium_dash_dot_dot:
+            current_line.mestyle = ::com::sun::star::table::BorderLineStyle::DASH_DOT_DOT;
+            break;
+        case orcus::spreadsheet::border_style_t::medium_dashed:
+            current_line.mestyle = ::com::sun::star::table::BorderLineStyle::DASHED;
+            break;
+        default:
+            ;
+    }
 }
 
 void ScOrcusStyles::set_border_color(orcus::spreadsheet::border_direction_t dir,
@@ -1124,9 +1163,10 @@ void ScOrcusStyles::set_border_color(orcus::spreadsheet::border_direction_t dir,
     current_line.maColor = Color(alpha, red, green, blue);
 }
 
-void ScOrcusStyles::set_border_width(orcus::spreadsheet::border_direction_t /* dir */, orcus::length_t /* width */)
+void ScOrcusStyles::set_border_width(orcus::spreadsheet::border_direction_t  dir, orcus::length_t  width )
 {
-
+    border::border_line& current_line = maCurrentBorder.border_lines[dir];
+    current_line.mnWidth = translateToInternal(width.value, width.unit);
 }
 
 size_t ScOrcusStyles::commit_border()
commit 29b0cb0c427357b0225823d77ff06e44ca081187
Author: Jaskaran Singh <jvsg1303 at gmail.com>
Date:   Mon Jun 27 11:48:55 2016 +0530

    Fix getDirection for border in orcus interface
    
    Change-Id: I43077c6b61d883826476ab1234d6b70abadcae0a

diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
index 85511d7..f5e3080 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -805,13 +805,13 @@ SvxBoxItemLine getDirection(os::border_direction_t dir)
             return SvxBoxItemLine::RIGHT;
         break;
         case os::border_direction_t::left:
-            return SvxBoxItemLine::RIGHT;
+            return SvxBoxItemLine::LEFT;
         break;
         case os::border_direction_t::top:
-            return SvxBoxItemLine::RIGHT;
+            return SvxBoxItemLine::TOP;
         break;
         case os::border_direction_t::bottom:
-            return SvxBoxItemLine::RIGHT;
+            return SvxBoxItemLine::BOTTOM;
         break;
         default:
         break;


More information about the Libreoffice-commits mailing list