[Libreoffice-commits] core.git: Branch 'feature/orcus-continuous-integration' - 4 commits - sc/source

Markus Mohrhard markus.mohrhard at collabora.co.uk
Mon Jan 26 19:33:47 PST 2015


 sc/source/filter/inc/orcusinterface.hxx |   54 ++++++++++++++
 sc/source/filter/orcus/interface.cxx    |  116 ++++++++++++++++++++++++++++++++
 2 files changed, 169 insertions(+), 1 deletion(-)

New commits:
commit 7833cf026fe2cc740397e9805a0fb7a79a8c42c5
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Tue Jan 27 04:31:56 2015 +0100

    initial work for conditional formatting import for orcus
    
    Change-Id: If79f58c44072b7c2c20fc2026b2a6eed6d202b63

diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx
index f997446..e245b08 100644
--- a/sc/source/filter/inc/orcusinterface.hxx
+++ b/sc/source/filter/inc/orcusinterface.hxx
@@ -79,6 +79,52 @@ public:
     virtual size_t commit_segments() SAL_OVERRIDE;
 };
 
+class ScOrcusConditionalFormat : public orcus::spreadsheet::iface::import_conditional_format
+{
+public:
+    ScOrcusConditionalFormat(SCTAB nTab, ScDocument& rDoc);
+    virtual ~ScOrcusConditionalFormat();
+
+    virtual void set_color(orcus::spreadsheet::color_elem_t alpha, orcus::spreadsheet::color_elem_t red,
+            orcus::spreadsheet::color_elem_t green, orcus::spreadsheet::color_elem_t blue) SAL_OVERRIDE;
+
+    virtual void set_formula(const char* p, size_t n) SAL_OVERRIDE;
+
+    virtual void set_condition_type(orcus::spreadsheet::condition_type_t type) SAL_OVERRIDE;
+
+    virtual void set_date(orcus::spreadsheet::condition_date_type date) SAL_OVERRIDE;
+
+    virtual void commit_condition() SAL_OVERRIDE;
+
+    virtual void set_icon_name(const char* p, size_t n) SAL_OVERRIDE;
+
+    virtual void set_databar_gradient(bool gradient) SAL_OVERRIDE;
+
+    virtual void set_databar_axis(orcus::spreadsheet::databar_axis_t axis) SAL_OVERRIDE;
+
+    virtual void set_show_value(bool show) SAL_OVERRIDE;
+
+    virtual void set_xf_id(size_t xf) SAL_OVERRIDE;
+
+    virtual void set_operator(orcus::spreadsheet::condition_operator_t condition_type) SAL_OVERRIDE;
+
+    virtual void set_type(orcus::spreadsheet::conditional_format_t type) SAL_OVERRIDE;
+
+    virtual void commit_entry() SAL_OVERRIDE;
+
+    virtual void set_range(const char* p, size_t n) SAL_OVERRIDE;
+
+    virtual void set_range(orcus::spreadsheet::row_t row_start, orcus::spreadsheet::col_t col_start,
+            orcus::spreadsheet::row_t row_end, orcus::spreadsheet::col_t col_end) SAL_OVERRIDE;
+
+    virtual void commit_format() SAL_OVERRIDE;
+
+private:
+
+    SCTAB mnTab;
+    ScDocument& mrDoc;
+};
+
 class ScOrcusAutoFilter : public orcus::spreadsheet::iface::import_auto_filter
 {
 public:
@@ -130,6 +176,7 @@ class ScOrcusSheet : public orcus::spreadsheet::iface::import_sheet
     sc::SharedFormulaGroups maFormulaGroups;
     ScOrcusAutoFilter maAutoFilter;
     ScOrcusSheetProperties maProperties;
+    ScOrcusConditionalFormat maConditionalFormat;
 
     typedef std::map<size_t, ScRangeData*> SharedFormulaContainer;
     SharedFormulaContainer maSharedFormulas;
@@ -144,6 +191,7 @@ public:
     virtual orcus::spreadsheet::iface::import_auto_filter* get_auto_filter() SAL_OVERRIDE { return &maAutoFilter; }
     virtual orcus::spreadsheet::iface::import_sheet_properties* get_sheet_properties() SAL_OVERRIDE;
     virtual orcus::spreadsheet::iface::import_table* get_table() SAL_OVERRIDE;
+    virtual orcus::spreadsheet::iface::import_conditional_format* get_conditional_format() SAL_OVERRIDE;
 
     // Orcus import interface
     virtual void set_auto(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, const char* p, size_t n) SAL_OVERRIDE;
diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
index 8655246..e71b967 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -282,6 +282,98 @@ void ScOrcusSheetProperties::set_merge_cell_range(const char* /*p_range*/, size_
 {
 }
 
+ScOrcusConditionalFormat::ScOrcusConditionalFormat(SCTAB nTab, ScDocument& rDoc):
+    mnTab(nTab),
+    mrDoc(rDoc)
+{
+}
+
+ScOrcusConditionalFormat::~ScOrcusConditionalFormat()
+{
+}
+
+void ScOrcusConditionalFormat::set_color(os::color_elem_t /*alpha*/, os::color_elem_t /*red*/,
+        os::color_elem_t /*green*/, os::color_elem_t /*blue*/)
+{
+    SAL_INFO("sc.orcus.condformat", "set_color");
+}
+
+void ScOrcusConditionalFormat::set_condition_type(os::condition_type_t /*type*/)
+{
+    SAL_INFO("sc.orcus.condformat", "set_condition_type");
+}
+
+void ScOrcusConditionalFormat::set_formula(const char* /*p*/, size_t /*n*/)
+{
+    SAL_INFO("sc.orcus.condformat", "set_formula");
+}
+
+void ScOrcusConditionalFormat::set_date(os::condition_date_type /*date*/)
+{
+    SAL_INFO("sc.orcus.condformat", "set_date");
+}
+
+void ScOrcusConditionalFormat::commit_condition()
+{
+    SAL_INFO("sc.orcus.condformat", "commit_condition");
+}
+
+void ScOrcusConditionalFormat::set_icon_name(const char* /*p*/, size_t /*n*/)
+{
+    SAL_INFO("sc.orcus.condformat", "set_icon_name");
+}
+
+void ScOrcusConditionalFormat::set_databar_gradient(bool /*gradient*/)
+{
+    SAL_INFO("sc.orcus.condformat", "set_databar_gradient");
+}
+
+void ScOrcusConditionalFormat::set_databar_axis(os::databar_axis_t /*axis*/)
+{
+    SAL_INFO("sc.orcus.condformat", "set_databar_axis");
+}
+
+void ScOrcusConditionalFormat::set_show_value(bool /*show*/)
+{
+    SAL_INFO("sc.orcus.condformat", "set_show_value");
+}
+
+void ScOrcusConditionalFormat::set_xf_id(size_t /*xf*/)
+{
+    SAL_INFO("sc.orcus.condformat", "set_xf_id");
+}
+
+void ScOrcusConditionalFormat::set_operator(os::condition_operator_t /*condition_type*/)
+{
+    SAL_INFO("sc.orcus.condformat", "set_operator");
+}
+
+void ScOrcusConditionalFormat::set_type(os::conditional_format_t /*type*/)
+{
+    SAL_INFO("sc.orcus.condformat", "set_type");
+}
+
+void ScOrcusConditionalFormat::commit_entry()
+{
+    SAL_INFO("sc.orcus.condformat", "commit_entry");
+}
+
+void ScOrcusConditionalFormat::set_range(const char* /*p*/, size_t /*n*/)
+{
+    SAL_INFO("sc.orcus.condformat", "set_range");
+}
+
+void ScOrcusConditionalFormat::set_range(os::row_t /*row_start*/, os::col_t /*col_start*/,
+        os::row_t /*row_end*/, os::col_t /*col_end*/)
+{
+    SAL_INFO("sc.orcus.condformat", "set_range");
+}
+
+void ScOrcusConditionalFormat::commit_format()
+{
+    SAL_INFO("sc.orcus.condformat", "commit_format");
+}
+
 ScOrcusSheet::ScOrcusSheet(ScDocumentImport& rDoc, SCTAB nTab, ScOrcusFactory& rFactory) :
     mrDoc(rDoc),
     mnTab(nTab),
@@ -289,6 +381,7 @@ ScOrcusSheet::ScOrcusSheet(ScDocumentImport& rDoc, SCTAB nTab, ScOrcusFactory& r
     mrStyles(static_cast<ScOrcusStyles&>(*mrFactory.get_styles())),
     maAutoFilter(rDoc.getDoc()),
     maProperties(mnTab, mrDoc),
+    maConditionalFormat(mnTab, rDoc.getDoc()),
     mnCellCount(0)
 {
 }
@@ -313,6 +406,11 @@ os::iface::import_table* ScOrcusSheet::get_table()
     return NULL;
 }
 
+os::iface::import_conditional_format* ScOrcusSheet::get_conditional_format()
+{
+    return &maConditionalFormat;
+}
+
 void ScOrcusSheet::set_auto(os::row_t row, os::col_t col, const char* p, size_t n)
 {
     OUString aVal(p, n, RTL_TEXTENCODING_UTF8);
commit c7aeb32d012d74f5299ab4f803ceb8446547567a
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Tue Jan 27 04:31:25 2015 +0100

    call it as well
    
    Change-Id: I8ac7ebdf8af13ebd76a3c044fea5b0156808c852

diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
index 14c1bf1..8655246 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -680,6 +680,8 @@ void ScOrcusStyles::applyXfToItemSet(SfxItemSet& rSet, const xf& rXf)
         SAL_WARN("sc.orcus.style", "invalid border id");
         return;
     }
+    const border& rBorder = maBorders[nBorderId];
+    rBorder.applyToItemSet(rSet);
 
     size_t nProtectionId = rXf.mnProtectionId;
     if (nProtectionId >= maProtections.size())
@@ -687,6 +689,8 @@ void ScOrcusStyles::applyXfToItemSet(SfxItemSet& rSet, const xf& rXf)
         SAL_WARN("sc.orcus.style", "invalid protection id");
         return;
     }
+    const protection& rProtection = maProtections[nProtectionId];
+    rProtection.applyToItemSet(rSet);
 
     size_t nNumberFormatId = rXf.mnNumberFormatId;
     if (nNumberFormatId >= maNumberFormats.size())
@@ -694,6 +698,8 @@ void ScOrcusStyles::applyXfToItemSet(SfxItemSet& rSet, const xf& rXf)
         SAL_WARN("sc.orcus.style", "invalid number format id");
         return;
     }
