[Libreoffice-commits] .: 21 commits - boost/Module_boost.mk boost/Package_boostthread.mk boost/prj boost/StaticLibrary_boostthread.mk comphelper/inc comphelper/source config_host.mk.in configure.in framework/source liborcus/makefile.mk liborcus/prj Makefile.top ooo.lst.in RepositoryExternal.mk sc/CppunitTest_sc_ucalc.mk sc/inc sc/Library_scfilt.mk scp2/source sc/prj sc/source sfx2/inc sfx2/source tail_build/prj

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Sep 7 06:11:28 PDT 2012


 Makefile.top                                  |    1 
 RepositoryExternal.mk                         |   33 +
 boost/Module_boost.mk                         |   12 
 boost/Package_boostthread.mk                  |   14 
 boost/StaticLibrary_boostthread.mk            |   24 +
 boost/prj/d.lst                               |    1 
 comphelper/inc/comphelper/mediadescriptor.hxx |    1 
 comphelper/source/misc/mediadescriptor.cxx    |    6 
 config_host.mk.in                             |    3 
 configure.in                                  |   34 +
 framework/source/loadenv/loadenv.cxx          |   58 ++
 liborcus/makefile.mk                          |   69 +++
 liborcus/prj/build.lst                        |    3 
 liborcus/prj/d.lst                            |   10 
 ooo.lst.in                                    |    1 
 sc/CppunitTest_sc_ucalc.mk                    |    4 
 sc/Library_scfilt.mk                          |    5 
 sc/inc/filter.hxx                             |    3 
 sc/inc/orcus/README                           |    7 
 sc/inc/orcus/css_parser.hpp                   |  525 --------------------------
 sc/inc/orcus/csv_parser.hpp                   |  387 -------------------
 sc/inc/orcusfilters.hxx                       |   28 +
 sc/prj/build.lst                              |    2 
 sc/source/filter/ftools/ftools.cxx            |    8 
 sc/source/filter/inc/ftools.hxx               |    9 
 sc/source/filter/inc/orcusfiltersimpl.hxx     |   23 +
 sc/source/filter/orcus/orcusfiltersimpl.cxx   |  162 ++++++++
 sc/source/ui/docshell/docsh.cxx               |   20 
 sc/source/ui/docshell/impex.cxx               |    2 
 sc/source/ui/inc/docsh.hxx                    |    1 
 scp2/source/ooo/file_library_ooo.scp          |    1 
 sfx2/inc/sfx2/objsh.hxx                       |    2 
 sfx2/source/doc/objstor.cxx                   |   12 
 sfx2/source/doc/sfxbasemodel.cxx              |   31 +
 sfx2/source/view/frmload.cxx                  |   16 
 tail_build/prj/build.lst                      |    2 
 36 files changed, 572 insertions(+), 948 deletions(-)

New commits:
commit c50de9b0fc803a979d6cb6987999740fa36be3d6
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri Sep 7 00:27:08 2012 -0400

    I forgot this.
    
    Change-Id: Idabfb29b653982008bb5d4159458894f53cbf6f4

diff --git a/configure.in b/configure.in
index e0544a1..2fb4b35 100644
--- a/configure.in
+++ b/configure.in
@@ -8610,6 +8610,7 @@ else
     SYSTEM_LIBORCUS=NO
 fi
 AC_SUBST(SYSTEM_LIBORCUS)
+AC_SUBST(ORCUS_TARBALL)
 AC_SUBST(LIBORCUS_CFLAGS)
 AC_SUBST(LIBORCUS_LIBS)
 
commit 03094f1edbb519f803952fa7b4a63efb412594b6
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri Sep 7 00:22:17 2012 -0400

    Set orcus package tarball location for download.
    
    Change-Id: Iccdb2e53ad6a62d3ee96d368b897d47ee77fdc12

diff --git a/configure.in b/configure.in
index 4e37bcd..e0544a1 100644
--- a/configure.in
+++ b/configure.in
@@ -8605,6 +8605,7 @@ if test "$with_system_orcus" = "yes"; then
     PKG_CHECK_MODULES(ORCUS, orcus >= 0.1.0)
 else
     AC_MSG_RESULT([internal])
+    ORCUS_TARBALL=46d9f4cf8b145c21ce1056e116d2ce71-liborcus_0.1.0.tar.bz2
     BUILD_TYPE="$BUILD_TYPE LIBORCUS"
     SYSTEM_LIBORCUS=NO
 fi
diff --git a/ooo.lst.in b/ooo.lst.in
index 367b829..416968e 100644
--- a/ooo.lst.in
+++ b/ooo.lst.in
@@ -99,6 +99,7 @@ fa6a2f85bd28baab035b2c95e722713f-liblangtag-0.2.tar.bz2
 @GOOGLE_DOCS_EXTENSION_PACK@
 @FREETYPE_TARBALL@
 @FONTCONFIG_TARBALL@
+ at ORCUS_TARBALL@
 http://dev-www.libreoffice.org/extern
 185d60944ea767075d27247c3162b3bc-unowinreg.dll
 http://ooo.itc.hu/oxygenoffice/download/libreoffice/
commit 0e9ac8852948da47a67077bdaabc9f3c8172f14b
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri Sep 7 00:06:12 2012 -0400

    Final 0.1.0 package md5sum.
    
    Change-Id: I6738fd748817dfb2441c580ea2928b81a77d7aed

diff --git a/liborcus/makefile.mk b/liborcus/makefile.mk
index de34e64..b108fce 100644
--- a/liborcus/makefile.mk
+++ b/liborcus/makefile.mk
@@ -33,7 +33,7 @@ TARGET=orcus
 .ENDIF
 
 TARFILE_NAME=liborcus_0.1.0
-TARFILE_MD5=aa346e934019d412ea6905563225f3cb
+TARFILE_MD5=46d9f4cf8b145c21ce1056e116d2ce71
 
 PATCH_FILES=
 
commit 8a0d4ff715738f30a368f58e787d8932dfeb6f29
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Thu Sep 6 22:21:12 2012 -0400

    Disable the experimental orcus-based csv filter for now.
    
    Change-Id: Iba8b36aaa19bbf2a9cb632fb6fe586b27ae27a7a

diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx
index a4c042a..1b6c35a 100644
--- a/framework/source/loadenv/loadenv.cxx
+++ b/framework/source/loadenv/loadenv.cxx
@@ -718,6 +718,13 @@ LoadEnv::EContentType LoadEnv::classifyContent(const ::rtl::OUString&
 
 namespace {
 
+#if 1
+bool queryOrcusTypeAndFilter(const uno::Sequence<beans::PropertyValue>&, OUString&, OUString&)
+{
+    return false;
+}
+#else
+// TODO: We will reinstate this function later, so don't remove this!
 bool queryOrcusTypeAndFilter(const uno::Sequence<beans::PropertyValue>& rDescriptor, OUString& rType, OUString& rFilter)
 {
     OUString aURL;
@@ -745,6 +752,7 @@ bool queryOrcusTypeAndFilter(const uno::Sequence<beans::PropertyValue>& rDescrip
 
     return false;
 }
+#endif
 
 }
 
commit 0e895a59fc78332e8a2c2912e51d9a9f7812f513
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Thu Sep 6 19:56:41 2012 -0400

    Fix the windows build again, with new package.
    
    Change-Id: I4c2a480cc4a818c0b7ac5f0ad71826327d661eac

diff --git a/liborcus/makefile.mk b/liborcus/makefile.mk
index 763b6ce..de34e64 100644
--- a/liborcus/makefile.mk
+++ b/liborcus/makefile.mk
@@ -33,14 +33,16 @@ TARGET=orcus
 .ENDIF
 
 TARFILE_NAME=liborcus_0.1.0
-TARFILE_MD5=13febcdd79ad25280f199a36b792c5f9
+TARFILE_MD5=aa346e934019d412ea6905563225f3cb
 
 PATCH_FILES=
 
 .IF "$(GUI)$(COM)"=="WNTMSC"
 
 BUILD_DIR=vsprojects/liborcus-static-nozip
-BUILD_ACTION=export BOOST_INCLUDE_DIR=$(OUTDIR)/inc && \
+BUILD_ACTION= \
+	export BOOST_INCLUDE_DIR=$(OUTDIR)/inc/external && \
+	export BOOST_LIB_DIR=$(OUTDIR)/lib && \
 	$(COMPATH)$/vcpackages$/vcbuild.exe liborcus-static-nozip.vcproj "Release|Win32"
 
 .ELSE
commit 0454b737d3cb33f47d2aef899ee1d22a2bf60412
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Thu Sep 6 15:10:19 2012 -0400

    Make boostthread windows only for now.
    
    Not sure if unix needs it since most folks build with system boost
    there.
    
    Change-Id: I49d02a682e6658f6e3c5a6ada480903567d8c436

diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 9aa0188..c99e4ea 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -326,8 +326,13 @@ else # !SYSTEM_BOOST
 
 $(eval $(call gb_Helper_register_static_libraries,PLAINLIBS, \
 	boostdatetime \
+))
+
+ifeq ($(OS),WNT)
+$(eval $(call gb_Helper_register_static_libraries,PLAINLIBS, \
 	boostthread \
 ))
+endif
 
 define gb_LinkTarget__use_boostdatetime
 $(call gb_LinkTarget_use_static_libraries,$(1),\
diff --git a/boost/Module_boost.mk b/boost/Module_boost.mk
index cca44ea..bb51163 100644
--- a/boost/Module_boost.mk
+++ b/boost/Module_boost.mk
@@ -13,7 +13,15 @@ ifeq ($(SYSTEM_BOOST),NO)
 
 $(eval $(call gb_Module_add_targets,boost,\
 	StaticLibrary_boostdatetime \
+))
+
+ifeq ($(OS),WNT)
+$(eval $(call gb_Module_add_targets,boost,\
 	StaticLibrary_boostthread \
+))
+endif
+
+$(eval $(call gb_Module_add_targets,boost,\
 	UnpackedTarball_boost \
 ))
 
@@ -24,6 +32,6 @@ $(eval $(call gb_Module_add_targets,boost,\
 ))
 endif
 
-endif
+endif # SYSTEM_BOOST
 
 # vim: set noet sw=4 ts=4:
commit af4630416a33659e9d1257cea27cdae1b9a354d9
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Thu Sep 6 13:57:22 2012 -0400

    Resurrect boost thread lib.  Orcus needs it.
    
    Change-Id: Iadb4a223e4db523b50ee85b9079a7a4ba5971fd0

diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 66b3480..9aa0188 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -326,6 +326,7 @@ else # !SYSTEM_BOOST
 
 $(eval $(call gb_Helper_register_static_libraries,PLAINLIBS, \
 	boostdatetime \
+	boostthread \
 ))
 
 define gb_LinkTarget__use_boostdatetime
diff --git a/boost/Module_boost.mk b/boost/Module_boost.mk
index 0dda414..cca44ea 100644
--- a/boost/Module_boost.mk
+++ b/boost/Module_boost.mk
@@ -13,12 +13,14 @@ ifeq ($(SYSTEM_BOOST),NO)
 
 $(eval $(call gb_Module_add_targets,boost,\
 	StaticLibrary_boostdatetime \
+	StaticLibrary_boostthread \
 	UnpackedTarball_boost \
 ))
 
 ifeq ($(OS),WNT)
 $(eval $(call gb_Module_add_targets,boost,\
 	Package_boostdatetime \
+	Package_boostthread \
 ))
 endif
 
diff --git a/boost/Package_boostthread.mk b/boost/Package_boostthread.mk
new file mode 100644
index 0000000..e79c39a
--- /dev/null
+++ b/boost/Package_boostthread.mk
@@ -0,0 +1,14 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Package_Package,boostthread,$(gb_StaticLibrary_OUTDIRLOCATION)))
+
+$(eval $(call gb_Package_add_file,boostthread,lib/libboost_thread-vc90-mt-1_44.lib,$(notdir $(call gb_StaticLibrary_get_target,boostthread))))
+
+# vim: set noet sw=4 ts=4:
diff --git a/boost/StaticLibrary_boostthread.mk b/boost/StaticLibrary_boostthread.mk
new file mode 100644
index 0000000..1b4c8fe
--- /dev/null
+++ b/boost/StaticLibrary_boostthread.mk
@@ -0,0 +1,24 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_StaticLibrary_StaticLibrary,boostthread))
+
+$(eval $(call gb_StaticLibrary_set_warnings_not_errors,boostthread))
+	
+$(eval $(call gb_StaticLibrary_use_unpacked,boostthread,boost))
+
+$(eval $(call gb_StaticLibrary_set_cxx_suffix,boostthread,cpp))
+
+$(eval $(call gb_StaticLibrary_add_generated_exception_objects,boostthread,\
+	UnpackedTarball/boost/libs/thread/src/win32/thread \
+	UnpackedTarball/boost/libs/thread/src/win32/tss_dll \
+	UnpackedTarball/boost/libs/thread/src/win32/tss_pe \
+))
+
+# vim: set noet sw=4 ts=4:
commit b54f64931471631a698a51496db0a321f095aede
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Wed Sep 5 13:57:23 2012 -0400

    Updated the liborcus package.
    
    Change-Id: Ie8f581401dfb144fda1673597ed6717b15b03e71

diff --git a/liborcus/makefile.mk b/liborcus/makefile.mk
index 64b1e7b..763b6ce 100644
--- a/liborcus/makefile.mk
+++ b/liborcus/makefile.mk
@@ -33,7 +33,7 @@ TARGET=orcus
 .ENDIF
 
 TARFILE_NAME=liborcus_0.1.0
