[packages/libreoffice] - patch to build with liborcu-0.5.1 (ported from libreoffice-4.1.0.0.alpha1)

draenog draenog at pld-linux.org
Sun May 19 03:37:57 CEST 2013


commit eea44993b0c0179deb87999a47d23839b3220d91
Author: Kacper Kornet <draenog at pld-linux.org>
Date:   Sun May 19 02:36:08 2013 +0100

    - patch to build with liborcu-0.5.1 (ported from
      libreoffice-4.1.0.0.alpha1)

 libreoffice-liborcus-build.patch | 1063 ++++++++++++++++++++++++++++++++++++++
 libreoffice.spec                 |    2 +
 2 files changed, 1065 insertions(+)
---
diff --git a/libreoffice.spec b/libreoffice.spec
index aa8b2ab..6dae7b2 100644
--- a/libreoffice.spec
+++ b/libreoffice.spec
@@ -79,6 +79,7 @@ Source25:	http://dev-www.libreoffice.org/src/a7983f859eafb2677d7ff386a023bc40-xs
 Patch0:		%{name}-hamcrest.patch
 Patch1:		%{name}-liborcus.patch
 Patch2:		%{name}-mdds.patch
+Patch3:		%{name}-liborcus-build.patch
 URL:		http://www.documentfoundation.org/
 BuildRequires:	/usr/bin/getopt
 BuildRequires:	GConf2-devel
@@ -2531,6 +2532,7 @@ bashowe uzupełnianie nazw dla LibreOffice.
 %patch0 -p0
 %patch1 -p1
 %patch2 -p1
+%patch3 -p1
 
 for dir in *-%{version}; do
 	[ -f $dir/ChangeLog ] && mv $dir/ChangeLog ChangeLog-$dir
