[Libreoffice-commits] core.git: Branch 'feature/orcus-continuous-integration' - 6 commits - framework/source sc/source
Markus Mohrhard
markus.mohrhard at collabora.co.uk
Fri Aug 22 02:32:15 PDT 2014
framework/source/loadenv/loadenv.cxx | 7 -
sc/source/filter/inc/orcusinterface.hxx | 91 ++++++++++++++++++
sc/source/filter/oox/worksheetfragment.cxx | 2
sc/source/filter/orcus/interface.cxx | 143 ++++++++++++++++++++++-------
4 files changed, 207 insertions(+), 36 deletions(-)
New commits:
commit 20d8e5237b90ceffe03f4e010030c9afc17b6bd5
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Fri Aug 22 11:22:03 2014 +0200
remove crazy whitespaces
Change-Id: Ia104e5dedbaf19dff5b0eaf4eb6f4c355570cc00
diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx
index 49cd13b..d9cfbda 100644
--- a/framework/source/loadenv/loadenv.cxx
+++ b/framework/source/loadenv/loadenv.cxx
@@ -1079,9 +1079,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() , sal_False );
- bool bMinimized = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_MINIMIZED() , sal_False );
- bool bPreview = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_PREVIEW() , sal_False );
+ bool bHidden = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_HIDDEN(), sal_False);
+ bool bMinimized = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_MINIMIZED(), sal_False);
+ bool bPreview = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_PREVIEW(), sal_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 4e113d9c2fb8dc7fe48a779caf4368664d1218b0
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
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 1616d3b..49cd13b 100644
--- a/framework/source/loadenv/loadenv.cxx
+++ b/framework/source/loadenv/loadenv.cxx
@@ -762,6 +762,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 5532df4e35e2f39b777baf0f4e21cd7ed2812d61
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
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 a124ea8..81e36e0 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>
@@ -24,6 +26,7 @@
#include <boost/unordered_map.hpp>
#include <map>
+#include <vector>
class ScDocumentImport;
class ScOrcusSheet;
@@ -154,6 +157,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 1205494..92aff7b 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()
commit d258f837d538d49378a84ee3713fcc38e4384373
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
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 e57e259..a124ea8 100644
--- a/sc/source/filter/inc/orcusinterface.hxx
+++ b/sc/source/filter/inc/orcusinterface.hxx
@@ -93,6 +93,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 c3ac8c6..1205494 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -683,6 +683,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 023036b68148da42d8ec01c132135d8749970303
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Tue Aug 19 17:31:02 2014 +0200
import table as ScDBData
Change-Id: Ibce6247b19ca7c0788743baba24d07722500efd0
diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx
index d8c8daf..e57e259 100644
--- a/sc/source/filter/inc/orcusinterface.hxx
+++ b/sc/source/filter/inc/orcusinterface.hxx
@@ -285,6 +285,9 @@ private:
ScDocument& mrDoc;
ScOrcusAutoFilter maAutoFilter;
+ ScRange maRange;
+ OUString maName;
+
public:
ScOrcusTable(SCTAB nTab, ScDocument& rDoc);
virtual ~ScOrcusTable();
diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
index 6490dac..c3ac8c6 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,10 +727,30 @@ 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)
@@ -739,8 +760,8 @@ void ScOrcusTable::set_totals_row_count(size_t row_count)
void ScOrcusTable::set_name(const char* p, size_t n)
{
- OUString aName(p, n, RTL_TEXTENCODING_UTF8);
- SAL_INFO("sc.orcus.table", "set_name: " << aName);
+ 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)
@@ -810,6 +831,13 @@ void ScOrcusTable::set_style_show_column_stripes(bool 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 adedf8dad040f308f30d7ab718ecb086b0ba6c4a
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Tue Aug 19 14:56:01 2014 +0200
add autofilter to table import
Change-Id: Ifde0871a1769fd7890a71381dd90955e500b5cb2
diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx
index 8c089bb..d8c8daf 100644
--- a/sc/source/filter/inc/orcusinterface.hxx
+++ b/sc/source/filter/inc/orcusinterface.hxx
@@ -282,9 +282,11 @@ class ScOrcusTable : public orcus::spreadsheet::iface::import_table
{
private:
SCTAB mnTab;
+ ScDocument& mrDoc;
+ ScOrcusAutoFilter maAutoFilter;
public:
- ScOrcusTable(SCTAB nTab);
+ ScOrcusTable(SCTAB nTab, ScDocument& rDoc);
virtual ~ScOrcusTable();
virtual orcus::spreadsheet::iface::import_auto_filter* get_auto_filter() SAL_OVERRIDE;
diff --git a/sc/source/filter/oox/worksheetfragment.cxx b/sc/source/filter/oox/worksheetfragment.cxx
index 7fd5e76..d5f1648 100644
--- a/sc/source/filter/oox/worksheetfragment.cxx
+++ b/sc/source/filter/oox/worksheetfragment.cxx
@@ -209,7 +209,7 @@ WorksheetFragment::WorksheetFragment( const WorksheetHelper& rHelper, const OUSt
nRead = xStream->readBytes(aData, 8000);
aString.append(OString((char*) aData.getConstArray(), nRead));
} while(nRead == 8000);
- ScOrcusTable aTable(getSheetIndex());
+ ScOrcusTable aTable(getSheetIndex(), getScDocument());
orcus::import_xlsx::read_table(aString.getStr(), aString.getLength(), &aTable);
}
diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
index c0c74f9..6490dac 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -215,11 +215,6 @@ 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);
@@ -710,8 +705,10 @@ void ScOrcusAutoFilter::commit()
SAL_INFO("sc.orcus.autofilter", "commit");
}
-ScOrcusTable::ScOrcusTable(SCTAB nTab):
- mnTab(nTab)
+ScOrcusTable::ScOrcusTable(SCTAB nTab, ScDocument& rDoc):
+ mnTab(nTab),
+ mrDoc(rDoc),
+ maAutoFilter(rDoc)
{
}
@@ -721,7 +718,7 @@ ScOrcusTable::~ScOrcusTable()
os::iface::import_auto_filter* ScOrcusTable::get_auto_filter()
{
- return NULL;
+ return &maAutoFilter;
}
void ScOrcusTable::set_identifier(size_t id)
More information about the Libreoffice-commits
mailing list