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

Markus Mohrhard markus.mohrhard at collabora.co.uk
Sun Jan 11 07:49:50 PST 2015


 sc/source/filter/inc/orcusinterface.hxx |    8 ++
 sc/source/filter/orcus/interface.cxx    |   90 +++++++++++++++++++++++++-------
 2 files changed, 80 insertions(+), 18 deletions(-)

New commits:
commit aed536d2e50f0250cd84511b418c311de32d770b
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sun Jan 11 16:48:33 2015 +0100

    make sure that the cell properties are really imported
    
    Change-Id: I6cac96214fd57162fb4421c9dbc9e54c20207385

diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx
index 01b9258..fc56f37 100644
--- a/sc/source/filter/inc/orcusinterface.hxx
+++ b/sc/source/filter/inc/orcusinterface.hxx
@@ -30,6 +30,7 @@
 
 class ScDocumentImport;
 class ScOrcusSheet;
+class ScOrcusStyles;
 class ScOrcusFactory;
 class ScRangeData;
 class SfxItemSet;
@@ -125,6 +126,7 @@ class ScOrcusSheet : public orcus::spreadsheet::iface::import_sheet
     ScDocumentImport& mrDoc;
     SCTAB mnTab;
     ScOrcusFactory& mrFactory;
+    ScOrcusStyles& mrStyles;
     sc::SharedFormulaGroups maFormulaGroups;
     ScOrcusAutoFilter maAutoFilter;
     ScOrcusSheetProperties maProperties;
@@ -273,6 +275,9 @@ private:
 
 public:
     ScOrcusStyles(ScDocument& rDoc);
+
+    bool applyXfToItemSet(SfxItemSet& rSet, size_t xfId);
+
     // font
 
     virtual void set_font_count(size_t n) SAL_OVERRIDE;
diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
index 0c5e035..fff1c29 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -20,6 +20,8 @@
 #include "dbdata.hxx"
 #include "stlpool.hxx"
 #include "scitems.hxx"
+#include "patattr.hxx"
+#include "docpool.hxx"
 
 #include <editeng/postitem.hxx>
 #include <editeng/wghtitem.hxx>
@@ -284,6 +286,7 @@ ScOrcusSheet::ScOrcusSheet(ScDocumentImport& rDoc, SCTAB nTab, ScOrcusFactory& r
     mrDoc(rDoc),
     mnTab(nTab),
     mrFactory(rFactory),
+    mrStyles(static_cast<ScOrcusStyles&>(*mrFactory.get_styles())),
     maAutoFilter(rDoc.getDoc()),
     maProperties(mnTab, mrDoc),
     mnCellCount(0)
@@ -369,10 +372,13 @@ void ScOrcusSheet::set_format(os::row_t /*row*/, os::col_t /*col*/, size_t xf_in
     SAL_INFO("sc.orcus.style", "set format: " << xf_index);
 }
 
-void ScOrcusSheet::set_format_range(os::row_t /*row_start*/, os::col_t /*col_start*/,
-        os::row_t /*row_end*/, os::col_t /*col_end*/, size_t xf_index)
+void ScOrcusSheet::set_format_range(os::row_t row_start, os::col_t col_start,
+        os::row_t row_end, os::col_t col_end, size_t xf_index)
 {
     SAL_INFO("sc.orcus.style", "set format range: " << xf_index);
+    ScPatternAttr aPattern(mrDoc.getDoc().GetPool());
+    mrStyles.applyXfToItemSet(aPattern.GetItemSet(), xf_index);
+    mrDoc.getDoc().ApplyPatternAreaTab(col_start, row_start, col_end, row_end, mnTab, aPattern);
 }
 
 namespace {
@@ -672,6 +678,20 @@ void ScOrcusStyles::applyXfToItemSet(SfxItemSet& rSet, const xf& rXf)
     }
 }
 
+bool ScOrcusStyles::applyXfToItemSet(SfxItemSet& rSet, size_t xfId)
+{
+    SAL_INFO("sc.orcus.style", "applyXfToitemSet: " << xfId);
+    if (maCellXfs.size() <= xfId)
+    {
+        SAL_WARN("sc.orcus.style", "invalid xf id");
+        return false;
+    }
+
+    const xf& rXf = maCellXfs[xfId];
+    applyXfToItemSet(rSet, rXf);
+    return true;
+}
+
 void ScOrcusStyles::set_font_count(size_t /*n*/)
 {
     // needed at all?
commit 0cab73f122446a60e5a510209332c9ac10be5032
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sun Jan 11 16:08:21 2015 +0100

    add new method from orcus
    
    Change-Id: I7b9335d711df83f412fbaeaa8bc0c574dd632dcb

diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx
index f0c26ff..01b9258 100644
--- a/sc/source/filter/inc/orcusinterface.hxx
+++ b/sc/source/filter/inc/orcusinterface.hxx
@@ -152,6 +152,8 @@ public:
         orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, int year, int month, int day, int hour, int minute, double second) SAL_OVERRIDE;
 
     virtual void set_format(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, size_t xf_index) SAL_OVERRIDE;