diff --git a/libreoffice-liborcus-build.patch b/libreoffice-liborcus-build.patch
new file mode 100644
index 0000000..8ddaabc
--- /dev/null
+++ b/libreoffice-liborcus-build.patch
@@ -0,0 +1,1063 @@
+From 0b1c2382e436f4a085784fd383a16cecf783d3ea Mon Sep 17 00:00:00 2001
+From: Kohei Yoshida <kohei.yoshida at gmail.com>
+Date: Mon, 8 Apr 2013 14:58:39 -0400
+Subject: [PATCH 1/9] Get it to build with the latest orcus. It may not be
+ fully functional.
+
+Change-Id: Ife3c14a446273654d720eb38349cc42d1ed76893
+---
+ sc/source/filter/inc/orcusinterface.hxx | 18 ++++++++++++++++++
+ sc/source/filter/orcus/interface.cxx    | 25 +++++++++++++++++++++++++
+ sc/source/filter/orcus/xmlcontext.cxx   |  2 +-
+ 3 files changed, 44 insertions(+), 1 deletion(-)
+
+diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx
+index 2f8380c..4bc9b40 100644
+--- a/sc/source/filter/inc/orcusinterface.hxx
++++ b/sc/source/filter/inc/orcusinterface.hxx
+@@ -71,17 +71,31 @@ public:
+     // Orcus import interface
+     virtual void set_auto(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, const char* p, size_t n);
+     virtual void set_format(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, size_t xf_index);
++
+     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);
+     virtual void set_formula_result(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, const char* p, size_t n);
++
+     virtual void set_shared_formula(
+         orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, orcus::spreadsheet::formula_grammar_t grammar, size_t sindex,
+         const char* p_formula, size_t n_formula);
++
+     virtual void set_shared_formula(
+         orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, orcus::spreadsheet::formula_grammar_t grammar, size_t sindex,
+         const char* p_formula, size_t n_formula, const char* p_range, size_t n_range);
++
+     virtual void set_shared_formula(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, size_t sindex);
++
++    virtual void set_array_formula(
++        orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, orcus::spreadsheet::formula_grammar_t grammar,
++        const char* p, size_t n, orcus::spreadsheet::row_t array_rows, orcus::spreadsheet::col_t array_cols);
++
++    virtual void set_array_formula(
++        orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, orcus::spreadsheet::formula_grammar_t grammar,
++        const char* p, size_t n, const char* p_range, size_t n_range);
++
+     virtual void set_string(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, size_t sindex);
+     virtual void set_value(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, double value);
++    virtual void set_bool(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, bool value);
+ 
+     SCTAB getIndex() const { return mnTab; }
+ };
+@@ -119,6 +133,10 @@ public:
+     virtual void set_cell_locked(bool b);
+     virtual size_t commit_cell_protection();
+ 
++    // number format
++    virtual void set_number_format(const char* s, size_t n);
++    virtual size_t commit_number_format();
++
+     // cell style xf
+ 
+     virtual void set_cell_style_xf_count(size_t n);
+diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
+index b21e7e5..5a7ab84 100644
+--- a/sc/source/filter/orcus/interface.cxx
++++ b/sc/source/filter/orcus/interface.cxx
+@@ -191,6 +191,18 @@ void ScOrcusSheet::set_shared_formula(row_t row, col_t col, size_t sindex)
+     mrDoc.PutCell( col, row, mnTab, pCell );
+ }
+ 
++void ScOrcusSheet::set_array_formula(
++    row_t /*row*/, col_t /*col*/, formula_grammar_t /*grammar*/,
++    const char* /*p*/, size_t /*n*/, row_t /*array_rows*/, col_t /*array_cols*/)
++{
++}
++
++void ScOrcusSheet::set_array_formula(
++    row_t /*row*/, col_t /*col*/, formula_grammar_t /*grammar*/,
++    const char* /*p*/, size_t /*n*/, const char* /*p_range*/, size_t /*n_range*/)
++{
++}
++
+ void ScOrcusSheet::set_string(row_t row, col_t col, size_t sindex)
+ {
+     // Calc does not yet support shared strings so we have to
+@@ -208,6 +220,11 @@ void ScOrcusSheet::set_value(row_t row, col_t col, double value)
+     mrDoc.SetValue( col, row, mnTab, value );
+ }
+ 
++void ScOrcusSheet::set_bool(row_t row, col_t col, bool value)
++{
++    mrDoc.SetValue(col, row, mnTab, value ? 1.0 : 0.0);
++}
++
+ size_t ScOrcusSharedStrings::append(const char* s, size_t n)
+ {
+     OUString aNewString(s, n, RTL_TEXTENCODING_UTF8);
+@@ -341,6 +358,14 @@ size_t ScOrcusStyles::commit_cell_protection()
+     return 0;
+ }
+ 
++void ScOrcusStyles::set_number_format(const char* /*s*/, size_t /*n*/)
++{
++}
++
++size_t ScOrcusStyles::commit_number_format()
++{
++    return 0;
++}
+ 
+ // cell style xf
+ 
+diff --git a/sc/source/filter/orcus/xmlcontext.cxx b/sc/source/filter/orcus/xmlcontext.cxx
+index ecbf35b..5642382 100644
+--- a/sc/source/filter/orcus/xmlcontext.cxx
++++ b/sc/source/filter/orcus/xmlcontext.cxx
+@@ -159,7 +159,7 @@ bool ScOrcusXMLContextImpl::loadXMLStructure(SvTreeListBox& rTreeCtrl, ScOrcusXM
+ 
+     // TODO: Use our own stream loading call instead of one from orcus.
+     std::string aStrm;
+-    orcus::load_file_content(path, aStrm);
++//  orcus::load_file_content(path, aStrm);
+ 
+     if (aStrm.empty())
+         return false;
+-- 
+1.8.3.rc2
+
+
+From 1b65d3db48c938288d0ab288adeefb77181aa36a Mon Sep 17 00:00:00 2001
+From: Kohei Yoshida <kohei.yoshida at gmail.com>
+Date: Mon, 8 Apr 2013 21:41:51 -0400
+Subject: [PATCH 2/9] Use ucb to load bytes from file URL.
+
+With this, we get file system abstraction for free.
+
+Change-Id: Iec988712599f506444cf9c7e3ebbd59d38f083ee
+---
+ sc/Library_scfilt.mk                  |  1 +
+ sc/source/filter/orcus/xmlcontext.cxx | 34 +++++++++++++++++++++++++++++-----
+ 2 files changed, 30 insertions(+), 5 deletions(-)
+
+diff --git a/sc/Library_scfilt.mk b/sc/Library_scfilt.mk
+index bdb99ca..0a849da 100644
+--- a/sc/Library_scfilt.mk
++++ b/sc/Library_scfilt.mk
+@@ -58,6 +58,7 @@ $(eval $(call gb_Library_use_libraries,scfilt,\
+ 	svxcore \
+ 	tk \
+ 	tl \
++	ucbhelper \
+ 	utl \
+ 	vcl \
+ 	i18nisolang1 \
+diff --git a/sc/source/filter/orcus/xmlcontext.cxx b/sc/source/filter/orcus/xmlcontext.cxx
+index 5642382..001c8f9 100644
+--- a/sc/source/filter/orcus/xmlcontext.cxx
++++ b/sc/source/filter/orcus/xmlcontext.cxx
+@@ -14,6 +14,7 @@
+ 
+ #include "svtools/treelistbox.hxx"
+ #include "svtools/treelistentry.hxx"
++#include "ucbhelper/content.hxx"
+ 
+ #include <orcus/spreadsheet/import_interface.hpp>
+ #include <orcus/xml_structure_tree.hpp>
+@@ -21,7 +22,14 @@
+ #include <orcus/orcus_xml.hpp>
+ #include <orcus/global.hpp>
+ 
++#include <com/sun/star/ucb/XCommandEnvironment.hpp>
++
+ #include <string>
++#include <sstream>
++
++#define BUFFER_SIZE 4096
++
++using namespace com::sun::star;
+ 
+ namespace {
+ 
+@@ -143,6 +151,26 @@ public:
+     }
+ };
+ 
++void loadContentFromURL(const OUString& rURL, std::string& rStrm)
++{
++    ucbhelper::Content aContent(
++        rURL, uno::Reference<ucb::XCommandEnvironment>(), comphelper::getProcessComponentContext());
++    uno::Reference<io::XInputStream> xStrm = aContent.openStream();
++
++    std::ostringstream aStrmBuf;
++    uno::Sequence<sal_Int8> aBytes;
++    size_t nBytesRead = 0;
++    do
++    {
++        nBytesRead = xStrm->readBytes(aBytes, BUFFER_SIZE);
++        const sal_Int8* p = aBytes.getConstArray();
++        aStrmBuf << std::string(p, p + nBytesRead);
++    }
++    while (nBytesRead == BUFFER_SIZE);
++
++    rStrm = aStrmBuf.str();
++}
++
+ }
+ 
+ ScOrcusXMLContextImpl::ScOrcusXMLContextImpl(ScDocument& rDoc, const OUString& rPath) :
+@@ -154,12 +182,8 @@ bool ScOrcusXMLContextImpl::loadXMLStructure(SvTreeListBox& rTreeCtrl, ScOrcusXM
+ {
+     rParam.maUserDataStore.clear();
+ 
+-    OString aSysPath = ScOrcusFiltersImpl::toSystemPath(maPath);
+-    const char* path = aSysPath.getStr();
+-
+-    // TODO: Use our own stream loading call instead of one from orcus.
+     std::string aStrm;
+-//  orcus::load_file_content(path, aStrm);
++    loadContentFromURL(maPath, aStrm);
+ 
+     if (aStrm.empty())
+         return false;
+-- 
+1.8.3.rc2
+
+
+From 0189185a3d743f8b5b29d2630b9b6d96639ab3a5 Mon Sep 17 00:00:00 2001
+From: Kohei Yoshida <kohei.yoshida at gmail.com>
+Date: Tue, 9 Apr 2013 15:36:03 -0400
+Subject: [PATCH 3/9] Manage to use orcus to import ods, xlsx, and csv.
+
+But this occasionally crashes.
+
+Change-Id: I0a18d0e210639b43b89b966a54de541b9a43e329
+
+Conflicts:
+	framework/source/loadenv/loadenv.cxx
+	sc/source/filter/inc/orcusfiltersimpl.hxx
+	sc/source/filter/orcus/orcusfiltersimpl.cxx
+	sc/source/ui/inc/docsh.hxx
+	sfx2/inc/sfx2/docfilt.hxx
+	sfx2/inc/sfx2/objsh.hxx
+	sfx2/source/doc/docfile.cxx
+	sfx2/source/doc/docfilt.cxx
+---
+ sc/inc/orcusfilters.hxx                     |  4 +++
+ sc/source/filter/inc/orcusfiltersimpl.hxx   |  2 ++
+ sc/source/filter/orcus/orcusfiltersimpl.cxx | 42 +++++++++++++++++++++++++++++
+ 3 files changed, 48 insertions(+)
+
+diff --git a/sc/inc/orcusfilters.hxx b/sc/inc/orcusfilters.hxx
+index 22e9cc9..99c1b34 100644
+--- a/sc/inc/orcusfilters.hxx
++++ b/sc/inc/orcusfilters.hxx
+@@ -30,6 +30,10 @@ public:
+ 
+     virtual bool importGnumeric(ScDocument& rDoc, const rtl::OUString& rPath) const = 0;
+ 
++    virtual bool importXLSX(ScDocument& rDoc, const rtl::OUString& rPath) const = 0;
++
++    virtual bool importODS(ScDocument& rDoc, const rtl::OUString& rPath) const = 0;
++
+     /**
+      * Create a context for XML file.  The context object stores session
+      * information for each unique XML file.  You must create a new context
+diff --git a/sc/source/filter/inc/orcusfiltersimpl.hxx b/sc/source/filter/inc/orcusfiltersimpl.hxx
+index a97a50c..e54e4cb 100644
+--- a/sc/source/filter/inc/orcusfiltersimpl.hxx
++++ b/sc/source/filter/inc/orcusfiltersimpl.hxx
+@@ -22,6 +22,8 @@ public:
+ 
+     virtual bool importCSV(ScDocument& rDoc, const rtl::OUString& rPath) const;
+     virtual bool importGnumeric(ScDocument& rDoc, const rtl::OUString& rPath) const;
++    virtual bool importXLSX(ScDocument& rDoc, const rtl::OUString& rPath) const;
++    virtual bool importODS(ScDocument& rDoc, const rtl::OUString& rPath) const;
+ 
+     virtual ScOrcusXMLContext* createXMLContext(ScDocument& rDoc, const rtl::OUString& rPath) const;
+ };
+diff --git a/sc/source/filter/orcus/orcusfiltersimpl.cxx b/sc/source/filter/orcus/orcusfiltersimpl.cxx
+index ed33cc1..25b8267 100644
+--- a/sc/source/filter/orcus/orcusfiltersimpl.cxx
++++ b/sc/source/filter/orcus/orcusfiltersimpl.cxx
+@@ -17,6 +17,8 @@
+ #include <orcus/spreadsheet/import_interface.hpp>
+ #include <orcus/orcus_csv.hpp>
+ #include <orcus/orcus_gnumeric.hpp>
++#include <orcus/orcus_xlsx.hpp>
++#include <orcus/orcus_ods.hpp>
+ #include <orcus/global.hpp>
+ 
+ #ifdef WNT
+@@ -71,6 +73,46 @@ bool ScOrcusFiltersImpl::importGnumeric(ScDocument& rDoc, const OUString& rPath)
+     return true;
+ }
+ 
++bool ScOrcusFiltersImpl::importXLSX(ScDocument& rDoc, const rtl::OUString& rPath) const
++{
++    ScOrcusFactory aFactory(rDoc);
++    OString aSysPath = toSystemPath(rPath);
++    const char* path = aSysPath.getStr();
++
++    try
++    {
++        orcus::orcus_xlsx filter(&aFactory);
++        filter.read_file(path);
++    }
++    catch (const std::exception& e)
++    {
++        SAL_WARN("sc", "Unable to load xlsx file! " << e.what());
++        return false;
++    }
++
++    return true;
++}
++
++bool ScOrcusFiltersImpl::importODS(ScDocument& rDoc, const rtl::OUString& rPath) const
++{
++    ScOrcusFactory aFactory(rDoc);
++    OString aSysPath = toSystemPath(rPath);
++    const char* path = aSysPath.getStr();
++
++    try
++    {
++        orcus::orcus_ods filter(&aFactory);
++        filter.read_file(path);
++    }
++    catch (const std::exception& e)
++    {
++        SAL_WARN("sc", "Unable to load ods file! " << e.what());
++        return false;
++    }
++
++    return true;
++}
++
+ ScOrcusXMLContext* ScOrcusFiltersImpl::createXMLContext(ScDocument& rDoc, const rtl::OUString& rPath) const
+ {
+     return new ScOrcusXMLContextImpl(rDoc, rPath);
+-- 
+1.8.3.rc2
+
+
+From 20e36f8c360bd964f7a9b61fbe1292d1e29808bf Mon Sep 17 00:00:00 2001
+From: Kohei Yoshida <kohei.yoshida at gmail.com>
+Date: Tue, 9 Apr 2013 16:14:40 -0400
+Subject: [PATCH 4/9] Try not to crash during import of xlsx and ods documents.
+
+Also, let's not leak memory by returning a new'ed instance from get_styles().
+Orcus never manages the life cycle of objects returned from client code.
+
+Change-Id: Id92eb10dbe88c2a55b5d04e408a01fa9c25fa9a1
+---
+ sc/source/filter/inc/orcusinterface.hxx | 31 ++++++++++++++++---------------
+ sc/source/filter/orcus/interface.cxx    |  4 ++--
+ 2 files changed, 18 insertions(+), 17 deletions(-)
+
+diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx
+index 4bc9b40..0de1fcc 100644
+--- a/sc/source/filter/inc/orcusinterface.hxx
++++ b/sc/source/filter/inc/orcusinterface.hxx
+@@ -42,21 +42,6 @@ public:
+     const OUString& getByIndex(size_t index) const;
+ };
+ 
+-class ScOrcusFactory : public orcus::spreadsheet::iface::import_factory
+-{
+-    ScDocument& mrDoc;
+-    boost::ptr_vector<ScOrcusSheet> maSheets;
+-    ScOrcusSharedStrings maSharedStrings;
+-
+-public:
+-    ScOrcusFactory(ScDocument& rDoc);
+-
+-    virtual orcus::spreadsheet::iface::import_sheet* append_sheet(const char *sheet_name, size_t sheet_name_length);
+-    virtual orcus::spreadsheet::iface::import_sheet* get_sheet(const char *sheet_name, size_t sheet_name_length);
+-    virtual orcus::spreadsheet::iface::import_shared_strings* get_shared_strings();
+-    virtual orcus::spreadsheet::iface::import_styles* get_styles();
+-};
+-
+ class ScOrcusSheet : public orcus::spreadsheet::iface::import_sheet
+ {
+     ScDocument& mrDoc;
+@@ -165,5 +150,21 @@ public:
+     virtual size_t commit_cell_style();
+ };
+ 
++class ScOrcusFactory : public orcus::spreadsheet::iface::import_factory
++{
++    ScDocument& mrDoc;
++    boost::ptr_vector<ScOrcusSheet> maSheets;
++    ScOrcusSharedStrings maSharedStrings;
++    ScOrcusStyles maStyles;
++
++public:
++    ScOrcusFactory(ScDocument& rDoc);
++
++    virtual orcus::spreadsheet::iface::import_sheet* append_sheet(const char *sheet_name, size_t sheet_name_length);
++    virtual orcus::spreadsheet::iface::import_sheet* get_sheet(const char *sheet_name, size_t sheet_name_length);
++    virtual orcus::spreadsheet::iface::import_shared_strings* get_shared_strings();
++    virtual orcus::spreadsheet::iface::import_styles* get_styles();
++};
++
+ #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 5a7ab84..6e1391b 100644
+--- a/sc/source/filter/orcus/interface.cxx
++++ b/sc/source/filter/orcus/interface.cxx
+@@ -73,7 +73,7 @@ orcus::spreadsheet::iface::import_shared_strings* ScOrcusFactory::get_shared_str
+ orcus::spreadsheet::iface::import_styles* ScOrcusFactory::get_styles()
+ {
+     // We don't support it yet.
+-    return new ScOrcusStyles;
++    return &maStyles;
+ }
+ 
+ ScOrcusSheet::ScOrcusSheet(ScDocument& rDoc, SCTAB nTab, ScOrcusSharedStrings& rSharedStrings) :
+@@ -246,7 +246,7 @@ const OUString& ScOrcusSharedStrings::getByIndex(size_t nIndex) const
+     if(nIndex < maSharedStrings.size())
+         return maSharedStrings[nIndex];
+ 
+-    throw std::exception();
++    return EMPTY_OUSTRING;
+ }
+ 
+ void ScOrcusSharedStrings::set_segment_bold(bool /*b*/)
+-- 
+1.8.3.rc2
+
+
+From f3fb0bd26a8707fb5c5b6dd43ac23b726c11c434 Mon Sep 17 00:00:00 2001
+From: Kohei Yoshida <kohei.yoshida at gmail.com>
+Date: Tue, 9 Apr 2013 19:17:03 -0400
+Subject: [PATCH 5/9] Defer string cell import until the end when importing via
+ orcus.
+
+This is because orcus imports cells before it imports the string table.
+
+Change-Id: I1b85be2d9832b9a9a52961ece735de8cd980b893
+
+Conflicts:
+	sc/source/filter/orcus/interface.cxx
+---
+ sc/inc/document.hxx                     |  1 +
+ sc/source/core/data/document.cxx        |  6 +++
+ sc/source/filter/inc/orcusinterface.hxx | 28 +++++++++++---
+ sc/source/filter/orcus/interface.cxx    | 67 +++++++++++++++++++++------------
+ 4 files changed, 71 insertions(+), 31 deletions(-)
+
+diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
+index 31c5ac2..0b97341 100644
+--- a/sc/inc/document.hxx
++++ b/sc/inc/document.hxx
+@@ -750,6 +750,7 @@ public:
+     SC_DLLPUBLIC bool           SetString(
+         SCCOL nCol, SCROW nRow, SCTAB nTab, const rtl::OUString& rString,
+         ScSetStringParam* pParam = NULL );
++    SC_DLLPUBLIC bool SetString( const ScAddress& rPos, const OUString& rString, ScSetStringParam* pParam = NULL );
+     SC_DLLPUBLIC void           SetValue( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& rVal );
+     void            SetError( SCCOL nCol, SCROW nRow, SCTAB nTab, const sal_uInt16 nError);
+ 
+diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
+index 8cc1713..66af3d2 100644
+--- a/sc/source/core/data/document.cxx
++++ b/sc/source/core/data/document.cxx
+@@ -2940,6 +2940,12 @@ bool ScDocument::SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const rtl::OUStr
+         return false;
+ }
+ 
++bool ScDocument::SetString(
++    const ScAddress& rPos, const OUString& rString, ScSetStringParam* pParam )
++{
++    return SetString(rPos.Col(), rPos.Row(), rPos.Tab(), rString, pParam);
++}
++
+ 
+ void ScDocument::SetValue( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& rVal )
+ {
+diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx
+index 0de1fcc..313331c 100644
+--- a/sc/source/filter/inc/orcusinterface.hxx
++++ b/sc/source/filter/inc/orcusinterface.hxx
+@@ -21,13 +21,16 @@
+ 
+ class ScDocument;
+ class ScOrcusSheet;
++class ScOrcusFactory;
+ class ScRangeData;
+ 
+ class ScOrcusSharedStrings : public orcus::spreadsheet::iface::import_shared_strings
+ {
+-    std::vector<OUString> maSharedStrings;
++    std::vector<OUString>& mrStrings;
+ 
+ public:
++    ScOrcusSharedStrings(std::vector<OUString>& rStrings);
++
+     virtual size_t append(const char* s, size_t n);
+     virtual size_t add(const char* s, size_t n);
+ 
+@@ -38,20 +41,18 @@ public:
+     virtual void append_segment(const char* s, size_t n);
+ 
+     virtual size_t commit_segments();
+-
+-    const OUString& getByIndex(size_t index) const;
+ };
+ 
+ class ScOrcusSheet : public orcus::spreadsheet::iface::import_sheet
+ {
+     ScDocument& mrDoc;
+     SCTAB mnTab;
+-    ScOrcusSharedStrings& mrSharedStrings;
++    ScOrcusFactory& mrFactory;
+ 
+     typedef std::map<size_t, ScRangeData*> SharedFormulaContainer;
+     SharedFormulaContainer maSharedFormulas;
+ public:
+-    ScOrcusSheet(ScDocument& rDoc, SCTAB nTab, ScOrcusSharedStrings& rSharedStrings);
++    ScOrcusSheet(ScDocument& rDoc, SCTAB nTab, ScOrcusFactory& rFactory);
+ 
+     // Orcus import interface
+     virtual void set_auto(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, const char* p, size_t n);
+@@ -152,9 +153,21 @@ public:
+ 
+ class ScOrcusFactory : public orcus::spreadsheet::iface::import_factory
+ {
++    struct StringCellCache
++    {
++        ScAddress maPos;
++        size_t mnIndex;
++
++        StringCellCache(const ScAddress& rPos, size_t nIndex);
++    };
++
++    typedef std::vector<StringCellCache> StringCellCaches;
++
+     ScDocument& mrDoc;
+-    boost::ptr_vector<ScOrcusSheet> maSheets;
++    std::vector<OUString> maStrings;
++    StringCellCaches maStringCells;
+     ScOrcusSharedStrings maSharedStrings;
++    boost::ptr_vector<ScOrcusSheet> maSheets;
+     ScOrcusStyles maStyles;
+ 
+ public:
+@@ -164,6 +177,9 @@ public:
+     virtual orcus::spreadsheet::iface::import_sheet* get_sheet(const char *sheet_name, size_t sheet_name_length);
+     virtual orcus::spreadsheet::iface::import_shared_strings* get_shared_strings();
+     virtual orcus::spreadsheet::iface::import_styles* get_styles();
++    virtual void finalize();
++
++    void pushStringCell(const ScAddress& rPos, size_t nStrIndex);
+ };
+ 
+ #endif
+diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
+index 6e1391b..d46c1f7 100644
+--- a/sc/source/filter/orcus/interface.cxx
++++ b/sc/source/filter/orcus/interface.cxx
+@@ -13,14 +13,18 @@
+ #include "cell.hxx"
+ #include "rangenam.hxx"
+ #include "tokenarray.hxx"
+-#include <formula/token.hxx>
++#include "stringutil.hxx"
+ 
++#include <formula/token.hxx>
+ 
+ using orcus::spreadsheet::row_t;
+ using orcus::spreadsheet::col_t;
+ using orcus::spreadsheet::formula_grammar_t;
+ 
+-ScOrcusFactory::ScOrcusFactory(ScDocument& rDoc) : mrDoc(rDoc) {}
++ScOrcusFactory::StringCellCache::StringCellCache(const ScAddress& rPos, size_t nIndex) :
++    maPos(rPos), mnIndex(nIndex) {}
++
++ScOrcusFactory::ScOrcusFactory(ScDocument& rDoc) : mrDoc(rDoc), maSharedStrings(maStrings) {}
+ 
+ orcus::spreadsheet::iface::import_sheet* ScOrcusFactory::append_sheet(const char* sheet_name, size_t sheet_name_length)
+ {
+@@ -29,7 +33,7 @@ orcus::spreadsheet::iface::import_sheet* ScOrcusFactory::append_sheet(const char
+         return NULL;
+ 
+     SCTAB nTab = mrDoc.GetTableCount() - 1;
+-    maSheets.push_back(new ScOrcusSheet(mrDoc, nTab, maSharedStrings));
++    maSheets.push_back(new ScOrcusSheet(mrDoc, nTab, *this));
+     return &maSheets.back();
+ }
+ 
+@@ -61,7 +65,7 @@ orcus::spreadsheet::iface::import_sheet* ScOrcusFactory::get_sheet(const char* s
+         return &(*it);
+ 
+     // Create a new orcus sheet instance for this.
+-    maSheets.push_back(new ScOrcusSheet(mrDoc, nTab, maSharedStrings));
++    maSheets.push_back(new ScOrcusSheet(mrDoc, nTab, *this));
+     return &maSheets.back();
+ }
+ 
+@@ -76,8 +80,28 @@ orcus::spreadsheet::iface::import_styles* ScOrcusFactory::get_styles()
+     return &maStyles;
+ }
+ 
+-ScOrcusSheet::ScOrcusSheet(ScDocument& rDoc, SCTAB nTab, ScOrcusSharedStrings& rSharedStrings) :
+-    mrDoc(rDoc), mnTab(nTab), mrSharedStrings(rSharedStrings) {}
++void ScOrcusFactory::finalize()
++{
++    ScSetStringParam aParam;
++    aParam.setTextInput();
++    StringCellCaches::const_iterator it = maStringCells.begin(), itEnd = maStringCells.end();
++    for (; it != itEnd; ++it)
++    {
++        if (it->mnIndex >= maStrings.size())
++            // String index out-of-bound!  Something is up.
++            continue;
++
++        mrDoc.SetString(it->maPos, maStrings[it->mnIndex], &aParam);
++    }
++}
++
++void ScOrcusFactory::pushStringCell(const ScAddress& rPos, size_t nStrIndex)
++{
++    maStringCells.push_back(StringCellCache(rPos, nStrIndex));
++}
++
++ScOrcusSheet::ScOrcusSheet(ScDocument& rDoc, SCTAB nTab, ScOrcusFactory& rFactory) :
++    mrDoc(rDoc), mnTab(nTab), mrFactory(rFactory) {}
+ 
+ void ScOrcusSheet::set_auto(row_t row, col_t col, const char* p, size_t n)
+ {
+@@ -205,14 +229,12 @@ void ScOrcusSheet::set_array_formula(
+ 
+ void ScOrcusSheet::set_string(row_t row, col_t col, size_t sindex)
+ {
+-    // Calc does not yet support shared strings so we have to
+-    // workaround by importing shared strings into a temporary
+-    // shared string container and writing into calc model as
+-    // normal string
++    // We need to defer string cells since the shared string pool is not yet
++    // populated at the time this method is called.  Orcus imports string
++    // table after the cells get imported.  We won't need to do this once we
++    // implement true shared strings in Calc core.
+ 
+-    const OUString& rSharedString = mrSharedStrings.getByIndex(sindex);
+-    ScBaseCell* pCell = ScBaseCell::CreateTextCell( rSharedString, &mrDoc );
+-    mrDoc.PutCell(col, row, mnTab, pCell);
++    mrFactory.pushStringCell(ScAddress(col, row, mnTab), sindex);
+ }
+ 
+ void ScOrcusSheet::set_value(row_t row, col_t col, double value)
+@@ -225,28 +247,23 @@ void ScOrcusSheet::set_bool(row_t row, col_t col, bool value)
+     mrDoc.SetValue(col, row, mnTab, value ? 1.0 : 0.0);
+ }
+ 
++ScOrcusSharedStrings::ScOrcusSharedStrings(std::vector<OUString>& rStrings) :
++    mrStrings(rStrings) {}
++
+ size_t ScOrcusSharedStrings::append(const char* s, size_t n)
+ {
+     OUString aNewString(s, n, RTL_TEXTENCODING_UTF8);
+-    maSharedStrings.push_back(aNewString);
++    mrStrings.push_back(aNewString);
+ 
+-    return maSharedStrings.size() - 1;
++    return mrStrings.size() - 1;
+ }
+ 
+ size_t ScOrcusSharedStrings::add(const char* s, size_t n)
+ {
+     OUString aNewString(s, n, RTL_TEXTENCODING_UTF8);
+-    maSharedStrings.push_back(aNewString);
+-
+-    return maSharedStrings.size() - 1;
+-}
+-
+-const OUString& ScOrcusSharedStrings::getByIndex(size_t nIndex) const
+-{
+-    if(nIndex < maSharedStrings.size())
+-        return maSharedStrings[nIndex];
++    mrStrings.push_back(aNewString);
+ 
+-    return EMPTY_OUSTRING;
++    return mrStrings.size() - 1;
+ }
+ 
+ void ScOrcusSharedStrings::set_segment_bold(bool /*b*/)
+-- 
+1.8.3.rc2
+
+
+From 0f543ee074f046f3ca0765079a158a11b1391499 Mon Sep 17 00:00:00 2001
+From: Kohei Yoshida <kohei.yoshida at gmail.com>
+Date: Wed, 20 Mar 2013 10:16:10 -0400
+Subject: [PATCH 6/9] Add convenience methods to set maximum text input and
+ numeric input modes.
+
+And remove one use of ScDocument::PutCell().
+
+Change-Id: Iaa3c115794894964cb7c9f809235cdb7669be094
+
+Conflicts:
+	sc/inc/stringutil.hxx
+	sc/source/core/data/dbdocutl.cxx
+	sc/source/core/data/document.cxx
+	sc/source/filter/dif/difimp.cxx
+	sc/source/filter/excel/xihelper.cxx
+	sc/source/filter/xml/xmlcelli.cxx
+---
+ sc/inc/stringutil.hxx              | 22 ++++++++++++++++------
+ sc/source/core/tool/stringutil.cxx | 14 ++++++++++++++
+ 2 files changed, 30 insertions(+), 6 deletions(-)
+
+diff --git a/sc/inc/stringutil.hxx b/sc/inc/stringutil.hxx
+index 48c94f5..f3dcf59 100644
+--- a/sc/inc/stringutil.hxx
++++ b/sc/inc/stringutil.hxx
+@@ -72,16 +72,26 @@ struct SC_DLLPUBLIC ScSetStringParam
+     TextFormatPolicy meSetTextNumFormat;
+ 
+     /**
+-     * When true, treat input with a leading apostrophe / single quote special
+-     * in that it escapes numeric or date/time input such that it is not
+-     * interpreted and the input string is taken instead. This can be used
+-     * during text file import so the leading apostrophe is not lost if it
+-     * precedes a numeric value.
+-     * Usually set mbHandleApostrophe = !mbSetTextCellFormat
++     * When true, treat input with a leading apostrophe as an escape character
++     * for a numeric value content, to treat the numeric value as a text. When
++     * false, the whole string input including the leading apostrophe will be
++     * entered literally as string.
+      */
+     bool mbHandleApostrophe;
+ 
+     ScSetStringParam();
++
++    /**
++     * Call this whenever you need to unconditionally set input as text, no
++     * matter what the input is.
++     */
++    void setTextInput();
++
++    /**
++     * Call this whenever you need to maximize the chance of input being
++     * detected as a numeric value (numbers, dates, times etc).
++     */
++    void setNumericInput();
+ };
+ 
+ // ============================================================================
+diff --git a/sc/source/core/tool/stringutil.cxx b/sc/source/core/tool/stringutil.cxx
+index 62e4804..2e65416 100644
+--- a/sc/source/core/tool/stringutil.cxx
++++ b/sc/source/core/tool/stringutil.cxx
+@@ -32,6 +32,20 @@ ScSetStringParam::ScSetStringParam() :
+ {
+ }
+ 
++void ScSetStringParam::setTextInput()
++{
++    mbDetectNumberFormat = false;
++    mbHandleApostrophe = false;
++    meSetTextNumFormat = Always;
++}
++
++void ScSetStringParam::setNumericInput()
++{
++    mbDetectNumberFormat = true;
++    mbHandleApostrophe = true;
++    meSetTextNumFormat = Never;
++}
++
+ // ============================================================================-
+ 
+ bool ScStringUtil::parseSimpleNumber(
+-- 
+1.8.3.rc2
+
+
+From 165d7c63887217a244d6f7928f8a362dd9631a03 Mon Sep 17 00:00:00 2001
+From: Kohei Yoshida <kohei.yoshida at gmail.com>
+Date: Tue, 9 Apr 2013 22:36:58 -0400
+Subject: [PATCH 7/9] Implement set_date() interface method.
+
+It'll simply call set_auto() for now.
+
+Change-Id: I580b2ecbd34ffe7674f64ade912877ef07a60aca
+
+Conflicts:
+	sc/source/filter/orcus/interface.cxx
+---
+ sc/source/filter/inc/orcusinterface.hxx |  9 ++++---
+ sc/source/filter/orcus/interface.cxx    | 45 ++++++++++++++++++---------------
+ 2 files changed, 30 insertions(+), 24 deletions(-)
+
+diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx
+index 313331c..3604da5 100644
+--- a/sc/source/filter/inc/orcusinterface.hxx
++++ b/sc/source/filter/inc/orcusinterface.hxx
+@@ -56,6 +56,11 @@ public:
+ 
+     // Orcus import interface
+     virtual void set_auto(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, const char* p, size_t n);
++    virtual void set_string(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, size_t sindex);
++    virtual void set_value(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, double value);
++    virtual void set_bool(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, bool value);
++    virtual void set_date(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, const char* p, size_t n);
++
+     virtual void set_format(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, size_t xf_index);
+ 
+     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);
+@@ -79,10 +84,6 @@ public:
+         orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, orcus::spreadsheet::formula_grammar_t grammar,
+         const char* p, size_t n, const char* p_range, size_t n_range);
+ 
+-    virtual void set_string(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, size_t sindex);
+-    virtual void set_value(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, double value);
+-    virtual void set_bool(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, bool value);
+-
+     SCTAB getIndex() const { return mnTab; }
+ };
+ 
+diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
+index d46c1f7..2f8b097 100644
+--- a/sc/source/filter/orcus/interface.cxx
++++ b/sc/source/filter/orcus/interface.cxx
+@@ -109,6 +109,31 @@ void ScOrcusSheet::set_auto(row_t row, col_t col, const char* p, size_t n)
+     mrDoc.SetString(col, row, mnTab, aVal);
+ }
+ 
++void ScOrcusSheet::set_string(row_t row, col_t col, size_t sindex)
++{
++    // We need to defer string cells since the shared string pool is not yet
++    // populated at the time this method is called.  Orcus imports string
++    // table after the cells get imported.  We won't need to do this once we
++    // implement true shared strings in Calc core.
++
++    mrFactory.pushStringCell(ScAddress(col, row, mnTab), sindex);
++}
++
++void ScOrcusSheet::set_value(row_t row, col_t col, double value)
++{
++    mrDoc.SetValue( col, row, mnTab, value );
++}
++
++void ScOrcusSheet::set_bool(row_t row, col_t col, bool value)
++{
++    mrDoc.SetValue(col, row, mnTab, value ? 1.0 : 0.0);
++}
++
++void ScOrcusSheet::set_date(row_t row, col_t col, const char* p, size_t n)
++{
++    set_auto(row, col, p, n);
++}
++
+ void ScOrcusSheet::set_format(row_t /*row*/, col_t /*col*/, size_t /*xf_index*/)
+ {
+ }
+@@ -227,26 +252,6 @@ void ScOrcusSheet::set_array_formula(
+ {
+ }
+ 
+-void ScOrcusSheet::set_string(row_t row, col_t col, size_t sindex)
+-{
+-    // We need to defer string cells since the shared string pool is not yet
+-    // populated at the time this method is called.  Orcus imports string
+-    // table after the cells get imported.  We won't need to do this once we
+-    // implement true shared strings in Calc core.
+-
+-    mrFactory.pushStringCell(ScAddress(col, row, mnTab), sindex);
+-}
+-
+-void ScOrcusSheet::set_value(row_t row, col_t col, double value)
+-{
+-    mrDoc.SetValue( col, row, mnTab, value );
+-}
+-
+-void ScOrcusSheet::set_bool(row_t row, col_t col, bool value)
+-{
+-    mrDoc.SetValue(col, row, mnTab, value ? 1.0 : 0.0);
+-}
+-
+ ScOrcusSharedStrings::ScOrcusSharedStrings(std::vector<OUString>& rStrings) :
+     mrStrings(rStrings) {}
+ 
+-- 
+1.8.3.rc2
+
+
+From ce2bae5773fa82dee81d0c41fd7b1ad0eb792b98 Mon Sep 17 00:00:00 2001
+From: Kohei Yoshida <kohei.yoshida at gmail.com>
+Date: Wed, 10 Apr 2013 15:03:12 -0400
+Subject: [PATCH 8/9] Properly implement date / time value import from orcus.
+
+Change-Id: Icaf310182dcdd2a5d06c2d4bcbb98e3850fb2d80
+---
+ sc/source/filter/inc/orcusinterface.hxx |  3 ++-
+ sc/source/filter/orcus/interface.cxx    | 27 ++++++++++++++++++++++++---
+ 2 files changed, 26 insertions(+), 4 deletions(-)
+
+diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx
+index 3604da5..acdd450 100644
+--- a/sc/source/filter/inc/orcusinterface.hxx
++++ b/sc/source/filter/inc/orcusinterface.hxx
+@@ -59,7 +59,8 @@ public:
+     virtual void set_string(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, size_t sindex);
+     virtual void set_value(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, double value);
+     virtual void set_bool(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, bool value);
+-    virtual void set_date(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, const char* p, size_t n);
++    virtual void set_date_time(
++        orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, int year, int month, int day, int hour, int minute, double second);
+ 
+     virtual void set_format(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, size_t xf_index);
+ 
+diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
+index 2f8b097..d5a673b 100644
+--- a/sc/source/filter/orcus/interface.cxx
++++ b/sc/source/filter/orcus/interface.cxx
+@@ -15,7 +15,10 @@
+ #include "tokenarray.hxx"
+ #include "stringutil.hxx"
+ 
+-#include <formula/token.hxx>
++#include "formula/token.hxx"
++#include "tools/datetime.hxx"
++
++#define D_TIMEFACTOR              86400.0
+ 
+ using orcus::spreadsheet::row_t;
+ using orcus::spreadsheet::col_t;
+@@ -129,9 +132,27 @@ void ScOrcusSheet::set_bool(row_t row, col_t col, bool value)
+     mrDoc.SetValue(col, row, mnTab, value ? 1.0 : 0.0);
+ }
+ 
+-void ScOrcusSheet::set_date(row_t row, col_t col, const char* p, size_t n)
++void ScOrcusSheet::set_date_time(
++    row_t row, col_t col, int year, int month, int day, int hour, int minute, double second)
+ {
+-    set_auto(row, col, p, n);
++    SvNumberFormatter* pFormatter = mrDoc.GetFormatTable();
++
++    Date aDate(day, month, year);
++    sal_uIntPtr nSec = floor(second);
++    sal_uIntPtr nSec100 = (second - nSec) * 100;
++    Time aTime(hour, minute, nSec, nSec100);
++    Date aNullDate(*pFormatter->GetNullDate());
++    long nDateDiff = aDate - aNullDate;
++
++    double fTime =
++        static_cast<double>(aTime.Get100Sec()) / 100.0 +
++        aTime.GetSec() +
++        aTime.GetMin() * 60.0 +
++        aTime.GetHour() * 3600.0;
++
++    fTime /= D_TIMEFACTOR;
++
++    mrDoc.SetValue(col, row, mnTab, nDateDiff + fTime);
+ }
+ 
+ void ScOrcusSheet::set_format(row_t /*row*/, col_t /*col*/, size_t /*xf_index*/)
+-- 
+1.8.3.rc2
+
+
+From 60e741a076e343656ff6edc6b87fe8bb1a77d700 Mon Sep 17 00:00:00 2001
+From: Kohei Yoshida <kohei.yoshida at gmail.com>
+Date: Wed, 10 Apr 2013 21:04:38 -0400
+Subject: [PATCH 9/9] Import null date via orcus.
+
+Change-Id: Ifa50e460768ffff4b1096d795ab694fea62a6c29
+
+Conflicts:
+	sc/source/filter/orcus/interface.cxx
+---
+ sc/source/filter/inc/orcusinterface.hxx | 12 ++++++++++++
+ sc/source/filter/orcus/interface.cxx    | 20 +++++++++++++++++++-
+ 2 files changed, 31 insertions(+), 1 deletion(-)
+
+diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx
+index acdd450..d6363d8 100644
+--- a/sc/source/filter/inc/orcusinterface.hxx
++++ b/sc/source/filter/inc/orcusinterface.hxx
+@@ -24,6 +24,16 @@ class ScOrcusSheet;
+ class ScOrcusFactory;
+ class ScRangeData;
+ 
++class ScOrcusGlobalSettings : public orcus::spreadsheet::iface::import_global_settings
++{
++    ScDocument& mrDoc;
++
++public:
++    ScOrcusGlobalSettings(ScDocument& rDoc);
++
++    virtual void set_origin_date(int year, int month, int day);
++};
++
+ class ScOrcusSharedStrings : public orcus::spreadsheet::iface::import_shared_strings
+ {
+     std::vector<OUString>& mrStrings;
+@@ -168,6 +178,7 @@ class ScOrcusFactory : public orcus::spreadsheet::iface::import_factory
+     ScDocument& mrDoc;
+     std::vector<OUString> maStrings;
+     StringCellCaches maStringCells;
++    ScOrcusGlobalSettings maGlobalSettings;
+     ScOrcusSharedStrings maSharedStrings;
+     boost::ptr_vector<ScOrcusSheet> maSheets;
+     ScOrcusStyles maStyles;
+@@ -177,6 +188,7 @@ public:
+ 
+     virtual orcus::spreadsheet::iface::import_sheet* append_sheet(const char *sheet_name, size_t sheet_name_length);
+     virtual orcus::spreadsheet::iface::import_sheet* get_sheet(const char *sheet_name, size_t sheet_name_length);
++    virtual orcus::spreadsheet::iface::import_global_settings* get_global_settings();
+     virtual orcus::spreadsheet::iface::import_shared_strings* get_shared_strings();
+     virtual orcus::spreadsheet::iface::import_styles* get_styles();
+     virtual void finalize();
+diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
+index d5a673b..0acc22e 100644
+--- a/sc/source/filter/orcus/interface.cxx
++++ b/sc/source/filter/orcus/interface.cxx
+@@ -14,6 +14,7 @@
+ #include "rangenam.hxx"
+ #include "tokenarray.hxx"
+ #include "stringutil.hxx"
++#include "docoptio.hxx"
+ 
+ #include "formula/token.hxx"
+ #include "tools/datetime.hxx"
+@@ -24,10 +25,22 @@ using orcus::spreadsheet::row_t;
+ using orcus::spreadsheet::col_t;
+ using orcus::spreadsheet::formula_grammar_t;
+ 
++ScOrcusGlobalSettings::ScOrcusGlobalSettings(ScDocument& rDoc) : mrDoc(rDoc) {}
++
++void ScOrcusGlobalSettings::set_origin_date(int year, int month, int day)
++{
++    ScDocOptions aOpt = mrDoc.GetDocOptions();
++    aOpt.SetDate(year, month, day);
++    mrDoc.SetDocOptions(aOpt);
++}
++
+ ScOrcusFactory::StringCellCache::StringCellCache(const ScAddress& rPos, size_t nIndex) :
+     maPos(rPos), mnIndex(nIndex) {}
+ 
+-ScOrcusFactory::ScOrcusFactory(ScDocument& rDoc) : mrDoc(rDoc), maSharedStrings(maStrings) {}
++ScOrcusFactory::ScOrcusFactory(ScDocument& rDoc) :
++    mrDoc(rDoc),
++    maGlobalSettings(mrDoc),
++    maSharedStrings(maStrings) {}
+ 
+ orcus::spreadsheet::iface::import_sheet* ScOrcusFactory::append_sheet(const char* sheet_name, size_t sheet_name_length)
+ {
+@@ -72,6 +85,11 @@ orcus::spreadsheet::iface::import_sheet* ScOrcusFactory::get_sheet(const char* s
+     return &maSheets.back();
+ }
+ 
++orcus::spreadsheet::iface::import_global_settings* ScOrcusFactory::get_global_settings()
++{
++    return &maGlobalSettings;
++}
++
+ orcus::spreadsheet::iface::import_shared_strings* ScOrcusFactory::get_shared_strings()
+ {
+     return &maSharedStrings;
+-- 
+1.8.3.rc2
+
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/libreoffice.git/commitdiff/eea44993b0c0179deb87999a47d23839b3220d91




More information about the pld-cvs-commit mailing list