+    const number_format& rFormat = maNumberFormats[nNumberFormatId];
+    rFormat.applyToItemSet(rSet);
 }
 
 bool ScOrcusStyles::applyXfToItemSet(SfxItemSet& rSet, size_t xfId)
commit 883338956e4ab3a7b117bc3da33f71d3c16b414d
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Tue Jan 27 04:30:59 2015 +0100

    implement the applyToItemSet for more properties
    
    Change-Id: I120fe6b4c52c40560aa589debb610aeccc438b81

diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
index c53a3a4..14c1bf1 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -620,10 +620,22 @@ ScOrcusStyles::protection::protection():
 {
 }
 
+void ScOrcusStyles::protection::applyToItemSet(SfxItemSet& /*rSet*/) const
+{
+}
+
 ScOrcusStyles::border::border()
 {
 }
 
+void ScOrcusStyles::border::applyToItemSet(SfxItemSet& /*rSet*/) const
+{
+}
+
+void ScOrcusStyles::number_format::applyToItemSet(SfxItemSet& /*rSet*/) const
+{
+}
+
 ScOrcusStyles::xf::xf():
     mnFontId(0),
     mnFillId(0),
commit 13895ad12d26bf09491931ad8830b57db6607b6b
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Fri Jan 16 22:16:46 2015 +0100

    add applyToItemSet method to all properties
    
    Change-Id: Iaa67f0c6c619af248074d9c1a436a1e59563fd2b

diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx
index fc56f37..f997446 100644
--- a/sc/source/filter/inc/orcusinterface.hxx
+++ b/sc/source/filter/inc/orcusinterface.hxx
@@ -218,8 +218,9 @@ private:
 
     struct border
     {
-
         border();
+
+        void applyToItemSet(SfxItemSet& rSet) const;
     };
 
     border maCurrentBorder;
@@ -231,6 +232,7 @@ private:
         bool mbLocked;
 
         protection();
+        void applyToItemSet(SfxItemSet& rSet) const;
     };
 
     protection maCurrentProtection;
@@ -239,6 +241,8 @@ private:
     struct number_format
     {
         OUString maCode;
+
+        void applyToItemSet(SfxItemSet& rSet) const;
     };
 
     number_format maCurrentNumberFormat;


More information about the Libreoffice-commits mailing list