summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/source/filter/inc/orcusinterface.hxx82
-rw-r--r--sc/source/filter/orcus/interface.cxx96
2 files changed, 157 insertions, 21 deletions
diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx
index 5ce55e61c196..f188f047556d 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;
@@ -153,6 +156,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 a53202901194..875f47c31f9f 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -460,25 +460,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*/)
@@ -494,7 +531,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
@@ -548,17 +586,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)
@@ -569,13 +610,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
@@ -587,7 +631,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
@@ -599,30 +644,35 @@ 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;
}
// 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*/)
@@ -649,17 +699,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()