[Libreoffice-commits] core.git: 33 commits - configure.ac download.lst framework/source liborcus/ExternalPackage_liborcus.mk liborcus/ExternalProject_liborcus.mk liborcus/liborcus_0.1.0-boost-include.patch.1 liborcus/UnpackedTarball_orcus.mk RepositoryExternal.mk sc/CppunitTest_sc_filters_test.mk sc/CppunitTest_sc_subsequent_export_test.mk sc/CppunitTest_sc_subsequent_filters_test.mk sc/CppunitTest_sc_ucalc.mk sc/inc sc/Library_scfilt.mk sc/qa sc/source sfx2/inc sfx2/source
Kohei Yoshida
kohei.yoshida at gmail.com
Fri Apr 12 22:51:59 PDT 2013
RepositoryExternal.mk | 11 +
configure.ac | 2
download.lst | 2
framework/source/loadenv/loadenv.cxx | 19 +
liborcus/ExternalPackage_liborcus.mk | 6
liborcus/ExternalProject_liborcus.mk | 45 +++-
liborcus/UnpackedTarball_orcus.mk | 3
liborcus/liborcus_0.1.0-boost-include.patch.1 | 26 --
sc/CppunitTest_sc_filters_test.mk | 1
sc/CppunitTest_sc_subsequent_export_test.mk | 1
sc/CppunitTest_sc_subsequent_filters_test.mk | 1
sc/CppunitTest_sc_ucalc.mk | 1
sc/Library_scfilt.mk | 1
sc/inc/globalnames.hxx | 2
sc/inc/orcusfilters.hxx | 9
sc/qa/unit/helper/qahelper.hxx | 1
sc/source/core/data/dbdocutl.cxx | 7
sc/source/core/data/dpgroup.cxx | 5
sc/source/core/data/dputil.cxx | 5
sc/source/core/tool/interpr2.cxx | 13 -
sc/source/filter/inc/orcusfiltersimpl.hxx | 6
sc/source/filter/inc/orcusinterface.hxx | 108 +++++++---
sc/source/filter/orcus/interface.cxx | 228 +++++++++++++++++----
sc/source/filter/orcus/orcusfiltersimpl.cxx | 79 ++++++-
sc/source/ui/docshell/docsh.cxx | 31 ++
sc/source/ui/inc/docsh.hxx | 2
sc/source/ui/view/viewfun6.cxx | 6
sfx2/inc/sfx2/docfilt.hxx | 19 +
sfx2/inc/sfx2/objsh.hxx | 4
sfx2/inc/sfx2/sfxbasemodel.hxx | 3
sfx2/source/bastyp/fltfnc.cxx | 2
sfx2/source/doc/docfile.cxx | 71 +++---
sfx2/source/doc/docfilt.cxx | 15 +
sfx2/source/doc/objstor.cxx | 6
sfx2/source/doc/sfxbasemodel.cxx | 279 +++++++++++++-------------
35 files changed, 691 insertions(+), 329 deletions(-)
New commits:
commit 0583907f2b6a9fc5ca2a6368a1c22c803a4fe758
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Sat Apr 13 00:41:13 2013 -0400
Handle hidden property for external filter loading as well.
Change-Id: I7a0154161d28e59c3e741fd592d3ce175676c901
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index fee8ea7..9024cd0 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -1823,6 +1823,16 @@ OUString getFilterProvider( SfxMedium& rMedium )
return pFilter->GetProviderName();
}
+void setUpdatePickList( SfxMedium* pMedium )
+{
+ bool bHidden = false;
+ SFX_ITEMSET_ARG(pMedium->GetItemSet(), pHidItem, SfxBoolItem, SID_HIDDEN, false);
+ if (pHidItem)
+ bHidden = pHidItem->GetValue();
+
+ pMedium->SetUpdatePickList(!bHidden);
+}
+
}
void SAL_CALL SfxBaseModel::load( const Sequence< beans::PropertyValue >& seqArguments )
@@ -1855,7 +1865,7 @@ void SAL_CALL SfxBaseModel::load( const Sequence< beans::PropertyValue >& seqA
nError = ERRCODE_IO_GENERAL;
handleLoadError(nError, pMedium);
- pMedium->SetUpdatePickList(false);
+ setUpdatePickList(pMedium);
return;
}
@@ -1943,20 +1953,13 @@ void SAL_CALL SfxBaseModel::load( const Sequence< beans::PropertyValue >& seqA
m_pData->m_pObjectShell->ResetError();
handleLoadError(nError, pMedium);
-
- loadCmisProperties( );
-
- sal_Bool bHidden = sal_False;
- SFX_ITEMSET_ARG( pMedium->GetItemSet(), pHidItem, SfxBoolItem, SID_HIDDEN, sal_False);
- if ( pHidItem )
- bHidden = pHidItem->GetValue();
+ loadCmisProperties();
+ setUpdatePickList(pMedium);
#if OSL_DEBUG_LEVEL > 0
SFX_ITEMSET_ARG( pMedium->GetItemSet(), pPasswdItem, SfxStringItem, SID_PASSWORD, sal_False);
OSL_ENSURE( !pPasswdItem, "There should be no Password property in the document MediaDescriptor!" );
#endif
- // !TODO: will be done by Framework!
- pMedium->SetUpdatePickList( !bHidden );
}
//________________________________________________________________________________________________________
commit 9f7ac9aeeb60ed521ef07323e904ffc9eb13b715
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri Apr 12 23:36:53 2013 -0400
Get cppunit in sc to link with orcus-parser.
Change-Id: I1f53a4f4b9beee501e29149ed88e3ce5d63d9a3c
diff --git a/download.lst b/download.lst
index b8948f4..90aa6e5 100644
--- a/download.lst
+++ b/download.lst
@@ -68,7 +68,7 @@ export NEON_TARBALL := ff369e69ef0f0143beb5626164e87ae2-neon-0.29.5.tar.gz
export NSS_TARBALL := a0a861f539f0e7a91d05e6b9457e4db1-nss-3.13.5-with-nspr-4.9.1.tar.gz
export OPENLDAP_TARBALL := 804c6cb5698db30b75ad0ff1c25baefd-openldap-2.4.31.tgz
export OPENSSL_TARBALL := 51a40a81b3b7abe8a5c33670bd3da0ce-openssl-0.9.8v.tar.gz
-export ORCUS_TARBALL := 5c4201c038183b2e9b69d317784b2245-liborcus-0.5.1.tar.bz2
+export ORCUS_TARBALL := ea2acaf140ae40a87a952caa75184f4d-liborcus-0.5.1.tar.bz2
export PIXMAN_TARBALL := c63f411b3ad147db2bcce1bf262a0e02-pixman-0.24.4.tar.bz2
export PNG_TARBALL := 9e5d864bce8f06751bbd99962ecf4aad-libpng-1.5.10.tar.gz
export POSTGRESQL_TARBALL := c0b4799ea9850eae3ead14f0a60e9418-postgresql-9.2.1.tar.bz2
diff --git a/liborcus/ExternalProject_liborcus.mk b/liborcus/ExternalProject_liborcus.mk
index f70a377..daded4d 100644
--- a/liborcus/ExternalProject_liborcus.mk
+++ b/liborcus/ExternalProject_liborcus.mk
@@ -64,6 +64,8 @@ $(call gb_ExternalProject_get_state_target,liborcus,build) :
$(call gb_ExternalProject_run,build,\
$(if $(filter ANDROID,$(OS)),LIBS='-lgnustl_shared -lm') \
$(if $(filter YES,$(SYSTEM_ZLIB)),LIBS+=-lz) \
+ $(if $(filter MSC,$(COM)),CPPFLAGS+="-DBOOST_ALL_NO_LIB") \
+ $(if $(filter MSC,$(COM)),CXXFLAGS+=$(BOOST_CXXFLAGS)) \
$(if $(filter NO,$(SYSTEM_ZLIB)),CPPFLAGS+=-I$(OUTDIR)/inc/external/zlib) \
$(if $(filter NO,$(SYSTEM_BOOST)),CXXFLAGS+=-I$(WORKDIR)/UnpackedTarball/boost) \
$(if $(filter YES,$(SYSTEM_BOOST)),LDFLAGS=$(BOOST_LDFLAGS)) \
diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx
index 9558691..0599771 100644
--- a/sc/qa/unit/helper/qahelper.hxx
+++ b/sc/qa/unit/helper/qahelper.hxx
@@ -30,6 +30,7 @@
#define SC_QA_HELPER_HXX
#include <test/bootstrapfixture.hxx>
+#define __ORCUS_STATIC_LIB
#include "helper/csv_handler.hxx"
#include "helper/debughelper.hxx"
#include "orcus/csv_parser.hpp"
commit 1c82446d381baa2a643a073755533a8b4b125710
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri Apr 12 15:21:00 2013 -0400
Let's see if this works for Visual Studio 2010....
Change-Id: I80b0dc6f36f798e06aad2221760b6b36d1a7f82b
diff --git a/liborcus/ExternalProject_liborcus.mk b/liborcus/ExternalProject_liborcus.mk
index 2d42fff..f70a377 100644
--- a/liborcus/ExternalProject_liborcus.mk
+++ b/liborcus/ExternalProject_liborcus.mk
@@ -41,10 +41,10 @@ $(call gb_ExternalProject_get_state_target,liborcus,build) :
&& export BOOST_LIB_DIR=$(OUTDIR)/lib \
&& cd $(EXTERNAL_WORKDIR)/vsprojects/liborcus-static \
&& $(COMPATH)/../Common7/Tools/vcupgrade.exe liborcus-static.vcproj \
- && MSBuild.exe liborcus-static.vcxproj /p:Configuration=Release /p:OutDir=Release/ /p:TargetName=orcus /p:WholeProgramOptimization=no \
+ && MSBuild.exe liborcus-static.vcxproj /p:Configuration=Release /p:OutDir=Release/ /p:TargetName=liborcus-static /p:WholeProgramOptimization=no \
&& cd $(EXTERNAL_WORKDIR)/vsprojects/liborcus-parser-static \
&& $(COMPATH)/../Common7/Tools/vcupgrade.exe liborcus-parser-static.vcproj \
- && MSBuild.exe liborcus-parser-static.vcxproj /p:Configuration=Release /p:OutDir=Release/ /p:TargetName=orcus /p:WholeProgramOptimization=no \
+ && MSBuild.exe liborcus-parser-static.vcxproj /p:Configuration=Release /p:OutDir=Release/ /p:TargetName=liborcus-parser-static /p:WholeProgramOptimization=no \
&& touch $@
endif
commit 58b4cd934fd28b796dc12590f33971dd32ec95ee
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri Apr 12 13:26:51 2013 -0400
Go back to using Visual Studio project files to build.
gcc-wrapper is too smart for me to figure out.
Change-Id: Ia36255035ac0be8ddc6cfc26dac06f3cd1310769
diff --git a/liborcus/ExternalPackage_liborcus.mk b/liborcus/ExternalPackage_liborcus.mk
index 8ed7a67..a310e9fe 100644
--- a/liborcus/ExternalPackage_liborcus.mk
+++ b/liborcus/ExternalPackage_liborcus.mk
@@ -12,8 +12,8 @@ $(eval $(call gb_ExternalPackage_ExternalPackage,liborcus,orcus))
$(eval $(call gb_ExternalPackage_use_external_project,liborcus,liborcus))
ifeq ($(OS)$(COM),WNTMSC)
-$(eval $(call gb_ExternalPackage_add_file,liborcus,lib/orcus.lib,src/liborcus/.libs/liborcus-0.6.lib))
-$(eval $(call gb_ExternalPackage_add_file,liborcus,lib/orcus-parser.lib,src/parser/.libs/liborcus-parser-0.6.lib))
+$(eval $(call gb_ExternalPackage_add_file,liborcus,lib/orcus.lib,vsprojects/liborcus-static/Release/liborcus-static.lib))
+$(eval $(call gb_ExternalPackage_add_file,liborcus,lib/orcus-parser.lib,vsprojects/liborcus-parser-static/Release/liborcus-parser-static.lib))
else
$(eval $(call gb_ExternalPackage_add_file,liborcus,lib/liborcus.a,src/liborcus/.libs/liborcus-0.6.a))
$(eval $(call gb_ExternalPackage_add_file,liborcus,lib/liborcus-parser.a,src/parser/.libs/liborcus-parser-0.6.a))
diff --git a/liborcus/ExternalProject_liborcus.mk b/liborcus/ExternalProject_liborcus.mk
index 5b344455..2d42fff 100644
--- a/liborcus/ExternalProject_liborcus.mk
+++ b/liborcus/ExternalProject_liborcus.mk
@@ -22,6 +22,34 @@ $(eval $(call gb_ExternalProject_register_targets,liborcus,\
build \
))
+ifeq ($(OS)$(COM),WNTMSC)
+
+ifeq ($(VCVER),90)
+$(call gb_ExternalProject_get_state_target,liborcus,build) :
+ export BOOST_INCLUDE_DIR=$(WORKDIR)/UnpackedTarball/boost \
+ && export ZLIB_INCLUDE_DIR=$(OUTDIR)/inc/external/zlib \
+ && export BOOST_LIB_DIR=$(OUTDIR)/lib \
+ && cd $(EXTERNAL_WORKDIR)/vsprojects/liborcus-static \
+ && $(COMPATH)/vcpackages/vcbuild.exe liborcus-static.vcproj "Release|Win32" \
+ && cd $(EXTERNAL_WORKDIR)/vsprojects/liborcus-parser-static \
+ && $(COMPATH)/vcpackages/vcbuild.exe liborcus-parser-static.vcproj "Release|Win32" \
+ && touch $@
+else
+$(call gb_ExternalProject_get_state_target,liborcus,build) :
+ export BOOST_INCLUDE_DIR=$(WORKDIR)/UnpackedTarball/boost \
+ && export ZLIB_INCLUDE_DIR=$(OUTDIR)/inc/external/zlib \
+ && export BOOST_LIB_DIR=$(OUTDIR)/lib \
+ && cd $(EXTERNAL_WORKDIR)/vsprojects/liborcus-static \
+ && $(COMPATH)/../Common7/Tools/vcupgrade.exe liborcus-static.vcproj \
+ && MSBuild.exe liborcus-static.vcxproj /p:Configuration=Release /p:OutDir=Release/ /p:TargetName=orcus /p:WholeProgramOptimization=no \
+ && cd $(EXTERNAL_WORKDIR)/vsprojects/liborcus-parser-static \
+ && $(COMPATH)/../Common7/Tools/vcupgrade.exe liborcus-parser-static.vcproj \
+ && MSBuild.exe liborcus-parser-static.vcxproj /p:Configuration=Release /p:OutDir=Release/ /p:TargetName=orcus /p:WholeProgramOptimization=no \
+ && touch $@
+endif
+
+else
+
# Must be built with debug GNU C++ library if --enable-dbgutil has
# caused the LO code to be built thusly.
@@ -51,4 +79,6 @@ $(call gb_ExternalProject_get_state_target,liborcus,build) :
&& $(MAKE) \
)
+endif
+
# vim: set noet sw=4 ts=4:
commit 0af23aaf69694a3eceaf995d0971d3818c1c2501
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri Apr 12 12:38:35 2013 -0400
Trying to fix Windows build. Still broken.
Change-Id: I4d5764d9fd8f03e61c99d5f5597314deefc3ffd5
diff --git a/liborcus/ExternalProject_liborcus.mk b/liborcus/ExternalProject_liborcus.mk
index b46180c..5b344455 100644
--- a/liborcus/ExternalProject_liborcus.mk
+++ b/liborcus/ExternalProject_liborcus.mk
@@ -30,10 +30,16 @@ $(eval $(call gb_ExternalProject_register_targets,liborcus,\
# that executable on Android, but we don't want to bother with
# patching out building it for Android.
+#$(if $(filter MSC,$(COM)),CPPFLAGS+="-DBOOST_ALL_NO_LIB") CXXFLAGS+="$(BOOST_CXXFLAGS))
+
$(call gb_ExternalProject_get_state_target,liborcus,build) :
$(call gb_ExternalProject_run,build,\
$(if $(filter ANDROID,$(OS)),LIBS='-lgnustl_shared -lm') \
$(if $(filter YES,$(SYSTEM_ZLIB)),LIBS+=-lz) \
+ $(if $(filter NO,$(SYSTEM_ZLIB)),CPPFLAGS+=-I$(OUTDIR)/inc/external/zlib) \
+ $(if $(filter NO,$(SYSTEM_BOOST)),CXXFLAGS+=-I$(WORKDIR)/UnpackedTarball/boost) \
+ $(if $(filter YES,$(SYSTEM_BOOST)),LDFLAGS=$(BOOST_LDFLAGS)) \
+ $(if $(filter LINUX FREEBSD OPENBSD NETBSD DRAGONFLY ANDROID,$(OS)),$(if $(gb_ENABLE_DBGUTIL),CPPFLAGS+=-D_GLIBCXX_DEBUG)) \
./configure \
--with-pic \
--enable-static \
@@ -41,11 +47,6 @@ $(call gb_ExternalProject_get_state_target,liborcus,build) :
--disable-debug \
--disable-spreadsheet-model \
--disable-werror \
- $(if $(filter LINUX FREEBSD OPENBSD NETBSD DRAGONFLY ANDROID,$(OS)),$(if $(gb_ENABLE_DBGUTIL),CPPFLAGS=-D_GLIBCXX_DEBUG)) \
- $(if $(filter MSC,$(COM)),CPPFLAGS="-DBOOST_ALL_NO_LIB") \
- CXXFLAGS="$(BOOST_CXXFLAGS) $(if $(filter NO,$(SYSTEM_BOOST)),\
- -I$(call gb_UnpackedTarball_get_dir,boost),$(BOOST_CPPFLAGS))" \
- $(if $(filter YES,$(SYSTEM_BOOST)),LDFLAGS=$(BOOST_LDFLAGS)) \
$(if $(filter YES,$(CROSS_COMPILING)),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
&& $(MAKE) \
)
commit 2ee0956ceedec98a4a678da179ff7a470e3e8818
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri Apr 12 10:30:05 2013 -0400
Deliver orcus-parser.lib on Windows.
Change-Id: Iba5edf90ad26c96697e5acb47055f9311ea73b98
diff --git a/liborcus/ExternalPackage_liborcus.mk b/liborcus/ExternalPackage_liborcus.mk
index c2fd898..8ed7a67 100644
--- a/liborcus/ExternalPackage_liborcus.mk
+++ b/liborcus/ExternalPackage_liborcus.mk
@@ -13,6 +13,7 @@ $(eval $(call gb_ExternalPackage_use_external_project,liborcus,liborcus))
ifeq ($(OS)$(COM),WNTMSC)
$(eval $(call gb_ExternalPackage_add_file,liborcus,lib/orcus.lib,src/liborcus/.libs/liborcus-0.6.lib))
+$(eval $(call gb_ExternalPackage_add_file,liborcus,lib/orcus-parser.lib,src/parser/.libs/liborcus-parser-0.6.lib))
else
$(eval $(call gb_ExternalPackage_add_file,liborcus,lib/liborcus.a,src/liborcus/.libs/liborcus-0.6.a))
$(eval $(call gb_ExternalPackage_add_file,liborcus,lib/liborcus-parser.a,src/parser/.libs/liborcus-parser-0.6.a))
commit 51f79228454c09d2b8e30b4490fdb9a31942b62b
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri Apr 12 10:31:53 2013 -0400
Newer version 0.5.1 (since 0.5.0 package was broken on Windows).
It contains a missing header needed for Windows.
Change-Id: I538d7d807fef3b6e50e70bf8f48defeb3cb79c9b
diff --git a/download.lst b/download.lst
index 4399a4f..b8948f4 100644
--- a/download.lst
+++ b/download.lst
@@ -68,7 +68,7 @@ export NEON_TARBALL := ff369e69ef0f0143beb5626164e87ae2-neon-0.29.5.tar.gz
export NSS_TARBALL := a0a861f539f0e7a91d05e6b9457e4db1-nss-3.13.5-with-nspr-4.9.1.tar.gz
export OPENLDAP_TARBALL := 804c6cb5698db30b75ad0ff1c25baefd-openldap-2.4.31.tgz
export OPENSSL_TARBALL := 51a40a81b3b7abe8a5c33670bd3da0ce-openssl-0.9.8v.tar.gz
-export ORCUS_TARBALL := 8a43b3de758dcd529b16ac96b46069fb-liborcus-0.5.0.tar.bz2
+export ORCUS_TARBALL := 5c4201c038183b2e9b69d317784b2245-liborcus-0.5.1.tar.bz2
export PIXMAN_TARBALL := c63f411b3ad147db2bcce1bf262a0e02-pixman-0.24.4.tar.bz2
export PNG_TARBALL := 9e5d864bce8f06751bbd99962ecf4aad-libpng-1.5.10.tar.gz
export POSTGRESQL_TARBALL := c0b4799ea9850eae3ead14f0a60e9418-postgresql-9.2.1.tar.bz2
commit 4d9c2fb1e0d94fb205a32bb92c709178700aaaf4
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Thu Apr 11 23:11:21 2013 -0400
Get sc to build.
Change-Id: Ia5a73ec2acd3663a35632f268b59c0646cd356ea
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 927a123..1dcb377 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -2295,6 +2295,10 @@ $(eval $(call gb_Helper_register_static_libraries,PLAINLIBS,\
orcus \
))
+$(eval $(call gb_Helper_register_static_libraries,PLAINLIBS,\
+ orcus-parser \
+))
+
define gb_LinkTarget__use_orcus
$(call gb_LinkTarget_use_unpacked,$(1),orcus)
$(call gb_LinkTarget_set_include,$(1),\
@@ -2310,6 +2314,13 @@ $(if $(filter YES,$(SYSTEM_BOOST)), \
endef
+define gb_LinkTarget__use_orcus-parser
+$(call gb_LinkTarget_use_static_libraries,$(1),\
+ orcus-parser \
+)
+
+endef
+
endif # SYSTEM_LIBORCUS
diff --git a/sc/CppunitTest_sc_filters_test.mk b/sc/CppunitTest_sc_filters_test.mk
index a3235e6..521b6e0 100644
--- a/sc/CppunitTest_sc_filters_test.mk
+++ b/sc/CppunitTest_sc_filters_test.mk
@@ -41,6 +41,7 @@ $(eval $(call gb_CppunitTest_use_externals,sc_filters_test, \
boost_headers \
mdds_headers \
orcus \
+ orcus-parser \
))
$(eval $(call gb_CppunitTest_use_libraries,sc_filters_test, \
diff --git a/sc/CppunitTest_sc_subsequent_export_test.mk b/sc/CppunitTest_sc_subsequent_export_test.mk
index e63caf2..56fd35d 100644
--- a/sc/CppunitTest_sc_subsequent_export_test.mk
+++ b/sc/CppunitTest_sc_subsequent_export_test.mk
@@ -35,6 +35,7 @@ $(eval $(call gb_CppunitTest_use_externals,sc_subsequent_export_test, \
boost_headers \
mdds_headers \
orcus \
+ orcus-parser \
))
$(eval $(call gb_CppunitTest_use_libraries,sc_subsequent_export_test, \
diff --git a/sc/CppunitTest_sc_subsequent_filters_test.mk b/sc/CppunitTest_sc_subsequent_filters_test.mk
index a200dac..f6ea862 100644
--- a/sc/CppunitTest_sc_subsequent_filters_test.mk
+++ b/sc/CppunitTest_sc_subsequent_filters_test.mk
@@ -35,6 +35,7 @@ $(eval $(call gb_CppunitTest_use_externals,sc_subsequent_filters_test, \
boost_headers \
mdds_headers \
orcus \
+ orcus-parser \
))
$(eval $(call gb_CppunitTest_use_libraries,sc_subsequent_filters_test, \
diff --git a/sc/CppunitTest_sc_ucalc.mk b/sc/CppunitTest_sc_ucalc.mk
index 00dc942..3ee4a57 100644
--- a/sc/CppunitTest_sc_ucalc.mk
+++ b/sc/CppunitTest_sc_ucalc.mk
@@ -45,6 +45,7 @@ $(eval $(call gb_CppunitTest_use_externals,sc_ucalc,\
boost_headers \
mdds_headers \
orcus \
+ orcus-parser \
))
$(eval $(call gb_CppunitTest_use_libraries,sc_ucalc, \
diff --git a/sc/Library_scfilt.mk b/sc/Library_scfilt.mk
index 5c8c8ef..dfb98f7 100644
--- a/sc/Library_scfilt.mk
+++ b/sc/Library_scfilt.mk
@@ -70,6 +70,7 @@ $(eval $(call gb_Library_use_libraries,scfilt,\
$(eval $(call gb_Library_use_externals,scfilt,\
orcus \
+ orcus-parser \
zlib \
))
commit f4f455c8882d858298b4e72a8801b2973f82656e
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Thu Apr 11 22:40:31 2013 -0400
Deliver another library, though sc still can't link to it. Damn.
Change-Id: I6a0193df0cdb82e1855c5ac2d38976c7fb29d039
diff --git a/liborcus/ExternalPackage_liborcus.mk b/liborcus/ExternalPackage_liborcus.mk
index d47e608..c2fd898 100644
--- a/liborcus/ExternalPackage_liborcus.mk
+++ b/liborcus/ExternalPackage_liborcus.mk
@@ -15,6 +15,7 @@ ifeq ($(OS)$(COM),WNTMSC)
$(eval $(call gb_ExternalPackage_add_file,liborcus,lib/orcus.lib,src/liborcus/.libs/liborcus-0.6.lib))
else
$(eval $(call gb_ExternalPackage_add_file,liborcus,lib/liborcus.a,src/liborcus/.libs/liborcus-0.6.a))
+$(eval $(call gb_ExternalPackage_add_file,liborcus,lib/liborcus-parser.a,src/parser/.libs/liborcus-parser-0.6.a))
endif
# vim: set noet sw=4 ts=4:
diff --git a/liborcus/ExternalProject_liborcus.mk b/liborcus/ExternalProject_liborcus.mk
index ca98e8b..b46180c 100644
--- a/liborcus/ExternalProject_liborcus.mk
+++ b/liborcus/ExternalProject_liborcus.mk
@@ -33,6 +33,7 @@ $(eval $(call gb_ExternalProject_register_targets,liborcus,\
$(call gb_ExternalProject_get_state_target,liborcus,build) :
$(call gb_ExternalProject_run,build,\
$(if $(filter ANDROID,$(OS)),LIBS='-lgnustl_shared -lm') \
+ $(if $(filter YES,$(SYSTEM_ZLIB)),LIBS+=-lz) \
./configure \
--with-pic \
--enable-static \
@@ -45,7 +46,6 @@ $(call gb_ExternalProject_get_state_target,liborcus,build) :
CXXFLAGS="$(BOOST_CXXFLAGS) $(if $(filter NO,$(SYSTEM_BOOST)),\
-I$(call gb_UnpackedTarball_get_dir,boost),$(BOOST_CPPFLAGS))" \
$(if $(filter YES,$(SYSTEM_BOOST)),LDFLAGS=$(BOOST_LDFLAGS)) \
- $(if $(filter YES,$(SYSTEM_ZLIB)),LIBS=-lz) \
$(if $(filter YES,$(CROSS_COMPILING)),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
&& $(MAKE) \
)
commit a2fa2edb7e626034220340d7e1290d1da343fa03
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Thu Apr 11 20:29:55 2013 -0400
Fix linker error against system zlib.
Not sure what we'll have to do with the internal zlib. Not tested
that scenario yet.
Change-Id: Iec9e4f30b006ceaa2271156650b5ad922d4b40e4
diff --git a/liborcus/ExternalProject_liborcus.mk b/liborcus/ExternalProject_liborcus.mk
index 4be7040..ca98e8b 100644
--- a/liborcus/ExternalProject_liborcus.mk
+++ b/liborcus/ExternalProject_liborcus.mk
@@ -45,6 +45,7 @@ $(call gb_ExternalProject_get_state_target,liborcus,build) :
CXXFLAGS="$(BOOST_CXXFLAGS) $(if $(filter NO,$(SYSTEM_BOOST)),\
-I$(call gb_UnpackedTarball_get_dir,boost),$(BOOST_CPPFLAGS))" \
$(if $(filter YES,$(SYSTEM_BOOST)),LDFLAGS=$(BOOST_LDFLAGS)) \
+ $(if $(filter YES,$(SYSTEM_ZLIB)),LIBS=-lz) \
$(if $(filter YES,$(CROSS_COMPILING)),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
&& $(MAKE) \
)
commit 4eb2211230d3ff327e8965a52953d0e83b031e91
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Thu Apr 11 19:49:15 2013 -0400
This patch has been upstreamed.
Change-Id: I7ba26813e1dfdd138096c597abd9f67c953aca4d
diff --git a/liborcus/UnpackedTarball_orcus.mk b/liborcus/UnpackedTarball_orcus.mk
index 13be4e6..d09b3f4 100644
--- a/liborcus/UnpackedTarball_orcus.mk
+++ b/liborcus/UnpackedTarball_orcus.mk
@@ -15,11 +15,10 @@ $(eval $(call gb_UnpackedTarball_set_patchlevel,orcus,0))
orcus_patches :=
# make config.sub recognize arm-linux-androideabi
-orcus_patches += liborcus_0.1.0-configure.patch
+# orcus_patches += liborcus_0.1.0-configure.patch <- does not apply
# <https://gitorious.org/orcus/orcus/merge_requests/2#
# f60d6eecee72349993a392a9a63ddf3383d3b8c8-
# f60d6eecee72349993a392a9a63ddf3383d3b8c8 at 2>:
-orcus_patches += liborcus_0.1.0-boost-include.patch.1
$(eval $(call gb_UnpackedTarball_add_patches,orcus,\
$(foreach patch,$(orcus_patches),liborcus/$(patch)) \
diff --git a/liborcus/liborcus_0.1.0-boost-include.patch.1 b/liborcus/liborcus_0.1.0-boost-include.patch.1
deleted file mode 100644
index 07558b0..0000000
--- a/liborcus/liborcus_0.1.0-boost-include.patch.1
+++ /dev/null
@@ -1,26 +0,0 @@
-From f60d6eecee72349993a392a9a63ddf3383d3b8c8 Mon Sep 17 00:00:00 2001
-From: Stephan Bergmann <sbergman at redhat.com>
-Date: Sat, 16 Feb 2013 13:25:44 +0100
-Subject: [PATCH] Missing include <boost/noncopyable.hpp>
-
-(at least when compiling against Boost 1.53.0)
----
- src/liborcus/dom_tree.cpp | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/src/liborcus/dom_tree.cpp b/src/liborcus/dom_tree.cpp
-index ecf7beb..14725ad 100644
---- a/src/liborcus/dom_tree.cpp
-+++ b/src/liborcus/dom_tree.cpp
-@@ -34,6 +34,8 @@
- #include <iostream>
- #include <sstream>
-
-+#include <boost/noncopyable.hpp>
-+
- using namespace std;
-
- namespace orcus {
---
-1.8.1.2
-
commit f14e7094f8683ffedbe9173da4f19d32f89d2a47
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Thu Apr 11 19:40:07 2013 -0400
Update the internal liborcus package to 0.5.0.
Change-Id: Ib0070ad8509ba4084a8b0871fbc8c24b550433d7
diff --git a/download.lst b/download.lst
index f0888a2..4399a4f 100644
--- a/download.lst
+++ b/download.lst
@@ -68,7 +68,7 @@ export NEON_TARBALL := ff369e69ef0f0143beb5626164e87ae2-neon-0.29.5.tar.gz
export NSS_TARBALL := a0a861f539f0e7a91d05e6b9457e4db1-nss-3.13.5-with-nspr-4.9.1.tar.gz
export OPENLDAP_TARBALL := 804c6cb5698db30b75ad0ff1c25baefd-openldap-2.4.31.tgz
export OPENSSL_TARBALL := 51a40a81b3b7abe8a5c33670bd3da0ce-openssl-0.9.8v.tar.gz
-export ORCUS_TARBALL := 8755aac23317494a9028569374dc87b2-liborcus_0.3.0.tar.bz2
+export ORCUS_TARBALL := 8a43b3de758dcd529b16ac96b46069fb-liborcus-0.5.0.tar.bz2
export PIXMAN_TARBALL := c63f411b3ad147db2bcce1bf262a0e02-pixman-0.24.4.tar.bz2
export PNG_TARBALL := 9e5d864bce8f06751bbd99962ecf4aad-libpng-1.5.10.tar.gz
export POSTGRESQL_TARBALL := c0b4799ea9850eae3ead14f0a60e9418-postgresql-9.2.1.tar.bz2
diff --git a/liborcus/ExternalPackage_liborcus.mk b/liborcus/ExternalPackage_liborcus.mk
index 159faac..d47e608 100644
--- a/liborcus/ExternalPackage_liborcus.mk
+++ b/liborcus/ExternalPackage_liborcus.mk
@@ -12,9 +12,9 @@ $(eval $(call gb_ExternalPackage_ExternalPackage,liborcus,orcus))
$(eval $(call gb_ExternalPackage_use_external_project,liborcus,liborcus))
ifeq ($(OS)$(COM),WNTMSC)
-$(eval $(call gb_ExternalPackage_add_file,liborcus,lib/orcus.lib,src/liborcus/.libs/liborcus-0.4.lib))
+$(eval $(call gb_ExternalPackage_add_file,liborcus,lib/orcus.lib,src/liborcus/.libs/liborcus-0.6.lib))
else
-$(eval $(call gb_ExternalPackage_add_file,liborcus,lib/liborcus.a,src/liborcus/.libs/liborcus-0.4.a))
+$(eval $(call gb_ExternalPackage_add_file,liborcus,lib/liborcus.a,src/liborcus/.libs/liborcus-0.6.a))
endif
# vim: set noet sw=4 ts=4:
diff --git a/liborcus/ExternalProject_liborcus.mk b/liborcus/ExternalProject_liborcus.mk
index 21db367..4be7040 100644
--- a/liborcus/ExternalProject_liborcus.mk
+++ b/liborcus/ExternalProject_liborcus.mk
@@ -37,7 +37,6 @@ $(call gb_ExternalProject_get_state_target,liborcus,build) :
--with-pic \
--enable-static \
--disable-shared \
- --without-libzip \
--disable-debug \
--disable-spreadsheet-model \
--disable-werror \
commit 9dbf503b434aeee1a405725d97d2aa2b89625336
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Thu Apr 11 15:39:19 2013 -0400
Now we require liborcus-0.6 package.
Change-Id: I05555e9bb7904d7b9c25842d76ebeea53a7c1dfd
diff --git a/configure.ac b/configure.ac
index 6e45005..23e3ca4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8552,7 +8552,7 @@ AC_SUBST(REDLAND_MAJOR)
dnl ===================================================================
dnl Check for system orcus
dnl ===================================================================
-libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.4 >= 0.3.0])
+libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.6 >= 0.5.0])
if test "$with_system_orcus" != "yes"; then
if test "$SYSTEM_BOOST" = "YES"; then
# ===========================================================
commit 7b764697d519b9dc2295c43879b6c2b89168fd9e
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Thu Apr 11 12:24:41 2013 -0400
Increment progress also during post string cell insertion phase.
Change-Id: Ie8dad05f8629f8acea735c6ff71851d22b997a37
diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
index 53f9321..99ea336 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -109,6 +109,7 @@ void ScOrcusFactory::finalize()
{
ScSetStringParam aParam;
aParam.setTextInput();
+ int nCellCount = 0;
StringCellCaches::const_iterator it = maStringCells.begin(), itEnd = maStringCells.end();
for (; it != itEnd; ++it)
{
@@ -117,6 +118,12 @@ void ScOrcusFactory::finalize()
continue;
mrDoc.SetString(it->maPos, maStrings[it->mnIndex], &aParam);
+ ++nCellCount;
+ if (nCellCount == 100000)
+ {
+ incrementProgress();
+ nCellCount = 0;
+ }
}
if (mxStatusIndicator.is())
commit 7745d29ce1e500c42331852cdba284e0509af98a
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Thu Apr 11 12:14:30 2013 -0400
Obviously we do support it now, albeit partially.
Change-Id: Ib7f28a27ea99e76f439673e4971706ed9bb7a488
diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
index 1e3fb18..53f9321 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -102,7 +102,6 @@ orcus::spreadsheet::iface::import_shared_strings* ScOrcusFactory::get_shared_str
orcus::spreadsheet::iface::import_styles* ScOrcusFactory::get_styles()
{
- // We don't support it yet.
return &maStyles;
}
commit 3fc45b3f5841cc61efc74057f6956c4a1426382e
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Thu Apr 11 12:13:05 2013 -0400
Show progress indicator during document import via orcus.
Change-Id: I74e2b8299455753d4663f344506912302317b681
diff --git a/sc/inc/orcusfilters.hxx b/sc/inc/orcusfilters.hxx
index ab09d8c..62c9759 100644
--- a/sc/inc/orcusfilters.hxx
+++ b/sc/inc/orcusfilters.hxx
@@ -17,6 +17,7 @@ class SvTreeListBox;
struct ScOrcusXMLTreeParam;
struct ScOrcusImportXMLParam;
class ScOrcusXMLContext;
+class SfxMedium;
/**
* Collection of orcus filter wrappers.
@@ -26,13 +27,13 @@ class ScOrcusFilters
public:
virtual ~ScOrcusFilters() {}
- virtual bool importCSV(ScDocument& rDoc, const OUString& rPath) const = 0;
+ virtual bool importCSV(ScDocument& rDoc, SfxMedium& rMedium) const = 0;
- virtual bool importGnumeric(ScDocument& rDoc, const OUString& rPath) const = 0;
+ virtual bool importGnumeric(ScDocument& rDoc, SfxMedium& rMedium) const = 0;
- virtual bool importXLSX(ScDocument& rDoc, const OUString& rPath) const = 0;
+ virtual bool importXLSX(ScDocument& rDoc, SfxMedium& rMedium) const = 0;
- virtual bool importODS(ScDocument& rDoc, const OUString& rPath) const = 0;
+ virtual bool importODS(ScDocument& rDoc, SfxMedium& rMedium) const = 0;
/**
* Create a context for XML file. The context object stores session
diff --git a/sc/source/filter/inc/orcusfiltersimpl.hxx b/sc/source/filter/inc/orcusfiltersimpl.hxx
index e07cd19..0db7f6a 100644
--- a/sc/source/filter/inc/orcusfiltersimpl.hxx
+++ b/sc/source/filter/inc/orcusfiltersimpl.hxx
@@ -20,10 +20,10 @@ class ScOrcusFiltersImpl : public ScOrcusFilters
public:
static OString toSystemPath(const OUString& rPath);
- virtual bool importCSV(ScDocument& rDoc, const OUString& rPath) const;
- virtual bool importGnumeric(ScDocument& rDoc, const OUString& rPath) const;
- virtual bool importXLSX(ScDocument& rDoc, const OUString& rPath) const;
- virtual bool importODS(ScDocument& rDoc, const OUString& rPath) const;
+ virtual bool importCSV(ScDocument& rDoc, SfxMedium& rMedium) const;
+ virtual bool importGnumeric(ScDocument& rDoc, SfxMedium& rMedium) const;
+ virtual bool importXLSX(ScDocument& rDoc, SfxMedium& rMedium) const;
+ virtual bool importODS(ScDocument& rDoc, SfxMedium& rMedium) const;
virtual ScOrcusXMLContext* createXMLContext(ScDocument& rDoc, const OUString& rPath) const;
};
diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx
index 05ebc6d..862a4cb 100644
--- a/sc/source/filter/inc/orcusinterface.hxx
+++ b/sc/source/filter/inc/orcusinterface.hxx
@@ -26,6 +26,12 @@ class ScOrcusSheet;
class ScOrcusFactory;
class ScRangeData;
+namespace com { namespace sun { namespace star { namespace task {
+
+class XStatusIndicator;
+
+}}}}
+
class ScOrcusGlobalSettings : public orcus::spreadsheet::iface::import_global_settings
{
ScDocument& mrDoc;
@@ -64,6 +70,11 @@ class ScOrcusSheet : public orcus::spreadsheet::iface::import_sheet
typedef std::map<size_t, ScRangeData*> SharedFormulaContainer;
SharedFormulaContainer maSharedFormulas;
+
+ int mnCellCount;
+
+ void cellInserted();
+
public:
ScOrcusSheet(ScDocument& rDoc, SCTAB nTab, ScOrcusFactory& rFactory);
@@ -190,6 +201,10 @@ class ScOrcusFactory : public orcus::spreadsheet::iface::import_factory
boost::ptr_vector<ScOrcusSheet> maSheets;
ScOrcusStyles maStyles;
+ int mnProgress;
+
+ com::sun::star::uno::Reference<com::sun::star::task::XStatusIndicator> mxStatusIndicator;
+
public:
ScOrcusFactory(ScDocument& rDoc);
@@ -204,6 +219,10 @@ public:
size_t addString(const OUString& rStr);
void pushStringCell(const ScAddress& rPos, size_t nStrIndex);
+
+ void incrementProgress();
+
+ void setStatusIndicator(const com::sun::star::uno::Reference<com::sun::star::task::XStatusIndicator>& rIndicator);
};
#endif
diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
index 07bc1b2..1e3fb18 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -16,10 +16,15 @@
#include "stringutil.hxx"
#include "globalnames.hxx"
#include "docoptio.hxx"
+#include "globstr.hrc"
#include "formula/token.hxx"
#include "tools/datetime.hxx"
+#include <com/sun/star/task/XStatusIndicator.hpp>
+
+using namespace com::sun::star;
+
using orcus::spreadsheet::row_t;
using orcus::spreadsheet::col_t;
using orcus::spreadsheet::formula_grammar_t;
@@ -39,7 +44,8 @@ ScOrcusFactory::StringCellCache::StringCellCache(const ScAddress& rPos, size_t n
ScOrcusFactory::ScOrcusFactory(ScDocument& rDoc) :
mrDoc(rDoc),
maGlobalSettings(mrDoc),
- maSharedStrings(*this) {}
+ maSharedStrings(*this),
+ mnProgress(0) {}
orcus::spreadsheet::iface::import_sheet* ScOrcusFactory::append_sheet(const char* sheet_name, size_t sheet_name_length)
{
@@ -113,6 +119,9 @@ void ScOrcusFactory::finalize()
mrDoc.SetString(it->maPos, maStrings[it->mnIndex], &aParam);
}
+
+ if (mxStatusIndicator.is())
+ mxStatusIndicator->end();
}
size_t ScOrcusFactory::appendString(const OUString& rStr)
@@ -139,13 +148,48 @@ void ScOrcusFactory::pushStringCell(const ScAddress& rPos, size_t nStrIndex)
maStringCells.push_back(StringCellCache(rPos, nStrIndex));
}
+void ScOrcusFactory::incrementProgress()
+{
+ if (!mxStatusIndicator.is())
+ // Status indicator object not set.
+ return;
+
+ // For now, we'll hard-code the progress range to be 100, and stops at 99
+ // in all cases.
+
+ if (!mnProgress)
+ mxStatusIndicator->start(ScGlobal::GetRscString(STR_LOAD_DOC), 100);
+
+ if (mnProgress == 99)
+ return;
+
+ ++mnProgress;
+ mxStatusIndicator->setValue(mnProgress);
+}
+
+void ScOrcusFactory::setStatusIndicator(const uno::Reference<task::XStatusIndicator>& rIndicator)
+{
+ mxStatusIndicator = rIndicator;
+}
+
ScOrcusSheet::ScOrcusSheet(ScDocument& rDoc, SCTAB nTab, ScOrcusFactory& rFactory) :
- mrDoc(rDoc), mnTab(nTab), mrFactory(rFactory) {}
+ mrDoc(rDoc), mnTab(nTab), mrFactory(rFactory), mnCellCount(0) {}
+
+void ScOrcusSheet::cellInserted()
+{
+ ++mnCellCount;
+ if (mnCellCount == 100000)
+ {
+ mrFactory.incrementProgress();
+ mnCellCount = 0;
+ }
+}
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);
+ cellInserted();
}
void ScOrcusSheet::set_string(row_t row, col_t col, size_t sindex)
@@ -156,16 +200,19 @@ void ScOrcusSheet::set_string(row_t row, col_t col, size_t sindex)
// implement true shared strings in Calc core.
mrFactory.pushStringCell(ScAddress(col, row, mnTab), sindex);
+ cellInserted();
}
void ScOrcusSheet::set_value(row_t row, col_t col, double value)
{
mrDoc.SetValue( col, row, mnTab, value );
+ cellInserted();
}
void ScOrcusSheet::set_bool(row_t row, col_t col, bool value)
{
mrDoc.SetValue(col, row, mnTab, value ? 1.0 : 0.0);
+ cellInserted();
}
void ScOrcusSheet::set_date_time(
@@ -189,6 +236,7 @@ void ScOrcusSheet::set_date_time(
fTime /= DATE_TIME_FACTOR;
mrDoc.SetValue(col, row, mnTab, nDateDiff + fTime);
+ cellInserted();
}
void ScOrcusSheet::set_format(row_t /*row*/, col_t /*col*/, size_t /*xf_index*/)
@@ -225,6 +273,7 @@ void ScOrcusSheet::set_formula(
OUString aFormula(p, n, RTL_TEXTENCODING_UTF8);
formula::FormulaGrammar::Grammar eGrammar = getCalcGrammarFromOrcus( grammar );
mrDoc.SetFormula(ScAddress(col,row,mnTab), aFormula, eGrammar);
+ cellInserted();
}
void ScOrcusSheet::set_formula_result(row_t row, col_t col, const char* p, size_t n)
@@ -257,6 +306,7 @@ void ScOrcusSheet::set_shared_formula(
ScTokenArray aArr;
aArr.AddToken( formula::FormulaIndexToken( ocName, pSharedFormula->GetIndex() ) );
mrDoc.SetFormula(ScAddress(col,row,mnTab), aArr);
+ cellInserted();
}
}
@@ -277,6 +327,7 @@ void ScOrcusSheet::set_shared_formula(
ScTokenArray aArr;
aArr.AddToken( formula::FormulaIndexToken( ocName, pSharedFormula->GetIndex() ) );
mrDoc.SetFormula(ScAddress(col,row,mnTab), aArr);
+ cellInserted();
}
}
@@ -289,6 +340,7 @@ void ScOrcusSheet::set_shared_formula(row_t row, col_t col, size_t sindex)
ScTokenArray aArr;
aArr.AddToken( formula::FormulaIndexToken( ocName, pSharedFormula->GetIndex() ) );
mrDoc.SetFormula(ScAddress(col,row,mnTab), aArr);
+ cellInserted();
}
void ScOrcusSheet::set_array_formula(
diff --git a/sc/source/filter/orcus/orcusfiltersimpl.cxx b/sc/source/filter/orcus/orcusfiltersimpl.cxx
index 7ef1310..c9213d6 100644
--- a/sc/source/filter/orcus/orcusfiltersimpl.cxx
+++ b/sc/source/filter/orcus/orcusfiltersimpl.cxx
@@ -13,6 +13,10 @@
#include "document.hxx"
#include "tools/urlobj.hxx"
+#include "sfx2/docfile.hxx"
+#include "sfx2/frame.hxx"
+#include "sfx2/sfxsids.hrc"
+#include "svl/itemset.hxx"
#include <orcus/spreadsheet/import_interface.hpp>
#include <orcus/orcus_csv.hpp>
@@ -21,22 +25,44 @@
#include <orcus/orcus_ods.hpp>
#include <orcus/global.hpp>
+#include <com/sun/star/task/XStatusIndicator.hpp>
+
#ifdef WNT
#define SYSTEM_PATH INetURLObject::FSYS_DOS
#else
#define SYSTEM_PATH INetURLObject::FSYS_UNX
#endif
+using namespace com::sun::star;
+
+namespace {
+
+uno::Reference<task::XStatusIndicator> getStatusIndicator(SfxMedium& rMedium)
+{
+ uno::Reference<task::XStatusIndicator> xStatusIndicator;
+ SfxItemSet* pSet = rMedium.GetItemSet();
+ if (pSet)
+ {
+ const SfxUnoAnyItem* pItem = static_cast<const SfxUsrAnyItem*>(pSet->GetItem(SID_PROGRESS_STATUSBAR_CONTROL));
+ if (pItem)
+ xStatusIndicator.set(pItem->GetValue(), uno::UNO_QUERY);
+ }
+ return xStatusIndicator;
+}
+
+}
+
OString ScOrcusFiltersImpl::toSystemPath(const OUString& rPath)
{
INetURLObject aURL(rPath);
return OUStringToOString(aURL.getFSysPath(SYSTEM_PATH), RTL_TEXTENCODING_UTF8);
}
-bool ScOrcusFiltersImpl::importCSV(ScDocument& rDoc, const OUString& rPath) const
+bool ScOrcusFiltersImpl::importCSV(ScDocument& rDoc, SfxMedium& rMedium) const
{
ScOrcusFactory aFactory(rDoc);
- OString aSysPath = toSystemPath(rPath);
+ aFactory.setStatusIndicator(getStatusIndicator(rMedium));
+ OString aSysPath = toSystemPath(rMedium.GetName());
const char* path = aSysPath.getStr();
try
@@ -53,10 +79,11 @@ bool ScOrcusFiltersImpl::importCSV(ScDocument& rDoc, const OUString& rPath) cons
return true;
}
-bool ScOrcusFiltersImpl::importGnumeric(ScDocument& rDoc, const OUString& rPath) const
+bool ScOrcusFiltersImpl::importGnumeric(ScDocument& rDoc, SfxMedium& rMedium) const
{
ScOrcusFactory aFactory(rDoc);
- OString aSysPath = toSystemPath(rPath);
+ aFactory.setStatusIndicator(getStatusIndicator(rMedium));
+ OString aSysPath = toSystemPath(rMedium.GetName());
const char* path = aSysPath.getStr();
try
@@ -73,10 +100,11 @@ bool ScOrcusFiltersImpl::importGnumeric(ScDocument& rDoc, const OUString& rPath)
return true;
}
-bool ScOrcusFiltersImpl::importXLSX(ScDocument& rDoc, const OUString& rPath) const
+bool ScOrcusFiltersImpl::importXLSX(ScDocument& rDoc, SfxMedium& rMedium) const
{
ScOrcusFactory aFactory(rDoc);
- OString aSysPath = toSystemPath(rPath);
+ aFactory.setStatusIndicator(getStatusIndicator(rMedium));
+ OString aSysPath = toSystemPath(rMedium.GetName());
const char* path = aSysPath.getStr();
try
@@ -93,10 +121,11 @@ bool ScOrcusFiltersImpl::importXLSX(ScDocument& rDoc, const OUString& rPath) con
return true;
}
-bool ScOrcusFiltersImpl::importODS(ScDocument& rDoc, const OUString& rPath) const
+bool ScOrcusFiltersImpl::importODS(ScDocument& rDoc, SfxMedium& rMedium) const
{
ScOrcusFactory aFactory(rDoc);
- OString aSysPath = toSystemPath(rPath);
+ aFactory.setStatusIndicator(getStatusIndicator(rMedium));
+ OString aSysPath = toSystemPath(rMedium.GetName());
const char* path = aSysPath.getStr();
try
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 0cc10bd..7b5a383 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -1508,22 +1508,22 @@ bool ScDocShell::LoadExternal( SfxMedium& rMed )
const OUString& rFilterName = pFilter->GetName();
if (rFilterName == "gnumeric")
{
- if (!pOrcus->importGnumeric(aDocument, rMed.GetName()))
+ if (!pOrcus->importGnumeric(aDocument, rMed))
return false;
}
else if (rFilterName == "csv")
{
- if (!pOrcus->importCSV(aDocument, rMed.GetName()))
+ if (!pOrcus->importCSV(aDocument, rMed))
return false;
}
else if (rFilterName == "xlsx")
{
- if (!pOrcus->importXLSX(aDocument, rMed.GetName()))
+ if (!pOrcus->importXLSX(aDocument, rMed))
return false;
}
else if (rFilterName == "ods")
{
- if (!pOrcus->importODS(aDocument, rMed.GetName()))
+ if (!pOrcus->importODS(aDocument, rMed))
return false;
}
commit eb878bf1659f12036e85a3b636c041976863152f
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Thu Apr 11 00:31:02 2013 -0400
Get the filter provider name from SfxMedium instead.
This property is now transferred to SfxMedium. Let's get it from there.
Change-Id: Ie0a4680581500135f3b65370ea94946f02c02cb8
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 84e34e2..fee8ea7 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -1814,18 +1814,13 @@ void SAL_CALL SfxBaseModel::initNew()
namespace {
-OUString getFilterProvider(const Sequence<beans::PropertyValue>& rArgs)
+OUString getFilterProvider( SfxMedium& rMedium )
{
- OUString aStr;
- for (sal_Int32 i = 0, n = rArgs.getLength(); i < n; ++i)
- {
- if (rArgs[i].Name == "FilterProvider")
- {
- rArgs[i].Value >>= aStr;
- return aStr;
- }
- }
- return aStr;
+ const SfxFilter* pFilter = rMedium.GetFilter();
+ if (!pFilter)
+ return OUString();
+
+ return pFilter->GetProviderName();
}
}
@@ -1853,7 +1848,7 @@ void SAL_CALL SfxBaseModel::load( const Sequence< beans::PropertyValue >& seqA
SfxMedium* pMedium = new SfxMedium( seqArguments );
sal_uInt32 nError = ERRCODE_NONE;
- OUString aFilterProvider = getFilterProvider(seqArguments);
+ OUString aFilterProvider = getFilterProvider(*pMedium);
if (!aFilterProvider.isEmpty())
{
if (!m_pData->m_pObjectShell->DoLoadExternal(pMedium))
commit ee5e495aa46bd73bcbfd77fc651cca8e7990b84a
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Thu Apr 11 00:23:45 2013 -0400
Reduce indentation by early bail-out.
Change-Id: Iaf2fed36b33d44f06f2c2750f800da5a6dd454ab
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 5b28cc2..84e34e2 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -1843,125 +1843,125 @@ void SAL_CALL SfxBaseModel::load( const Sequence< beans::PropertyValue >& seqA
// the object shell should exist always
DBG_ASSERT( m_pData->m_pObjectShell.Is(), "Model is useless without an ObjectShell" );
- if ( m_pData->m_pObjectShell.Is() )
- {
- if( m_pData->m_pObjectShell->GetMedium() )
- // if a Medium is present, the document is already initialized
- throw frame::DoubleInitializationException();
+ if (!m_pData->m_pObjectShell.Is())
+ return;
- SfxMedium* pMedium = new SfxMedium( seqArguments );
+ if( m_pData->m_pObjectShell->GetMedium() )
+ // if a Medium is present, the document is already initialized
+ throw frame::DoubleInitializationException();
- sal_uInt32 nError = ERRCODE_NONE;
- OUString aFilterProvider = getFilterProvider(seqArguments);
- if (!aFilterProvider.isEmpty())
- {
- if (!m_pData->m_pObjectShell->DoLoadExternal(pMedium))
- nError = ERRCODE_IO_GENERAL;
+ SfxMedium* pMedium = new SfxMedium( seqArguments );
- handleLoadError(nError, pMedium);
- pMedium->SetUpdatePickList(false);
- return;
- }
+ sal_uInt32 nError = ERRCODE_NONE;
+ OUString aFilterProvider = getFilterProvider(seqArguments);
+ if (!aFilterProvider.isEmpty())
+ {
+ if (!m_pData->m_pObjectShell->DoLoadExternal(pMedium))
+ nError = ERRCODE_IO_GENERAL;
- String aFilterName;
- SFX_ITEMSET_ARG( pMedium->GetItemSet(), pFilterNameItem, SfxStringItem, SID_FILTER_NAME, sal_False );
- if( pFilterNameItem )
- aFilterName = pFilterNameItem->GetValue();
- if( !m_pData->m_pObjectShell->GetFactory().GetFilterContainer()->GetFilter4FilterName( aFilterName ) )
- {
- // filtername is not valid
- delete pMedium;
- throw frame::IllegalArgumentIOException();
- }
+ handleLoadError(nError, pMedium);
+ pMedium->SetUpdatePickList(false);
+ return;
+ }
- SFX_ITEMSET_ARG( pMedium->GetItemSet(), pSalvageItem, SfxStringItem, SID_DOC_SALVAGE, sal_False );
- sal_Bool bSalvage = pSalvageItem ? sal_True : sal_False;
+ String aFilterName;
+ SFX_ITEMSET_ARG( pMedium->GetItemSet(), pFilterNameItem, SfxStringItem, SID_FILTER_NAME, sal_False );
+ if( pFilterNameItem )
+ aFilterName = pFilterNameItem->GetValue();
+ if( !m_pData->m_pObjectShell->GetFactory().GetFilterContainer()->GetFilter4FilterName( aFilterName ) )
+ {
+ // filtername is not valid
+ delete pMedium;
+ throw frame::IllegalArgumentIOException();
+ }
- // load document
- if ( !m_pData->m_pObjectShell->DoLoad(pMedium) )
- nError=ERRCODE_IO_GENERAL;
+ SFX_ITEMSET_ARG( pMedium->GetItemSet(), pSalvageItem, SfxStringItem, SID_DOC_SALVAGE, sal_False );
+ sal_Bool bSalvage = pSalvageItem ? sal_True : sal_False;
- // QUESTION: if the following happens outside of DoLoad, something important is missing there!
- Reference< task::XInteractionHandler > xHandler = pMedium->GetInteractionHandler();
- if( m_pData->m_pObjectShell->GetErrorCode() )
+ // load document
+ if ( !m_pData->m_pObjectShell->DoLoad(pMedium) )
+ nError=ERRCODE_IO_GENERAL;
+
+ // QUESTION: if the following happens outside of DoLoad, something important is missing there!
+ Reference< task::XInteractionHandler > xHandler = pMedium->GetInteractionHandler();
+ if( m_pData->m_pObjectShell->GetErrorCode() )
+ {
+ nError = m_pData->m_pObjectShell->GetErrorCode();
+ if ( nError == ERRCODE_IO_BROKENPACKAGE && xHandler.is() )
{
- nError = m_pData->m_pObjectShell->GetErrorCode();
- if ( nError == ERRCODE_IO_BROKENPACKAGE && xHandler.is() )
+ OUString aDocName = pMedium->GetURLObject().getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET );
+ SFX_ITEMSET_ARG( pMedium->GetItemSet(), pRepairItem, SfxBoolItem, SID_REPAIRPACKAGE, sal_False );
+ if ( !pRepairItem || !pRepairItem->GetValue() )
{
- OUString aDocName = pMedium->GetURLObject().getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET );
- SFX_ITEMSET_ARG( pMedium->GetItemSet(), pRepairItem, SfxBoolItem, SID_REPAIRPACKAGE, sal_False );
- if ( !pRepairItem || !pRepairItem->GetValue() )
+ RequestPackageReparation aRequest( aDocName );
+ xHandler->handle( aRequest.GetRequest() );
+ if( aRequest.isApproved() )
{
- RequestPackageReparation aRequest( aDocName );
- xHandler->handle( aRequest.GetRequest() );
- if( aRequest.isApproved() )
- {
- // broken package: try second loading and allow repair
- pMedium->GetItemSet()->Put( SfxBoolItem( SID_REPAIRPACKAGE, sal_True ) );
- pMedium->GetItemSet()->Put( SfxBoolItem( SID_TEMPLATE, sal_True ) );
- pMedium->GetItemSet()->Put( SfxStringItem( SID_DOCINFO_TITLE, aDocName ) );
-
- // the error must be reset and the storage must be reopened in new mode
- pMedium->ResetError();
- pMedium->CloseStorage();
- m_pData->m_pObjectShell->PrepareSecondTryLoad_Impl();
- if ( !m_pData->m_pObjectShell->DoLoad(pMedium) )
- nError=ERRCODE_IO_GENERAL;
- nError = m_pData->m_pObjectShell->GetErrorCode();
- }
+ // broken package: try second loading and allow repair
+ pMedium->GetItemSet()->Put( SfxBoolItem( SID_REPAIRPACKAGE, sal_True ) );
+ pMedium->GetItemSet()->Put( SfxBoolItem( SID_TEMPLATE, sal_True ) );
+ pMedium->GetItemSet()->Put( SfxStringItem( SID_DOCINFO_TITLE, aDocName ) );
+
+ // the error must be reset and the storage must be reopened in new mode
+ pMedium->ResetError();
+ pMedium->CloseStorage();
+ m_pData->m_pObjectShell->PrepareSecondTryLoad_Impl();
+ if ( !m_pData->m_pObjectShell->DoLoad(pMedium) )
+ nError=ERRCODE_IO_GENERAL;
+ nError = m_pData->m_pObjectShell->GetErrorCode();
}
+ }
- if ( nError == ERRCODE_IO_BROKENPACKAGE )
- {
- // repair either not allowed or not successful
- NotifyBrokenPackage aRequest( aDocName );
- xHandler->handle( aRequest.GetRequest() );
- }
+ if ( nError == ERRCODE_IO_BROKENPACKAGE )
+ {
+ // repair either not allowed or not successful
+ NotifyBrokenPackage aRequest( aDocName );
+ xHandler->handle( aRequest.GetRequest() );
}
}
+ }
- if( m_pData->m_pObjectShell->IsAbortingImport() )
- nError = ERRCODE_ABORT;
+ if( m_pData->m_pObjectShell->IsAbortingImport() )
+ nError = ERRCODE_ABORT;
- if( bSalvage )
- {
- // file recovery: restore original filter
- SFX_ITEMSET_ARG( pMedium->GetItemSet(), pFilterItem, SfxStringItem, SID_FILTER_NAME, sal_False );
- SfxFilterMatcher& rMatcher = SFX_APP()->GetFilterMatcher();
- const SfxFilter* pSetFilter = rMatcher.GetFilter4FilterName( pFilterItem->GetValue() );
- pMedium->SetFilter( pSetFilter );
- m_pData->m_pObjectShell->SetModified(sal_True);
- }
+ if( bSalvage )
+ {
+ // file recovery: restore original filter
+ SFX_ITEMSET_ARG( pMedium->GetItemSet(), pFilterItem, SfxStringItem, SID_FILTER_NAME, sal_False );
+ SfxFilterMatcher& rMatcher = SFX_APP()->GetFilterMatcher();
+ const SfxFilter* pSetFilter = rMatcher.GetFilter4FilterName( pFilterItem->GetValue() );
+ pMedium->SetFilter( pSetFilter );
+ m_pData->m_pObjectShell->SetModified(sal_True);
+ }
- // TODO/LATER: may be the mode should be retrieved from outside and the preused filter should not be set
- if ( m_pData->m_pObjectShell->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED )
- {
- SFX_ITEMSET_ARG( pMedium->GetItemSet(), pFilterItem, SfxStringItem, SID_FILTER_NAME, sal_False );
- if ( pFilterItem )
- m_pData->m_aPreusedFilterName = pFilterItem->GetValue();
- }
+ // TODO/LATER: may be the mode should be retrieved from outside and the preused filter should not be set
+ if ( m_pData->m_pObjectShell->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED )
+ {
+ SFX_ITEMSET_ARG( pMedium->GetItemSet(), pFilterItem, SfxStringItem, SID_FILTER_NAME, sal_False );
+ if ( pFilterItem )
+ m_pData->m_aPreusedFilterName = pFilterItem->GetValue();
+ }
- if ( !nError )
- nError = pMedium->GetError();
+ if ( !nError )
+ nError = pMedium->GetError();
- m_pData->m_pObjectShell->ResetError();
+ m_pData->m_pObjectShell->ResetError();
- handleLoadError(nError, pMedium);
+ handleLoadError(nError, pMedium);
- loadCmisProperties( );
+ loadCmisProperties( );
- sal_Bool bHidden = sal_False;
- SFX_ITEMSET_ARG( pMedium->GetItemSet(), pHidItem, SfxBoolItem, SID_HIDDEN, sal_False);
- if ( pHidItem )
- bHidden = pHidItem->GetValue();
+ sal_Bool bHidden = sal_False;
+ SFX_ITEMSET_ARG( pMedium->GetItemSet(), pHidItem, SfxBoolItem, SID_HIDDEN, sal_False);
+ if ( pHidItem )
+ bHidden = pHidItem->GetValue();
#if OSL_DEBUG_LEVEL > 0
- SFX_ITEMSET_ARG( pMedium->GetItemSet(), pPasswdItem, SfxStringItem, SID_PASSWORD, sal_False);
- OSL_ENSURE( !pPasswdItem, "There should be no Password property in the document MediaDescriptor!" );
+ SFX_ITEMSET_ARG( pMedium->GetItemSet(), pPasswdItem, SfxStringItem, SID_PASSWORD, sal_False);
+ OSL_ENSURE( !pPasswdItem, "There should be no Password property in the document MediaDescriptor!" );
#endif
- // !TODO: will be done by Framework!
- pMedium->SetUpdatePickList( !bHidden );
- }
+ // !TODO: will be done by Framework!
+ pMedium->SetUpdatePickList( !bHidden );
}
//________________________________________________________________________________________________________
commit b894370445ce740c8a416aa04f88431d158b4f74
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Thu Apr 11 00:18:40 2013 -0400
Share error handling code between DoLoad() and DoLoadExternal().
Change-Id: I34167b80e9ac31b32639cd3be903ba9edbdfa41a
diff --git a/sfx2/inc/sfx2/sfxbasemodel.hxx b/sfx2/inc/sfx2/sfxbasemodel.hxx
index 9c15b50..524c86b 100644
--- a/sfx2/inc/sfx2/sfxbasemodel.hxx
+++ b/sfx2/inc/sfx2/sfxbasemodel.hxx
@@ -91,6 +91,7 @@
#include <svl/lstner.hxx>
+class SfxMedium;
class SfxPrinter;
class SfxViewShell;
class SfxObjectShell ;
@@ -1456,6 +1457,8 @@ private:
SAL_DLLPRIVATE void loadCmisProperties();
+ SAL_DLLPRIVATE void handleLoadError( sal_uInt32 nError, SfxMedium* pMedium );
+
//________________________________________________________________________________________________________
// private variables and methods
//________________________________________________________________________________________________________
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index c84e2ad..5b28cc2 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -1851,15 +1851,14 @@ void SAL_CALL SfxBaseModel::load( const Sequence< beans::PropertyValue >& seqA
SfxMedium* pMedium = new SfxMedium( seqArguments );
+ sal_uInt32 nError = ERRCODE_NONE;
OUString aFilterProvider = getFilterProvider(seqArguments);
if (!aFilterProvider.isEmpty())
{
if (!m_pData->m_pObjectShell->DoLoadExternal(pMedium))
- {
- throw task::ErrorCodeIOException(
- OUString(), Reference<XInterface>(), ERRCODE_IO_CANTREAD);
- }
+ nError = ERRCODE_IO_GENERAL;
+ handleLoadError(nError, pMedium);
pMedium->SetUpdatePickList(false);
return;
}
@@ -1879,7 +1878,6 @@ void SAL_CALL SfxBaseModel::load( const Sequence< beans::PropertyValue >& seqA
sal_Bool bSalvage = pSalvageItem ? sal_True : sal_False;
// load document
- sal_uInt32 nError = ERRCODE_NONE;
if ( !m_pData->m_pObjectShell->DoLoad(pMedium) )
nError=ERRCODE_IO_GENERAL;
@@ -1948,38 +1946,7 @@ void SAL_CALL SfxBaseModel::load( const Sequence< beans::PropertyValue >& seqA
m_pData->m_pObjectShell->ResetError();
- if ( nError )
- {
- sal_Bool bSilent = sal_False;
- SFX_ITEMSET_ARG( pMedium->GetItemSet(), pSilentItem, SfxBoolItem, SID_SILENT, sal_False);
- if( pSilentItem )
- bSilent = pSilentItem->GetValue();
-
- sal_Bool bWarning = ((nError & ERRCODE_WARNING_MASK) == ERRCODE_WARNING_MASK);
- if ( nError != ERRCODE_IO_BROKENPACKAGE && !bSilent )
- {
- // broken package was handled already
- if ( SfxObjectShell::UseInteractionToHandleError( xHandler, nError ) && !bWarning )
- {
- // abort loading (except for warnings)
- nError = ERRCODE_IO_ABORT;
- }
- }
-
- if ( m_pData->m_pObjectShell->GetMedium() != pMedium )
- {
- // for whatever reason document now has another medium
- OSL_FAIL("Document has rejected the medium?!");
- delete pMedium;
- }
-
- if ( !bWarning ) // #i30711# don't abort loading if it's only a warning
- {
- throw task::ErrorCodeIOException( OUString(),
- Reference< XInterface >(),
- nError ? nError : ERRCODE_IO_CANTREAD );
- }
- }
+ handleLoadError(nError, pMedium);
loadCmisProperties( );
@@ -2711,6 +2678,43 @@ void SfxBaseModel::loadCmisProperties( )
}
}
+void SfxBaseModel::handleLoadError( sal_uInt32 nError, SfxMedium* pMedium )
+{
+ if (!nError)
+ // No error condition.
+ return;
+
+ bool bSilent = false;
+ SFX_ITEMSET_ARG( pMedium->GetItemSet(), pSilentItem, SfxBoolItem, SID_SILENT, false);
+ if( pSilentItem )
+ bSilent = pSilentItem->GetValue();
+
+ bool bWarning = ((nError & ERRCODE_WARNING_MASK) == ERRCODE_WARNING_MASK);
+ if ( nError != ERRCODE_IO_BROKENPACKAGE && !bSilent )
+ {
+ // broken package was handled already
+ if ( SfxObjectShell::UseInteractionToHandleError(pMedium->GetInteractionHandler(), nError) && !bWarning)
+ {
+ // abort loading (except for warnings)
+ nError = ERRCODE_IO_ABORT;
+ }
+ }
+
+ if ( m_pData->m_pObjectShell->GetMedium() != pMedium )
+ {
+ // for whatever reason document now has another medium
+ OSL_FAIL("Document has rejected the medium?!");
+ delete pMedium;
+ }
+
+ if ( !bWarning ) // #i30711# don't abort loading if it's only a warning
+ {
+ throw task::ErrorCodeIOException( OUString(),
+ Reference< XInterface >(),
+ nError ? nError : ERRCODE_IO_CANTREAD );
+ }
+}
+
//________________________________________________________________________________________________________
// SfxListener
//________________________________________________________________________________________________________
commit ddd2a00ef18e7c8865dc5888d54f99d08aa4063f
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Wed Apr 10 23:54:49 2013 -0400
Handle load error correctly.
When we fail to load a new document, we shouldn't manually delete
the SfxMedium instance there since SfxObjectShell gets to own it after
the DoLoadExternal call. And we need to throw an error instead of simply
return from load().
Change-Id: Ic194d47dd1caaab3034aba1b9add54c9b5338a38
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index a333a98..c84e2ad 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -1856,8 +1856,8 @@ void SAL_CALL SfxBaseModel::load( const Sequence< beans::PropertyValue >& seqA
{
if (!m_pData->m_pObjectShell->DoLoadExternal(pMedium))
{
- delete pMedium;
- return;
+ throw task::ErrorCodeIOException(
+ OUString(), Reference<XInterface>(), ERRCODE_IO_CANTREAD);
}
pMedium->SetUpdatePickList(false);
commit 4b3da418d665b7c9bb0f3a8783b7666330e1ec11
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Wed Apr 10 21:12:30 2013 -0400
Parameter order is wrong.
Change-Id: I165c75693c4d4acb331e93905392fa7b6f7bc1c0
diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
index 68f7a1f..07bc1b2 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -29,7 +29,7 @@ ScOrcusGlobalSettings::ScOrcusGlobalSettings(ScDocument& rDoc) : mrDoc(rDoc) {}
void ScOrcusGlobalSettings::set_origin_date(int year, int month, int day)
{
ScDocOptions aOpt = mrDoc.GetDocOptions();
- aOpt.SetDate(year, month, day);
+ aOpt.SetDate(day, month, year);
mrDoc.SetDocOptions(aOpt);
}
commit 3b9bc3e8703fe751911333f22e689710187f130d
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Wed Apr 10 21:04:38 2013 -0400
Import null date via orcus.
Change-Id: Ifa50e460768ffff4b1096d795ab694fea62a6c29
diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx
index 4cb03fa..05ebc6d 100644
--- a/sc/source/filter/inc/orcusinterface.hxx
+++ b/sc/source/filter/inc/orcusinterface.hxx
@@ -26,6 +26,16 @@ class ScOrcusSheet;
class ScOrcusFactory;
class ScRangeData;
+class ScOrcusGlobalSettings : public orcus::spreadsheet::iface::import_global_settings
+{
+ ScDocument& mrDoc;
+
+public:
+ ScOrcusGlobalSettings(ScDocument& rDoc);
+
+ virtual void set_origin_date(int year, int month, int day);
+};
+
class ScOrcusSharedStrings : public orcus::spreadsheet::iface::import_shared_strings
{
ScOrcusFactory& mrFactory;
@@ -175,6 +185,7 @@ class ScOrcusFactory : public orcus::spreadsheet::iface::import_factory
StringHashType maStringHash;
StringCellCaches maStringCells;
+ ScOrcusGlobalSettings maGlobalSettings;
ScOrcusSharedStrings maSharedStrings;
boost::ptr_vector<ScOrcusSheet> maSheets;
ScOrcusStyles maStyles;
@@ -184,6 +195,7 @@ public:
virtual orcus::spreadsheet::iface::import_sheet* append_sheet(const char *sheet_name, size_t sheet_name_length);
virtual orcus::spreadsheet::iface::import_sheet* get_sheet(const char *sheet_name, size_t sheet_name_length);
+ virtual orcus::spreadsheet::iface::import_global_settings* get_global_settings();
virtual orcus::spreadsheet::iface::import_shared_strings* get_shared_strings();
virtual orcus::spreadsheet::iface::import_styles* get_styles();
virtual void finalize();
diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
index e843467..68f7a1f 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -15,6 +15,7 @@
#include "tokenarray.hxx"
#include "stringutil.hxx"
#include "globalnames.hxx"
+#include "docoptio.hxx"
#include "formula/token.hxx"
#include "tools/datetime.hxx"
@@ -23,10 +24,22 @@ using orcus::spreadsheet::row_t;
using orcus::spreadsheet::col_t;
using orcus::spreadsheet::formula_grammar_t;
+ScOrcusGlobalSettings::ScOrcusGlobalSettings(ScDocument& rDoc) : mrDoc(rDoc) {}
+
+void ScOrcusGlobalSettings::set_origin_date(int year, int month, int day)
+{
+ ScDocOptions aOpt = mrDoc.GetDocOptions();
+ aOpt.SetDate(year, month, day);
+ mrDoc.SetDocOptions(aOpt);
+}
+
ScOrcusFactory::StringCellCache::StringCellCache(const ScAddress& rPos, size_t nIndex) :
maPos(rPos), mnIndex(nIndex) {}
-ScOrcusFactory::ScOrcusFactory(ScDocument& rDoc) : mrDoc(rDoc), maSharedStrings(*this) {}
+ScOrcusFactory::ScOrcusFactory(ScDocument& rDoc) :
+ mrDoc(rDoc),
+ maGlobalSettings(mrDoc),
+ maSharedStrings(*this) {}
orcus::spreadsheet::iface::import_sheet* ScOrcusFactory::append_sheet(const char* sheet_name, size_t sheet_name_length)
{
@@ -71,6 +84,11 @@ orcus::spreadsheet::iface::import_sheet* ScOrcusFactory::get_sheet(const char* s
return &maSheets.back();
}
+orcus::spreadsheet::iface::import_global_settings* ScOrcusFactory::get_global_settings()
+{
+ return &maGlobalSettings;
+}
+
orcus::spreadsheet::iface::import_shared_strings* ScOrcusFactory::get_shared_strings()
{
return &maSharedStrings;
commit bc36f99b32cd46acd4e5dbdc63cfff23316185af
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Wed Apr 10 15:14:02 2013 -0400
Centralize D_TIMEFACTOR as DATE_TIME_FACTOR.
It was about time.
Change-Id: I87225be540c22b3031c6aee3f3fd9d26795abef8
diff --git a/sc/inc/globalnames.hxx b/sc/inc/globalnames.hxx
index 4fee471..b388a7c 100644
--- a/sc/inc/globalnames.hxx
+++ b/sc/inc/globalnames.hxx
@@ -36,6 +36,8 @@
#define TEXTWIDTH_DIRTY 0xffff
+#define DATE_TIME_FACTOR 86400.0
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/dbdocutl.cxx b/sc/source/core/data/dbdocutl.cxx
index fcdfab5..eb244f7 100644
--- a/sc/source/core/data/dbdocutl.cxx
+++ b/sc/source/core/data/dbdocutl.cxx
@@ -26,11 +26,10 @@
#include "document.hxx"
#include "formula/errorcodes.hxx"
#include "stringutil.hxx"
+#include "globalnames.hxx"
using namespace ::com::sun::star;
-#define D_TIMEFACTOR 86400.0
-
// ----------------------------------------------------------------------------
ScDatabaseDocUtil::StrData::StrData() :
@@ -111,7 +110,7 @@ void ScDatabaseDocUtil::PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB
util::Time aTime = xRow->getTime(nRowPos);
nVal = ( aTime.Hours * 3600 + aTime.Minutes * 60 +
- aTime.Seconds + aTime.HundredthSeconds / 100.0 ) / D_TIMEFACTOR;
+ aTime.Seconds + aTime.HundredthSeconds / 100.0 ) / DATE_TIME_FACTOR;
bEmptyFlag = xRow->wasNull();
bValue = sal_True;
}
@@ -127,7 +126,7 @@ void ScDatabaseDocUtil::PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB
nVal = ( Date( aStamp.Day, aStamp.Month, aStamp.Year ) -
*pFormTable->GetNullDate() ) +
( aStamp.Hours * 3600 + aStamp.Minutes * 60 +
- aStamp.Seconds + aStamp.HundredthSeconds / 100.0 ) / D_TIMEFACTOR;
+ aStamp.Seconds + aStamp.HundredthSeconds / 100.0 ) / DATE_TIME_FACTOR;
bEmptyFlag = xRow->wasNull();
bValue = sal_True;
}
diff --git a/sc/source/core/data/dpgroup.cxx b/sc/source/core/data/dpgroup.cxx
index bc2e132..5368523 100644
--- a/sc/source/core/data/dpgroup.cxx
+++ b/sc/source/core/data/dpgroup.cxx
@@ -27,6 +27,7 @@
#include "dpobject.hxx"
#include "dpglobal.hxx"
#include "dputil.hxx"
+#include "globalnames.hxx"
#include <rtl/math.hxx>
@@ -48,8 +49,6 @@ using ::com::sun::star::uno::UNO_QUERY_THROW;
using ::std::vector;
using ::boost::shared_ptr;
-#define D_TIMEFACTOR 86400.0
-
const sal_uInt16 SC_DP_LEAPYEAR = 1648; // arbitrary leap year for date calculations
class ScDPGroupNumFilter : public ScDPFilteredCache::FilterBase
@@ -155,7 +154,7 @@ bool ScDPGroupDateFilter::match( const ScDPItemData & rCellData ) const
// (as in the cell functions, ScInterpreter::ScGetHour etc.: seconds are rounded)
double time = rCellData.GetValue() - approxFloor(rCellData.GetValue());
- long seconds = static_cast<long>(approxFloor(time*D_TIMEFACTOR + 0.5));
+ long seconds = static_cast<long>(approxFloor(time*DATE_TIME_FACTOR + 0.5));
switch (nGroupType)
{
diff --git a/sc/source/core/data/dputil.cxx b/sc/source/core/data/dputil.cxx
index a842d7d..bbf0489 100644
--- a/sc/source/core/data/dputil.cxx
+++ b/sc/source/core/data/dputil.cxx
@@ -30,6 +30,7 @@
#include "global.hxx"
#include "dpitemdata.hxx"
#include "dpnumgroupinfo.hxx"
+#include "globalnames.hxx"
#include "comphelper/string.hxx"
#include "unotools/localedatawrapper.hxx"
@@ -40,8 +41,6 @@
#include <com/sun/star/sheet/DataPilotFieldGroupBy.hpp>
#include <com/sun/star/i18n/CalendarDisplayIndex.hpp>
-#define D_TIMEFACTOR 86400.0
-
using namespace com::sun::star;
namespace {
@@ -314,7 +313,7 @@ sal_Int32 ScDPUtil::getDatePartValue(
// (as in the cell functions, ScInterpreter::ScGetHour etc.: seconds are rounded)
double fTime = fValue - rtl::math::approxFloor(fValue);
- long nSeconds = (long)rtl::math::approxFloor(fTime*D_TIMEFACTOR+0.5);
+ long nSeconds = (long)rtl::math::approxFloor(fTime*DATE_TIME_FACTOR+0.5);
switch (nDatePart)
{
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index 883a2e9..ad4daa7 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -43,14 +43,13 @@
#include "dpobject.hxx"
#include "postit.hxx"
#include "tokenarray.hxx"
+#include "globalnames.hxx"
#include <string.h>
#include <math.h>
using namespace formula;
-// STATIC DATA -----------------------------------------------------------
-#define D_TIMEFACTOR 86400.0
#define SCdEpsilon 1.0E-7
//-----------------------------------------------------------------------------
@@ -117,7 +116,7 @@ void ScInterpreter::ScGetActTime()
double nTime = ((double)aActTime.Get100Sec() / 100 +
(double)(aActTime.GetSec() +
(aActTime.GetMin() * 60) +
- (aActTime.GetHour() * 3600))) / D_TIMEFACTOR;
+ (aActTime.GetHour() * 3600))) / DATE_TIME_FACTOR;
PushDouble( (double) nDiff + nTime );
}
@@ -150,7 +149,7 @@ void ScInterpreter::ScGetMin()
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetMin" );
double fTime = GetDouble();
fTime -= ::rtl::math::approxFloor(fTime); // Datumsanteil weg
- long nVal = (long)::rtl::math::approxFloor(fTime*D_TIMEFACTOR+0.5) % 3600;
+ long nVal = (long)::rtl::math::approxFloor(fTime*DATE_TIME_FACTOR+0.5) % 3600;
PushDouble( (double) (nVal/60) );
}
@@ -159,7 +158,7 @@ void ScInterpreter::ScGetSec()
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetSec" );
double fTime = GetDouble();
fTime -= ::rtl::math::approxFloor(fTime); // Datumsanteil weg
- long nVal = (long)::rtl::math::approxFloor(fTime*D_TIMEFACTOR+0.5) % 60;
+ long nVal = (long)::rtl::math::approxFloor(fTime*DATE_TIME_FACTOR+0.5) % 60;
PushDouble( (double) nVal );
}
@@ -168,7 +167,7 @@ void ScInterpreter::ScGetHour()
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetHour" );
double fTime = GetDouble();
fTime -= ::rtl::math::approxFloor(fTime); // Datumsanteil weg
- long nVal = (long)::rtl::math::approxFloor(fTime*D_TIMEFACTOR+0.5) / 3600;
+ long nVal = (long)::rtl::math::approxFloor(fTime*DATE_TIME_FACTOR+0.5) / 3600;
PushDouble((double) nVal);
}
@@ -289,7 +288,7 @@ void ScInterpreter::ScGetTime()
double nSec = GetDouble();
double nMin = GetDouble();
double nHour = GetDouble();
- double fTime = fmod( (nHour * 3600) + (nMin * 60) + nSec, D_TIMEFACTOR) / D_TIMEFACTOR;
+ double fTime = fmod( (nHour * 3600) + (nMin * 60) + nSec, DATE_TIME_FACTOR) / DATE_TIME_FACTOR;
if (fTime < 0)
PushIllegalArgument();
else
diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
index 06d03ba..e843467 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -14,12 +14,11 @@
#include "rangenam.hxx"
#include "tokenarray.hxx"
#include "stringutil.hxx"
+#include "globalnames.hxx"
#include "formula/token.hxx"
#include "tools/datetime.hxx"
-#define D_TIMEFACTOR 86400.0
-
using orcus::spreadsheet::row_t;
using orcus::spreadsheet::col_t;
using orcus::spreadsheet::formula_grammar_t;
@@ -169,7 +168,7 @@ void ScOrcusSheet::set_date_time(
aTime.GetMin() * 60.0 +
aTime.GetHour() * 3600.0;
- fTime /= D_TIMEFACTOR;
+ fTime /= DATE_TIME_FACTOR;
mrDoc.SetValue(col, row, mnTab, nDateDiff + fTime);
}
diff --git a/sc/source/ui/view/viewfun6.cxx b/sc/source/ui/view/viewfun6.cxx
index 37376e4..ec0f6d4 100644
--- a/sc/source/ui/view/viewfun6.cxx
+++ b/sc/source/ui/view/viewfun6.cxx
@@ -43,14 +43,12 @@
#include "formulacell.hxx"
#include "markdata.hxx"
#include "drawview.hxx"
+#include "globalnames.hxx"
#include <vector>
using ::std::vector;
-#define D_TIMEFACTOR 86400.0
-
-
void ScViewFunc::DetectiveAddPred()
{
ScDocShell* pDocSh = GetViewData()->GetDocShell();
@@ -255,7 +253,7 @@ void ScViewFunc::InsertCurrentTime(short nCellFmt, const OUString& rUndoStr)
double fTime =
aActTime.Get100Sec() / 100.0 + aActTime.GetSec() +
(aActTime.GetMin() * 60.0) + (aActTime.GetHour() * 3600.0);
- fTime /= D_TIMEFACTOR;
+ fTime /= DATE_TIME_FACTOR;
pUndoMgr->EnterListAction(rUndoStr, rUndoStr);
pDocSh->GetDocFunc().SetValueCell(aCurPos, fDate+fTime, true);
commit 2a53a72fbffe285fb50193f853bab60db61ccf54
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Wed Apr 10 15:03:12 2013 -0400
Properly implement date / time value import from orcus.
Change-Id: Icaf310182dcdd2a5d06c2d4bcbb98e3850fb2d80
diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx
index 69e123b..4cb03fa 100644
--- a/sc/source/filter/inc/orcusinterface.hxx
+++ b/sc/source/filter/inc/orcusinterface.hxx
@@ -62,7 +62,8 @@ public:
virtual void set_string(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, size_t sindex);
virtual void set_value(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, double value);
virtual void set_bool(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, bool value);
- virtual void set_date(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, const char* p, size_t n);
+ virtual void set_date_time(
+ orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, int year, int month, int day, int hour, int minute, double second);
virtual void set_format(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, size_t xf_index);
diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
index 5c00e56..06d03ba 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -15,7 +15,10 @@
#include "tokenarray.hxx"
#include "stringutil.hxx"
-#include <formula/token.hxx>
+#include "formula/token.hxx"
+#include "tools/datetime.hxx"
+
+#define D_TIMEFACTOR 86400.0
using orcus::spreadsheet::row_t;
using orcus::spreadsheet::col_t;
@@ -148,9 +151,27 @@ void ScOrcusSheet::set_bool(row_t row, col_t col, bool value)
mrDoc.SetValue(col, row, mnTab, value ? 1.0 : 0.0);
}
-void ScOrcusSheet::set_date(row_t row, col_t col, const char* p, size_t n)
+void ScOrcusSheet::set_date_time(
+ row_t row, col_t col, int year, int month, int day, int hour, int minute, double second)
{
- set_auto(row, col, p, n);
+ SvNumberFormatter* pFormatter = mrDoc.GetFormatTable();
+
+ Date aDate(day, month, year);
+ sal_uIntPtr nSec = floor(second);
+ sal_uIntPtr nSec100 = (second - nSec) * 100;
+ Time aTime(hour, minute, nSec, nSec100);
+ Date aNullDate(*pFormatter->GetNullDate());
+ long nDateDiff = aDate - aNullDate;
+
+ double fTime =
+ static_cast<double>(aTime.Get100Sec()) / 100.0 +
+ aTime.GetSec() +
+ aTime.GetMin() * 60.0 +
+ aTime.GetHour() * 3600.0;
+
+ fTime /= D_TIMEFACTOR;
+
+ mrDoc.SetValue(col, row, mnTab, nDateDiff + fTime);
}
void ScOrcusSheet::set_format(row_t /*row*/, col_t /*col*/, size_t /*xf_index*/)
commit eea7b093d10d5bec85a090f5d205783bada94ad6
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Tue Apr 9 22:36:58 2013 -0400
Implement set_date() interface method.
It'll simply call set_auto() for now.
Change-Id: I580b2ecbd34ffe7674f64ade912877ef07a60aca
diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx
index adf7882..69e123b 100644
--- a/sc/source/filter/inc/orcusinterface.hxx
+++ b/sc/source/filter/inc/orcusinterface.hxx
@@ -59,6 +59,11 @@ public:
// Orcus import interface
virtual void set_auto(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, const char* p, size_t n);
+ virtual void set_string(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, size_t sindex);
+ virtual void set_value(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, double value);
+ virtual void set_bool(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, bool value);
+ virtual void set_date(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, const char* p, size_t n);
+
virtual void set_format(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, size_t xf_index);
virtual void set_formula(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, orcus::spreadsheet::formula_grammar_t grammar, const char* p, size_t n);
@@ -82,10 +87,6 @@ public:
orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, orcus::spreadsheet::formula_grammar_t grammar,
const char* p, size_t n, const char* p_range, size_t n_range);
- virtual void set_string(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, size_t sindex);
- virtual void set_value(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, double value);
- virtual void set_bool(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, bool value);
-
SCTAB getIndex() const { return mnTab; }
};
diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
index 8f9eb07..5c00e56 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -128,6 +128,31 @@ void ScOrcusSheet::set_auto(row_t row, col_t col, const char* p, size_t n)
mrDoc.SetString(col, row, mnTab, aVal);
}
+void ScOrcusSheet::set_string(row_t row, col_t col, size_t sindex)
+{
+ // We need to defer string cells since the shared string pool is not yet
+ // populated at the time this method is called. Orcus imports string
+ // table after the cells get imported. We won't need to do this once we
+ // implement true shared strings in Calc core.
+
+ mrFactory.pushStringCell(ScAddress(col, row, mnTab), sindex);
+}
+
+void ScOrcusSheet::set_value(row_t row, col_t col, double value)
+{
+ mrDoc.SetValue( col, row, mnTab, value );
+}
+
+void ScOrcusSheet::set_bool(row_t row, col_t col, bool value)
+{
+ mrDoc.SetValue(col, row, mnTab, value ? 1.0 : 0.0);
+}
+
+void ScOrcusSheet::set_date(row_t row, col_t col, const char* p, size_t n)
+{
+ set_auto(row, col, p, n);
+}
+
void ScOrcusSheet::set_format(row_t /*row*/, col_t /*col*/, size_t /*xf_index*/)
{
}
@@ -240,26 +265,6 @@ void ScOrcusSheet::set_array_formula(
{
}
-void ScOrcusSheet::set_string(row_t row, col_t col, size_t sindex)
-{
- // We need to defer string cells since the shared string pool is not yet
- // populated at the time this method is called. Orcus imports string
- // table after the cells get imported. We won't need to do this once we
- // implement true shared strings in Calc core.
-
- mrFactory.pushStringCell(ScAddress(col, row, mnTab), sindex);
-}
-
-void ScOrcusSheet::set_value(row_t row, col_t col, double value)
-{
- mrDoc.SetValue( col, row, mnTab, value );
-}
-
-void ScOrcusSheet::set_bool(row_t row, col_t col, bool value)
-{
- mrDoc.SetValue(col, row, mnTab, value ? 1.0 : 0.0);
-}
-
ScOrcusSharedStrings::ScOrcusSharedStrings(ScOrcusFactory& rFactory) :
mrFactory(rFactory) {}
commit 302a764316bbca6447940d7f346f821daabaff27
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Tue Apr 9 21:00:19 2013 -0400
Implement segment-based string import.
With this, string cells from ODS docs get imported. For now, format runs
are ignored.
Change-Id: Ia9530357d3afc6cf4a0c52362bc770560debfd61
diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx
index de07b75..adf7882 100644
--- a/sc/source/filter/inc/orcusinterface.hxx
+++ b/sc/source/filter/inc/orcusinterface.hxx
@@ -11,6 +11,7 @@
#define __SC_ORCUSINTERFACE_HXX__
#include "address.hxx"
+#include "rtl/strbuf.hxx"
#define __ORCUS_STATIC_LIB
#include <orcus/spreadsheet/import_interface.hpp>
@@ -29,6 +30,7 @@ class ScOrcusSharedStrings : public orcus::spreadsheet::iface::import_shared_str
{
ScOrcusFactory& mrFactory;
+ OStringBuffer maCurSegment;
public:
ScOrcusSharedStrings(ScOrcusFactory& rFactory);
diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
index 73b4d0b..8f9eb07 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -278,22 +278,28 @@ size_t ScOrcusSharedStrings::add(const char* s, size_t n)
void ScOrcusSharedStrings::set_segment_bold(bool /*b*/)
{
}
+
void ScOrcusSharedStrings::set_segment_italic(bool /*b*/)
{
}
+
void ScOrcusSharedStrings::set_segment_font_name(const char* /*s*/, size_t /*n*/)
{
}
+
void ScOrcusSharedStrings::set_segment_font_size(double /*point*/)
{
}
-void ScOrcusSharedStrings::append_segment(const char* /*s*/, size_t /*n*/)
+
+void ScOrcusSharedStrings::append_segment(const char* s, size_t n)
{
+ maCurSegment.append(s, n);
}
size_t ScOrcusSharedStrings::commit_segments()
{
- return 0;
+ OString aStr = maCurSegment.makeStringAndClear();
+ return mrFactory.addString(OStringToOUString(aStr, RTL_TEXTENCODING_UTF8));
}
void ScOrcusStyles::set_font_count(size_t /*n*/)
commit 01944e4c8c44a7fd9a8bc42708247f1bf5a528f6
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Tue Apr 9 19:50:21 2013 -0400
Correctly implement add() and append() of shared strings interface.
Change-Id: I9c1d0e904464ff2489678972aa5c6b6e4246cd81
diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx
index 313331c..de07b75 100644
--- a/sc/source/filter/inc/orcusinterface.hxx
+++ b/sc/source/filter/inc/orcusinterface.hxx
@@ -16,6 +16,7 @@
#include <orcus/spreadsheet/import_interface.hpp>
#include <boost/ptr_container/ptr_vector.hpp>
+#include <boost/unordered_map.hpp>
#include <map>
@@ -26,10 +27,10 @@ class ScRangeData;
class ScOrcusSharedStrings : public orcus::spreadsheet::iface::import_shared_strings
{
- std::vector<OUString>& mrStrings;
+ ScOrcusFactory& mrFactory;
public:
- ScOrcusSharedStrings(std::vector<OUString>& rStrings);
+ ScOrcusSharedStrings(ScOrcusFactory& rFactory);
virtual size_t append(const char* s, size_t n);
virtual size_t add(const char* s, size_t n);
@@ -161,10 +162,14 @@ class ScOrcusFactory : public orcus::spreadsheet::iface::import_factory
StringCellCache(const ScAddress& rPos, size_t nIndex);
};
+ typedef boost::unordered_map<OUString, size_t, OUStringHash> StringHashType;
typedef std::vector<StringCellCache> StringCellCaches;
ScDocument& mrDoc;
+
std::vector<OUString> maStrings;
+ StringHashType maStringHash;
+
StringCellCaches maStringCells;
ScOrcusSharedStrings maSharedStrings;
boost::ptr_vector<ScOrcusSheet> maSheets;
@@ -179,6 +184,9 @@ public:
virtual orcus::spreadsheet::iface::import_styles* get_styles();
virtual void finalize();
+ size_t appendString(const OUString& rStr);
+ size_t addString(const OUString& rStr);
+
void pushStringCell(const ScAddress& rPos, size_t nStrIndex);
};
diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
index 45f2304..73b4d0b 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -24,7 +24,7 @@ using orcus::spreadsheet::formula_grammar_t;
ScOrcusFactory::StringCellCache::StringCellCache(const ScAddress& rPos, size_t nIndex) :
maPos(rPos), mnIndex(nIndex) {}
-ScOrcusFactory::ScOrcusFactory(ScDocument& rDoc) : mrDoc(rDoc), maSharedStrings(maStrings) {}
+ScOrcusFactory::ScOrcusFactory(ScDocument& rDoc) : mrDoc(rDoc), maSharedStrings(*this) {}
orcus::spreadsheet::iface::import_sheet* ScOrcusFactory::append_sheet(const char* sheet_name, size_t sheet_name_length)
{
@@ -95,6 +95,25 @@ void ScOrcusFactory::finalize()
}
}
+size_t ScOrcusFactory::appendString(const OUString& rStr)
+{
+ size_t nPos = maStrings.size();
+ maStrings.push_back(rStr);
+ maStringHash.insert(StringHashType::value_type(rStr, nPos));
+
+ return nPos;
+}
+
+size_t ScOrcusFactory::addString(const OUString& rStr)
+{
+ // Add only if the string is not yet present in the string pool.
+ StringHashType::iterator it = maStringHash.find(rStr);
+ if (it != maStringHash.end())
+ return it->second;
+
+ return appendString(rStr);
+}
+
void ScOrcusFactory::pushStringCell(const ScAddress& rPos, size_t nStrIndex)
{
maStringCells.push_back(StringCellCache(rPos, nStrIndex));
@@ -241,23 +260,19 @@ void ScOrcusSheet::set_bool(row_t row, col_t col, bool value)
mrDoc.SetValue(col, row, mnTab, value ? 1.0 : 0.0);
}
-ScOrcusSharedStrings::ScOrcusSharedStrings(std::vector<OUString>& rStrings) :
- mrStrings(rStrings) {}
+ScOrcusSharedStrings::ScOrcusSharedStrings(ScOrcusFactory& rFactory) :
+ mrFactory(rFactory) {}
size_t ScOrcusSharedStrings::append(const char* s, size_t n)
{
OUString aNewString(s, n, RTL_TEXTENCODING_UTF8);
- mrStrings.push_back(aNewString);
-
- return mrStrings.size() - 1;
+ return mrFactory.appendString(aNewString);
}
size_t ScOrcusSharedStrings::add(const char* s, size_t n)
{
OUString aNewString(s, n, RTL_TEXTENCODING_UTF8);
- mrStrings.push_back(aNewString);
-
- return mrStrings.size() - 1;
+ return mrFactory.addString(aNewString);
}
void ScOrcusSharedStrings::set_segment_bold(bool /*b*/)
commit 05f4bb6cdd5617db8db0c3d5279cff373cec949b
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Tue Apr 9 19:17:03 2013 -0400
Defer string cell import until the end when importing via orcus.
This is because orcus imports cells before it imports the string table.
Change-Id: I1b85be2d9832b9a9a52961ece735de8cd980b893
diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx
index 0de1fcc..313331c 100644
--- a/sc/source/filter/inc/orcusinterface.hxx
+++ b/sc/source/filter/inc/orcusinterface.hxx
@@ -21,13 +21,16 @@
class ScDocument;
class ScOrcusSheet;
+class ScOrcusFactory;
class ScRangeData;
class ScOrcusSharedStrings : public orcus::spreadsheet::iface::import_shared_strings
{
- std::vector<OUString> maSharedStrings;
+ std::vector<OUString>& mrStrings;
public:
+ ScOrcusSharedStrings(std::vector<OUString>& rStrings);
+
virtual size_t append(const char* s, size_t n);
virtual size_t add(const char* s, size_t n);
@@ -38,20 +41,18 @@ public:
virtual void append_segment(const char* s, size_t n);
virtual size_t commit_segments();
-
- const OUString& getByIndex(size_t index) const;
};
class ScOrcusSheet : public orcus::spreadsheet::iface::import_sheet
{
ScDocument& mrDoc;
SCTAB mnTab;
- ScOrcusSharedStrings& mrSharedStrings;
+ ScOrcusFactory& mrFactory;
typedef std::map<size_t, ScRangeData*> SharedFormulaContainer;
SharedFormulaContainer maSharedFormulas;
public:
- ScOrcusSheet(ScDocument& rDoc, SCTAB nTab, ScOrcusSharedStrings& rSharedStrings);
+ ScOrcusSheet(ScDocument& rDoc, SCTAB nTab, ScOrcusFactory& rFactory);
// Orcus import interface
virtual void set_auto(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, const char* p, size_t n);
@@ -152,9 +153,21 @@ public:
class ScOrcusFactory : public orcus::spreadsheet::iface::import_factory
{
+ struct StringCellCache
+ {
+ ScAddress maPos;
+ size_t mnIndex;
+
+ StringCellCache(const ScAddress& rPos, size_t nIndex);
+ };
+
+ typedef std::vector<StringCellCache> StringCellCaches;
+
ScDocument& mrDoc;
- boost::ptr_vector<ScOrcusSheet> maSheets;
+ std::vector<OUString> maStrings;
+ StringCellCaches maStringCells;
ScOrcusSharedStrings maSharedStrings;
+ boost::ptr_vector<ScOrcusSheet> maSheets;
ScOrcusStyles maStyles;
public:
@@ -164,6 +177,9 @@ public:
virtual orcus::spreadsheet::iface::import_sheet* get_sheet(const char *sheet_name, size_t sheet_name_length);
virtual orcus::spreadsheet::iface::import_shared_strings* get_shared_strings();
virtual orcus::spreadsheet::iface::import_styles* get_styles();
+ virtual void finalize();
+
+ void pushStringCell(const ScAddress& rPos, size_t nStrIndex);
};
#endif
diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
index 5e48208..45f2304 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -13,14 +13,18 @@
#include "formulacell.hxx"
#include "rangenam.hxx"
#include "tokenarray.hxx"
-#include <formula/token.hxx>
+#include "stringutil.hxx"
+#include <formula/token.hxx>
using orcus::spreadsheet::row_t;
using orcus::spreadsheet::col_t;
using orcus::spreadsheet::formula_grammar_t;
-ScOrcusFactory::ScOrcusFactory(ScDocument& rDoc) : mrDoc(rDoc) {}
+ScOrcusFactory::StringCellCache::StringCellCache(const ScAddress& rPos, size_t nIndex) :
+ maPos(rPos), mnIndex(nIndex) {}
+
+ScOrcusFactory::ScOrcusFactory(ScDocument& rDoc) : mrDoc(rDoc), maSharedStrings(maStrings) {}
orcus::spreadsheet::iface::import_sheet* ScOrcusFactory::append_sheet(const char* sheet_name, size_t sheet_name_length)
{
@@ -29,7 +33,7 @@ orcus::spreadsheet::iface::import_sheet* ScOrcusFactory::append_sheet(const char
return NULL;
SCTAB nTab = mrDoc.GetTableCount() - 1;
- maSheets.push_back(new ScOrcusSheet(mrDoc, nTab, maSharedStrings));
+ maSheets.push_back(new ScOrcusSheet(mrDoc, nTab, *this));
return &maSheets.back();
}
@@ -61,7 +65,7 @@ orcus::spreadsheet::iface::import_sheet* ScOrcusFactory::get_sheet(const char* s
return &(*it);
// Create a new orcus sheet instance for this.
- maSheets.push_back(new ScOrcusSheet(mrDoc, nTab, maSharedStrings));
+ maSheets.push_back(new ScOrcusSheet(mrDoc, nTab, *this));
return &maSheets.back();
}
@@ -76,8 +80,28 @@ orcus::spreadsheet::iface::import_styles* ScOrcusFactory::get_styles()
return &maStyles;
}
-ScOrcusSheet::ScOrcusSheet(ScDocument& rDoc, SCTAB nTab, ScOrcusSharedStrings& rSharedStrings) :
- mrDoc(rDoc), mnTab(nTab), mrSharedStrings(rSharedStrings) {}
+void ScOrcusFactory::finalize()
+{
+ ScSetStringParam aParam;
+ aParam.setTextInput();
+ StringCellCaches::const_iterator it = maStringCells.begin(), itEnd = maStringCells.end();
+ for (; it != itEnd; ++it)
+ {
+ if (it->mnIndex >= maStrings.size())
+ // String index out-of-bound! Something is up.
+ continue;
+
+ mrDoc.SetString(it->maPos, maStrings[it->mnIndex], &aParam);
+ }
+}
+
+void ScOrcusFactory::pushStringCell(const ScAddress& rPos, size_t nStrIndex)
+{
+ maStringCells.push_back(StringCellCache(rPos, nStrIndex));
+}
+
+ScOrcusSheet::ScOrcusSheet(ScDocument& rDoc, SCTAB nTab, ScOrcusFactory& rFactory) :
+ mrDoc(rDoc), mnTab(nTab), mrFactory(rFactory) {}
void ScOrcusSheet::set_auto(row_t row, col_t col, const char* p, size_t n)
{
@@ -199,13 +223,12 @@ void ScOrcusSheet::set_array_formula(
void ScOrcusSheet::set_string(row_t row, col_t col, size_t sindex)
{
- // Calc does not yet support shared strings so we have to
- // workaround by importing shared strings into a temporary
- // shared string container and writing into calc model as
- // normal string
+ // We need to defer string cells since the shared string pool is not yet
+ // populated at the time this method is called. Orcus imports string
+ // table after the cells get imported. We won't need to do this once we
+ // implement true shared strings in Calc core.
- const OUString& rSharedString = mrSharedStrings.getByIndex(sindex);
- mrDoc.SetTextCell(ScAddress(col,row,mnTab), rSharedString);
+ mrFactory.pushStringCell(ScAddress(col, row, mnTab), sindex);
}
void ScOrcusSheet::set_value(row_t row, col_t col, double value)
@@ -218,28 +241,23 @@ void ScOrcusSheet::set_bool(row_t row, col_t col, bool value)
mrDoc.SetValue(col, row, mnTab, value ? 1.0 : 0.0);
}
+ScOrcusSharedStrings::ScOrcusSharedStrings(std::vector<OUString>& rStrings) :
+ mrStrings(rStrings) {}
+
size_t ScOrcusSharedStrings::append(const char* s, size_t n)
{
OUString aNewString(s, n, RTL_TEXTENCODING_UTF8);
- maSharedStrings.push_back(aNewString);
+ mrStrings.push_back(aNewString);
- return maSharedStrings.size() - 1;
+ return mrStrings.size() - 1;
}
size_t ScOrcusSharedStrings::add(const char* s, size_t n)
{
OUString aNewString(s, n, RTL_TEXTENCODING_UTF8);
- maSharedStrings.push_back(aNewString);
-
- return maSharedStrings.size() - 1;
-}
-
-const OUString& ScOrcusSharedStrings::getByIndex(size_t nIndex) const
-{
- if(nIndex < maSharedStrings.size())
- return maSharedStrings[nIndex];
+ mrStrings.push_back(aNewString);
- return EMPTY_OUSTRING;
+ return mrStrings.size() - 1;
}
void ScOrcusSharedStrings::set_segment_bold(bool /*b*/)
commit 644f122a2d2b49f3aff9755093872bb38565ee5d
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Tue Apr 9 17:08:36 2013 -0400
Use environment variable LIBO_USE_ORCUS to decide whether or not to use orcus.
This way we won't need to re-compile every time we need to switch between.
Change-Id: I7d56a838c420a645ce8bebe0f0d9beaa78476fd6
diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx
index c824222..1820254 100644
--- a/framework/source/loadenv/loadenv.cxx
+++ b/framework/source/loadenv/loadenv.cxx
@@ -80,6 +80,7 @@
#include <unotools/ucbhelper.hxx>
#include <comphelper/configurationhelper.hxx>
#include <rtl/ustrbuf.hxx>
+#include "rtl/bootstrap.hxx"
#include <vcl/svapp.hxx>
const char PROP_TYPES[] = "Types";
@@ -734,6 +735,10 @@ bool queryOrcusTypeAndFilter(const uno::Sequence<beans::PropertyValue>& rDescrip
if (aURL.isEmpty() || aURL.copy(0,8).equalsIgnoreAsciiCase("private:"))
return false;
+ OUString aUseOrcus;
+ rtl::Bootstrap::get("LIBO_USE_ORCUS", aUseOrcus);
+ bool bUseOrcus = (aUseOrcus == "YES");
+
// TODO : Type must be set to be generic_Text (or any other type that
// exists) in order to find a usable loader. Exploit it as a temporary
// hack.
@@ -744,7 +749,11 @@ bool queryOrcusTypeAndFilter(const uno::Sequence<beans::PropertyValue>& rDescrip
rFilter = "gnumeric";
return true;
}
- else if (aURL.endsWith(".xlsx"))
+
+ if (!bUseOrcus)
+ return false;
+
+ if (aURL.endsWith(".xlsx"))
{
rType = "generic_Text";
rFilter = "xlsx";
commit 44358ce0b0c2ee5de981fdce66849b3f3ac32390
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Tue Apr 9 16:14:40 2013 -0400
Try not to crash during import of xlsx and ods documents.
Also, let's not leak memory by returning a new'ed instance from get_styles().
Orcus never manages the life cycle of objects returned from client code.
Change-Id: Id92eb10dbe88c2a55b5d04e408a01fa9c25fa9a1
diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx
index 4bc9b40..0de1fcc 100644
--- a/sc/source/filter/inc/orcusinterface.hxx
+++ b/sc/source/filter/inc/orcusinterface.hxx
@@ -42,21 +42,6 @@ public:
const OUString& getByIndex(size_t index) const;
};
-class ScOrcusFactory : public orcus::spreadsheet::iface::import_factory
-{
- ScDocument& mrDoc;
- boost::ptr_vector<ScOrcusSheet> maSheets;
- ScOrcusSharedStrings maSharedStrings;
-
-public:
- ScOrcusFactory(ScDocument& rDoc);
-
- virtual orcus::spreadsheet::iface::import_sheet* append_sheet(const char *sheet_name, size_t sheet_name_length);
- virtual orcus::spreadsheet::iface::import_sheet* get_sheet(const char *sheet_name, size_t sheet_name_length);
- virtual orcus::spreadsheet::iface::import_shared_strings* get_shared_strings();
- virtual orcus::spreadsheet::iface::import_styles* get_styles();
-};
-
class ScOrcusSheet : public orcus::spreadsheet::iface::import_sheet
{
ScDocument& mrDoc;
@@ -165,5 +150,21 @@ public:
virtual size_t commit_cell_style();
};
+class ScOrcusFactory : public orcus::spreadsheet::iface::import_factory
+{
+ ScDocument& mrDoc;
+ boost::ptr_vector<ScOrcusSheet> maSheets;
+ ScOrcusSharedStrings maSharedStrings;
+ ScOrcusStyles maStyles;
+
+public:
+ ScOrcusFactory(ScDocument& rDoc);
+
+ virtual orcus::spreadsheet::iface::import_sheet* append_sheet(const char *sheet_name, size_t sheet_name_length);
+ virtual orcus::spreadsheet::iface::import_sheet* get_sheet(const char *sheet_name, size_t sheet_name_length);
+ virtual orcus::spreadsheet::iface::import_shared_strings* get_shared_strings();
+ virtual orcus::spreadsheet::iface::import_styles* get_styles();
+};
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
index 25d9b5d..5e48208 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -73,7 +73,7 @@ orcus::spreadsheet::iface::import_shared_strings* ScOrcusFactory::get_shared_str
orcus::spreadsheet::iface::import_styles* ScOrcusFactory::get_styles()
{
// We don't support it yet.
- return new ScOrcusStyles;
+ return &maStyles;
}
ScOrcusSheet::ScOrcusSheet(ScDocument& rDoc, SCTAB nTab, ScOrcusSharedStrings& rSharedStrings) :
@@ -239,7 +239,7 @@ const OUString& ScOrcusSharedStrings::getByIndex(size_t nIndex) const
if(nIndex < maSharedStrings.size())
return maSharedStrings[nIndex];
- throw std::exception();
+ return EMPTY_OUSTRING;
}
void ScOrcusSharedStrings::set_segment_bold(bool /*b*/)
commit 0552a09b95010d0f622688c2508a0684803a3fa5
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Tue Apr 9 15:36:03 2013 -0400
Manage to use orcus to import ods, xlsx, and csv.
But this occasionally crashes.
Change-Id: I0a18d0e210639b43b89b966a54de541b9a43e329
diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx
index 86646d5..c824222 100644
--- a/framework/source/loadenv/loadenv.cxx
+++ b/framework/source/loadenv/loadenv.cxx
@@ -744,7 +744,6 @@ bool queryOrcusTypeAndFilter(const uno::Sequence<beans::PropertyValue>& rDescrip
rFilter = "gnumeric";
return true;
}
-#if 0
else if (aURL.endsWith(".xlsx"))
{
rType = "generic_Text";
@@ -757,7 +756,12 @@ bool queryOrcusTypeAndFilter(const uno::Sequence<beans::PropertyValue>& rDescrip
rFilter = "ods";
return true;
}
-#endif
+ else if (aURL.endsWith(".csv"))
+ {
+ rType = "generic_Text";
+ rFilter = "csv";
+ return true;
+ }
return false;
}
diff --git a/sc/inc/orcusfilters.hxx b/sc/inc/orcusfilters.hxx
index ef88795..ab09d8c 100644
--- a/sc/inc/orcusfilters.hxx
+++ b/sc/inc/orcusfilters.hxx
@@ -30,6 +30,10 @@ public:
virtual bool importGnumeric(ScDocument& rDoc, const OUString& rPath) const = 0;
+ virtual bool importXLSX(ScDocument& rDoc, const OUString& rPath) const = 0;
+
+ virtual bool importODS(ScDocument& rDoc, const OUString& rPath) const = 0;
+
/**
* Create a context for XML file. The context object stores session
* information for each unique XML file. You must create a new context
diff --git a/sc/source/filter/inc/orcusfiltersimpl.hxx b/sc/source/filter/inc/orcusfiltersimpl.hxx
index de5f988..e07cd19 100644
--- a/sc/source/filter/inc/orcusfiltersimpl.hxx
+++ b/sc/source/filter/inc/orcusfiltersimpl.hxx
@@ -22,6 +22,8 @@ public:
virtual bool importCSV(ScDocument& rDoc, const OUString& rPath) const;
virtual bool importGnumeric(ScDocument& rDoc, const OUString& rPath) const;
+ virtual bool importXLSX(ScDocument& rDoc, const OUString& rPath) const;
+ virtual bool importODS(ScDocument& rDoc, const OUString& rPath) const;
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list