-TARFILE_MD5=9f4fecdd1267a2a685f06de8508c88ff
+TARFILE_MD5=13febcdd79ad25280f199a36b792c5f9
 
 PATCH_FILES=
 
@@ -50,8 +50,7 @@ CONFIGURE_ACTION=./configure \
 	--with-pic \
 	--enable-static \
 	--disable-shared \
-	--with-mdds-include-path=$(OUTDIR)/inc \
-	--disable-libzip \
+	--without-libzip \
 	--disable-debug \
 	--disable-spreadsheet-model
 
commit edeac60cb5df5d7caee11009d23f43506d14f305
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Wed Sep 5 00:22:33 2012 -0400

    Use DOS style file path on Windows.
    
    Change-Id: Iefd223eb0df5809ae7123a2bdf4111477e6bd71d

diff --git a/sc/source/filter/orcus/orcusfiltersimpl.cxx b/sc/source/filter/orcus/orcusfiltersimpl.cxx
index 39cdb52..3c8c211 100644
--- a/sc/source/filter/orcus/orcusfiltersimpl.cxx
+++ b/sc/source/filter/orcus/orcusfiltersimpl.cxx
@@ -14,7 +14,6 @@
 #include "orcusfiltersimpl.hxx"
 
 #define __ORCUS_STATIC_LIB
-#define BOOST_DISABLE_THREADS
 #include <orcus/spreadsheet/import_interface.hpp>
 #include <orcus/orcus_csv.hpp>
 
@@ -24,6 +23,12 @@ using orcus::spreadsheet::row_t;
 using orcus::spreadsheet::col_t;
 using orcus::spreadsheet::formula_grammar_t;
 