+    virtual void set_format_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 , size_t xf_index) SAL_OVERRIDE;
 
     virtual void set_formula(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, orcus::spreadsheet::formula_grammar_t grammar, const char* p, size_t n) SAL_OVERRIDE;
     virtual void set_formula_result(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 859f745..0c5e035 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -369,6 +369,12 @@ void ScOrcusSheet::set_format(os::row_t /*row*/, os::col_t /*col*/, size_t xf_in
     SAL_INFO("sc.orcus.style", "set format: " << xf_index);
 }
 
+void ScOrcusSheet::set_format_range(os::row_t /*row_start*/, os::col_t /*col_start*/,
+        os::row_t /*row_end*/, os::col_t /*col_end*/, size_t xf_index)
+{
+    SAL_INFO("sc.orcus.style", "set format range: " << xf_index);
+}
+
 namespace {
 
 formula::FormulaGrammar::Grammar getCalcGrammarFromOrcus( os::formula_grammar_t grammar )
commit 940ad2fc6c0c422b90be5993eb4642df35fe9827
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sun Jan 11 15:29:45 2015 +0100

    use a consistent log area for orcus styles
    
    Change-Id: I8d020d541cbe1ccd4fbc38f2ba0ba63351ddfaa4

diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
index 253b2ab..859f745 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -364,8 +364,9 @@ void ScOrcusSheet::set_date_time(
     cellInserted();
 }
 
-void ScOrcusSheet::set_format(os::row_t /*row*/, os::col_t /*col*/, size_t /*xf_index*/)
+void ScOrcusSheet::set_format(os::row_t /*row*/, os::col_t /*col*/, size_t xf_index)
 {
+    SAL_INFO("sc.orcus.style", "set format: " << xf_index);
 }
 
 namespace {
@@ -568,6 +569,16 @@ ScOrcusStyles::font::font():
 {
 }
 
+namespace {
+
+std::ostream& operator<<(std::ostream& rStrm, const Color& rColor)
+{
+    rStrm << "Red: " << rColor.GetRed() << ", Green: " << rColor.GetGreen() << ", Blue: " << rColor.GetBlue();
+    return rStrm;
+}
+
+}
+
 void ScOrcusStyles::font::applyToItemSet(SfxItemSet& rSet) const
 {
     FontItalic eItalic = mbItalic ? ITALIC_NORMAL : ITALIC_NONE;
@@ -619,7 +630,7 @@ void ScOrcusStyles::applyXfToItemSet(SfxItemSet& rSet, const xf& rXf)
     size_t nFontId = rXf.mnFontId;
     if (nFontId >= maFonts.size())
     {
-        SAL_WARN("sc.orcus.styles", "invalid font id");
+        SAL_WARN("sc.orcus.style", "invalid font id");
         return;
     }
 
@@ -629,28 +640,28 @@ void ScOrcusStyles::applyXfToItemSet(SfxItemSet& rSet, const xf& rXf)
     size_t nFillId = rXf.mnFillId;
     if (nFillId >= maFills.size())
     {
-        SAL_WARN("sc.orcus.styles", "invalid fill id");
+        SAL_WARN("sc.orcus.style", "invalid fill id");
         return;
     }
 
     size_t nBorderId = rXf.mnBorderId;
     if (nBorderId >= maBorders.size())
     {
-        SAL_WARN("sc.orcus.styles", "invalid border id");
+        SAL_WARN("sc.orcus.style", "invalid border id");
         return;
     }
 
     size_t nProtectionId = rXf.mnProtectionId;
     if (nProtectionId >= maProtections.size())
     {
-        SAL_WARN("sc.orcus.styles", "invalid protection id");
+        SAL_WARN("sc.orcus.style", "invalid protection id");
         return;
     }
 
     size_t nNumberFormatId = rXf.mnNumberFormatId;
     if (nNumberFormatId >= maNumberFormats.size())
     {
-        SAL_WARN("sc.orcus.styles", "invalid number format id");
+        SAL_WARN("sc.orcus.style", "invalid number format id");
         return;
     }
 }
@@ -766,7 +777,7 @@ void ScOrcusStyles::set_border_color(orcus::spreadsheet::border_direction_t /*di
 
 size_t ScOrcusStyles::commit_border()
 {
-    SAL_INFO("sc.orcus.styles", "commit border");
+    SAL_INFO("sc.orcus.style", "commit border");
     return 0;
 }
 
@@ -783,7 +794,7 @@ void ScOrcusStyles::set_cell_locked(bool b)
 
 size_t ScOrcusStyles::commit_cell_protection()
 {
-    SAL_INFO("sc.orcus.styles", "commit cell protection");
+    SAL_INFO("sc.orcus.style", "commit cell protection");
     maProtections.push_back(maCurrentProtection);
     return maProtections.size() - 1;
 }
@@ -804,7 +815,7 @@ void ScOrcusStyles::set_number_format_code(const char* s, size_t n)
 
 size_t ScOrcusStyles::commit_number_format()
 {
-    SAL_INFO("sc.orcus.styles", "commit number format");
+    SAL_INFO("sc.orcus.style", "commit number format");
     maNumberFormats.push_back(maCurrentNumberFormat);
     return maNumberFormats.size() - 1;
 }
@@ -818,7 +829,7 @@ void ScOrcusStyles::set_cell_style_xf_count(size_t /*n*/)
 
 size_t ScOrcusStyles::commit_cell_style_xf()
 {
-    SAL_INFO("sc.orcus.styles", "commit cell style xf");
+    SAL_INFO("sc.orcus.style", "commit cell style xf");
     maCellStyleXfs.push_back(maCurrentXF);
     return maCellStyleXfs.size() - 1;
 }
@@ -832,7 +843,7 @@ void ScOrcusStyles::set_cell_xf_count(size_t /*n*/)
 
 size_t ScOrcusStyles::commit_cell_xf()
 {
-    SAL_INFO("sc.orcus.styles", "commit cell xf");
+    SAL_INFO("sc.orcus.style", "commit cell xf");
     maCellXfs.push_back(maCurrentXF);
     return maCellXfs.size() - 1;
 }
@@ -908,10 +919,10 @@ void ScOrcusStyles::set_cell_style_builtin(size_t index)
 
 size_t ScOrcusStyles::commit_cell_style()
 {
-    SAL_INFO("sc.orcus.styles", "commit cell styles");
+    SAL_INFO("sc.orcus.style", "commit cell style: " << maCurrentCellStyle.maName);
     if (maCurrentCellStyle.mnXFId >= maCellStyleXfs.size())
     {
-        SAL_WARN("sc.orcus.styles", "invalid xf id for commit cell style");
+        SAL_WARN("sc.orcus.style", "invalid xf id for commit cell style");
         return 0;
     }
 
commit ecc72fdb53f714e28dfeaf4c711bba4d823ef4c4
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sat Jan 10 22:33:22 2015 +0100

    correct import for row height and col width
    
    Change-Id: Id26ae200b3262769e66528e1d00639471e72c0d7

diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
index 69b09c2..253b2ab 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -229,22 +229,33 @@ double translateToInternal(double nVal, orcus::length_unit_t unit)
     switch(unit)
     {
         case orcus::length_unit_inch:
+            return nVal * 72.0 * 20.0;
+            break;
         case orcus::length_unit_twip:
+            return nVal;
+            break;
         case orcus::length_unit_point:
+            return nVal * 20.0;
+            break;
         case orcus::length_unit_centimeter:
+            return nVal * 20.0 * 72.0 / 2.54;
+            break;
         case orcus::length_unit_unknown:
+            SAL_WARN("sc,orcus", "unknown unit");
+            break;
         default:
             break;
     }
-    return 0;
+    return nVal;
 }
 
 
 }
 
-void ScOrcusSheetProperties::set_column_width(os::col_t col, double width, orcus::length_unit_t /*unit*/)
+void ScOrcusSheetProperties::set_column_width(os::col_t col, double width, orcus::length_unit_t unit)
 {
-    mrDoc.getDoc().SetColWidthOnly(col, mnTab, width);
+    double nNewWidth = translateToInternal(width, unit);
+    mrDoc.getDoc().SetColWidthOnly(col, mnTab, nNewWidth);
 }
 
 void ScOrcusSheetProperties::set_column_hidden(os::col_t col, bool hidden)
@@ -253,9 +264,10 @@ void ScOrcusSheetProperties::set_column_hidden(os::col_t col, bool hidden)
         mrDoc.getDoc().SetColHidden(col, col, mnTab, hidden);
 }
 
-void ScOrcusSheetProperties::set_row_height(os::row_t row, double height, orcus::length_unit_t /*unit*/)
+void ScOrcusSheetProperties::set_row_height(os::row_t row, double height, orcus::length_unit_t unit)
 {
-    mrDoc.getDoc().SetRowHeightOnly(row, row,mnTab, height);
+    double nNewHeight = translateToInternal(height, unit);
+    mrDoc.getDoc().SetRowHeightOnly(row, row,mnTab, nNewHeight);
 }
 
 void ScOrcusSheetProperties::set_row_hidden(os::row_t row, bool hidden)
commit fd0752545e06936bc26b85d4a91c84b11c31e4ae
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Mon Aug 18 07:51:05 2014 +0200

    add ScOrcusSheet::get_table method
    
    Conflicts:
    	sc/source/filter/orcus/interface.cxx
    
    Change-Id: I2369e29e96cf33dbe263b090dee0d1100ecce8de

diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx
index 37986a3..f0c26ff 100644
--- a/sc/source/filter/inc/orcusinterface.hxx
+++ b/sc/source/filter/inc/orcusinterface.hxx
@@ -141,6 +141,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;
 
     // 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 5801bbc..69b09c2 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -293,6 +293,11 @@ os::iface::import_sheet_properties* ScOrcusSheet::get_sheet_properties()
     return &maProperties;
 }
 
+os::iface::import_table* ScOrcusSheet::get_table()
+{
+    return NULL;
+}
+
 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);


More information about the Libreoffice-commits mailing list