framework/source/layoutmanager/toolbarlayoutmanager.cxx | 12 framework/source/loadenv/loadenv.cxx | 29 sc/inc/documentimport.hxx | 1 sc/inc/stlpool.hxx | 3 sc/source/filter/inc/orcusinterface.hxx | 230 +++++ sc/source/filter/inc/worksheethelper.hxx | 2 sc/source/filter/oox/worksheethelper.cxx | 4 sc/source/filter/orcus/interface.cxx | 663 +++++++++++++++- vcl/opengl/gdiimpl.cxx | 4 9 files changed, 888 insertions(+), 60 deletions(-)
New commits: commit 1f43fa330a2ebc26127edce07318124011f21f56 Author: Markus Mohrhard <[email protected]> Date: Tue Jan 27 04:31:56 2015 +0100 initial work for conditional formatting import for orcus Conflicts: sc/source/filter/inc/orcusinterface.hxx Change-Id: If79f58c44072b7c2c20fc2026b2a6eed6d202b63 diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx index dec7d38..a61a282 100644 --- a/sc/source/filter/inc/orcusinterface.hxx +++ b/sc/source/filter/inc/orcusinterface.hxx @@ -79,6 +79,64 @@ 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_t 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_databar_color_positive(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_databar_color_negative(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_min_databar_length(double length) SAL_OVERRIDE; + + virtual void set_max_databar_length(double length) SAL_OVERRIDE; + + virtual void set_show_value(bool show) SAL_OVERRIDE; + + virtual void set_iconset_reverse(bool reverse) 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 +188,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 +203,7 @@ public: virtual orcus::spreadsheet::iface::import_auto_filter* get_auto_filter() SAL_OVERRIDE { return &maAutoFilter; } virtual orcus::spreadsheet::iface::import_table* get_table() SAL_OVERRIDE; virtual orcus::spreadsheet::iface::import_sheet_properties* get_sheet_properties() 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 b9291a8..c65324a 100644 --- a/sc/source/filter/orcus/interface.cxx +++ b/sc/source/filter/orcus/interface.cxx @@ -281,6 +281,127 @@ void ScOrcusSheetProperties::set_merge_cell_range(const char* /*p_range*/, size_ { } +ScOrcusConditionalFormat::ScOrcusConditionalFormat(SCTAB nTab, ScDocument& rDoc): + mnTab(nTab), + mrDoc(rDoc) +{ + (void)mnTab; + (void)mrDoc; +} + +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_t /*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_databar_color_positive(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_databar_color_positive"); +} + +void ScOrcusConditionalFormat::set_databar_color_negative(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_databar_color_negative"); +} + +void ScOrcusConditionalFormat::set_min_databar_length(double /*length*/) +{ + SAL_INFO("sc.orcus.condformat", "set_min_databar_length"); +} + +void ScOrcusConditionalFormat::set_max_databar_length(double /*length*/) +{ + SAL_INFO("sc.orcus.condformat", "set_max_databar_length"); +} + +void ScOrcusConditionalFormat::set_show_value(bool /*show*/) +{ + SAL_INFO("sc.orcus.condformat", "set_show_value"); +} + +void ScOrcusConditionalFormat::set_iconset_reverse(bool /*reverse*/) +{ + SAL_INFO("sc.orcus.condformat", "set_iconset_reverse"); +} + +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), @@ -288,6 +409,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) { } @@ -312,6 +434,11 @@ os::iface::import_sheet_properties* ScOrcusSheet::get_sheet_properties() return &maProperties; } +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); diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx index 5e2785c..ac6624f 100644 --- a/vcl/opengl/gdiimpl.cxx +++ b/vcl/opengl/gdiimpl.cxx @@ -898,6 +898,8 @@ void OpenGLSalGraphicsImpl::DrawTextureRect( OpenGLTexture& rTexture, const SalT { OpenGLZone aZone; + SAL_INFO("vcl.opengl", "draw texture rect"); + GLfloat aTexCoord[8]; rTexture.GetCoord( aTexCoord, rPosAry, bInverted ); mpProgram->SetTextureCoord( aTexCoord ); @@ -908,6 +910,8 @@ void OpenGLSalGraphicsImpl::DrawTexture( OpenGLTexture& rTexture, const SalTwoRe { OpenGLZone aZone; + SAL_INFO("vcl.opengl", "draw texture"); + if( !UseProgram( "textureVertexShader", "textureFragmentShader" ) ) return; mpProgram->SetTexture( "sampler", rTexture ); commit 81abc70a5bdbb3db4d3874f4e7e7150fc3f56698 Author: Markus Mohrhard <[email protected]> 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 8b3a616..b9291a8 100644 --- a/sc/source/filter/orcus/interface.cxx +++ b/sc/source/filter/orcus/interface.cxx @@ -682,6 +682,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()) @@ -689,6 +691,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()) @@ -696,6 +700,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 f631b8ce62fd2b12d43d9d9dcf45afd4b3ff4a15 Author: Markus Mohrhard <[email protected]> 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 0586b43..8b3a616 100644 --- a/sc/source/filter/orcus/interface.cxx +++ b/sc/source/filter/orcus/interface.cxx @@ -622,10 +622,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 f4191be4c839acff8707a7502268213bfbb2d620 Author: Markus Mohrhard <[email protected]> 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 5862276..dec7d38 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; commit bd38b1f18456fc7b7a8bf1ecfd9286c26f6c4736 Author: Markus Mohrhard <[email protected]> Date: Sun Jan 11 22:04:42 2015 +0100 apply fill properties to item set Change-Id: I89d8d84d199a991d75b9c613fd72d66c18642b12 diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx index 7e4987b..0586b43 100644 --- a/sc/source/filter/orcus/interface.cxx +++ b/sc/source/filter/orcus/interface.cxx @@ -661,6 +661,9 @@ void ScOrcusStyles::applyXfToItemSet(SfxItemSet& rSet, const xf& rXf) return; } + const fill& rFill = maFills[nFillId]; + rFill.applyToItemSet(rSet); + size_t nBorderId = rXf.mnBorderId; if (nBorderId >= maBorders.size()) { commit b5cebea8b3cc949c4d68053090b0b1ff3a8ae15b Author: Markus Mohrhard <[email protected]> Date: Sun Jan 11 21:38:50 2015 +0100 import the background color Change-Id: I63dfc5b879abcb63cc4d0d67389467d76f94bca9 diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx index 718fa4c..7e4987b 100644 --- a/sc/source/filter/orcus/interface.cxx +++ b/sc/source/filter/orcus/interface.cxx @@ -608,9 +608,12 @@ void ScOrcusStyles::font::applyToItemSet(SfxItemSet& rSet) const void ScOrcusStyles::fill::applyToItemSet(SfxItemSet& rSet) const { if (maPattern.equalsIgnoreAsciiCase("none")) + { + SAL_INFO("sc.orcus.style", "no fill style"); return; + } - rSet.Put(SvxBrushItem(maFgColor, ATTR_BACKGROUND)); + rSet.Put(SvxBrushItem(maBgColor, ATTR_BACKGROUND)); } ScOrcusStyles::protection::protection(): commit b16c40efa77b8ad3e1d485222158ea20935aba47 Author: Markus Mohrhard <[email protected]> Date: Sun Jan 11 21:37:52 2015 +0100 make sure to print numbers as ints and not as characters Change-Id: I8409ac35a6368c80d0f9bf6b49619a63ce502a5a diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx index cba4b70..718fa4c 100644 --- a/sc/source/filter/orcus/interface.cxx +++ b/sc/source/filter/orcus/interface.cxx @@ -586,7 +586,7 @@ namespace { std::ostream& operator<<(std::ostream& rStrm, const Color& rColor) { - rStrm << "Red: " << rColor.GetRed() << ", Green: " << rColor.GetGreen() << ", Blue: " << rColor.GetBlue(); + rStrm << "Red: " << (int)rColor.GetRed() << ", Green: " << (int)rColor.GetGreen() << ", Blue: " << (int)rColor.GetBlue(); return rStrm; } commit 650e9065c9821d28d146cc3b3a68b676d5e878cc Author: Markus Mohrhard <[email protected]> Date: Sun Jan 11 16:48:33 2015 +0100 make sure that the cell properties are really imported Conflicts: sc/source/filter/orcus/interface.cxx Change-Id: I6cac96214fd57162fb4421c9dbc9e54c20207385 diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx index 06551c2..5862276 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 0957714..cba4b70 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> @@ -283,6 +285,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) @@ -368,9 +371,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(os::row_t /*row*/, os::col_t /*col*/, - os::row_t /*row_end*/, os::col_t /*col_end*/, size_t /*xf_index*/) +void ScOrcusSheet::set_format(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 { @@ -673,6 +680,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 5486dc71336e6e1f0f20d16e526712439131f949 Author: Markus Mohrhard <[email protected]> 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 10a1ce4..0957714 100644 --- a/sc/source/filter/orcus/interface.cxx +++ b/sc/source/filter/orcus/interface.cxx @@ -363,8 +363,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); } void ScOrcusSheet::set_format(os::row_t /*row*/, os::col_t /*col*/, @@ -573,6 +574,18 @@ 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; @@ -624,7 +637,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; } @@ -634,28 +647,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; } } @@ -771,7 +784,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; } @@ -788,7 +801,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; } @@ -809,7 +822,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; } @@ -823,7 +836,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; } @@ -837,7 +850,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; } @@ -924,10 +937,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 2cf73ac4257959b0767c965476a07494c911115f Author: Markus Mohrhard <[email protected]> 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 e1db595..10a1ce4 100644 --- a/sc/source/filter/orcus/interface.cxx +++ b/sc/source/filter/orcus/interface.cxx @@ -228,22 +228,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) @@ -252,9 +263,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 9a556f56939e131f62de88cd0286f24c0fa6dc9c Author: Markus Mohrhard <[email protected]> Date: Fri Jan 9 18:39:35 2015 +0100 temp Change-Id: Ia71c6f0b673f58b804403841a92f7ab30a619e3e diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx index 9cad8e9..e1db595 100644 --- a/sc/source/filter/orcus/interface.cxx +++ b/sc/source/filter/orcus/interface.cxx @@ -221,6 +221,26 @@ ScOrcusSheetProperties::~ScOrcusSheetProperties() { } +namespace { + +double translateToInternal(double nVal, orcus::length_unit_t unit) +{ + switch(unit) + { + case orcus::length_unit_inch: + case orcus::length_unit_twip: + case orcus::length_unit_point: + case orcus::length_unit_centimeter: + case orcus::length_unit_unknown: + default: + break; + } + return 0; +} + + +} + void ScOrcusSheetProperties::set_column_width(os::col_t col, double width, orcus::length_unit_t /*unit*/) { mrDoc.getDoc().SetColWidthOnly(col, mnTab, width); commit f1310337481f30465f47f46adac98f88b1f95104 Author: Markus Mohrhard <[email protected]> Date: Tue Oct 28 14:46:26 2014 +0100 implement import_sheet_properties interface Conflicts: sc/source/filter/inc/orcusinterface.hxx sc/source/filter/orcus/interface.cxx Change-Id: Ifed14df422c067fb6faacf370cbe9e1acf336d24 diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx index b72f6a8..06551c2 100644 --- a/sc/source/filter/inc/orcusinterface.hxx +++ b/sc/source/filter/inc/orcusinterface.hxx @@ -101,6 +101,25 @@ private: ScRange maRange; }; +class ScOrcusSheetProperties : public orcus::spreadsheet::iface::import_sheet_properties +{ + ScDocumentImport& mrDoc; + SCTAB mnTab; +public: + ScOrcusSheetProperties(SCTAB nTab, ScDocumentImport& rDoc); + virtual ~ScOrcusSheetProperties(); + + virtual void set_column_width(orcus::spreadsheet::col_t col, double width, orcus::length_unit_t unit) SAL_OVERRIDE; + + virtual void set_column_hidden(orcus::spreadsheet::col_t col, bool hidden) SAL_OVERRIDE; + + virtual void set_row_height(orcus::spreadsheet::row_t row, double height, orcus::length_unit_t unit) SAL_OVERRIDE; + + virtual void set_row_hidden(orcus::spreadsheet::row_t row, bool hidden) SAL_OVERRIDE; + + virtual void set_merge_cell_range(const char* p_range, size_t n_range) SAL_OVERRIDE; +}; + class ScOrcusSheet : public orcus::spreadsheet::iface::import_sheet { ScDocumentImport& mrDoc; @@ -108,6 +127,7 @@ class ScOrcusSheet : public orcus::spreadsheet::iface::import_sheet ScOrcusFactory& mrFactory; sc::SharedFormulaGroups maFormulaGroups; ScOrcusAutoFilter maAutoFilter; + ScOrcusSheetProperties maProperties; typedef std::map<size_t, ScRangeData*> SharedFormulaContainer; SharedFormulaContainer maSharedFormulas; @@ -121,6 +141,7 @@ public: virtual orcus::spreadsheet::iface::import_auto_filter* get_auto_filter() SAL_OVERRIDE { return &maAutoFilter; } virtual orcus::spreadsheet::iface::import_table* get_table() SAL_OVERRIDE; + virtual orcus::spreadsheet::iface::import_sheet_properties* get_sheet_properties() 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 8ab43e1..9cad8e9 100644 --- a/sc/source/filter/orcus/interface.cxx +++ b/sc/source/filter/orcus/interface.cxx @@ -211,8 +211,51 @@ void ScOrcusFactory::setStatusIndicator(const uno::Reference<task::XStatusIndica mxStatusIndicator = rIndicator; } +ScOrcusSheetProperties::ScOrcusSheetProperties(SCTAB nTab, ScDocumentImport& rDoc): + mrDoc(rDoc), + mnTab(nTab) +{ +} + +ScOrcusSheetProperties::~ScOrcusSheetProperties() +{ +} + +void ScOrcusSheetProperties::set_column_width(os::col_t col, double width, orcus::length_unit_t /*unit*/) +{ + mrDoc.getDoc().SetColWidthOnly(col, mnTab, width); +} + +void ScOrcusSheetProperties::set_column_hidden(os::col_t col, bool hidden) +{ + if (hidden) + mrDoc.getDoc().SetColHidden(col, col, mnTab, hidden); +} + +void ScOrcusSheetProperties::set_row_height(os::row_t row, double height, orcus::length_unit_t /*unit*/) +{ + mrDoc.getDoc().SetRowHeightOnly(row, row,mnTab, height); +} + +void ScOrcusSheetProperties::set_row_hidden(os::row_t row, bool hidden) +{ + if (hidden) + mrDoc.getDoc().SetRowHidden(row, row, mnTab, hidden); +} + +void ScOrcusSheetProperties::set_merge_cell_range(const char* /*p_range*/, size_t /*n_range*/) +{ +} + ScOrcusSheet::ScOrcusSheet(ScDocumentImport& rDoc, SCTAB nTab, ScOrcusFactory& rFactory) : - mrDoc(rDoc), mnTab(nTab), mrFactory(rFactory), maAutoFilter(rDoc.getDoc()), mnCellCount(0) {} + mrDoc(rDoc), + mnTab(nTab), + mrFactory(rFactory), + maAutoFilter(rDoc.getDoc()), + maProperties(mnTab, mrDoc), + mnCellCount(0) +{ +} void ScOrcusSheet::cellInserted() { @@ -229,6 +272,11 @@ os::iface::import_table* ScOrcusSheet::get_table() return NULL; } +os::iface::import_sheet_properties* ScOrcusSheet::get_sheet_properties() +{ + return &maProperties; +} + 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 8cb21b2a88a5dc48457b30306173d650425919f6 Author: Markus Mohrhard <[email protected]> Date: Tue Oct 28 14:33:33 2014 +0100 prevent default operator= Change-Id: Ibcd843a992b06b73e628b0249fb9f3ea723510d2 diff --git a/sc/inc/documentimport.hxx b/sc/inc/documentimport.hxx index aa69458..e7fc0b6 100644 --- a/sc/inc/documentimport.hxx +++ b/sc/inc/documentimport.hxx @@ -42,6 +42,7 @@ class SC_DLLPUBLIC ScDocumentImport : boost::noncopyable ScDocumentImportImpl* mpImpl; ScDocumentImport(); // disabled + ScDocumentImport& operator=(const ScDocumentImport&); //disabled public: commit 6ae1b105e38e537ae3d38186913069a2334bd66f Author: Markus Mohrhard <[email protected]> Date: Tue Oct 28 00:12:06 2014 +0100 don't protect the gnumeric filter with the USE_ORCUS flag Change-Id: Id91c7844879bea589bf97f999fd0c69669dfa7f6 diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index 3f2db03b0..aca4c09 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -666,13 +666,6 @@ namespace { bool queryOrcusTypeAndFilter(const uno::Sequence<beans::PropertyValue>& rDescriptor, OUString& rType, OUString& rFilter) { - // depending on the experimental mode - uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); - if (!xContext.is() || !officecfg::Office::Common::Misc::ExperimentalMode::get(xContext)) - { - return false; - } - OUString aURL; sal_Int32 nSize = rDescriptor.getLength(); for (sal_Int32 i = 0; i < nSize; ++i) @@ -688,10 +681,6 @@ bool queryOrcusTypeAndFilter(const uno::Sequence<beans::PropertyValue>& rDescrip if (aURL.isEmpty() || aURL.copy(0,8).equalsIgnoreAsciiCase("private:")) return false; - OUString aUseOrcus; - rtl::Bootstrap::get("LIBO_USE_ORCUS", aUseOrcus); - bool bUseOrcus = (aUseOrcus == "YES"); - // TODO : Type must be set to be generic_Text (or any other type that // exists) in order to find a usable loader. Exploit it as a temporary // hack. @@ -703,6 +692,17 @@ bool queryOrcusTypeAndFilter(const uno::Sequence<beans::PropertyValue>& rDescrip return true; } + // depending on the experimental mode + uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); + if (!xContext.is() || !officecfg::Office::Common::Misc::ExperimentalMode::get(xContext)) + { + return false; + } + + OUString aUseOrcus; + rtl::Bootstrap::get("LIBO_USE_ORCUS", aUseOrcus); + bool bUseOrcus = (aUseOrcus == "YES"); + if (!bUseOrcus) return false; commit 63a4e2338c17264c4a734482b754ee9c6df8c94a Author: Markus Mohrhard <[email protected]> Date: Tue Aug 26 15:18:19 2014 +0200 import cell fill color Change-Id: Icbc6ef69a00f05ffa7bb78227968c13a16cdc7a0 diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx index 8269b9b..b72f6a8 100644 --- a/sc/source/filter/inc/orcusinterface.hxx +++ b/sc/source/filter/inc/orcusinterface.hxx @@ -186,6 +186,8 @@ private: OUString maPattern; Color maFgColor; Color maBgColor; + + void applyToItemSet(SfxItemSet& rSet) const; }; fill maCurrentFill; diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx index 9d0a1e8..8ab43e1 100644 --- a/sc/source/filter/orcus/interface.cxx +++ b/sc/source/filter/orcus/interface.cxx @@ -24,6 +24,7 @@ #include <editeng/postitem.hxx> #include <editeng/wghtitem.hxx> #include <editeng/colritem.hxx> +#include <editeng/brushitem.hxx> #include <editeng/udlnitem.hxx> #include <formula/token.hxx> @@ -504,6 +505,14 @@ void ScOrcusStyles::font::applyToItemSet(SfxItemSet& rSet) const rSet.Put(SvxUnderlineItem(meUnderline, ATTR_FONT_UNDERLINE)); } +void ScOrcusStyles::fill::applyToItemSet(SfxItemSet& rSet) const +{ + if (maPattern.equalsIgnoreAsciiCase("none")) + return; + + rSet.Put(SvxBrushItem(maFgColor, ATTR_BACKGROUND)); +} + ScOrcusStyles::protection::protection(): mbHidden(false), mbLocked(false) @@ -637,22 +646,26 @@ void ScOrcusStyles::set_fill_count(size_t /*n*/) // needed at all? } -void ScOrcusStyles::set_fill_pattern_type(const char* /*s*/, size_t /*n*/) +void ScOrcusStyles::set_fill_pattern_type(const char* s, size_t n) { + maCurrentFill.maPattern = OUString(s, n, RTL_TEXTENCODING_UTF8); } -void ScOrcusStyles::set_fill_fg_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*/) +void ScOrcusStyles::set_fill_fg_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) { + maCurrentFill.maFgColor = Color(alpha, red, green, blue); } -void ScOrcusStyles::set_fill_bg_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*/) +void ScOrcusStyles::set_fill_bg_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) { + maCurrentFill.maBgColor = Color(alpha, red, green, blue); } size_t ScOrcusStyles::commit_fill() { SAL_INFO("sc.orcus.style", "commit fill"); - return 0; + maFills.push_back(maCurrentFill); + return maFills.size() - 1; } // border commit 910755289a9d32f47d282049eb9d384cbc2fd083 Author: Markus Mohrhard <[email protected]> Date: Tue Aug 26 15:17:19 2014 +0200 we need to create the default styles in the interface right now We should fix this but it needs some work in the import code. Change-Id: If9ce52f6aa2b30faf832a89f39abef4b853a5ec1 diff --git a/sc/inc/stlpool.hxx b/sc/inc/stlpool.hxx index e83aef0..15acaf8 100644 --- a/sc/inc/stlpool.hxx +++ b/sc/inc/stlpool.hxx @@ -21,6 +21,7 @@ #define INCLUDED_SC_INC_STLPOOL_HXX #include <svl/style.hxx> +#include "scdllapi.h" class ScStyleSheet; class ScDocument; @@ -42,7 +43,7 @@ public: SfxStyleSheetBase* GetActualStyleSheet () { return pActualStyleSheet; } - void CreateStandardStyles(); + void SC_DLLPUBLIC CreateStandardStyles(); void CopyStdStylesFrom( ScStyleSheetPool* pSrcPool ); void CopyStyleFrom( ScStyleSheetPool* pSrcPool, diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx index 905326d..9d0a1e8 100644 --- a/sc/source/filter/orcus/interface.cxx +++ b/sc/source/filter/orcus/interface.cxx @@ -481,6 +481,7 @@ size_t ScOrcusSharedStrings::commit_segments() ScOrcusStyles::ScOrcusStyles(ScDocument& rDoc): mrDoc(rDoc) { + mrDoc.GetStyleSheetPool()->CreateStandardStyles(); } ScOrcusStyles::font::font(): commit bf8279d836b612a029a94d21f909e28023207ac3 Author: Markus Mohrhard <[email protected]> Date: Tue Aug 26 15:14:41 2014 +0200 import font underline Change-Id: I4857d9d49b9f6ef1b92a1d5f61f9f9e852620949 diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx index cd08d5c..8269b9b 100644 --- a/sc/source/filter/inc/orcusinterface.hxx +++ b/sc/source/filter/inc/orcusinterface.hxx @@ -14,6 +14,7 @@ #include "documentimport.hxx" #include <tools/color.hxx> +#include <tools/fontenum.hxx> #include "sharedformulagroups.hxx" @@ -170,6 +171,7 @@ private: OUString maName; double mnSize; Color maColor; + FontUnderline meUnderline; font(); diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx index 281a31f..905326d 100644 --- a/sc/source/filter/orcus/interface.cxx +++ b/sc/source/filter/orcus/interface.cxx @@ -24,6 +24,7 @@ #include <editeng/postitem.hxx> #include <editeng/wghtitem.hxx> #include <editeng/colritem.hxx> +#include <editeng/udlnitem.hxx> #include <formula/token.hxx> #include <tools/datetime.hxx> @@ -485,7 +486,8 @@ ScOrcusStyles::ScOrcusStyles(ScDocument& rDoc): ScOrcusStyles::font::font(): mbBold(false), mbItalic(false), - mnSize(10) + mnSize(10), + meUnderline(UNDERLINE_NONE) { } @@ -498,6 +500,7 @@ void ScOrcusStyles::font::applyToItemSet(SfxItemSet& rSet) const rSet.Put(SvxWeightItem(eWeight, ATTR_FONT_WEIGHT)); rSet.Put(SvxColorItem(maColor, ATTR_FONT_COLOR)); + rSet.Put(SvxUnderlineItem(meUnderline, ATTR_FONT_UNDERLINE)); } ScOrcusStyles::protection::protection(): @@ -593,8 +596,22 @@ void ScOrcusStyles::set_font_size(double point) maCurrentFont.mnSize = point; } -void ScOrcusStyles::set_font_underline(orcus::spreadsheet::underline_t /*e*/) +void ScOrcusStyles::set_font_underline(orcus::spreadsheet::underline_t e) { + switch(e) + { + case orcus::spreadsheet::underline_single: + case orcus::spreadsheet::underline_single_accounting: + maCurrentFont.meUnderline = UNDERLINE_SINGLE; + break; + case orcus::spreadsheet::underline_double: + case orcus::spreadsheet::underline_double_accounting: + maCurrentFont.meUnderline = UNDERLINE_DOUBLE; + break; + case orcus::spreadsheet::underline_none: + maCurrentFont.meUnderline = UNDERLINE_NONE; + break; + } } void ScOrcusStyles::set_font_color(orcus::spreadsheet::color_elem_t alpha, commit 0bd4408a88e58cedd0ca2c35c8a9396c91ad2ee8 Author: Markus Mohrhard <[email protected]> Date: Sat Aug 23 15:25:05 2014 +0200 next step on correct styles import from orcus Change-Id: I5d7487dee3120b2a74affe6b081d0c1ea338edc0 diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx index 2e4cc4c..cd08d5c 100644 --- a/sc/source/filter/inc/orcusinterface.hxx +++ b/sc/source/filter/inc/orcusinterface.hxx @@ -31,6 +31,7 @@ class ScDocumentImport; class ScOrcusSheet; class ScOrcusFactory; class ScRangeData; +class SfxItemSet; namespace com { namespace sun { namespace star { namespace task { @@ -160,6 +161,7 @@ public: class ScOrcusStyles : public orcus::spreadsheet::iface::import_styles { private: + ScDocument& mrDoc; struct font { @@ -170,6 +172,8 @@ private: Color maColor; font(); + + void applyToItemSet(SfxItemSet& rSet) const; }; font maCurrentFont; @@ -220,6 +224,7 @@ private: size_t mnBorderId; size_t mnProtectionId; size_t mnNumberFormatId; + size_t mnStyleXf; xf(); }; @@ -239,7 +244,10 @@ private: cell_style maCurrentCellStyle; + void applyXfToItemSet(SfxItemSet& rSet, const xf& rXf); + public: + ScOrcusStyles(ScDocument& rDoc); // 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 ed2718a..281a31f 100644 --- a/sc/source/filter/orcus/interface.cxx +++ b/sc/source/filter/orcus/interface.cxx @@ -18,6 +18,12 @@ #include "globstr.hrc" #include "compiler.hxx" #include "dbdata.hxx" +#include "stlpool.hxx" +#include "scitems.hxx" + +#include <editeng/postitem.hxx> +#include <editeng/wghtitem.hxx> +#include <editeng/colritem.hxx> #include <formula/token.hxx> #include <tools/datetime.hxx> @@ -52,6 +58,7 @@ ScOrcusFactory::ScOrcusFactory(ScDocument& rDoc) : maDoc(rDoc), maGlobalSettings(maDoc), maSharedStrings(*this), + maStyles(rDoc), mnProgress(0) {} orcus::spreadsheet::iface::import_sheet* ScOrcusFactory::append_sheet(const char* sheet_name, size_t sheet_name_length) @@ -470,6 +477,11 @@ size_t ScOrcusSharedStrings::commit_segments() return mrFactory.addString(OStringToOUString(aStr, RTL_TEXTENCODING_UTF8)); } +ScOrcusStyles::ScOrcusStyles(ScDocument& rDoc): + mrDoc(rDoc) +{ +} + ScOrcusStyles::font::font(): mbBold(false), mbItalic(false), @@ -477,6 +489,17 @@ ScOrcusStyles::font::font(): { } +void ScOrcusStyles::font::applyToItemSet(SfxItemSet& rSet) const +{ + FontItalic eItalic = mbItalic ? ITALIC_NORMAL : ITALIC_NONE; + rSet.Put(SvxPostureItem(eItalic, ATTR_FONT_POSTURE)); + + FontWeight eWeight = mbBold ? WEIGHT_BOLD : WEIGHT_NORMAL; + rSet.Put(SvxWeightItem(eWeight, ATTR_FONT_WEIGHT)); + + rSet.Put(SvxColorItem(maColor, ATTR_FONT_COLOR)); +} + ScOrcusStyles::protection::protection(): mbHidden(false), mbLocked(false) @@ -492,7 +515,8 @@ ScOrcusStyles::xf::xf(): mnFillId(0), mnBorderId(0), mnProtectionId(0), - mnNumberFormatId(0) + mnNumberFormatId(0), + mnStyleXf(0) { } @@ -502,6 +526,47 @@ ScOrcusStyles::cell_style::cell_style(): { } +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"); + return; + } + + const font& rFont = maFonts[nFontId]; + rFont.applyToItemSet(rSet); + + size_t nFillId = rXf.mnFillId; + if (nFillId >= maFills.size()) + { + SAL_WARN("sc.orcus.styles", "invalid fill id"); + return; + } + + size_t nBorderId = rXf.mnBorderId; + if (nBorderId >= maBorders.size()) + { + SAL_WARN("sc.orcus.styles", "invalid border id"); + return; + } + + size_t nProtectionId = rXf.mnProtectionId; + if (nProtectionId >= maProtections.size()) + { + SAL_WARN("sc.orcus.styles", "invalid protection id"); + return; + } + + size_t nNumberFormatId = rXf.mnNumberFormatId; + if (nNumberFormatId >= maNumberFormats.size()) + { + SAL_WARN("sc.orcus.styles", "invalid number format id"); + return; + } +} + void ScOrcusStyles::set_font_count(size_t /*n*/) { // needed at all? @@ -542,6 +607,7 @@ void ScOrcusStyles::set_font_color(orcus::spreadsheet::color_elem_t alpha, size_t ScOrcusStyles::commit_font() { + SAL_INFO("sc.orcus.style", "commit font"); maFonts.push_back(maCurrentFont); return maFonts.size() - 1; } @@ -567,6 +633,7 @@ void ScOrcusStyles::set_fill_bg_color(orcus::spreadsheet::color_elem_t /*alpha*/ size_t ScOrcusStyles::commit_fill() { + SAL_INFO("sc.orcus.style", "commit fill"); return 0; } @@ -593,6 +660,7 @@ void ScOrcusStyles::set_border_color(orcus::spreadsheet::border_direction_t /*di size_t ScOrcusStyles::commit_border() { + SAL_INFO("sc.orcus.styles", "commit border"); return 0; } @@ -609,6 +677,7 @@ void ScOrcusStyles::set_cell_locked(bool b) size_t ScOrcusStyles::commit_cell_protection() { + SAL_INFO("sc.orcus.styles", "commit cell protection"); maProtections.push_back(maCurrentProtection); return maProtections.size() - 1; } @@ -629,6 +698,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"); maNumberFormats.push_back(maCurrentNumberFormat); return maNumberFormats.size() - 1; } @@ -642,6 +712,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"); maCellStyleXfs.push_back(maCurrentXF); return maCellStyleXfs.size() - 1; } @@ -655,6 +726,7 @@ void ScOrcusStyles::set_cell_xf_count(size_t /*n*/) size_t ScOrcusStyles::commit_cell_xf() { + SAL_INFO("sc.orcus.styles", "commit cell xf"); maCellXfs.push_back(maCurrentXF); return maCellXfs.size() - 1; } @@ -697,8 +769,9 @@ void ScOrcusStyles::set_xf_protection(size_t index) maCurrentXF.mnProtectionId = index; } -void ScOrcusStyles::set_xf_style_xf(size_t /*index*/) +void ScOrcusStyles::set_xf_style_xf(size_t index) { + maCurrentXF.mnStyleXf = index; } void ScOrcusStyles::set_xf_apply_alignment(bool /*b*/) @@ -740,6 +813,20 @@ void ScOrcusStyles::set_cell_style_builtin(size_t index) size_t ScOrcusStyles::commit_cell_style() { + SAL_INFO("sc.orcus.styles", "commit cell styles"); + if (maCurrentCellStyle.mnXFId >= maCellStyleXfs.size()) + { + SAL_WARN("sc.orcus.styles", "invalid xf id for commit cell style"); + return 0; + } + + ScStyleSheetPool* pPool = mrDoc.GetStyleSheetPool(); + SfxStyleSheetBase& rBase = pPool->Make(maCurrentCellStyle.maName, SFX_STYLE_FAMILY_PARA); + SfxItemSet& rSet = rBase.GetItemSet(); + + xf& rXf = maCellStyleXfs[maCurrentCellStyle.mnXFId]; + applyXfToItemSet(rSet, rXf); + return 0; } commit ab036f3b3ce069ad34924208c0e697d0d92a0f85 Author: Markus Mohrhard <[email protected]> Date: Sat Aug 23 15:24:04 2014 +0200 import font color correctly Change-Id: I7996da193d24e81a625070ddfc7d17311af38774 diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx index 3bb0885..ed2718a 100644 --- a/sc/source/filter/orcus/interface.cxx +++ b/sc/source/filter/orcus/interface.cxx @@ -532,11 +532,12 @@ void ScOrcusStyles::set_font_underline(orcus::spreadsheet::underline_t /*e*/) { } -void ScOrcusStyles::set_font_color(orcus::spreadsheet::color_elem_t, - orcus::spreadsheet::color_elem_t, - orcus::spreadsheet::color_elem_t, - orcus::spreadsheet::color_elem_t) +void ScOrcusStyles::set_font_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) { + maCurrentFont.maColor = Color(alpha, red, green, blue); } size_t ScOrcusStyles::commit_font() commit b0a2cc695ea3ab3b6e66bc7822135ea6e1cc1b3f Author: Markus Mohrhard <[email protected]> Date: Fri Aug 22 11:22:03 2014 +0200 remove crazy whitespaces Conflicts: framework/source/loadenv/loadenv.cxx Change-Id: Ia104e5dedbaf19dff5b0eaf4eb6f4c355570cc00 diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index e2c1d63..3f2db03b0 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -1084,9 +1084,9 @@ bool LoadEnv::impl_loadContent() // So we prevent our code against wrong using. Why? // It could be, that using of this progress could make trouble. e.g. He make window visible ... // but shouldn't do that. But if no indicator is available ... nobody has a chance to do that! - bool bHidden = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_HIDDEN() , false ); - bool bMinimized = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_MINIMIZED() , false ); - bool bPreview = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_PREVIEW() , false ); + bool bHidden = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_HIDDEN(), false); + bool bMinimized = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_MINIMIZED(), false); + bool bPreview = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_PREVIEW(), false); css::uno::Reference< css::task::XStatusIndicator > xProgress = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_STATUSINDICATOR(), css::uno::Reference< css::task::XStatusIndicator >()); if (!bHidden && !bMinimized && !bPreview && !xProgress.is()) commit c427f2ee1773a4cb7b5b2b83c0b91e07e5a30781 Author: Markus Mohrhard <[email protected]> Date: Fri Aug 22 11:21:44 2014 +0200 make experimental orcus import work again Change-Id: I2e599331669c3018557835ab227395c54c247ac9 diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index 6f6cc12..e2c1d63 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -767,6 +767,7 @@ void LoadEnv::impl_detectTypeAndFilter() m_lMediaDescriptor[utl::MediaDescriptor::PROP_TYPENAME()] <<= sType; m_lMediaDescriptor[utl::MediaDescriptor::PROP_FILTERNAME()] <<= sFilter; m_lMediaDescriptor[utl::MediaDescriptor::PROP_FILTERPROVIDER()] <<= OUString("orcus"); + m_lMediaDescriptor[utl::MediaDescriptor::PROP_DOCUMENTSERVICE()] <<= OUString("com.sun.star.sheet.SpreadsheetDocument"); return; } commit cb24ff3e1dde0c999158a91a657569c28c01a86e Author: Markus Mohrhard <[email protected]> Date: Fri Aug 22 09:03:42 2014 +0200 tep for correct styles import from orcus Change-Id: Ifdd4686b5fd8a00dbe8ff74400a909697895e30b diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx index 2e687ec..2e4cc4c 100644 --- a/sc/source/filter/inc/orcusinterface.hxx +++ b/sc/source/filter/inc/orcusinterface.hxx @@ -13,6 +13,8 @@ #include "address.hxx" #include "documentimport.hxx" +#include <tools/color.hxx> + #include "sharedformulagroups.hxx" #include <rtl/strbuf.hxx> @@ -23,6 +25,7 @@ #include <boost/ptr_container/ptr_vector.hpp> #include <map> #include <unordered_map> +#include <vector> class ScDocumentImport; class ScOrcusSheet; @@ -156,6 +159,85 @@ public: class ScOrcusStyles : public orcus::spreadsheet::iface::import_styles { +private: + + struct font + { + bool mbBold; + bool mbItalic; + OUString maName; + double mnSize; + Color maColor; + + font(); + }; + + font maCurrentFont; + std::vector<font> maFonts; + + struct fill + { + OUString maPattern; + Color maFgColor; + Color maBgColor; + }; + + fill maCurrentFill; + std::vector<fill> maFills; + + struct border + { + + border(); + }; + + border maCurrentBorder; + std::vector<border> maBorders; + + struct protection + { + bool mbHidden; + bool mbLocked; + + protection(); + }; + + protection maCurrentProtection; + std::vector<protection> maProtections; + + struct number_format + { + OUString maCode; + }; + + number_format maCurrentNumberFormat; + std::vector<number_format> maNumberFormats; + + struct xf + { + size_t mnFontId; + size_t mnFillId; + size_t mnBorderId; + size_t mnProtectionId; + size_t mnNumberFormatId; + + xf(); + }; + + xf maCurrentXF; + std::vector<xf> maCellStyleXfs; + std::vector<xf> maCellXfs; + + struct cell_style + { + OUString maName; + size_t mnXFId; + size_t mnBuiltInId; + + cell_style(); + }; + + cell_style maCurrentCellStyle; public: // font diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx index 35ecc83..3bb0885 100644 --- a/sc/source/filter/orcus/interface.cxx +++ b/sc/source/filter/orcus/interface.cxx @@ -470,25 +470,62 @@ size_t ScOrcusSharedStrings::commit_segments() return mrFactory.addString(OStringToOUString(aStr, RTL_TEXTENCODING_UTF8)); } +ScOrcusStyles::font::font(): + mbBold(false), + mbItalic(false), + mnSize(10) +{ +} + +ScOrcusStyles::protection::protection(): + mbHidden(false), + mbLocked(false) +{ +} + +ScOrcusStyles::border::border() +{ +} + +ScOrcusStyles::xf::xf(): + mnFontId(0), + mnFillId(0), + mnBorderId(0), + mnProtectionId(0), + mnNumberFormatId(0) +{ +} + +ScOrcusStyles::cell_style::cell_style(): + mnXFId(0), + mnBuiltInId(0) +{ +} + void ScOrcusStyles::set_font_count(size_t /*n*/) { // needed at all? } -void ScOrcusStyles::set_font_bold(bool /*b*/) +void ScOrcusStyles::set_font_bold(bool b) { + maCurrentFont.mbBold = b; } -void ScOrcusStyles::set_font_italic(bool /*b*/) +void ScOrcusStyles::set_font_italic(bool b) { + maCurrentFont.mbItalic = b; } -void ScOrcusStyles::set_font_name(const char* /*s*/, size_t /*n*/) +void ScOrcusStyles::set_font_name(const char* s, size_t n) { + OUString aName(s, n, RTL_TEXTENCODING_UTF8); + maCurrentFont.maName = aName; } -void ScOrcusStyles::set_font_size(double /*point*/) +void ScOrcusStyles::set_font_size(double point) { + maCurrentFont.mnSize = point; } void ScOrcusStyles::set_font_underline(orcus::spreadsheet::underline_t /*e*/) @@ -504,7 +541,8 @@ void ScOrcusStyles::set_font_color(orcus::spreadsheet::color_elem_t, size_t ScOrcusStyles::commit_font() { - return 0; + maFonts.push_back(maCurrentFont); + return maFonts.size() - 1; } // fill @@ -558,17 +596,20 @@ size_t ScOrcusStyles::commit_border() } // cell protection -void ScOrcusStyles::set_cell_hidden(bool /*b*/) +void ScOrcusStyles::set_cell_hidden(bool b) { + maCurrentProtection.mbHidden = b; } -void ScOrcusStyles::set_cell_locked(bool /*b*/) +void ScOrcusStyles::set_cell_locked(bool b) { + maCurrentProtection.mbLocked = b; } size_t ScOrcusStyles::commit_cell_protection() { - return 0; + maProtections.push_back(maCurrentProtection); + return maProtections.size() - 1; } void ScOrcusStyles::set_number_format_count(size_t) @@ -579,13 +620,16 @@ void ScOrcusStyles::set_number_format_identifier(size_t) { } -void ScOrcusStyles::set_number_format_code(const char* /*s*/, size_t /*n*/) +void ScOrcusStyles::set_number_format_code(const char* s, size_t n) { + OUString aCode(s, n, RTL_TEXTENCODING_UTF8); + maCurrentNumberFormat.maCode = aCode; } size_t ScOrcusStyles::commit_number_format() { - return 0; + maNumberFormats.push_back(maCurrentNumberFormat); + return maNumberFormats.size() - 1; } // cell style xf @@ -597,7 +641,8 @@ void ScOrcusStyles::set_cell_style_xf_count(size_t /*n*/) size_t ScOrcusStyles::commit_cell_style_xf() { - return 0; + maCellStyleXfs.push_back(maCurrentXF); + return maCellStyleXfs.size() - 1; } // cell xf @@ -609,7 +654,8 @@ void ScOrcusStyles::set_cell_xf_count(size_t /*n*/) size_t ScOrcusStyles::commit_cell_xf() { - return 0; + maCellXfs.push_back(maCurrentXF); + return maCellXfs.size() - 1; } // dxf @@ -625,25 +671,29 @@ size_t ScOrcusStyles::commit_dxf() // xf (cell format) - used both by cell xf and cell style xf. -void ScOrcusStyles::set_xf_number_format(size_t /*index*/) +void ScOrcusStyles::set_xf_number_format(size_t index) { - // no number format interfaces implemented yet + maCurrentXF.mnNumberFormatId = index; } -void ScOrcusStyles::set_xf_font(size_t /*index*/) +void ScOrcusStyles::set_xf_font(size_t index) { + maCurrentXF.mnFontId = index; } -void ScOrcusStyles::set_xf_fill(size_t /*index*/) +void ScOrcusStyles::set_xf_fill(size_t index) { + maCurrentXF.mnFillId = index; } -void ScOrcusStyles::set_xf_border(size_t /*index*/) +void ScOrcusStyles::set_xf_border(size_t index) { + maCurrentXF.mnBorderId = index; } -void ScOrcusStyles::set_xf_protection(size_t /*index*/) +void ScOrcusStyles::set_xf_protection(size_t index) { + maCurrentXF.mnProtectionId = index; } void ScOrcusStyles::set_xf_style_xf(size_t /*index*/) @@ -670,17 +720,21 @@ void ScOrcusStyles::set_cell_style_count(size_t /*n*/) // needed at all? } -void ScOrcusStyles::set_cell_style_name(const char* /*s*/, size_t /*n*/) +void ScOrcusStyles::set_cell_style_name(const char* s, size_t n) { + OUString aName(s, n, RTL_TEXTENCODING_UTF8); + maCurrentCellStyle.maName = aName; } -void ScOrcusStyles::set_cell_style_xf(size_t /*index*/) +void ScOrcusStyles::set_cell_style_xf(size_t index) { + maCurrentCellStyle.mnXFId = index; } -void ScOrcusStyles::set_cell_style_builtin(size_t /*index*/) +void ScOrcusStyles::set_cell_style_builtin(size_t index) { // not needed for gnumeric + maCurrentCellStyle.mnBuiltInId = index; } size_t ScOrcusStyles::commit_cell_style() commit 83ce673e63fe26784c4fed370c7c3ec886a53780 Author: Markus Mohrhard <[email protected]> Date: Fri Aug 22 09:03:30 2014 +0200 parse the range for autofilter Change-Id: Ia47e42db3a66a8d620803468182e8b9d3465b8e4 diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx index c48163d..2e687ec 100644 --- a/sc/source/filter/inc/orcusinterface.hxx +++ b/sc/source/filter/inc/orcusinterface.hxx @@ -92,6 +92,8 @@ public: private: ScDocument& mrDoc; + + ScRange maRange; }; class ScOrcusSheet : public orcus::spreadsheet::iface::import_sheet diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx index 7ab97b1..35ecc83 100644 --- a/sc/source/filter/orcus/interface.cxx +++ b/sc/source/filter/orcus/interface.cxx @@ -704,6 +704,8 @@ void ScOrcusAutoFilter::set_range(const char* p_ref, size_t n_ref) { OUString aRange(p_ref, n_ref, RTL_TEXTENCODING_UTF8); SAL_INFO("sc.orcus.autofilter", "set_range: " << aRange); + + maRange.Parse(aRange); } void ScOrcusAutoFilter::set_column(orcus::spreadsheet::col_t col) commit 57a8c00e4be5580f2532acfb8b1ab16edb3cdc0c Author: Markus Mohrhard <[email protected]> Date: Tue Aug 19 17:31:02 2014 +0200 import table as ScDBData Conflicts: sc/source/filter/inc/orcusinterface.hxx sc/source/filter/orcus/interface.cxx Change-Id: Ibce6247b19ca7c0788743baba24d07722500efd0 diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx index 8677bbf..c48163d 100644 --- a/sc/source/filter/inc/orcusinterface.hxx +++ b/sc/source/filter/inc/orcusinterface.hxx @@ -284,5 +284,48 @@ public: void setStatusIndicator(const com::sun::star::uno::Reference<com::sun::star::task::XStatusIndicator>& rIndicator); }; +class ScOrcusTable : public orcus::spreadsheet::iface::import_table +{ +private: + SCTAB mnTab; + ScDocument& mrDoc; + ScOrcusAutoFilter maAutoFilter; + + ScRange maRange; + OUString maName; + +public: + ScOrcusTable(SCTAB nTab, ScDocument& rDoc); + virtual ~ScOrcusTable(); + + virtual orcus::spreadsheet::iface::import_auto_filter* get_auto_filter() SAL_OVERRIDE; + + virtual void set_identifier(size_t id) SAL_OVERRIDE; + + virtual void set_range(const char* p_ref, size_t n_ref) SAL_OVERRIDE; + + virtual void set_totals_row_count(size_t row_count) SAL_OVERRIDE; + + virtual void set_name(const char* p, size_t n) SAL_OVERRIDE; + + virtual void set_display_name(const char* p, size_t n) SAL_OVERRIDE; + + virtual void set_column_count(size_t n) SAL_OVERRIDE; + + virtual void set_column_identifier(size_t id) SAL_OVERRIDE; + virtual void set_column_name(const char* p, size_t n) SAL_OVERRIDE; + virtual void set_column_totals_row_label(const char* p, size_t n) SAL_OVERRIDE; + virtual void set_column_totals_row_function(orcus::spreadsheet::totals_row_function_t func) SAL_OVERRIDE; + virtual void commit_column() SAL_OVERRIDE; + + virtual void set_style_name(const char* p, size_t n) SAL_OVERRIDE; + virtual void set_style_show_first_column(bool b) SAL_OVERRIDE; + virtual void set_style_show_last_column(bool b) SAL_OVERRIDE; + virtual void set_style_show_row_stripes(bool b) SAL_OVERRIDE; + virtual void set_style_show_column_stripes(bool b) SAL_OVERRIDE; + + virtual void commit() SAL_OVERRIDE; +}; + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx index 04f61ee..7ab97b1 100644 --- a/sc/source/filter/orcus/interface.cxx +++ b/sc/source/filter/orcus/interface.cxx @@ -17,6 +17,7 @@ #include "docoptio.hxx" #include "globstr.hrc" #include "compiler.hxx" +#include "dbdata.hxx" #include <formula/token.hxx> #include <tools/datetime.hxx> @@ -726,4 +727,138 @@ void ScOrcusAutoFilter::commit() SAL_INFO("sc.orcus.autofilter", "commit"); } +ScOrcusTable::ScOrcusTable(SCTAB nTab, ScDocument& rDoc): + mnTab(nTab), + mrDoc(rDoc), + maAutoFilter(rDoc) +{ +} + +ScOrcusTable::~ScOrcusTable() +{ +} + +os::iface::import_auto_filter* ScOrcusTable::get_auto_filter() +{ + return &maAutoFilter; +} + +void ScOrcusTable::set_identifier(size_t id) +{ + SAL_INFO("sc.orcus.table", "set_identifier :" << id); +} + +namespace { + +std::ostream& operator<<(std::ostream& rStrm, const ScAddress& rAddr) +{ + rStrm << "Col: " << rAddr.Col() << ", Row: " << rAddr.Row() << ", Tab: " << rAddr.Tab(); + return rStrm; +} + +std::ostream& operator<<(std::ostream& rStrm, const ScRange& rRange) +{ + rStrm << "aStart: " << rRange.aStart << std::endl; + rStrm << "aEnd: " << rRange.aEnd; + return rStrm; +} + +} + +void ScOrcusTable::set_range(const char* p_ref, size_t n_ref) +{ + OUString aRange(p_ref, n_ref, RTL_TEXTENCODING_UTF8); + SAL_INFO("sc.orcus.table", "set_range: " << aRange); + + maRange.Parse(aRange); + SAL_INFO("sc.orcus.table", "set_range translated range: " << maRange); +} + +void ScOrcusTable::set_totals_row_count(size_t row_count) +{ + SAL_INFO("sc.orcus.table", "set_totals_row_count: " << row_count); +} + +void ScOrcusTable::set_name(const char* p, size_t n) +{ + maName = OUString(p, n, RTL_TEXTENCODING_UTF8); + SAL_INFO("sc.orcus.table", "set_name: " << maName); +} + +void ScOrcusTable::set_display_name(const char* p, size_t n) +{ + OUString aName(p, n, RTL_TEXTENCODING_UTF8); + SAL_INFO("sc.orcus.table", "set_display_name: " << aName); +} + +void ScOrcusTable::set_column_count(size_t n) +{ + SAL_INFO("sc.orcus.table", "set_column_count: " << n); +} + +void ScOrcusTable::set_column_identifier(size_t id) +{ + SAL_INFO("sc.orcus.table", "set_column_identifier: " << id); +} + +void ScOrcusTable::set_column_name(const char* p, size_t n) +{ + OUString aName(p, n, RTL_TEXTENCODING_UTF8); + SAL_INFO("sc.orcus.table", "set_column_name: " << aName); +} + +void ScOrcusTable::set_column_totals_row_label(const char* p, size_t n) +{ + OUString aLabel(p, n, RTL_TEXTENCODING_UTF8); + SAL_INFO("sc.orcus.table", "set_column_totals_row_label: " << aLabel); +} + +void ScOrcusTable::set_column_totals_row_function(os::totals_row_function_t ) +{ + SAL_INFO("sc.orcus.table", "set_column_totals_row_function"); +} + +void ScOrcusTable::commit_column() +{ + SAL_INFO("sc.orcus.table", "commit_column"); +} + +void ScOrcusTable::set_style_name(const char* p, size_t n) +{ + OUString aName(p, n, RTL_TEXTENCODING_UTF8); + SAL_INFO("sc.orcus.table", "set_style_name: " << aName); +} + +void ScOrcusTable::set_style_show_first_column(bool b) +{ + SAL_INFO("sc.orcus.table", "set_style_show_first_column: " << b); +} + +void ScOrcusTable::set_style_show_last_column(bool b) +{ + SAL_INFO("sc.orcus.table", "set_style_show_last_column: " << b); +} + +void ScOrcusTable::set_style_show_row_stripes(bool b) +{ + SAL_INFO("sc.orcus.table", "set_style_show_row_stripes: " << b); +} + +void ScOrcusTable::set_style_show_column_stripes(bool b) +{ + SAL_INFO("sc.orcus.table", "set_style_show_column_stripes: " << b); +} + +void ScOrcusTable::commit() +{ + SAL_INFO("sc.orcus.table", "commit"); + + ScDBData* pDBData = new ScDBData(maName, mnTab, + maRange.aStart.Col(), maRange.aStart.Row(), + maRange.aEnd.Col(), maRange.aEnd.Row()); + + if(!mrDoc.GetDBCollection()->getNamedDBs().insert(pDBData)) + delete pDBData; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 27f69931fcc6062a7bd4da8c321c5422d23da603 Author: Markus Mohrhard <[email protected]> Date: Mon Aug 18 07:56:31 2014 +0200 add more orcus debug output Change-Id: I6f9135d0532026dffbb43c3b32d32cfc811a5823 diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx index a8e3f67..04f61ee 100644 --- a/sc/source/filter/orcus/interface.cxx +++ b/sc/source/filter/orcus/interface.cxx @@ -699,24 +699,31 @@ ScOrcusAutoFilter::~ScOrcusAutoFilter() { } -void ScOrcusAutoFilter::set_range(const char* /*p_ref*/, size_t /*n_ref*/) +void ScOrcusAutoFilter::set_range(const char* p_ref, size_t n_ref) { + OUString aRange(p_ref, n_ref, RTL_TEXTENCODING_UTF8); + SAL_INFO("sc.orcus.autofilter", "set_range: " << aRange); } -void ScOrcusAutoFilter::set_column(orcus::spreadsheet::col_t /*col*/) +void ScOrcusAutoFilter::set_column(orcus::spreadsheet::col_t col) { + SAL_INFO("sc.orcus.autofilter", "set_column: " << col); } -void ScOrcusAutoFilter::append_column_match_value(const char* /*p*/, size_t /*n*/) +void ScOrcusAutoFilter::append_column_match_value(const char* p, size_t n) { + OUString aString(p, n, RTL_TEXTENCODING_UTF8); + SAL_INFO("sc.orcus.autofilter", "append_column_match_value: " << aString); } void ScOrcusAutoFilter::commit_column() { + SAL_INFO("sc.orcus.autofilter", "commit column"); } void ScOrcusAutoFilter::commit() { + SAL_INFO("sc.orcus.autofilter", "commit"); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit c2559c5b08bc5ce61c2d7c4d634db880204b5494 Author: Markus Mohrhard <[email protected]> Date: Mon Aug 18 01:36:43 2014 +0200 make these types future proof Our core already supports more than 32k sheets and we should not use sal_Int16 anymore for sheets. Change-Id: Ifeb321cba044b255ef2e7d34da0908c27877d6ae diff --git a/sc/source/filter/inc/worksheethelper.hxx b/sc/source/filter/inc/worksheethelper.hxx index e11d6aa..0d61437 100644 --- a/sc/source/filter/inc/worksheethelper.hxx +++ b/sc/source/filter/inc/worksheethelper.hxx @@ -191,7 +191,7 @@ public: /** Returns the type of this sheet. */ WorksheetType getSheetType() const; /** Returns the index of the current sheet. */ - sal_Int16 getSheetIndex() const; + sal_Int32 getSheetIndex() const; /** Returns the XSpreadsheet interface of the current sheet. */ const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheet >& getSheet() const; diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx index 40a2874..4effbef 100644 --- a/sc/source/filter/oox/worksheethelper.cxx +++ b/sc/source/filter/oox/worksheethelper.cxx @@ -219,7 +219,7 @@ public: /** Returns the type of this sheet. */ inline WorksheetType getSheetType() const { return meSheetType; } /** Returns the index of the current sheet. */ - inline sal_Int16 getSheetIndex() const { return maUsedArea.Sheet; } + inline sal_Int32 getSheetIndex() const { return maUsedArea.Sheet; } /** Returns the XSpreadsheet interface of the current sheet. */ inline const Reference< XSpreadsheet >& getSheet() const { return mxSheet; } @@ -1407,7 +1407,7 @@ WorksheetType WorksheetHelper::getSheetType() const return mrSheetGlob.getSheetType(); } -sal_Int16 WorksheetHelper::getSheetIndex() const +sal_Int32 WorksheetHelper::getSheetIndex() const { return mrSheetGlob.getSheetIndex(); } commit be3fa5caa2ef94abd56dea1a23e0ed551f360f8c Author: Markus Mohrhard <[email protected]> Date: Mon Aug 18 07:51:05 2014 +0200 add ScOrcusSheet::get_table method Change-Id: I2369e29e96cf33dbe263b090dee0d1100ecce8de diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx index 633b43d..8677bbf 100644 --- a/sc/source/filter/inc/orcusinterface.hxx +++ b/sc/source/filter/inc/orcusinterface.hxx @@ -113,6 +113,7 @@ public: ScOrcusSheet(ScDocumentImport& rDoc, SCTAB nTab, ScOrcusFactory& rFactory); virtual orcus::spreadsheet::iface::import_auto_filter* get_auto_filter() SAL_OVERRIDE { return &maAutoFilter; } + 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 d897143..a8e3f67 100644 --- a/sc/source/filter/orcus/interface.cxx +++ b/sc/source/filter/orcus/interface.cxx @@ -214,6 +214,11 @@ void ScOrcusSheet::cellInserted() } } +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); commit edebac799d43b032fa63576a5bf936b470685d8d Author: Markus Mohrhard <[email protected]> Date: Wed Aug 26 14:00:09 2015 +0200 cosmetic clean-up Change-Id: I7e6689e07873dcb85c2bf1aac0db2ecddc01fe4b diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx index b9f2ebc..041339e 100644 --- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx +++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx @@ -1032,13 +1032,17 @@ void ToolbarLayoutManager::setParentWindow( { SolarMutexGuard aGuard; VclPtr< ::DockingAreaWindow > pWindow = dynamic_cast< ::DockingAreaWindow* >(VCLUnoHelper::GetWindow( xTopDockWindow ).get() ); - if( pWindow ) pWindow->SetAlign( WindowAlign::Top ); + if( pWindow ) + pWindow->SetAlign( WindowAlign::Top ); pWindow = dynamic_cast< ::DockingAreaWindow* >(VCLUnoHelper::GetWindow( xBottomDockWindow ).get() ); - if( pWindow ) pWindow->SetAlign( WindowAlign::Bottom ); + if( pWindow ) + pWindow->SetAlign( WindowAlign::Bottom ); pWindow = dynamic_cast< ::DockingAreaWindow* >(VCLUnoHelper::GetWindow( xLeftDockWindow ).get() ); - if( pWindow ) pWindow->SetAlign( WindowAlign::Left ); + if( pWindow ) + pWindow->SetAlign( WindowAlign::Left ); pWindow = dynamic_cast< ::DockingAreaWindow* >(VCLUnoHelper::GetWindow( xRightDockWindow ).get() ); - if( pWindow ) pWindow->SetAlign( WindowAlign::Right ); + if( pWindow ) + pWindow->SetAlign( WindowAlign::Right ); implts_reparentToolbars(); } else _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