+#ifdef WNT
+#define SYSTEM_PATH INetURLObject::FSYS_DOS
+#else
+#define SYSTEM_PATH INetURLObject::FSYS_UNX
+#endif
+
 namespace {
 
 class ScOrcusSheet;
@@ -138,7 +143,7 @@ bool ScOrcusFiltersImpl::importCSV(ScDocument& rDoc, const OUString& rPath) cons
 {
     ScOrcusFactory aFactory(rDoc);
     INetURLObject aURL(rPath);
-    const char* path = rtl::OUStringToOString(aURL.getFSysPath(INetURLObject::FSYS_UNX), RTL_TEXTENCODING_UTF8).getStr();
+    const char* path = rtl::OUStringToOString(aURL.getFSysPath(SYSTEM_PATH), RTL_TEXTENCODING_UTF8).getStr();
 
     try
     {
commit 5d33e9ae53df66d9e9c3d3d833ac165e21e6209c
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Tue Sep 4 16:18:26 2012 -0400

    Adopted the Linux build.
    
    Change-Id: I32c8e02b5568345906e8af1168f34ab0fb093052

diff --git a/liborcus/prj/d.lst b/liborcus/prj/d.lst
index 9e6eb02..4e09e77 100644
--- a/liborcus/prj/d.lst
+++ b/liborcus/prj/d.lst
@@ -5,5 +5,6 @@ mkdir: %_DEST%\inc\orcus\spreadsheet
 ..\%__SRC%\misc\build\liborcus*\include\orcus\spreadsheet\*.hpp %_DEST%\inc\orcus\spreadsheet\
 
 ..\%__SRC%\misc\build\liborcus*\src\liborcus\.libs\liborcus-0.2.a %_DEST%\lib\
+symlink: %_DEST%\lib\liborcus-0.2.a %_DEST%\lib\liborcus.a
 
 ..\%__SRC%\misc\build\liborcus*\vsprojects\liborcus-static-nozip\Release\orcus.lib %_DEST%\lib\
commit 49b0b694607b52545da14c8a3a064707e05b4bc2
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Tue Sep 4 15:05:35 2012 -0400

    Get it to build on Windows, with MSVC compiler.
    
    Took me 3 days just to get it to work...
    
    Change-Id: Ie28dc9b4ddb967a547cad33da18911b77bb9d558

diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 7a1289e..66b3480 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -1856,6 +1856,7 @@ $(eval $(call gb_Helper_register_libraries,PLAINLIBS_OOO,\
 
 endif # SYSTEM_PYTHON
 
+# ORCUS
 ifeq ($(SYSTEM_LIBORCUS),YES)
 
 define gb_LinkTarget__use_orcus
@@ -1870,14 +1871,13 @@ endef
 else # !SYSTEM_LIBORCUS
 
 $(eval $(call gb_Helper_register_static_libraries,PLAINLIBS, \
-	orcus-0.2 \
+	orcus \
 ))
 
 define gb_LinkTarget__use_orcus
 $(call gb_LinkTarget_use_static_libraries,$(1),\
-	orcus-0.2 \
+	orcus \
 )
-
 endef
 
 endif # SYSTEM_LIBORCUS
diff --git a/boost/prj/d.lst b/boost/prj/d.lst
index e69de29..8b13789 100644
--- a/boost/prj/d.lst
+++ b/boost/prj/d.lst
@@ -0,0 +1 @@
+
diff --git a/liborcus/makefile.mk b/liborcus/makefile.mk
index e57bb08..64b1e7b 100644
--- a/liborcus/makefile.mk
+++ b/liborcus/makefile.mk
@@ -33,12 +33,23 @@ TARGET=orcus
 .ENDIF
 
 TARFILE_NAME=liborcus_0.1.0
-TARFILE_MD5=870f887bad82663146676017671efb60
+TARFILE_MD5=9f4fecdd1267a2a685f06de8508c88ff
 
 PATCH_FILES=
 
+.IF "$(GUI)$(COM)"=="WNTMSC"
+
+BUILD_DIR=vsprojects/liborcus-static-nozip
+BUILD_ACTION=export BOOST_INCLUDE_DIR=$(OUTDIR)/inc && \
+	$(COMPATH)$/vcpackages$/vcbuild.exe liborcus-static-nozip.vcproj "Release|Win32"
+
+.ELSE
+
 CONFIGURE_DIR=
-CONFIGURE_ACTION=./autogen.sh \
+CONFIGURE_ACTION=./configure \
+	--with-pic \
+	--enable-static \
+	--disable-shared \
 	--with-mdds-include-path=$(OUTDIR)/inc \
 	--disable-libzip \
 	--disable-debug \
@@ -47,6 +58,8 @@ CONFIGURE_ACTION=./autogen.sh \
 BUILD_ACTION=make
 BUILD_DIR=
 
+.ENDIF
+
 # --- Targets ------------------------------------------------------
 
 .INCLUDE : set_ext.mk
diff --git a/liborcus/prj/d.lst b/liborcus/prj/d.lst
index 7c83728..9e6eb02 100644
--- a/liborcus/prj/d.lst
+++ b/liborcus/prj/d.lst
@@ -6,4 +6,4 @@ mkdir: %_DEST%\inc\orcus\spreadsheet
 
 ..\%__SRC%\misc\build\liborcus*\src\liborcus\.libs\liborcus-0.2.a %_DEST%\lib\
 
-..\%__SRC%\slb\*.lib %_DEST%\lib\*.lib
+..\%__SRC%\misc\build\liborcus*\vsprojects\liborcus-static-nozip\Release\orcus.lib %_DEST%\lib\
diff --git a/sc/source/filter/orcus/orcusfiltersimpl.cxx b/sc/source/filter/orcus/orcusfiltersimpl.cxx
index a45abfc..39cdb52 100644
--- a/sc/source/filter/orcus/orcusfiltersimpl.cxx
+++ b/sc/source/filter/orcus/orcusfiltersimpl.cxx
@@ -13,6 +13,8 @@
 
 #include "orcusfiltersimpl.hxx"
 
+#define __ORCUS_STATIC_LIB
+#define BOOST_DISABLE_THREADS
 #include <orcus/spreadsheet/import_interface.hpp>
 #include <orcus/orcus_csv.hpp>
 
commit 66c213adb03e4457380b3f67fb559e13cb72bf00
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri Aug 31 12:13:46 2012 -0400

    Make it more generic.
    
    Change-Id: I3d3ddec1a8313bb58f5ae6bbc3edc1f273e25f94

diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx
index 11ed90e..26b1ec7 100644
--- a/sfx2/source/view/frmload.cxx
+++ b/sfx2/source/view/frmload.cxx
@@ -519,8 +519,6 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA
 
     ::comphelper::NamedValueCollection aDescriptor( rArgs );
 
-    bool bLoadWithOrcus = aDescriptor.getOrDefault<OUString>("FilterProvider", OUString()) == "orcus";
-
     // ensure the descriptor contains a referrer
     if ( !aDescriptor.has( "Referer" ) )
         aDescriptor.put( "Referer", ::rtl::OUString() );
@@ -572,10 +570,14 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA
         // no model passed from outside? => create one from scratch
         if ( !xModel.is() )
         {
-            // beforehand, determine the filter to use, and update the descriptor with its information
-            if ( !bInitNewModel && !bLoadWithOrcus )
+            bool bInternalFilter = aDescriptor.getOrDefault<OUString>("FilterProvider", OUString()).isEmpty();
+
+            if (bInternalFilter && !bInitNewModel)
             {
-                impl_determineFilter( aDescriptor );
+                // Ensure that the current SfxFilter instance is loaded before
+                // going further.  We don't need to do this for external
+                // filter providers.
+                impl_determineFilter(aDescriptor);
             }
 
             // create the new doc
commit ae197be590cd06bff282bffce1ef77ff83087d39
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri Aug 31 12:06:52 2012 -0400

    I'll agree with the comment, and remove this line.
    
    Change-Id: Ieff30d8df8128488910b75603d2499102b529c3b

diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx
index e213986..11ed90e 100644
--- a/sfx2/source/view/frmload.cxx
+++ b/sfx2/source/view/frmload.cxx
@@ -525,12 +525,6 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA
     if ( !aDescriptor.has( "Referer" ) )
         aDescriptor.put( "Referer", ::rtl::OUString() );
 
-    // TODO: is this needed? finally, when loading is successfull, then there should be no need for this item,
-    // as the document can always obtain its frame. In particular, there might be situations where this frame
-    // is accessed, but already disposed: Imagine the user loading a document, opening a second view on it, and
-    // then closing the first view/frame.
-    aDescriptor.put( "Frame", _rTargetFrame );
-
     // did the caller already pass a model?
     Reference< XModel2 > xModel = aDescriptor.getOrDefault( "Model", Reference< XModel2 >() );
     const bool bExternalModel = xModel.is();
commit 2aebeb74a76499f078c7d21ea2d202d8b82caa0e
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri Aug 31 11:23:16 2012 -0400

    We don't need this special orcus directory now that orcus is integrated.
    
    Change-Id: I3a9ef8ca998ad53969bd0911091a1c234e0b227e

diff --git a/sc/inc/orcus/README b/sc/inc/orcus/README
deleted file mode 100644
index 0327d85..0000000
--- a/sc/inc/orcus/README
+++ /dev/null
@@ -1,7 +0,0 @@
-The headers in this directory are directly copied from the orcus project[1].
-Please send patches directly to the orcus project.
-
-Please don't modify these files here.  Any changes you may make here will get
-overwritten when copying updated files from orcus.
-
-[1] http://gitorious.org/orcus
diff --git a/sc/inc/orcus/css_parser.hpp b/sc/inc/orcus/css_parser.hpp
deleted file mode 100644
index 17aef45..0000000
--- a/sc/inc/orcus/css_parser.hpp
+++ /dev/null
@@ -1,525 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * Copyright (c) 2011 Kohei Yoshida
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following
- * conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- ************************************************************************/
-
-#ifndef __ORCUS_CSS_PARSER_HPP__
-#define __ORCUS_CSS_PARSER_HPP__
-
-#define ORCUS_DEBUG_CSS 0
-
-#include <cstdlib>
-#include <cstring>
-#include <exception>
-#include <string>
-#include <cassert>
-#include <sstream>
-
-#if ORCUS_DEBUG_CSS
-#include <iostream>
-#endif
-
-namespace orcus {
-
-class css_parse_error : public std::exception
-{
-    std::string m_msg;
-public:
-    css_parse_error(const std::string& msg) : m_msg(msg) {}
-    virtual ~css_parse_error() throw() {}
-    virtual const char* what() const throw() { return m_msg.c_str(); }
-};
-
-template<typename _Handler>
-class css_parser
-{
-public:
-    typedef _Handler handler_type;
-
-    css_parser(const char* p, size_t n, handler_type& hdl);
-    void parse();
-
-private:
-    // Handlers - at the time a handler is called the current position is
-    // expected to point to the first unprocessed non-blank character, and
-    // each handler must set the current position to the next unprocessed
-    // non-blank character when it finishes.
-    void rule();
-    void at_rule_name();
-    void selector_name();
-    void property_name();
-    void property();
-    void quoted_value();
-    void value();
-    void name_sep();
-    void property_sep();
-    void block();
-
-    void identifier(const char*& p, size_t& len);
-
-    void skip_blanks();
-    void skip_blanks_reverse();
-    void shrink_stream();
-    void next();
-    char cur_char() const;
-
-    size_t remaining_size() const { return m_length - m_pos - 1; }
-    bool has_char() const { return m_pos < m_length; }
-
-    static bool is_blank(char c)
-    {
-        return c == ' ' || c == '\t' || c == '\n';
-    }
-
-    static bool is_alpha(char c)
-    {
-        if ('a' <= c && c <= 'z')
-            return true;
-        if ('A' <= c && c <= 'Z')
-            return true;
-        return false;
-    }
-
-    static bool is_name_char(char c)
-    {
-        switch (c)
-        {
-            case '-':
-                return true;
-        }
-
-        return false;
-    }
-
-    static bool is_numeric(char c)
-    {
-        if ('0' <= c && c <= '9')
-            return true;
-        return false;
-    }
-
-    handler_type& m_handler;
-    const char* mp_char;
-    size_t m_pos;
-    size_t m_length;
-};
-
-template<typename _Handler>
-css_parser<_Handler>::css_parser(const char* p, size_t n, handler_type& hdl) :
-    m_handler(hdl), mp_char(p), m_pos(0), m_length(n) {}
-
-template<typename _Handler>
-void css_parser<_Handler>::parse()
-{
-    shrink_stream();
-
-#if ORCUS_DEBUG_CSS
-    std::cout << "compressed: '";
-    const char* p = mp_char;
-    for (size_t i = m_pos; i < m_length; ++i, ++p)
-        std::cout << *p;
-    std::cout << "'" << std::endl;
-#endif
-    m_handler.begin_parse();
-    while (has_char())
-        rule();
-    m_handler.end_parse();
-}
-
-template<typename _Handler>
-void css_parser<_Handler>::rule()
-{
-    // <selector name> , ... , <selector name> <block>
-    while (has_char())
-    {
-        char c = cur_char();
-        if (is_alpha(c) || c == '.' || c == '@')
-        {
-            selector_name();
-        }
-        else if (c == ',')
-        {
-            name_sep();
-        }
-        else if (c == '{')
-        {
-            block();
-        }
-        else
-        {
-            std::ostringstream os;
-            os << "failed to parse '" << c << "'";
-            throw css_parse_error(os.str());
-        }
-    }
-}
-
-template<typename _Handler>
-void css_parser<_Handler>::at_rule_name()
-{
-    assert(has_char());
-    assert(cur_char() == '@');
-    next();
-    char c = cur_char();
-    if (!is_alpha(c))
-        throw css_parse_error("first character of an at-rule name must be an alphabet.");
-
-    const char* p;
-    size_t len;
-    identifier(p, len);
-    skip_blanks();
-
-    m_handler.at_rule_name(p, len);
-#if ORCUS_DEBUG_CSS
-    std::string foo(p, len);
-    std::cout << "at-rule name: " << foo.c_str() << std::endl;
-#endif
-}
-
-template<typename _Handler>
-void css_parser<_Handler>::selector_name()
-{
-    // <element name>
-    // '.' <class name>
-    // <element name> '.' <class name>
-    //
-    // Both element and class names are identifiers.
-
-    assert(has_char());
-    char c = cur_char();
-    if (c == '@')
-    {
-        // This is the name of an at-rule.
-        at_rule_name();
-        return;
-    }
-
-    if (!is_alpha(c) && c != '.')
-        throw css_parse_error("first character of a name must be an alphabet or a dot.");
-
-    const char* p_elem = NULL;
-    const char* p_class = NULL;
-    size_t len_elem = 0;
-    size_t len_class = 0;
-    if (c != '.')
-        identifier(p_elem, len_elem);
-
-    if (cur_char() == '.')
-    {
-        next();
-        identifier(p_class, len_class);
-    }
-    skip_blanks();
-
-    m_handler.selector_name(p_elem, len_elem, p_class, len_class);
-#if ORCUS_DEBUG_CSS
-    std::string elem_name(p_elem, len_elem), class_name(p_class, len_class);
-    std::cout << "selector name: (element)'" << elem_name.c_str() << "' (class)'" << class_name.c_str() << "'" << std::endl;
-#endif
-}
-
-template<typename _Handler>
-void css_parser<_Handler>::property_name()
-{
-    // <identifier>
-
-    assert(has_char());
-    char c = cur_char();
-    if (!is_alpha(c) && c != '.')
-        throw css_parse_error("first character of a name must be an alphabet or a dot.");
-
-    const char* p;
-    size_t len;
-    identifier(p, len);
-    skip_blanks();
-
-    m_handler.property_name(p, len);
-#if ORCUS_DEBUG_CSS
-    std::string foo(p, len);
-    std::cout << "property name: " << foo.c_str() << std::endl;
-#endif
-}
-
-template<typename _Handler>
-void css_parser<_Handler>::property()
-{
-    // <property name> : <value> , ... , <value>
-
-    m_handler.begin_property();
-    property_name();
-    if (cur_char() != ':')
-        throw css_parse_error("':' expected.");
-    next();
-    skip_blanks();
-    while (has_char())
-    {
-        value();
-        char c = cur_char();
-        if (c == ',')
-        {
-            // separated by commas.
-            next();
-            skip_blanks();
-        }
-        else if (c == ';')
-            break;
-    }
-    skip_blanks();
-    m_handler.end_property();
-}
-
-template<typename _Handler>
-void css_parser<_Handler>::quoted_value()
-{
-    // Parse until the the end quote is reached.
-
-    assert(cur_char() == '"');
-    next();
-    const char* p = mp_char;
-    size_t len = 1;
-    for (next(); has_char(); next())
-    {
-        if (cur_char() == '"')
-        {
-            // End quote reached.
-            break;
-        }
-        ++len;
-    }
-
-    if (cur_char() != '"')
-        throw css_parse_error("end quote has never been reached.");
-
-    next();
-    skip_blanks();
-
-    m_handler.value(p, len);
-#if ORCUS_DEBUG_CSS
-    std::string foo(p, len);
-    std::cout << "quoted value: " << foo.c_str() << std::endl;
-#endif
-}
-
-template<typename _Handler>
-void css_parser<_Handler>::value()
-{
-    assert(has_char());
-    char c = cur_char();
-    if (c == '"')
-    {
-        quoted_value();
-        return;
-    }
-
-    if (!is_alpha(c) && !is_numeric(c) && c != '-' && c != '+' && c != '.')
-    {
-        std::ostringstream os;
-        os << "illegal first character of a value '" << c << "'";
-        throw css_parse_error(os.str());
-    }
-
-    const char* p = mp_char;
-    size_t len = 1;
-    for (next(); has_char(); next())
-    {
-        c = cur_char();
-        if (!is_alpha(c) && !is_name_char(c) && !is_numeric(c) && c != '.')
-            break;
-        ++len;
-    }
-    skip_blanks();
-
-    m_handler.value(p, len);
-#if ORCUS_DEBUG_CSS
-    std::string foo(p, len);
-    std::cout << "value: " << foo.c_str() << std::endl;
-#endif
-}
-
-template<typename _Handler>
-void css_parser<_Handler>::name_sep()
-{
-    assert(cur_char() == ',');
-#if ORCUS_DEBUG_CSS
-    std::cout << "," << std::endl;
-#endif
-    next();
-    skip_blanks();
-}
-
-template<typename _Handler>
-void css_parser<_Handler>::property_sep()
-{
-#if ORCUS_DEBUG_CSS
-    std::cout << ";" << std::endl;
-#endif
-    next();
-    skip_blanks();
-}
-
-template<typename _Handler>
-void css_parser<_Handler>::block()
-{
-    // '{' <property> ';' ... ';' <property> ';'(optional) '}'
-
-    assert(cur_char() == '{');
-#if ORCUS_DEBUG_CSS
-    std::cout << "{" << std::endl;
-#endif
-    m_handler.begin_block();
-
-    next();
-    skip_blanks();
-
-    // parse properties.
-    while (has_char())
-    {
-        property();
-        if (cur_char() != ';')
-            break;
-        property_sep();
-        if (cur_char() == '}')
-            // ';' after the last property.  This is optional but allowed.
-            break;
-    }
-
-    if (cur_char() != '}')
-        throw css_parse_error("} expected.");
-
-    m_handler.end_block();
-
-    next();
-    skip_blanks();
-
-#if ORCUS_DEBUG_CSS
-    std::cout << "}" << std::endl;
-#endif
-}
-
-template<typename _Handler>
-void css_parser<_Handler>::identifier(const char*& p, size_t& len)
-{
-    p = mp_char;
-    len = 1;
-    for (next(); has_char(); next())
-    {
-        char c = cur_char();
-        if (!is_alpha(c) && !is_name_char(c) && !is_numeric(c))
-            break;
-        ++len;
-    }
-}
-
-template<typename _Handler>
-void css_parser<_Handler>::skip_blanks()
-{
-    for (; has_char(); next())
-    {
-        if (!is_blank(*mp_char))
-            break;
-    }
-}
-
-template<typename _Handler>
-void css_parser<_Handler>::skip_blanks_reverse()
-{
-    const char* p = mp_char + remaining_size();
-    for (; p != mp_char; --p, --m_length)
-    {
-        if (!is_blank(*p))
-            break;
-    }
-}
-
-template<typename _Handler>
-void css_parser<_Handler>::shrink_stream()
-{
-    // Skip any leading blanks.
-    skip_blanks();
-
-    if (!remaining_size())
-        return;
-
-    // Skip any trailing blanks.
-    skip_blanks_reverse();
-
-    // Skip leading <!-- if present.
-
-    const char* com_open = "<!--";
-    size_t com_open_len = std::strlen(com_open);
-    if (remaining_size() < com_open_len)
-        // Not enough stream left.  Bail out.
-        return;
-
-    const char* p = mp_char;
-    for (size_t i = 0; i < com_open_len; ++i, ++p)
-    {
-        if (*p != com_open[i])
-            return;
-        next();
-    }
-    mp_char = p;
-
-    // Skip leading blanks once again.
-    skip_blanks();
-
-    // Skip trailing --> if present.
-    const char* com_close = "-->";
-    size_t com_close_len = std::strlen(com_close);
-    size_t n = remaining_size();
-    if (n < com_close_len)
-        // Not enough stream left.  Bail out.
-        return;
-
-    p = mp_char + n; // move to the last char.
-    for (size_t i = com_close_len; i > 0; --i, --p)
-    {
-        if (*p != com_close[i-1])
-            return;
-    }
-    m_length -= com_close_len;
-
-    skip_blanks_reverse();
-}
-
-template<typename _Handler>
-void css_parser<_Handler>::next()
-{
-    ++m_pos;
-    ++mp_char;
-}
-
-template<typename _Handler>
-char css_parser<_Handler>::cur_char() const
-{
-    return *mp_char;
-}
-
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/orcus/csv_parser.hpp b/sc/inc/orcus/csv_parser.hpp
deleted file mode 100644
index d1bb596..0000000
--- a/sc/inc/orcus/csv_parser.hpp
+++ /dev/null
@@ -1,387 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * Copyright (c) 2011 Kohei Yoshida
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following
- * conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- ************************************************************************/
-
-#ifndef __ORCUS_CSV_PARSER_HPP__
-#define __ORCUS_CSV_PARSER_HPP__
-
-#define ORCUS_DEBUG_CSV 0
-
-#include <cstdlib>
-#include <cstring>
-#include <exception>
-#include <string>
-#include <cassert>
-#include <sstream>
-
-#if ORCUS_DEBUG_CSV
-#include <iostream>
-using std::cout;
-using std::endl;
-#endif
-
-namespace orcus {
-
-struct csv_parser_config
-{
-    std::string delimiters;
-    char text_qualifier;
-    bool trim_cell_value:1;
-
-    csv_parser_config() :
-        trim_cell_value(true) {}
-};
-
-class csv_parse_error : public std::exception
-{
-    std::string m_msg;
-public:
-    csv_parse_error(const std::string& msg) : m_msg(msg) {}
-    virtual ~csv_parse_error() throw() {}
-    virtual const char* what() const throw() { return m_msg.c_str(); }
-};
-
-template<typename _Handler>
-class csv_parser
-{
-public:
-    typedef _Handler handler_type;
-
-    csv_parser(const char* p, size_t n, handler_type& hdl, const csv_parser_config& config);
-    void parse();
-
-private:
-    bool has_char() const { return m_pos < m_length; }
-    bool has_next() const { return m_pos + 1 < m_length; }
-    void next();
-    char cur_char() const;
-    char next_char() const;
-
-    bool is_delim(char c) const;
-    bool is_text_qualifier(char c) const;
-
-    // handlers
-    void row();
-    void cell();
-    void quoted_cell();
-
-    void parse_cell_with_quote(const char* p0, size_t len0);
-    void skip_blanks();
-
-    void init_cell_buf();
-    void append_to_cell_buf(const char* p, size_t len);
-
-    /**
-     * Push cell value to the handler.
-     */
-    void push_cell_value(const char* p, size_t n);
-
-    static bool is_blank(char c)
-    {
-        return c == ' ' || c == '\t';
-    }
-
-private:
-    handler_type& m_handler;
-    const csv_parser_config& m_config;
-    std::string m_cell_buf;
-    const char* mp_char;
-    size_t m_pos;
-    size_t m_length;
-    size_t m_cell_buf_size;
-};
-
-template<typename _Handler>
-csv_parser<_Handler>::csv_parser(const char* p, size_t n, handler_type& hdl, const csv_parser_config& config) :
-    m_handler(hdl), m_config(config), mp_char(p), m_pos(0), m_length(n) {}
-
-template<typename _Handler>
-void csv_parser<_Handler>::parse()
-{
-#if ORCUS_DEBUG_CSV
-    const char* p = mp_char;
-    for (size_t i = m_pos; i < m_length; ++i, ++p)
-        std::cout << *p;
-    std::cout << std::endl;
-#endif
-
-    m_handler.begin_parse();
-    while (has_char())
-        row();
-    m_handler.end_parse();
-}
-
-template<typename _Handler>
-void csv_parser<_Handler>::next()
-{
-    ++m_pos;
-    ++mp_char;
-}
-
-template<typename _Handler>
-char csv_parser<_Handler>::cur_char() const
-{
-    return *mp_char;
-}
-
-template<typename _Handler>
-char csv_parser<_Handler>::next_char() const
-{
-    return *(mp_char+1);
-}
-
-template<typename _Handler>
-bool csv_parser<_Handler>::is_delim(char c) const
-{
-    return m_config.delimiters.find(c) != std::string::npos;
-}
-
-template<typename _Handler>
-bool csv_parser<_Handler>::is_text_qualifier(char c) const
-{
-    return m_config.text_qualifier == c;
-}
-
-template<typename _Handler>
-void csv_parser<_Handler>::row()
-{
-    m_handler.begin_row();
-    while (true)
-    {
-        if (is_text_qualifier(cur_char()))
-            quoted_cell();
-        else
-            cell();
-
-        if (!has_char())
-        {
-            m_handler.end_row();
-            return;
-        }
-
-        char c = cur_char();
-        if (c == '\n')
-        {
-            next();
-#if ORCUS_DEBUG_CSV
-            cout << "(LF)" << endl;
-#endif
-            m_handler.end_row();
-            return;
-        }
-
-        assert(is_delim(c));
-        next();
-        if(m_config.trim_cell_value)
-            skip_blanks();
-    }
-}
-
-template<typename _Handler>
-void csv_parser<_Handler>::cell()
-{
-    const char* p = mp_char;
-    size_t len = 0;
-    char c = cur_char();
-    while (c != '\n' && !is_delim(c))
-    {
-        ++len;
-        next();
-        if (!has_char())
-            break;
-        c = cur_char();
-    }
-
-    if (!len)
-        p = NULL;
-
-    push_cell_value(p, len);
-}
-
-template<typename _Handler>
-void csv_parser<_Handler>::quoted_cell()
-{
-#if ORCUS_DEBUG_CSV
-    using namespace std;
-    cout << "--- quoted cell" << endl;
-#endif
-    char c = cur_char();
-    assert(is_text_qualifier(c));
-    next(); // Skip the opening quote.
-    if (!has_char())
-        return;
-
-    const char* p0 = mp_char;
-    size_t len = 1;
-    for (; has_char(); next(), ++len)
-    {
-        c = cur_char();
-#if ORCUS_DEBUG_CSV
-        cout << "'" << c << "'" << endl;
-#endif
-        if (!is_text_qualifier(c))
-            continue;
-
-        // current char is a quote. Check if the next char is also a text
-        // qualifier.
-
-        if (has_next() && is_text_qualifier(next_char()))
-        {
-            next();
-            parse_cell_with_quote(p0, len);
-            return;
-        }
-
-        // Closing quote.
-        m_handler.cell(p0, len-1);
-        next();
-        skip_blanks();
-        return;
-    }
-
-    // Stream ended prematurely.  Handle it gracefully.
-    m_handler.cell(p0, len);
-    next();
-    skip_blanks();
-}
-
-template<typename _Handler>
-void csv_parser<_Handler>::parse_cell_with_quote(const char* p0, size_t len0)
-{
-#if ORCUS_DEBUG_CSV
-    using namespace std;
-    cout << "--- parse cell with quote" << endl;
-#endif
-    assert(is_text_qualifier(cur_char()));
-
-    // Push the preceding chars to the temp buffer.
-    init_cell_buf();
-    append_to_cell_buf(p0, len0);
-
-    // Parse the rest, until the closing quote.
-    next();
-    const char* p_cur = mp_char;
-    size_t cur_len = 0;
-    for (; has_char(); next(), ++cur_len)
-    {
-        char c = cur_char();
-#if ORCUS_DEBUG_CSV
-        cout << "'" << c << "'" << endl;
-#endif
-        if (!is_text_qualifier(c))
-            continue;
-
-        if (has_next() && is_text_qualifier(next_char()))
-        {
-            // double quotation.  Copy the current segment to the cell buffer.
-            append_to_cell_buf(p_cur, cur_len);
-
-            next(); // to the 2nd quote.
-            p_cur = mp_char;
-            cur_len = 0;
-            continue;
-        }
-
-        // closing quote.  Flush the current segment to the cell
-        // buffer, push the value to the handler, and exit normally.
-        append_to_cell_buf(p_cur, cur_len);
-
-        m_handler.cell(&m_cell_buf[0], m_cell_buf_size);
-        next();
-        skip_blanks();
-        return;
-    }
-
-    // Stream ended prematurely.
-    throw csv_parse_error("stream ended prematurely while parsing quoted cell.");
-}
-
-template<typename _Handler>
-void csv_parser<_Handler>::skip_blanks()
-{
-    for (; has_char(); next())
-    {
-        if (!is_blank(*mp_char))
-            break;
-    }
-}
-
-template<typename _Handler>
-void csv_parser<_Handler>::init_cell_buf()
-{
-    m_cell_buf_size = 0;
-}
-
-template<typename _Handler>
-void csv_parser<_Handler>::append_to_cell_buf(const char* p, size_t len)
-{
-    size_t size_needed = m_cell_buf_size + len;
-    if (m_cell_buf.size() < size_needed)
-        m_cell_buf.resize(size_needed);
-
-    char* p_dest = &m_cell_buf[m_cell_buf_size];
-    std::strncpy(p_dest, p, len);
-    m_cell_buf_size += len;
-}
-
-template<typename _Handler>
-void csv_parser<_Handler>::push_cell_value(const char* p, size_t n)
-{
-    size_t len = n;
-
-    if (m_config.trim_cell_value)
-    {
-        // Trim any leading blanks.
-        for (size_t i = 0; i < n; ++i, --len, ++p)
-        {
-            if (!is_blank(*p))
-                break;
-        }
-
-        // Trim any trailing blanks.
-        if (len)
-        {
-            const char* p_end = p + (len-1);
-            for (; p != p_end; --p_end, --len)
-            {
-                if (!is_blank(*p_end))
-                    break;
-            }
-        }
-    }
-
-    m_handler.cell(p, len);
-#if ORCUS_DEBUG_CSV
-    cout << "(cell:'" << std::string(p, len) << "')" << endl;
-#endif
-}
-
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 8e96553dc6f4b84c9f81fecb52739bb05e154b1a
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri Aug 31 11:14:50 2012 -0400

    Use the latest license header.
    
    Change-Id: I6cd50b8707331b9cf41cb1d42b5ad3d167006478

diff --git a/sc/inc/orcusfilters.hxx b/sc/inc/orcusfilters.hxx
index 890cd9f..2464ede 100644
--- a/sc/inc/orcusfilters.hxx
+++ b/sc/inc/orcusfilters.hxx
@@ -1,29 +1,10 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /*
- * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ * This file is part of the LibreOffice project.
  *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License or as specified alternatively below. You may obtain a copy of
- * the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * Major Contributor(s):
- *   Copyright (C) 2012 Kohei Yoshida <kohei.yoshida at suse.com>
- *
- * All Rights Reserved.
- *
- * For minor contributions see the git repository.
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
- * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
- * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
- * instead of those above.
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
 #ifndef __SC_ORCUSFILTERS_HXX__
diff --git a/sc/source/filter/orcus/orcusfiltersimpl.cxx b/sc/source/filter/orcus/orcusfiltersimpl.cxx
index 0723744..a45abfc 100644
--- a/sc/source/filter/orcus/orcusfiltersimpl.cxx
+++ b/sc/source/filter/orcus/orcusfiltersimpl.cxx
@@ -1,29 +1,10 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /*
- * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ * This file is part of the LibreOffice project.
  *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License or as specified alternatively below. You may obtain a copy of
- * the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * Major Contributor(s):
- *   Copyright (C) 2012 Kohei Yoshida <kohei.yoshida at suse.com>
- *
- * All Rights Reserved.
- *
- * For minor contributions see the git repository.
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
- * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
- * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
- * instead of those above.
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
 #include "document.hxx"
commit c609c91fa7d67cdf67f2ed0c924a0690adf26e0b
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri Aug 31 11:13:25 2012 -0400

    Add or update the header guards.
    
    Change-Id: I1d2205e4659041670b1e3f0dc1dc41262e75c9ac

diff --git a/sc/inc/orcusfilters.hxx b/sc/inc/orcusfilters.hxx
index 5beede2..890cd9f 100644
--- a/sc/inc/orcusfilters.hxx
+++ b/sc/inc/orcusfilters.hxx
@@ -26,8 +26,8 @@
  * instead of those above.
  */
 
-#ifndef __SC_ORCUSHANDLER_HXX__
-#define __SC_ORCUSHANDLER_HXX__
+#ifndef __SC_ORCUSFILTERS_HXX__
+#define __SC_ORCUSFILTERS_HXX__
 
 #include "rtl/ustring.hxx"
 
diff --git a/sc/source/filter/inc/orcusfiltersimpl.hxx b/sc/source/filter/inc/orcusfiltersimpl.hxx
index 090c52f..e349120 100644
--- a/sc/source/filter/inc/orcusfiltersimpl.hxx
+++ b/sc/source/filter/inc/orcusfiltersimpl.hxx
@@ -7,6 +7,9 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#ifndef __SCFILT_ORCUSFILTERSIMPL_HXX__
+#define __SCFILT_ORCUSFILTERSIMPL_HXX__
+
 #include "orcusfilters.hxx"
 
 class ScOrcusFiltersImpl : public ScOrcusFilters
@@ -15,4 +18,6 @@ public:
     virtual bool importCSV(ScDocument& rDoc, const rtl::OUString& rPath) const;
 };
 
+#endif
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit c28f2fbddaa5c1042d1661125dc64a397e6a65fa
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri Aug 31 11:11:00 2012 -0400

    Move the orcus handling code from sc to scfilt.
    
    Then this will be subject to on-demand loading.
    
    Change-Id: Ibefcb77b4c8a97707f3ea177a81bd61bdc58fc31

diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index f83ba54..345c7b5 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -90,10 +90,6 @@ $(eval $(call gb_Library_use_libraries,sc,\
 	$(gb_STDLIBS) \
 ))
 
-$(eval $(call gb_Library_use_externals,sc,\
-	orcus \
-))
-
 $(eval $(call gb_Library_add_exception_objects,sc,\
 	sc/source/core/data/attarray \
 	sc/source/core/data/attrib \
@@ -214,7 +210,6 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
 	sc/source/core/tool/navicfg \
 	sc/source/core/tool/odffmap \
 	sc/source/core/tool/optutil \
-	sc/source/core/tool/orcushandler \
 	sc/source/core/tool/parclass \
 	sc/source/core/tool/printopt \
 	sc/source/core/tool/prnsave \
diff --git a/sc/Library_scfilt.mk b/sc/Library_scfilt.mk
index 7efd7d1..8816bc3 100644
--- a/sc/Library_scfilt.mk
+++ b/sc/Library_scfilt.mk
@@ -63,6 +63,10 @@ $(eval $(call gb_Library_use_libraries,scfilt,\
 	$(gb_STDLIBS) \
 ))
 
+$(eval $(call gb_Library_use_externals,scfilt,\
+	orcus \
+))
+
 $(eval $(call gb_Library_add_exception_objects,scfilt,\
 	sc/source/filter/dif/difexp \
 	sc/source/filter/dif/difimp \
@@ -214,6 +218,7 @@ $(eval $(call gb_Library_add_exception_objects,scfilt,\
         sc/source/filter/oox/worksheetfragment \
         sc/source/filter/oox/worksheethelper \
         sc/source/filter/oox/worksheetsettings \
+        sc/source/filter/orcus/orcusfiltersimpl \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/sc/inc/filter.hxx b/sc/inc/filter.hxx
index ac943f5..2359927 100644
--- a/sc/inc/filter.hxx
+++ b/sc/inc/filter.hxx
@@ -39,6 +39,7 @@ class ScAddress;
 class ScDocument;
 class ScRange;
 class SvNumberFormatter;
+class ScOrcusFilters;
 
 // return values im-/export filter  (sal_uLong)
 
@@ -119,6 +120,8 @@ class ScFormatFilterPlugin {
                   const String& rStreamPath, String& rNonConvertibleChars ) = 0;
     virtual FltError ScExportRTF( SvStream&, ScDocument*, const ScRange& rRange, const CharSet eDest ) = 0;
 
+    virtual ScOrcusFilters* GetOrcusFilters() = 0;
+
 protected:
     ~ScFormatFilterPlugin() {}
 };
diff --git a/sc/inc/orcusfilters.hxx b/sc/inc/orcusfilters.hxx
new file mode 100644
index 0000000..5beede2
--- /dev/null
+++ b/sc/inc/orcusfilters.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ *   Copyright (C) 2012 Kohei Yoshida <kohei.yoshida at suse.com>
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#ifndef __SC_ORCUSHANDLER_HXX__
+#define __SC_ORCUSHANDLER_HXX__
+
+#include "rtl/ustring.hxx"
+
+class ScDocument;
+
+/**
+ * Collection of orcus filter wrappers.
+ */
+class ScOrcusFilters
+{
+public:
+    virtual bool importCSV(ScDocument& rDoc, const rtl::OUString& rPath) const = 0;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/orcushandler.hxx b/sc/inc/orcushandler.hxx
deleted file mode 100644
index 8ed04a4..0000000
--- a/sc/inc/orcushandler.hxx
+++ /dev/null
@@ -1,47 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * Version: MPL 1.1 / GPLv3+ / LGPLv3+
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License or as specified alternatively below. You may obtain a copy of
- * the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * Major Contributor(s):
- *   Copyright (C) 2012 Kohei Yoshida <kohei.yoshida at suse.com>
- *
- * All Rights Reserved.
- *
- * For minor contributions see the git repository.
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
- * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
- * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
- * instead of those above.
- */
-
-#ifndef __SC_ORCUSHANDLER_HXX__
-#define __SC_ORCUSHANDLER_HXX__
-
-#include "rtl/ustring.hxx"
-
-class ScDocument;
-
-/**
- * Collection of orcus filter wrappers.
- */
-class ScOrcusFilters
-{
-public:
-    static bool importCSV(ScDocument& rDoc, const rtl::OUString& rPath);
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/tool/orcushandler.cxx b/sc/source/core/tool/orcushandler.cxx
deleted file mode 100644
index 3599b27..0000000
--- a/sc/source/core/tool/orcushandler.cxx
+++ /dev/null
@@ -1,173 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * Version: MPL 1.1 / GPLv3+ / LGPLv3+
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License or as specified alternatively below. You may obtain a copy of
- * the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * Major Contributor(s):
- *   Copyright (C) 2012 Kohei Yoshida <kohei.yoshida at suse.com>
- *
- * All Rights Reserved.
- *
- * For minor contributions see the git repository.
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
- * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
- * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
- * instead of those above.
- */
-
-#include "orcushandler.hxx"
-#include "document.hxx"
-
-#include "tools/urlobj.hxx"
-
-#include <orcus/spreadsheet/import_interface.hpp>
-#include <orcus/orcus_csv.hpp>
-
-#include <boost/ptr_container/ptr_vector.hpp>
-
-using orcus::spreadsheet::row_t;
-using orcus::spreadsheet::col_t;
-using orcus::spreadsheet::formula_grammar_t;
-
-namespace {
-
-class ScOrcusSheet;
-
-class ScOrcusFactory : public orcus::spreadsheet::iface::import_factory
-{
-    ScDocument& mrDoc;
-    boost::ptr_vector<ScOrcusSheet> maSheets;
-
-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;
-    SCTAB mnTab;
-public:
-    ScOrcusSheet(ScDocument& rDoc, SCTAB nTab);
-
-    virtual void set_auto(row_t row, col_t col, const char* p, size_t n);
-    virtual void set_format(row_t row, col_t col, size_t xf_index);
-    virtual void set_formula(row_t row, col_t col, formula_grammar_t grammar, const char* p, size_t n);
-    virtual void set_formula_result(row_t row, col_t col, const char* p, size_t n);
-    virtual void set_shared_formula(
-        row_t row, col_t col, 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(row_t row, col_t col, size_t sindex);
-    virtual void set_string(row_t row, col_t col, size_t sindex);
-    virtual void set_value(row_t row, col_t col, double value);
-};
-
-ScOrcusFactory::ScOrcusFactory(ScDocument& rDoc) : mrDoc(rDoc) {}
-
-orcus::spreadsheet::iface::import_sheet* ScOrcusFactory::append_sheet(const char* sheet_name, size_t sheet_name_length)
-{
-    OUString aTabName(sheet_name, sheet_name_length, RTL_TEXTENCODING_UTF8);
-    if (!mrDoc.InsertTab(SC_TAB_APPEND, aTabName))
-        return NULL;
-
-    SCTAB nTab = mrDoc.GetTableCount() - 1;
-    maSheets.push_back(new ScOrcusSheet(mrDoc, nTab));
-    return &maSheets.back();
-}
-
-orcus::spreadsheet::iface::import_sheet* ScOrcusFactory::get_sheet(const char* /*sheet_name*/, size_t /*sheet_name_length*/)
-{
-    // TODO: Implement this.
-    return NULL;
-}
-
-orcus::spreadsheet::iface::import_shared_strings* ScOrcusFactory::get_shared_strings()
-{
-    // We don't support it yet.
-    return NULL;
-}
-
-orcus::spreadsheet::iface::import_styles* ScOrcusFactory::get_styles()
-{
-    // We don't support it yet.
-    return NULL;
-}
-
-ScOrcusSheet::ScOrcusSheet(ScDocument& rDoc, SCTAB nTab) :
-    mrDoc(rDoc), mnTab(nTab) {}
-
-void ScOrcusSheet::set_auto(row_t row, col_t col, const char* p, size_t n)
-{
-    OUString aVal(p, n, RTL_TEXTENCODING_UTF8);
-    mrDoc.SetString(col, row, mnTab, aVal);
-}
-
-void ScOrcusSheet::set_format(row_t /*row*/, col_t /*col*/, size_t /*xf_index*/)
-{
-}
-
-void ScOrcusSheet::set_formula(
-    row_t /*row*/, col_t /*col*/, formula_grammar_t /*grammar*/, const char* /*p*/, size_t /*n*/)
-{
-}
-
-void ScOrcusSheet::set_formula_result(row_t /*row*/, col_t /*col*/, const char* /*p*/, size_t /*n*/)
-{
-}
-
-void ScOrcusSheet::set_shared_formula(
-    row_t /*row*/, col_t /*col*/, formula_grammar_t /*grammar*/, size_t /*sindex*/,
-    const char* /*p_formula*/, size_t /*n_formula*/, const char* /*p_range*/, size_t /*n_range*/)
-{
-}
-
-void ScOrcusSheet::set_shared_formula(row_t /*row*/, col_t /*col*/, size_t /*sindex*/)
-{
-}
-
-void ScOrcusSheet::set_string(row_t /*row*/, col_t /*col*/, size_t /*sindex*/)
-{
-}
-
-void ScOrcusSheet::set_value(row_t /*row*/, col_t /*col*/, double /*value*/)
-{
-}
-
-} // anonymous namespace
-
-bool ScOrcusFilters::importCSV(ScDocument& rDoc, const OUString& rPath)
-{
-    ScOrcusFactory aFactory(rDoc);
-    INetURLObject aURL(rPath);
-    const char* path = rtl::OUStringToOString(aURL.getFSysPath(INetURLObject::FSYS_UNX), RTL_TEXTENCODING_UTF8).getStr();
-
-    try
-    {
-        orcus::orcus_csv filter(&aFactory);
-        filter.read_file(path);
-    }
-    catch (const std::exception&)
-    {
-        rDoc.InsertTab(SC_TAB_APPEND, OUString("Foo"));
-        rDoc.SetString(0, 0, 0, "Failed to load!!!");
-        return false;
-    }
-    return true;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/ftools/ftools.cxx b/sc/source/filter/ftools/ftools.cxx
index bbfbe41..352b3ab 100644
--- a/sc/source/filter/ftools/ftools.cxx
+++ b/sc/source/filter/ftools/ftools.cxx
@@ -41,6 +41,7 @@
 #include "stlpool.hxx"
 #include "stlsheet.hxx"
 #include "compiler.hxx"
+#include "orcusfiltersimpl.hxx"
 
 #include <stdio.h>
 
@@ -358,10 +359,13 @@ bool ScfTools::GetHTMLNameFromName( const String& rSource, String& rName )
     return rName.Len() > 0;
 }
 
-// ============================================================================
+ScFormatFilterPluginImpl::ScFormatFilterPluginImpl() {}
+ScFormatFilterPluginImpl::~ScFormatFilterPluginImpl() {}
 
-ScFormatFilterPluginImpl::ScFormatFilterPluginImpl()
+ScOrcusFilters* ScFormatFilterPluginImpl::GetOrcusFilters()
 {
+    static ScOrcusFiltersImpl aImpl;
+    return &aImpl;
 }
 
 SAL_DLLPUBLIC_EXPORT ScFormatFilterPlugin * SAL_CALL ScFilterCreate(void)
diff --git a/sc/source/filter/inc/ftools.hxx b/sc/source/filter/inc/ftools.hxx
index 1ffd57f..323586f 100644
--- a/sc/source/filter/inc/ftools.hxx
+++ b/sc/source/filter/inc/ftools.hxx
@@ -289,10 +289,11 @@ typedef ::std::vector< ::rtl::OUString >            ScfStringVec;
 
 // ----------------------------------------------------------------------------
 
-class ScFormatFilterPluginImpl : public ScFormatFilterPlugin {
-  public:
+class ScFormatFilterPluginImpl : public ScFormatFilterPlugin
+{
+public:
     ScFormatFilterPluginImpl();
-    virtual ~ScFormatFilterPluginImpl() {}
+    virtual ~ScFormatFilterPluginImpl();
     // various import filters
     virtual FltError ScImportLotus123( SfxMedium&, ScDocument*, CharSet eSrc = RTL_TEXTENCODING_DONTKNOW );
     virtual FltError ScImportQuattroPro( SfxMedium &rMedium, ScDocument *pDoc );
@@ -322,6 +323,8 @@ class ScFormatFilterPluginImpl : public ScFormatFilterPlugin {
     virtual FltError ScExportHTML( SvStream&, const String& rBaseURL, ScDocument*, const ScRange& rRange, const CharSet eDest, bool bAll,
                   const String& rStreamPath, String& rNonConvertibleChars );
     virtual FltError ScExportRTF( SvStream&, ScDocument*, const ScRange& rRange, const CharSet eDest );
+
+    virtual ScOrcusFilters* GetOrcusFilters();
 };
 
 // ============================================================================
diff --git a/sc/source/filter/inc/orcusfiltersimpl.hxx b/sc/source/filter/inc/orcusfiltersimpl.hxx
new file mode 100644
index 0000000..090c52f
--- /dev/null
+++ b/sc/source/filter/inc/orcusfiltersimpl.hxx
@@ -0,0 +1,18 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "orcusfilters.hxx"
+
+class ScOrcusFiltersImpl : public ScOrcusFilters
+{
+public:
+    virtual bool importCSV(ScDocument& rDoc, const rtl::OUString& rPath) const;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/orcus/orcusfiltersimpl.cxx b/sc/source/filter/orcus/orcusfiltersimpl.cxx
new file mode 100644
index 0000000..0723744
--- /dev/null
+++ b/sc/source/filter/orcus/orcusfiltersimpl.cxx
@@ -0,0 +1,174 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ *   Copyright (C) 2012 Kohei Yoshida <kohei.yoshida at suse.com>
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include "document.hxx"
+
+#include "tools/urlobj.hxx"
+
+#include "orcusfiltersimpl.hxx"
+
+#include <orcus/spreadsheet/import_interface.hpp>
+#include <orcus/orcus_csv.hpp>
+
+#include <boost/ptr_container/ptr_vector.hpp>
+
+using orcus::spreadsheet::row_t;
+using orcus::spreadsheet::col_t;
+using orcus::spreadsheet::formula_grammar_t;
+
+namespace {
+
+class ScOrcusSheet;
+
+class ScOrcusFactory : public orcus::spreadsheet::iface::import_factory
+{
+    ScDocument& mrDoc;
+    boost::ptr_vector<ScOrcusSheet> maSheets;
+
+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;
+    SCTAB mnTab;
+public:
+    ScOrcusSheet(ScDocument& rDoc, SCTAB nTab);
+
+    virtual void set_auto(row_t row, col_t col, const char* p, size_t n);
+    virtual void set_format(row_t row, col_t col, size_t xf_index);
+    virtual void set_formula(row_t row, col_t col, formula_grammar_t grammar, const char* p, size_t n);
+    virtual void set_formula_result(row_t row, col_t col, const char* p, size_t n);
+    virtual void set_shared_formula(
+        row_t row, col_t col, 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(row_t row, col_t col, size_t sindex);
+    virtual void set_string(row_t row, col_t col, size_t sindex);
+    virtual void set_value(row_t row, col_t col, double value);
+};
+
+ScOrcusFactory::ScOrcusFactory(ScDocument& rDoc) : mrDoc(rDoc) {}
+
+orcus::spreadsheet::iface::import_sheet* ScOrcusFactory::append_sheet(const char* sheet_name, size_t sheet_name_length)
+{
+    OUString aTabName(sheet_name, sheet_name_length, RTL_TEXTENCODING_UTF8);
+    if (!mrDoc.InsertTab(SC_TAB_APPEND, aTabName))
+        return NULL;
+
+    SCTAB nTab = mrDoc.GetTableCount() - 1;
+    maSheets.push_back(new ScOrcusSheet(mrDoc, nTab));
+    return &maSheets.back();
+}
+
+orcus::spreadsheet::iface::import_sheet* ScOrcusFactory::get_sheet(const char* /*sheet_name*/, size_t /*sheet_name_length*/)
+{
+    // TODO: Implement this.
+    return NULL;
+}
+
+orcus::spreadsheet::iface::import_shared_strings* ScOrcusFactory::get_shared_strings()
+{
+    // We don't support it yet.
+    return NULL;
+}
+
+orcus::spreadsheet::iface::import_styles* ScOrcusFactory::get_styles()
+{
+    // We don't support it yet.
+    return NULL;
+}
+
+ScOrcusSheet::ScOrcusSheet(ScDocument& rDoc, SCTAB nTab) :
+    mrDoc(rDoc), mnTab(nTab) {}
+
+void ScOrcusSheet::set_auto(row_t row, col_t col, const char* p, size_t n)
+{
+    OUString aVal(p, n, RTL_TEXTENCODING_UTF8);
+    mrDoc.SetString(col, row, mnTab, aVal);
+}
+
+void ScOrcusSheet::set_format(row_t /*row*/, col_t /*col*/, size_t /*xf_index*/)
+{
+}
+
+void ScOrcusSheet::set_formula(
+    row_t /*row*/, col_t /*col*/, formula_grammar_t /*grammar*/, const char* /*p*/, size_t /*n*/)
+{
+}
+
+void ScOrcusSheet::set_formula_result(row_t /*row*/, col_t /*col*/, const char* /*p*/, size_t /*n*/)
+{
+}
+
+void ScOrcusSheet::set_shared_formula(
+    row_t /*row*/, col_t /*col*/, formula_grammar_t /*grammar*/, size_t /*sindex*/,
+    const char* /*p_formula*/, size_t /*n_formula*/, const char* /*p_range*/, size_t /*n_range*/)
+{
+}
+
+void ScOrcusSheet::set_shared_formula(row_t /*row*/, col_t /*col*/, size_t /*sindex*/)
+{
+}
+
+void ScOrcusSheet::set_string(row_t /*row*/, col_t /*col*/, size_t /*sindex*/)
+{
+}
+
+void ScOrcusSheet::set_value(row_t /*row*/, col_t /*col*/, double /*value*/)
+{
+}
+
+} // anonymous namespace
+
+bool ScOrcusFiltersImpl::importCSV(ScDocument& rDoc, const OUString& rPath) const
+{
+    ScOrcusFactory aFactory(rDoc);
+    INetURLObject aURL(rPath);
+    const char* path = rtl::OUStringToOString(aURL.getFSysPath(INetURLObject::FSYS_UNX), RTL_TEXTENCODING_UTF8).getStr();
+
+    try
+    {
+        orcus::orcus_csv filter(&aFactory);
+        filter.read_file(path);
+    }
+    catch (const std::exception&)
+    {
+        rDoc.InsertTab(SC_TAB_APPEND, OUString("Foo"));
+        rDoc.SetString(0, 0, 0, "Failed to load!!!");
+        return false;
+    }
+    return true;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 94e5103..26a470c 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -112,7 +112,7 @@
 #include "cellsuno.hxx"
 #include "dpobject.hxx"
 #include "markdata.hxx"
-#include "orcushandler.hxx"
+#include "orcusfilters.hxx"
 
 #ifdef ENABLE_TELEPATHY
 #include "sccollaboration.hxx"
@@ -1503,7 +1503,11 @@ bool ScDocShell::LoadExternal(SfxMedium& rMed, const OUString& rProvider)
 {
     if (rProvider == "orcus")
     {
-        if (!ScOrcusFilters::importCSV(aDocument, rMed.GetName()))
+        ScOrcusFilters* pOrcus = ScFormatFilter::Get().GetOrcusFilters();
+        if (!pOrcus)
+            return false;
+
+        if (!pOrcus->importCSV(aDocument, rMed.GetName()))
             return false;
 
         FinishedLoading(SFX_LOADED_MAINDOCUMENT | SFX_LOADED_IMAGES);
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index d110481..f2b36a4 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -2229,6 +2229,8 @@ class ScFormatFilterMissing : public ScFormatFilterPlugin {
     virtual FltError ScExportHTML( SvStream&, const String&, ScDocument*, const ScRange&, const CharSet, bool,
                   const String&, String& ) RETURN_ERROR
     virtual FltError ScExportRTF( SvStream&, ScDocument*, const ScRange&, const CharSet ) RETURN_ERROR
+
+    virtual ScOrcusFilters* GetOrcusFilters() { return NULL; }
 };
 
 extern "C" { static void SAL_CALL thisModule() {} }
commit c8b7e9822257938e9b1d1c6f7d93d085b06d5e96
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri Aug 31 10:11:32 2012 -0400

    Let's use static archive instead of shared object for liborcus.
    
    Change-Id: I5e33dac1025b1b3e5f49baf67c80da37d8e2ca5d

diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index d7d4a18..7a1289e 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -1869,10 +1869,13 @@ endef
 
 else # !SYSTEM_LIBORCUS
 
-define gb_LinkTarget__use_orcus
+$(eval $(call gb_Helper_register_static_libraries,PLAINLIBS, \
+	orcus-0.2 \
+))
 
-$(call gb_LinkTarget_add_libs,$(1),\
-	-lorcus-0.2 \
+define gb_LinkTarget__use_orcus
+$(call gb_LinkTarget_use_static_libraries,$(1),\
+	orcus-0.2 \
 )
 
 endef
diff --git a/liborcus/makefile.mk b/liborcus/makefile.mk
index a3b680c..e57bb08 100644
--- a/liborcus/makefile.mk
+++ b/liborcus/makefile.mk
@@ -33,7 +33,7 @@ TARGET=orcus
 .ENDIF
 
 TARFILE_NAME=liborcus_0.1.0
-TARFILE_MD5=3c9d8bd223637b9bca77bcf90d4366aa
+TARFILE_MD5=870f887bad82663146676017671efb60
 
 PATCH_FILES=
 
diff --git a/liborcus/prj/d.lst b/liborcus/prj/d.lst
index d491782..7c83728 100644
--- a/liborcus/prj/d.lst
+++ b/liborcus/prj/d.lst
@@ -4,7 +4,6 @@ mkdir: %_DEST%\inc\orcus\spreadsheet
 ..\%__SRC%\misc\build\liborcus*\include\orcus\*.hpp %_DEST%\inc\orcus\
 ..\%__SRC%\misc\build\liborcus*\include\orcus\spreadsheet\*.hpp %_DEST%\inc\orcus\spreadsheet\
 
-..\%__SRC%\misc\build\liborcus*\src\liborcus\.libs\liborcus-0.2.so.0 %_DEST%\lib\
-symlink: %_DEST%\lib\liborcus-0.2.so.0 %_DEST%\lib\liborcus-0.2.so
+..\%__SRC%\misc\build\liborcus*\src\liborcus\.libs\liborcus-0.2.a %_DEST%\lib\
 
 ..\%__SRC%\slb\*.lib %_DEST%\lib\*.lib
diff --git a/scp2/source/ooo/file_library_ooo.scp b/scp2/source/ooo/file_library_ooo.scp
index 5207804..928174b 100644
--- a/scp2/source/ooo/file_library_ooo.scp
+++ b/scp2/source/ooo/file_library_ooo.scp
@@ -1882,21 +1882,3 @@ SPECIAL_COMPONENT_LIB_FILE( gid_File_Lib_Lomenubar, lomenubar.uno )
 STD_LIB_FILE( gid_File_Lib_Tubes , tubes)
 #endif
 
-#ifndef SYSTEM_LIBORCUS
-
-File gid_File_Lib_Liborcus
-    LIB_FILE_BODY;
-    Styles = (PACKED);
-    Dir = SCP2_OOO_BIN_DIR;
-  #ifdef UNX
-    #ifdef MACOSX
-       Name = STRING(CONCAT3(liborcus-0.2,0,UNXSUFFIX));
-    #else
-       Name = STRING(CONCAT3(liborcus-0.2,UNXSUFFIX,.0));
-    #endif
-  #elif defined(WNT)
-       Name = "liborcus-0.2.dll";
-  #endif
-End
-
-#endif
commit 0df51f70be7eae0caaea24a24e8db69de189bb16
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri Aug 31 09:40:12 2012 -0400

    Updated the package, to reduce the size from 2.5M to 304K.
    
    Debug symbols were included.  Removed that.
    
    Change-Id: Ie8190f69fe9e04be591d41b76ad93611d5553f55

diff --git a/liborcus/makefile.mk b/liborcus/makefile.mk
index 5958a42..a3b680c 100644
--- a/liborcus/makefile.mk
+++ b/liborcus/makefile.mk
@@ -33,7 +33,7 @@ TARGET=orcus
 .ENDIF
 
 TARFILE_NAME=liborcus_0.1.0
-TARFILE_MD5=17cfc0065e7d250af3e5754cee97e652
+TARFILE_MD5=3c9d8bd223637b9bca77bcf90d4366aa
 
 PATCH_FILES=
 
@@ -41,6 +41,7 @@ CONFIGURE_DIR=
 CONFIGURE_ACTION=./autogen.sh \
 	--with-mdds-include-path=$(OUTDIR)/inc \
 	--disable-libzip \
+	--disable-debug \
 	--disable-spreadsheet-model
 
 BUILD_ACTION=make
commit 31f589b03a3ed9a60e3548e821c2ea1ebe1b7f76
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Thu Aug 30 23:26:59 2012 -0400

    Get internal liborcus to build.
    
    Change-Id: Ie08f8b608c5b71e5375793e6cf9054ea75d7732d

diff --git a/Makefile.top b/Makefile.top
index b8ec2f2..9b65103 100644
--- a/Makefile.top
+++ b/Makefile.top
@@ -210,6 +210,7 @@ libexttextcat\
 libgsf\
 liblangtag\
 libmspub\
+liborcus\
 libpng\
 librsvg\
 libvisio\
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 6cecad6..d7d4a18 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -1856,31 +1856,28 @@ $(eval $(call gb_Helper_register_libraries,PLAINLIBS_OOO,\
 
 endif # SYSTEM_PYTHON
 
-ifeq ($(SYSTEM_ORCUS),YES)
+ifeq ($(SYSTEM_LIBORCUS),YES)
 
 define gb_LinkTarget__use_orcus
 $(call gb_LinkTarget_set_include,$(1),\
 	$$(INCLUDE) \
-    $(ORCUS_CFLAGS) \
+    $(LIBORCUS_CFLAGS) \
 )
-$(call gb_LinkTarget_add_libs,$(1),$(ORCUS_LIBS))
+$(call gb_LinkTarget_add_libs,$(1),$(LIBORCUS_LIBS))
 
 endef
 
-else # !SYSTEM_ORCUS
-
-$(eval $(call gb_Helper_register_static_libraries,PLAINLIBS, \
-	orcuslib \
-))
+else # !SYSTEM_LIBORCUS
 
 define gb_LinkTarget__use_orcus
-$(call gb_LinkTarget_use_static_libraries,$(1),\
-	orcuslib \
+
+$(call gb_LinkTarget_add_libs,$(1),\
+	-lorcus-0.2 \
 )
 
 endef
 
-endif # SYSTEM_ORCUS
+endif # SYSTEM_LIBORCUS
 
 # MacOSX-only frameworks ############################################
 # (in alphabetical order)
diff --git a/configure.in b/configure.in
index f22a493..4e37bcd 100644
--- a/configure.in
+++ b/configure.in
@@ -8599,18 +8599,18 @@ dnl ===================================================================
 AC_MSG_CHECKING([which orcus library to use])
 if test "$with_system_orcus" = "yes"; then
     AC_MSG_RESULT([external])
-    SYSTEM_ORCUS=YES
-    ORCUS_CFLAGS="`$PKG_CONFIG --cflags liborcus-0.2`"
-    ORCUS_LIBS="`$PKG_CONFIG --libs liborcus-0.2`"
+    SYSTEM_LIBORCUS=YES
+    LIBORCUS_CFLAGS="`$PKG_CONFIG --cflags liborcus-0.2`"
+    LIBORCUS_LIBS="`$PKG_CONFIG --libs liborcus-0.2`"
     PKG_CHECK_MODULES(ORCUS, orcus >= 0.1.0)
 else
     AC_MSG_RESULT([internal])
-    BUILD_TYPE="$BUILD_TYPE ORCUS"
-    SYSTEM_ORCUS=NO
+    BUILD_TYPE="$BUILD_TYPE LIBORCUS"
+    SYSTEM_LIBORCUS=NO
 fi
-AC_SUBST(SYSTEM_ORCUS)
-AC_SUBST(ORCUS_CFLAGS)
-AC_SUBST(ORCUS_LIBS)
+AC_SUBST(SYSTEM_LIBORCUS)
+AC_SUBST(LIBORCUS_CFLAGS)
+AC_SUBST(LIBORCUS_LIBS)
 
 dnl ===================================================================
 dnl Check for system hunspell
diff --git a/liborcus/makefile.mk b/liborcus/makefile.mk
new file mode 100644
index 0000000..5958a42
--- /dev/null
+++ b/liborcus/makefile.mk
@@ -0,0 +1,54 @@
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# This file incorporates work covered by the following license notice:
+#
+#   Licensed to the Apache Software Foundation (ASF) under one or more
+#   contributor license agreements. See the NOTICE file distributed
+#   with this work for additional information regarding copyright
+#   ownership. The ASF licenses this file to you under the Apache
+#   License, Version 2.0 (the "License"); you may not use this file
+#   except in compliance with the License. You may obtain a copy of
+#   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+#
+
+PRJ=.
+
+PRJNAME=orcus
+TARGET=orcus
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE :	settings.mk
+
+# --- Files --------------------------------------------------------
+
+.IF "$(SYSTEM_LIBORCUS)" == "YES"
+ at all:
+    @echo "Using system liborcus..."
+.ENDIF
+
+TARFILE_NAME=liborcus_0.1.0
+TARFILE_MD5=17cfc0065e7d250af3e5754cee97e652
+
+PATCH_FILES=
+
+CONFIGURE_DIR=
+CONFIGURE_ACTION=./autogen.sh \
+	--with-mdds-include-path=$(OUTDIR)/inc \
+	--disable-libzip \
+	--disable-spreadsheet-model
+
+BUILD_ACTION=make
+BUILD_DIR=
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : set_ext.mk
+.INCLUDE :	target.mk
+.INCLUDE :	tg_ext.mk
+
diff --git a/liborcus/prj/build.lst b/liborcus/prj/build.lst
new file mode 100644
index 0000000..70eeee5
--- /dev/null
+++ b/liborcus/prj/build.lst
@@ -0,0 +1,3 @@
+orcus	liborcus	: BOOST:boost MDDS:mdds NULL
+orcus	liborcus	usr1	-	all	orcus_mkout NULL
+orcus	liborcus	nmake	-	all	orcus_liborcus NULL
diff --git a/liborcus/prj/d.lst b/liborcus/prj/d.lst
new file mode 100644
index 0000000..d491782
--- /dev/null
+++ b/liborcus/prj/d.lst
@@ -0,0 +1,10 @@
+mkdir: %_DEST%\inc\orcus
+mkdir: %_DEST%\inc\orcus\spreadsheet
+
+..\%__SRC%\misc\build\liborcus*\include\orcus\*.hpp %_DEST%\inc\orcus\
+..\%__SRC%\misc\build\liborcus*\include\orcus\spreadsheet\*.hpp %_DEST%\inc\orcus\spreadsheet\
+
+..\%__SRC%\misc\build\liborcus*\src\liborcus\.libs\liborcus-0.2.so.0 %_DEST%\lib\
+symlink: %_DEST%\lib\liborcus-0.2.so.0 %_DEST%\lib\liborcus-0.2.so
+
+..\%__SRC%\slb\*.lib %_DEST%\lib\*.lib
diff --git a/liborcus/prj/dmake b/liborcus/prj/dmake
new file mode 100644
index 0000000..e69de29
diff --git a/sc/prj/build.lst b/sc/prj/build.lst
index c782f35..5711a35 100644
--- a/sc/prj/build.lst
+++ b/sc/prj/build.lst
@@ -1,2 +1,2 @@
-sc      sc      : basic filter TRANSLATIONS:translations vbahelper oovbaapi svx uui stoc BOOST:boost formula mdds oox LIBXSLT:libxslt unoxml ure test xmloff desktop ucb package configmgr officecfg scripting chart2 eventattacher forms scaddins xmlsecurity tubes NULL
+sc      sc      : basic filter TRANSLATIONS:translations vbahelper oovbaapi svx uui stoc BOOST:boost formula MDDS:mdds oox LIBXSLT:libxslt unoxml ure test xmloff desktop ucb package configmgr officecfg scripting chart2 eventattacher forms scaddins xmlsecurity tubes LIBORCUS:liborcus NULL
 sc sc\prj nmake - all sc_prj NULL
diff --git a/sc/source/core/tool/orcushandler.cxx b/sc/source/core/tool/orcushandler.cxx
index 2fa5e89..3599b27 100644
--- a/sc/source/core/tool/orcushandler.cxx
+++ b/sc/source/core/tool/orcushandler.cxx
@@ -31,20 +31,20 @@
 
 #include "tools/urlobj.hxx"
 
-#include <orcus/model/interface.hpp>
+#include <orcus/spreadsheet/import_interface.hpp>
 #include <orcus/orcus_csv.hpp>
 
 #include <boost/ptr_container/ptr_vector.hpp>
 
-using orcus::model::row_t;
-using orcus::model::col_t;
-using orcus::model::formula_grammar_t;
+using orcus::spreadsheet::row_t;
+using orcus::spreadsheet::col_t;
+using orcus::spreadsheet::formula_grammar_t;
 
 namespace {
 
 class ScOrcusSheet;
 
-class ScOrcusFactory : public orcus::model::iface::factory
+class ScOrcusFactory : public orcus::spreadsheet::iface::import_factory
 {
     ScDocument& mrDoc;
     boost::ptr_vector<ScOrcusSheet> maSheets;
@@ -52,12 +52,13 @@ class ScOrcusFactory : public orcus::model::iface::factory
 public:
     ScOrcusFactory(ScDocument& rDoc);
 
-    virtual orcus::model::iface::sheet* append_sheet(const char *sheet_name, size_t sheet_name_length);
-    virtual orcus::model::iface::shared_strings* get_shared_strings();
-    virtual orcus::model::iface::styles* get_styles();
+    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::model::iface::sheet
+class ScOrcusSheet : public orcus::spreadsheet::iface::import_sheet
 {
     ScDocument& mrDoc;
     SCTAB mnTab;
@@ -78,7 +79,7 @@ public:
 
 ScOrcusFactory::ScOrcusFactory(ScDocument& rDoc) : mrDoc(rDoc) {}
 
-orcus::model::iface::sheet* ScOrcusFactory::append_sheet(const char* sheet_name, size_t sheet_name_length)
+orcus::spreadsheet::iface::import_sheet* ScOrcusFactory::append_sheet(const char* sheet_name, size_t sheet_name_length)
 {
     OUString aTabName(sheet_name, sheet_name_length, RTL_TEXTENCODING_UTF8);
     if (!mrDoc.InsertTab(SC_TAB_APPEND, aTabName))
@@ -89,13 +90,19 @@ orcus::model::iface::sheet* ScOrcusFactory::append_sheet(const char* sheet_name,
     return &maSheets.back();
 }
 
-orcus::model::iface::shared_strings* ScOrcusFactory::get_shared_strings()
+orcus::spreadsheet::iface::import_sheet* ScOrcusFactory::get_sheet(const char* /*sheet_name*/, size_t /*sheet_name_length*/)
+{
+    // TODO: Implement this.
+    return NULL;
+}
+
+orcus::spreadsheet::iface::import_shared_strings* ScOrcusFactory::get_shared_strings()
 {
     // We don't support it yet.
     return NULL;
 }
 
-orcus::model::iface::styles* ScOrcusFactory::get_styles()
+orcus::spreadsheet::iface::import_styles* ScOrcusFactory::get_styles()
 {
     // We don't support it yet.
     return NULL;
diff --git a/scp2/source/ooo/file_library_ooo.scp b/scp2/source/ooo/file_library_ooo.scp
index dbb27f6..5207804 100644
--- a/scp2/source/ooo/file_library_ooo.scp
+++ b/scp2/source/ooo/file_library_ooo.scp
@@ -1881,3 +1881,22 @@ SPECIAL_COMPONENT_LIB_FILE( gid_File_Lib_Lomenubar, lomenubar.uno )
 #ifdef ENABLE_TELEPATHY
 STD_LIB_FILE( gid_File_Lib_Tubes , tubes)
 #endif
+
+#ifndef SYSTEM_LIBORCUS
+
+File gid_File_Lib_Liborcus
+    LIB_FILE_BODY;
+    Styles = (PACKED);
+    Dir = SCP2_OOO_BIN_DIR;
+  #ifdef UNX
+    #ifdef MACOSX
+       Name = STRING(CONCAT3(liborcus-0.2,0,UNXSUFFIX));
+    #else
+       Name = STRING(CONCAT3(liborcus-0.2,UNXSUFFIX,.0));
+    #endif
+  #elif defined(WNT)
+       Name = "liborcus-0.2.dll";
+  #endif
+End
+
+#endif
diff --git a/tail_build/prj/build.lst b/tail_build/prj/build.lst
index ace4490..cfdfbb9 100644
--- a/tail_build/prj/build.lst
+++ b/tail_build/prj/build.lst
@@ -1,2 +1,2 @@
-tb      tail_build : AFMS:afms APACHE_COMMONS:apache-commons BSH:beanshell BERKELEYDB:berkeleydb BOOST:boost CAIRO:cairo CPPUNIT:cppunit DESKTOP:codemaker CURL:curl EXPAT:expat FONTCONFIG:fontconfig FREETYPE:freetype GLIB:glib GRAPHITE:graphite HUNSPELL:hunspell HYPHEN:hyphen ICU:icu DESKTOP:l10ntools JFREEREPORT:jfreereport JPEG:jpeg LCMS2:lcms2 LIBCDR:libcdr LIBCMIS:libcmis LIBEXTTEXTCAT:libexttextcat LIBLANGTAG:liblangtag LIBMSPUB:libmspub LIBXML2:libxml2 libxmlsec LIBXSLT:libxslt LIBWPG:libwpg LIBWPS:libwps LIBWPD:libwpd LIBVISIO:libvisio LPSOLVE:lpsolve MOZ:moz MYTHES:mythes NEON:neon NSS:nss OPENLDAP:openldap OPENSSL:openssl POSTGRESQL:postgresql PYTHON:python REDLAND:redland SAXON:saxon TRANSLATIONS:translations XPDF:xpdf ZLIB:zlib bridges cli_ure comphelper cppu cppuhelper external jurt jvmaccess jvmfwk offapi officecfg DESKTOP:rdbmaker readlicense_oo RHINO:rhino ridljar sal salhelper solenv soltools stoc ucbhelper ucpp udkapi xmlreader xsltml NULL
+tb      tail_build : AFMS:afms APACHE_COMMONS:apache-commons BSH:beanshell BERKELEYDB:berkeleydb BOOST:boost CAIRO:cairo CPPUNIT:cppunit DESKTOP:codemaker CURL:curl EXPAT:expat FONTCONFIG:fontconfig FREETYPE:freetype GLIB:glib GRAPHITE:graphite HUNSPELL:hunspell HYPHEN:hyphen ICU:icu DESKTOP:l10ntools JFREEREPORT:jfreereport JPEG:jpeg LCMS2:lcms2 LIBCDR:libcdr LIBCMIS:libcmis LIBEXTTEXTCAT:libexttextcat LIBLANGTAG:liblangtag LIBMSPUB:libmspub LIBXML2:libxml2 libxmlsec LIBXSLT:libxslt LIBWPG:libwpg LIBWPS:libwps LIBWPD:libwpd LIBVISIO:libvisio LIBORCUS:liborcus LPSOLVE:lpsolve MDDS:mdds MOZ:moz MYTHES:mythes NEON:neon NSS:nss OPENLDAP:openldap OPENSSL:openssl POSTGRESQL:postgresql PYTHON:python REDLAND:redland SAXON:saxon TRANSLATIONS:translations XPDF:xpdf ZLIB:zlib bridges cli_ure comphelper cppu cppuhelper external jurt jvmaccess jvmfwk offapi officecfg DESKTOP:rdbmaker readlicense_oo RHINO:rhino ridljar sal salhelper solenv soltools stoc ucbhelper ucpp udkapi xmlreader xs
 ltml NULL
 tb tail_build\prj nmake - all tb_prj   NULL
commit a6639312005763d19e877bc61e6a844c09f5fb23
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri Jul 27 22:14:39 2012 -0400

    First cut on integrating liborcus into libreoffice tree....
    
    It introduces the 'FilterProvider' property in the media descriptor
    to optionally bypass the normal loading process and let the external
    filter provider to handle the loading.
    
    For now I'm overwriting the csv import filter just to see how this
    could work just as an experiment.
    
    Orcus still needs a lot of work, and it crashes very often at the
    moment.
    
    Change-Id: I11b34572c71073144804a7d0dd5176c8067d8deb

diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 796eae5..6cecad6 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -2,7 +2,7 @@
 #*************************************************************************
 #
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-# 
+#
 # Copyright 2009 by Sun Microsystems, Inc.
 #
 # OpenOffice.org - a multi-platform office productivity suite
@@ -1856,6 +1856,31 @@ $(eval $(call gb_Helper_register_libraries,PLAINLIBS_OOO,\
 
 endif # SYSTEM_PYTHON
 
+ifeq ($(SYSTEM_ORCUS),YES)
+
+define gb_LinkTarget__use_orcus
+$(call gb_LinkTarget_set_include,$(1),\
+	$$(INCLUDE) \
+    $(ORCUS_CFLAGS) \
+)
+$(call gb_LinkTarget_add_libs,$(1),$(ORCUS_LIBS))
+
+endef
+
+else # !SYSTEM_ORCUS
+
+$(eval $(call gb_Helper_register_static_libraries,PLAINLIBS, \
+	orcuslib \
+))
+
+define gb_LinkTarget__use_orcus
+$(call gb_LinkTarget_use_static_libraries,$(1),\
+	orcuslib \
+)
+
+endef
+
+endif # SYSTEM_ORCUS
 
 # MacOSX-only frameworks ############################################
 # (in alphabetical order)
diff --git a/comphelper/inc/comphelper/mediadescriptor.hxx b/comphelper/inc/comphelper/mediadescriptor.hxx
index e1b14a6..53dcffc 100644
--- a/comphelper/inc/comphelper/mediadescriptor.hxx
+++ b/comphelper/inc/comphelper/mediadescriptor.hxx
@@ -59,6 +59,7 @@ class COMPHELPER_DLLPUBLIC MediaDescriptor : public SequenceAsHashMap
         static const ::rtl::OUString& PROP_ENCRYPTIONDATA();
         static const ::rtl::OUString& PROP_FILENAME();
         static const ::rtl::OUString& PROP_FILTERNAME();
+        static const ::rtl::OUString& PROP_FILTERPROVIDER();
         static const ::rtl::OUString& PROP_FILTEROPTIONS();
         static const ::rtl::OUString& PROP_FRAME();
         static const ::rtl::OUString& PROP_FRAMENAME();
diff --git a/comphelper/source/misc/mediadescriptor.cxx b/comphelper/source/misc/mediadescriptor.cxx
index 095ba80..311ff5e 100644
--- a/comphelper/source/misc/mediadescriptor.cxx
+++ b/comphelper/source/misc/mediadescriptor.cxx
@@ -95,6 +95,12 @@ const ::rtl::OUString& MediaDescriptor::PROP_FILTERNAME()
     return sProp;
 }
 
+const OUString& MediaDescriptor::PROP_FILTERPROVIDER()
+{
+    static const OUString aProp("FilterProvider");
+    return aProp;
+}
+
 const ::rtl::OUString& MediaDescriptor::PROP_FILTEROPTIONS()
 {
     static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("FilterOptions"));
diff --git a/config_host.mk.in b/config_host.mk.in
index f85e3cb..c83ae44 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -415,6 +415,8 @@ export OOO_SHELL=@BASH@
 export OOO_VENDOR=@OOO_VENDOR@
 export OPENSSL_CFLAGS=@OPENSSL_CFLAGS@
 export OPENSSL_LIBS=@OPENSSL_LIBS@
+export ORCUS_CFLAGS=@ORCUS_CFLAGS@
+export ORCUS_LIBS=@ORCUS_LIBS@
 export OS=@OS@
 export OSVERSION=@OSVERSION@
 export OS_FOR_BUILD=@OS_FOR_BUILD@
@@ -551,6 +553,7 @@ export SYSTEM_NSS=@SYSTEM_NSS@
 export SYSTEM_ODBC_HEADERS=@SYSTEM_ODBC_HEADERS@
 export SYSTEM_OPENLDAP=@SYSTEM_OPENLDAP@
 export SYSTEM_OPENSSL=@SYSTEM_OPENSSL@
+export SYSTEM_ORCUS=@SYSTEM_ORCUS@
 export SYSTEM_PANGO=@SYSTEM_PANGO@
 export SYSTEM_POPPLER=@SYSTEM_POPPLER@
 export SYSTEM_POSTGRESQL=@SYSTEM_POSTGRESQL@
diff --git a/configure.in b/configure.in
index c5a9357..f22a493 100644
--- a/configure.in
+++ b/configure.in
@@ -1637,6 +1637,11 @@ AC_ARG_WITH(system-redland,
         [Use redland library already on system.]),,
     [with_system_redland="$with_system_libs"])
 
+AC_ARG_WITH(system-orcus,
+    AS_HELP_STRING([--with-system-orcus],
+        [Use orcus library already on system.]),,
+    [with_system_orcus="$with_system_libs"])
+
 AC_ARG_WITH(system-mozilla,
     AS_HELP_STRING([--with-system-mozilla],
         [Use Mozilla already on system. Note that some components cannot be built
@@ -4837,7 +4842,7 @@ _ACEOF
     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
 #include <iostream>
 using namespace std;
-]], [[ try { throw 42; } catch (int e) { cout << "Yep, " << e << endl; } ]])],[   
+]], [[ try { throw 42; } catch (int e) { cout << "Yep, " << e << endl; } ]])],[
             MINGW_GCCDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libgcc' | $SED -e 's at .*DLL Name: @@'`
             if test -n "$MINGW_GCCDLL"; then
                 MINGW_SHARED_GCCLIB=YES
@@ -4847,14 +4852,14 @@ using namespace std;
                 AC_MSG_RESULT([no])
             fi
        ],[ AC_MSG_RESULT([no])
-       
+
     ])
 
     AC_MSG_CHECKING([for dynamic libstdc++])
     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
 #include <iostream>
 using namespace std;
-]], [[ cout << "Hello there." << endl; ]])],[   
+]], [[ cout << "Hello there." << endl; ]])],[
             MINGW_GXXDLL=`$OBJDUMP -p conftest.exe | grep 'DLL Name: libstdc++' | $SED -e 's at .*DLL Name: @@'`
             if test -n "$MINGW_GXXDLL"; then
                 mingw_gxxdll_root=${MINGW_GXXDLL%.dll}
@@ -4871,7 +4876,7 @@ using namespace std;
                 AC_MSG_RESULT([no])
             fi
        ],[ AC_MSG_RESULT([no])
-       
+
     ])
 
     AC_LANG_POP([C++])
@@ -8589,6 +8594,25 @@ AC_SUBST([MINGW_REDLAND_DLL])
 AC_SUBST([MINGW_SQLITE3_DLL])
 
 dnl ===================================================================
+dnl Check for system orcus
+dnl ===================================================================
+AC_MSG_CHECKING([which orcus library to use])
+if test "$with_system_orcus" = "yes"; then
+    AC_MSG_RESULT([external])
+    SYSTEM_ORCUS=YES
+    ORCUS_CFLAGS="`$PKG_CONFIG --cflags liborcus-0.2`"
+    ORCUS_LIBS="`$PKG_CONFIG --libs liborcus-0.2`"
+    PKG_CHECK_MODULES(ORCUS, orcus >= 0.1.0)
+else
+    AC_MSG_RESULT([internal])
+    BUILD_TYPE="$BUILD_TYPE ORCUS"
+    SYSTEM_ORCUS=NO
+fi
+AC_SUBST(SYSTEM_ORCUS)
+AC_SUBST(ORCUS_CFLAGS)
+AC_SUBST(ORCUS_LIBS)
+
+dnl ===================================================================
 dnl Check for system hunspell
 dnl ===================================================================
 AC_MSG_CHECKING([which libhunspell to use])
diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx
index 02a8c7a..a4c042a 100644
--- a/framework/source/loadenv/loadenv.cxx
+++ b/framework/source/loadenv/loadenv.cxx
@@ -91,13 +91,13 @@
 const char PROP_TYPES[] = "Types";
 const char PROP_NAME[] = "Name";
 
-
-namespace framework{
+namespace framework {
 
 // may there exist already a define .-(
 #ifndef css
 namespace css = ::com::sun::star;
 #endif
+using namespace com::sun::star;
 
 
 class LoadEnvListener : private ThreadHelpBase
@@ -716,6 +716,37 @@ LoadEnv::EContentType LoadEnv::classifyContent(const ::rtl::OUString&
     return E_UNSUPPORTED_CONTENT;
 }
 
+namespace {
+
+bool queryOrcusTypeAndFilter(const uno::Sequence<beans::PropertyValue>& rDescriptor, OUString& rType, OUString& rFilter)
+{
+    OUString aURL;
+    sal_Int32 nSize = rDescriptor.getLength();
+    for (sal_Int32 i = 0; i < nSize; ++i)
+    {
+        const beans::PropertyValue& rProp = rDescriptor[i];
+        if (rProp.Name == "URL")
+        {
+            rProp.Value >>= aURL;
+            break;
+        }
+    }
+
+    if (aURL.isEmpty() || aURL.copy(0,8).equalsIgnoreAsciiCase("private:"))
+        return false;
+
+    if (aURL.endsWith(".csv"))
+    {
+        // Use .csv as the first test file type.
+        rType = "generic_Text";
+        rFilter = "orcus-test-filter";
+        return true;
+    }
+
+    return false;
+}
+
+}
 
 void LoadEnv::impl_detectTypeAndFilter()
     throw(LoadEnvException, css::uno::RuntimeException)
@@ -736,7 +767,18 @@ void LoadEnv::impl_detectTypeAndFilter()
     aReadLock.unlock();
     // <- SAFE
 
-    ::rtl::OUString sType;
+    rtl::OUString sType, sFilter;
+
+    if (queryOrcusTypeAndFilter(lDescriptor, sType, sFilter) && !sType.isEmpty() && !sFilter.isEmpty())
+    {
+        // Orcus type detected.  Skip the normal type detection process.
+        m_lMediaDescriptor << lDescriptor;
+        m_lMediaDescriptor[comphelper::MediaDescriptor::PROP_TYPENAME()] <<= sType;
+        m_lMediaDescriptor[comphelper::MediaDescriptor::PROP_FILTERNAME()] <<= sFilter;
+        m_lMediaDescriptor[comphelper::MediaDescriptor::PROP_FILTERPROVIDER()] <<= OUString("orcus");
+        return;
+    }
+
     css::uno::Reference< css::document::XTypeDetection > xDetect(xSMGR->createInstance(SERVICENAME_TYPEDETECTION), css::uno::UNO_QUERY);
     if (xDetect.is())
         sType = xDetect->queryTypeByDescriptor(lDescriptor, sal_True); /*TODO should deep detection be able for enable/disable it from outside? */
@@ -753,7 +795,7 @@ void LoadEnv::impl_detectTypeAndFilter()
     m_lMediaDescriptor[::comphelper::MediaDescriptor::PROP_TYPENAME()] <<= sType;
     // Is there an already detected (may be preselected) filter?
     // see below ...
-    ::rtl::OUString sFilter = m_lMediaDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_FILTERNAME(), ::rtl::OUString());
+    sFilter = m_lMediaDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_FILTERNAME(), ::rtl::OUString());
 
     aWriteLock.unlock();
     // <- SAFE
diff --git a/sc/CppunitTest_sc_ucalc.mk b/sc/CppunitTest_sc_ucalc.mk
index 817bec0..6710f8a 100644
--- a/sc/CppunitTest_sc_ucalc.mk
+++ b/sc/CppunitTest_sc_ucalc.mk
@@ -43,6 +43,10 @@ ifeq ($(ENABLE_TELEPATHY),TRUE)
 $(eval $(call gb_CppunitTest_use_libraries,sc_ucalc,tubes))
 endif
 
+$(eval $(call gb_CppunitTest_use_externals,sc_ucalc,\
+	orcus \
+))
+
 $(eval $(call gb_CppunitTest_use_libraries,sc_ucalc, \
     avmedia \
     basegfx \
diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 345c7b5..f83ba54 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -90,6 +90,10 @@ $(eval $(call gb_Library_use_libraries,sc,\
 	$(gb_STDLIBS) \
 ))
 
+$(eval $(call gb_Library_use_externals,sc,\
+	orcus \
+))
+
 $(eval $(call gb_Library_add_exception_objects,sc,\
 	sc/source/core/data/attarray \
 	sc/source/core/data/attrib \
@@ -210,6 +214,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
 	sc/source/core/tool/navicfg \
 	sc/source/core/tool/odffmap \
 	sc/source/core/tool/optutil \
+	sc/source/core/tool/orcushandler \
 	sc/source/core/tool/parclass \
 	sc/source/core/tool/printopt \
 	sc/source/core/tool/prnsave \
diff --git a/sc/inc/orcushandler.hxx b/sc/inc/orcushandler.hxx
new file mode 100644
index 0000000..8ed04a4
--- /dev/null
+++ b/sc/inc/orcushandler.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ *   Copyright (C) 2012 Kohei Yoshida <kohei.yoshida at suse.com>
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#ifndef __SC_ORCUSHANDLER_HXX__
+#define __SC_ORCUSHANDLER_HXX__
+
+#include "rtl/ustring.hxx"
+
+class ScDocument;
+
+/**
+ * Collection of orcus filter wrappers.
+ */
+class ScOrcusFilters
+{
+public:
+    static bool importCSV(ScDocument& rDoc, const rtl::OUString& rPath);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/tool/orcushandler.cxx b/sc/source/core/tool/orcushandler.cxx
new file mode 100644
index 0000000..2fa5e89
--- /dev/null
+++ b/sc/source/core/tool/orcushandler.cxx
@@ -0,0 +1,166 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ *   Copyright (C) 2012 Kohei Yoshida <kohei.yoshida at suse.com>
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include "orcushandler.hxx"
+#include "document.hxx"
+
+#include "tools/urlobj.hxx"
+
+#include <orcus/model/interface.hpp>
+#include <orcus/orcus_csv.hpp>
+
+#include <boost/ptr_container/ptr_vector.hpp>
+
+using orcus::model::row_t;
+using orcus::model::col_t;
+using orcus::model::formula_grammar_t;
+
+namespace {
+
+class ScOrcusSheet;
+
+class ScOrcusFactory : public orcus::model::iface::factory
+{
+    ScDocument& mrDoc;
+    boost::ptr_vector<ScOrcusSheet> maSheets;
+
+public:
+    ScOrcusFactory(ScDocument& rDoc);
+
+    virtual orcus::model::iface::sheet* append_sheet(const char *sheet_name, size_t sheet_name_length);
+    virtual orcus::model::iface::shared_strings* get_shared_strings();
+    virtual orcus::model::iface::styles* get_styles();
+};
+
+class ScOrcusSheet : public orcus::model::iface::sheet
+{
+    ScDocument& mrDoc;
+    SCTAB mnTab;
+public:
+    ScOrcusSheet(ScDocument& rDoc, SCTAB nTab);
+
+    virtual void set_auto(row_t row, col_t col, const char* p, size_t n);
+    virtual void set_format(row_t row, col_t col, size_t xf_index);
+    virtual void set_formula(row_t row, col_t col, formula_grammar_t grammar, const char* p, size_t n);
+    virtual void set_formula_result(row_t row, col_t col, const char* p, size_t n);
+    virtual void set_shared_formula(
+        row_t row, col_t col, 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(row_t row, col_t col, size_t sindex);
+    virtual void set_string(row_t row, col_t col, size_t sindex);
+    virtual void set_value(row_t row, col_t col, double value);
+};
+
+ScOrcusFactory::ScOrcusFactory(ScDocument& rDoc) : mrDoc(rDoc) {}
+
+orcus::model::iface::sheet* ScOrcusFactory::append_sheet(const char* sheet_name, size_t sheet_name_length)
+{
+    OUString aTabName(sheet_name, sheet_name_length, RTL_TEXTENCODING_UTF8);
+    if (!mrDoc.InsertTab(SC_TAB_APPEND, aTabName))
+        return NULL;
+
+    SCTAB nTab = mrDoc.GetTableCount() - 1;
+    maSheets.push_back(new ScOrcusSheet(mrDoc, nTab));
+    return &maSheets.back();
+}
+
+orcus::model::iface::shared_strings* ScOrcusFactory::get_shared_strings()
+{
+    // We don't support it yet.
+    return NULL;
+}
+
+orcus::model::iface::styles* ScOrcusFactory::get_styles()
+{
+    // We don't support it yet.
+    return NULL;
+}
+
+ScOrcusSheet::ScOrcusSheet(ScDocument& rDoc, SCTAB nTab) :
+    mrDoc(rDoc), mnTab(nTab) {}
+
+void ScOrcusSheet::set_auto(row_t row, col_t col, const char* p, size_t n)
+{
+    OUString aVal(p, n, RTL_TEXTENCODING_UTF8);
+    mrDoc.SetString(col, row, mnTab, aVal);
+}
+
+void ScOrcusSheet::set_format(row_t /*row*/, col_t /*col*/, size_t /*xf_index*/)
+{
+}
+
+void ScOrcusSheet::set_formula(
+    row_t /*row*/, col_t /*col*/, formula_grammar_t /*grammar*/, const char* /*p*/, size_t /*n*/)
+{
+}
+
+void ScOrcusSheet::set_formula_result(row_t /*row*/, col_t /*col*/, const char* /*p*/, size_t /*n*/)
+{
+}
+
+void ScOrcusSheet::set_shared_formula(
+    row_t /*row*/, col_t /*col*/, formula_grammar_t /*grammar*/, size_t /*sindex*/,

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list