Makefile.fetch                                                                 
          |    1 
 RepositoryExternal.mk                                                          
          |   54 ++++
 config_host.mk.in                                                              
          |    3 
 config_host/config_writerperfect.h.in                                          
          |    4 
 configure.ac                                                                   
          |    6 
 download.lst                                                                   
          |    3 
 external/Module_external.mk                                                    
          |    1 
 
external/libstaroffice/0001-error-C2512-StarObject-no-appropriate-default-constr.patch.1
 |   54 ++++
 external/libstaroffice/ExternalPackage_libstaroffice.mk                        
          |   22 +
 external/libstaroffice/ExternalProject_libstaroffice.mk                        
          |   53 ++++
 external/libstaroffice/Library_staroffice.mk                                   
          |  108 +++++++++
 external/libstaroffice/Makefile                                                
          |    7 
 external/libstaroffice/Module_libstaroffice.mk                                 
          |   31 ++
 external/libstaroffice/README                                                  
          |    3 
 external/libstaroffice/UnpackedTarball_libstaroffice.mk                        
          |   42 +++
 external/libstaroffice/libstaroffice-bundled-soname.patch.0                    
          |   11 
 external/libstaroffice/rpath.patch                                             
          |   10 
 external/libstaroffice/ubsan-visibility.patch                                  
          |   11 
 filter/Configuration_filter.mk                                                 
          |    6 
 filter/source/config/fragments/filters/StarOffice_Drawing.xcu                  
          |   29 ++
 filter/source/config/fragments/filters/StarOffice_Spreadsheet.xcu              
          |   29 ++
 filter/source/config/fragments/filters/StarOffice_Writer.xcu                   
          |   29 ++
 filter/source/config/fragments/types/StarOffice_Drawing.xcu                    
          |   27 ++
 filter/source/config/fragments/types/StarOffice_Spreadsheet.xcu                
          |   27 ++
 filter/source/config/fragments/types/StarOffice_Writer.xcu                     
          |   27 ++
 writerperfect/Library_wpftcalc.mk                                              
          |    2 
 writerperfect/Library_wpftdraw.mk                                              
          |    2 
 writerperfect/Library_wpftwriter.mk                                            
          |    2 
 writerperfect/qa/unit/WpftCalcFilterTest.cxx                                   
          |    1 
 writerperfect/qa/unit/WpftDrawFilterTest.cxx                                   
          |    5 
 writerperfect/qa/unit/WpftImportTestBase.hxx                                   
          |    3 
 writerperfect/qa/unit/WpftWriterFilterTest.cxx                                 
          |    5 
 writerperfect/qa/unit/data/calc/libstaroffice/pass/Calc_3.1.sdc                
          |binary
 writerperfect/qa/unit/data/draw/libstaroffice/pass/Draw_3.1.sda                
          |binary
 writerperfect/qa/unit/data/writer/libstaroffice/pass/Writer_3.1.sdw            
          |binary
 writerperfect/source/calc/StarOfficeCalcImportFilter.cxx                       
          |   96 ++++++++
 writerperfect/source/calc/StarOfficeCalcImportFilter.hxx                       
          |   45 +++
 writerperfect/source/calc/wpftcalc.component                                   
          |    5 
 writerperfect/source/common/WPXSvInputStream.cxx                               
          |    4 
 writerperfect/source/draw/StarOfficeDrawImportFilter.cxx                       
          |   98 ++++++++
 writerperfect/source/draw/StarOfficeDrawImportFilter.hxx                       
          |   45 +++
 writerperfect/source/draw/wpftdraw.component                                   
          |    5 
 writerperfect/source/writer/StarOfficeWriterImportFilter.cxx                   
          |  116 ++++++++++
 writerperfect/source/writer/StarOfficeWriterImportFilter.hxx                   
          |   45 +++
 writerperfect/source/writer/wpftwriter.component                               
          |    5 
 45 files changed, 1080 insertions(+), 2 deletions(-)

New commits:
commit f471c55378290fb8dc3571c74cc6abe90d81c46c
Author: osnola <alo...@loria.fr>
Date:   Wed Aug 10 13:26:58 2016 +0200

    add test files for libstaroffice
    
    Change-Id: Iabb5965eb09e9128f2cfc720bf69e97f6a96fa22

diff --git a/config_host/config_writerperfect.h.in 
b/config_host/config_writerperfect.h.in
index b42b3a7..8d2d819 100644
--- a/config_host/config_writerperfect.h.in
+++ b/config_host/config_writerperfect.h.in
@@ -24,6 +24,10 @@
 #undef MWAW_VERSION_MINOR
 #undef MWAW_VERSION_MICRO
 
+#undef STAROFFICE_VERSION_MAJOR
+#undef STAROFFICE_VERSION_MINOR
+#undef STAROFFICE_VERSION_MICRO
+
 #undef WPS_VERSION_MAJOR
 #undef WPS_VERSION_MINOR
 #undef WPS_VERSION_MICRO
diff --git a/configure.ac b/configure.ac
index 6a1e021e..6277942 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7913,6 +7913,7 @@ dnl 
===================================================================
 dnl Check for system libstaroffice
 dnl ===================================================================
 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
+libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.2])
 
 dnl ===================================================================
 dnl Check for system libvisio
diff --git a/writerperfect/qa/unit/WpftCalcFilterTest.cxx 
b/writerperfect/qa/unit/WpftCalcFilterTest.cxx
index 848f7e2..98c4302 100644
--- a/writerperfect/qa/unit/WpftCalcFilterTest.cxx
+++ b/writerperfect/qa/unit/WpftCalcFilterTest.cxx
@@ -39,6 +39,7 @@ void WpftCalcFilterTest::test()
     doTest("com.sun.star.comp.Calc.MWAWCalcImportFilter", 
"/writerperfect/qa/unit/data/calc/libmwaw/");
     doTest("com.sun.star.comp.Calc.MSWorksCalcImportFilter", 
"/writerperfect/qa/unit/data/calc/libwps/");
     doTest("org.libreoffice.comp.Calc.NumbersImportFilter", 
"/writerperfect/qa/unit/data/calc/libetonyek/", aEtonyekOptional);
+    doTest("org.libreoffice.comp.Calc.StarOfficeCalcImportFilter", 
"/writerperfect/qa/unit/data/calc/libstaroffice/");
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(WpftCalcFilterTest);
diff --git a/writerperfect/qa/unit/WpftDrawFilterTest.cxx 
b/writerperfect/qa/unit/WpftDrawFilterTest.cxx
index c5288ee..b2c9bb8 100644
--- a/writerperfect/qa/unit/WpftDrawFilterTest.cxx
+++ b/writerperfect/qa/unit/WpftDrawFilterTest.cxx
@@ -45,6 +45,10 @@ void WpftDrawFilterTest::test()
         {"MacDraw_II.hqx", REQUIRE_MWAW_VERSION(0, 3, 3)},
         {"MacDraw_Pro_1.0.hqx", REQUIRE_MWAW_VERSION(0, 3, 4)},
     };
+    const writerperfect::test::WpftOptionalMap_t aStarOfficeOptional
+    {
+        {"Draw_3.1.sda", REQUIRE_STAROFFICE_VERSION(0, 0, 1)},
+    };
 
     doTest("com.sun.star.comp.Draw.CDRImportFilter", 
"/writerperfect/qa/unit/data/draw/libcdr/");
     doTest("com.sun.star.comp.Draw.CMXImportFilter", 
"/writerperfect/qa/unit/data/draw/libcdr-cmx/");
@@ -54,6 +58,7 @@ void WpftDrawFilterTest::test()
     doTest("com.sun.star.comp.Draw.VisioImportFilter", 
"/writerperfect/qa/unit/data/draw/libvisio/");
     doTest("com.sun.star.comp.Draw.WPGImportFilter", 
"/writerperfect/qa/unit/data/draw/libwpg/");
     doTest("org.libreoffice.comp.Draw.PageMakerImportFilter", 
"/writerperfect/qa/unit/data/draw/libpagemaker/");
+    doTest("org.libreoffice.comp.Draw.StarOfficeDrawImportFilter", 
"/writerperfect/qa/unit/data/draw/libstaroffice/", aStarOfficeOptional);
     doTest("org.libreoffice.comp.Draw.ZMFImportFilter", 
"/writerperfect/qa/unit/data/draw/libzmf/");
 }
 
diff --git a/writerperfect/qa/unit/WpftImportTestBase.hxx 
b/writerperfect/qa/unit/WpftImportTestBase.hxx
index ce70172..a3baec9 100644
--- a/writerperfect/qa/unit/WpftImportTestBase.hxx
+++ b/writerperfect/qa/unit/WpftImportTestBase.hxx
@@ -38,6 +38,9 @@
 #define REQUIRE_MWAW_VERSION(major, minor, micro) \
     REQUIRE_VERSION(MWAW_VERSION_MAJOR, MWAW_VERSION_MINOR, 
MWAW_VERSION_MICRO, major, minor, micro)
 
+#define REQUIRE_STAROFFICE_VERSION(major, minor, micro) \
+    REQUIRE_VERSION(STAROFFICE_VERSION_MAJOR, STAROFFICE_VERSION_MINOR, 
STAROFFICE_VERSION_MICRO, major, minor, micro)
+
 #define REQUIRE_WPS_VERSION(major, minor, micro) \
     REQUIRE_VERSION(WPS_VERSION_MAJOR, WPS_VERSION_MINOR, WPS_VERSION_MICRO, 
major, minor, micro)
 
diff --git a/writerperfect/qa/unit/WpftWriterFilterTest.cxx 
b/writerperfect/qa/unit/WpftWriterFilterTest.cxx
index bf97854..3e9c6ba 100644
--- a/writerperfect/qa/unit/WpftWriterFilterTest.cxx
+++ b/writerperfect/qa/unit/WpftWriterFilterTest.cxx
@@ -47,6 +47,10 @@ void WpftWriterFilterTest::test()
         {"RagTime_3.2.hqx", REQUIRE_MWAW_VERSION(0, 3, 2)},
         {"RagTime_5.5.rag", REQUIRE_MWAW_VERSION(0, 3, 6)},
     };
+    const writerperfect::test::WpftOptionalMap_t aStarOfficeOptional
+    {
+        {"Writer_3.1.sdw", REQUIRE_STAROFFICE_VERSION(0, 0, 2)},
+    };
     const writerperfect::test::WpftOptionalMap_t aWpsOptional
     {
         {"Word_5.0_DOS.doc", REQUIRE_WPS_VERSION(0, 4, 3)},
@@ -58,6 +62,7 @@ void WpftWriterFilterTest::test()
     doTest("com.sun.star.comp.Writer.MSWorksImportFilter", 
"/writerperfect/qa/unit/data/writer/libwps/", aWpsOptional);
     doTest("com.sun.star.comp.Writer.MWAWImportFilter", 
"/writerperfect/qa/unit/data/writer/libmwaw/", aMWAWOptional);
     doTest("org.libreoffice.comp.Writer.PagesImportFilter", 
"/writerperfect/qa/unit/data/writer/libetonyek/", aEtonyekOptional);
+    doTest("org.libreoffice.comp.Writer.StarOfficeWriterImportFilter", 
"/writerperfect/qa/unit/data/writer/libstaroffice/", aStarOfficeOptional);
     doTest("com.sun.star.comp.Writer.WordPerfectImportFilter", 
"/writerperfect/qa/unit/data/writer/libwpd/");
 }
 
diff --git a/writerperfect/qa/unit/data/calc/libstaroffice/fail/.gitignore 
b/writerperfect/qa/unit/data/calc/libstaroffice/fail/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git 
a/writerperfect/qa/unit/data/calc/libstaroffice/indeterminate/.gitignore 
b/writerperfect/qa/unit/data/calc/libstaroffice/indeterminate/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/writerperfect/qa/unit/data/calc/libstaroffice/pass/Calc_3.1.sdc 
b/writerperfect/qa/unit/data/calc/libstaroffice/pass/Calc_3.1.sdc
new file mode 100644
index 0000000..683d1a8
Binary files /dev/null and 
b/writerperfect/qa/unit/data/calc/libstaroffice/pass/Calc_3.1.sdc differ
diff --git a/writerperfect/qa/unit/data/draw/libstaroffice/fail/.gitignore 
b/writerperfect/qa/unit/data/draw/libstaroffice/fail/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git 
a/writerperfect/qa/unit/data/draw/libstaroffice/indeterminate/.gitignore 
b/writerperfect/qa/unit/data/draw/libstaroffice/indeterminate/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/writerperfect/qa/unit/data/draw/libstaroffice/pass/Draw_3.1.sda 
b/writerperfect/qa/unit/data/draw/libstaroffice/pass/Draw_3.1.sda
new file mode 100644
index 0000000..bd03aa7
Binary files /dev/null and 
b/writerperfect/qa/unit/data/draw/libstaroffice/pass/Draw_3.1.sda differ
diff --git a/writerperfect/qa/unit/data/writer/libstaroffice/fail/.gitignore 
b/writerperfect/qa/unit/data/writer/libstaroffice/fail/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git 
a/writerperfect/qa/unit/data/writer/libstaroffice/indeterminate/.gitignore 
b/writerperfect/qa/unit/data/writer/libstaroffice/indeterminate/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git 
a/writerperfect/qa/unit/data/writer/libstaroffice/pass/Writer_3.1.sdw 
b/writerperfect/qa/unit/data/writer/libstaroffice/pass/Writer_3.1.sdw
new file mode 100644
index 0000000..0884942
Binary files /dev/null and 
b/writerperfect/qa/unit/data/writer/libstaroffice/pass/Writer_3.1.sdw differ
commit 1faae1f37521df7734462443936e1469820fd489
Author: osnola <alo...@loria.fr>
Date:   Wed Aug 10 12:43:56 2016 +0200

    integrate libstaroffice
    
    Change-Id: I85913f1bd1af5d102573040588cca9d8ddeebb5d

diff --git a/Makefile.fetch b/Makefile.fetch
index bd96f12..ea7b343 100644
--- a/Makefile.fetch
+++ b/Makefile.fetch
@@ -203,6 +203,7 @@ $(WORKDIR)/download: $(BUILDDIR)/config_host.mk 
$(SRCDIR)/download.lst $(SRCDIR)
                $(call fetch_Optional,RHINO,RHINO_TARBALL) \
                $(call fetch_Optional,RHINO,SWING_TARBALL) \
                $(call fetch_Optional,SERF,SERF_TARBALL) \
+               $(call fetch_Optional,STAROFFICE,STAROFFICE_TARBALL) \
                $(call fetch_Optional,UCPP,UCPP_TARBALL) \
                $(call fetch_Optional,VISIO,VISIO_TARBALL) \
                $(call fetch_Optional,WPD,WPD_TARBALL) \
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index c880d63..806a5e8 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -2290,6 +2290,60 @@ endif # MSC
 
 endif # SYSTEM_MWAW
 
+ifneq ($(SYSTEM_STAROFFICE),)
+
+define gb_LinkTarget__use_staroffice
+$(call gb_LinkTarget_set_include,$(1),\
+       $$(INCLUDE) \
+    $(STAROFFICE_CFLAGS) \
+)
+$(call gb_LinkTarget_add_libs,$(1),$(STAROFFICE_LIBS))
+
+endef
+
+else # !SYSTEM_STAROFFICE
+
+ifeq ($(COM),MSC)
+
+$(eval $(call gb_Helper_register_libraries_for_install,PLAINLIBS_OOO,ooo,\
+       staroffice \
+))
+
+define gb_LinkTarget__use_staroffice
+$(call gb_LinkTarget_set_include,$(1),\
+       -I$(call gb_UnpackedTarball_get_dir,libstaroffice)/inc \
+       $$(INCLUDE) \
+)
+
+$(call gb_LinkTarget_use_libraries,$(1),\
+       staroffice \
+)
+
+endef
+
+else # !MSC
+
+$(eval $(call gb_Helper_register_packages_for_install,ooo,\
+       libstaroffice \
+))
+
+define gb_LinkTarget__use_staroffice
+$(call gb_LinkTarget_use_package,$(1),libstaroffice)
+
+$(call gb_LinkTarget_set_include,$(1),\
+       -I$(call gb_UnpackedTarball_get_dir,libstaroffice)/inc \
+       $$(INCLUDE) \
+)
+$(call gb_LinkTarget_add_libs,$(1),\
+       -L$(call gb_UnpackedTarball_get_dir,libstaroffice)/src/lib/.libs 
-lstaroffice-0.0 \
+)
+
+endef
+
+endif # MSC
+
+endif # SYSTEM_STAROFFICE
+
 
 ifneq ($(SYSTEM_LCMS2),)
 
diff --git a/config_host.mk.in b/config_host.mk.in
index ccefde9..7314216 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -501,6 +501,8 @@ export SORT=@SORT@
 export SPLIT_APP_MODULES=@SPLIT_APP_MODULES@
 export SPLIT_OPT_FEATURES=@SPLIT_OPT_FEATURES@
 export SRCDIR=@SRC_ROOT@
+export STAROFFICE_CFLAGS=$(gb_SPACE)@STAROFFICE_CFLAGS@
+export STAROFFICE_LIBS=$(gb_SPACE)@STAROFFICE_LIBS@
 export STRIP=@STRIP@
 export STRIP_COMPONENTS=@STRIP_COMPONENTS@
 export SUNTEMPLATES_DE_PACK=@SUNTEMPLATES_DE_PACK@
@@ -579,6 +581,7 @@ export SYSTEM_REDLAND=@SYSTEM_REDLAND@
 export SYSTEM_REVENGE=@SYSTEM_REVENGE@
 export SYSTEM_RHINO=@SYSTEM_RHINO@
 export SYSTEM_SERF=@SYSTEM_SERF@
+export SYSTEM_STAROFFICE=@SYSTEM_STAROFFICE@
 export SYSTEM_UCPP=@SYSTEM_UCPP@
 export SYSTEM_VISIO=@SYSTEM_VISIO@
 export SYSTEM_WPD=@SYSTEM_WPD@
diff --git a/configure.ac b/configure.ac
index 5759408..6a1e021e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7910,6 +7910,11 @@ dnl 
===================================================================
 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
 
 dnl ===================================================================
+dnl Check for system libstaroffice
+dnl ===================================================================
+libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
+
+dnl ===================================================================
 dnl Check for system libvisio
 dnl ===================================================================
 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
diff --git a/download.lst b/download.lst
index 457f08d..d5ad38e 100644
--- a/download.lst
+++ b/download.lst
@@ -151,6 +151,9 @@ export REVENGE_TARBALL := 
librevenge-0.0.$(REVENGE_VERSION_MICRO).tar.bz2
 export RHINO_TARBALL := 798b2ffdc8bcfe7bca2cf92b62caf685-rhino1_5R5.zip
 export SERF_MD5SUM := 4f8e76c9c6567aee1d66aba49f76a58b
 export SERF_TARBALL := serf-1.2.1.tar.bz2
+export STAROFFICE_MD5SUM := 4012950240c2bf768c9b29ad376123d7
+export STAROFFICE_VERSION_MICRO := 2
+export STAROFFICE_TARBALL := 
libstaroffice-0.0.$(STAROFFICE_VERSION_MICRO).tar.bz2
 export SWING_TARBALL := 35c94d2df8893241173de1d16b6034c0-swingExSrc.zip
 export UCPP_TARBALL := 0168229624cfac409e766913506961a8-ucpp-1.3.2.tar.gz
 export VISIO_MD5SUM := cbee198a78b842b2087f32d33c522818
diff --git a/external/Module_external.mk b/external/Module_external.mk
index 9c014a7..1e3ce40 100644
--- a/external/Module_external.mk
+++ b/external/Module_external.mk
@@ -94,6 +94,7 @@ $(eval $(call gb_Module_add_moduledirs,external,\
        $(call gb_Helper_optional,REVENGE,librevenge) \
        $(call gb_Helper_optional,RHINO,rhino) \
        $(call gb_Helper_optional,SERF,serf) \
+       $(call gb_Helper_optional,STAROFFICE,libstaroffice) \
        $(call gb_Helper_optional,UCPP,ucpp) \
        $(call gb_Helper_optional,VISIO,libvisio) \
        $(call gb_Helper_optional,WPD,libwpd) \
diff --git 
a/external/libstaroffice/0001-error-C2512-StarObject-no-appropriate-default-constr.patch.1
 
b/external/libstaroffice/0001-error-C2512-StarObject-no-appropriate-default-constr.patch.1
new file mode 100644
index 0000000..1c579b3
--- /dev/null
+++ 
b/external/libstaroffice/0001-error-C2512-StarObject-no-appropriate-default-constr.patch.1
@@ -0,0 +1,54 @@
+From 1bbb89aff70e81d47af617bb1407e70545a2f99a Mon Sep 17 00:00:00 2001
+From: David Tardon <dtar...@redhat.com>
+Date: Wed, 10 Aug 2016 18:52:46 +0200
+Subject: [PATCH] error C2512: 'StarObject' : no appropriate default
+ constructor available
+
+---
+ src/lib/StarObjectChart.cxx       | 2 +-
+ src/lib/StarObjectDraw.cxx        | 2 +-
+ src/lib/StarObjectSpreadsheet.cxx | 2 +-
+ 3 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/lib/StarObjectChart.cxx b/src/lib/StarObjectChart.cxx
+index 3438beb..d9b1604 100644
+--- a/src/lib/StarObjectChart.cxx
++++ b/src/lib/StarObjectChart.cxx
+@@ -71,7 +71,7 @@ struct State {
+ ////////////////////////////////////////////////////////////
+ // constructor/destructor, ...
+ ////////////////////////////////////////////////////////////
+-StarObjectChart::StarObjectChart(StarObject const &orig, bool duplicateState) 
: StarObject::StarObject(orig, duplicateState), m_chartState(new 
StarObjectChartInternal::State)
++StarObjectChart::StarObjectChart(StarObject const &orig, bool duplicateState) 
: StarObject(orig, duplicateState), m_chartState(new 
StarObjectChartInternal::State)
+ {
+ }
+ 
+diff --git a/src/lib/StarObjectDraw.cxx b/src/lib/StarObjectDraw.cxx
+index bb660a9..4e4fdc2 100644
+--- a/src/lib/StarObjectDraw.cxx
++++ b/src/lib/StarObjectDraw.cxx
+@@ -76,7 +76,7 @@ struct State {
+ ////////////////////////////////////////////////////////////
+ // constructor/destructor, ...
+ ////////////////////////////////////////////////////////////
+-StarObjectDraw::StarObjectDraw(StarObject const &orig, bool duplicateState) : 
StarObject::StarObject(orig, duplicateState), m_drawState(new 
StarObjectDrawInternal::State)
++StarObjectDraw::StarObjectDraw(StarObject const &orig, bool duplicateState) : 
StarObject(orig, duplicateState), m_drawState(new StarObjectDrawInternal::State)
+ {
+ }
+ 
+diff --git a/src/lib/StarObjectSpreadsheet.cxx 
b/src/lib/StarObjectSpreadsheet.cxx
+index 58409c8..c8bd71b 100644
+--- a/src/lib/StarObjectSpreadsheet.cxx
++++ b/src/lib/StarObjectSpreadsheet.cxx
+@@ -521,7 +521,7 @@ void SubDocument::parse(STOFFListenerPtr &listener, 
libstoff::SubDocumentType /*
+ ////////////////////////////////////////////////////////////
+ // constructor/destructor, ...
+ ////////////////////////////////////////////////////////////
+-StarObjectSpreadsheet::StarObjectSpreadsheet(StarObject const &orig, bool 
duplicateState) : StarObject::StarObject(orig, duplicateState), 
m_spreadsheetState(new StarObjectSpreadsheetInternal::State)
++StarObjectSpreadsheet::StarObjectSpreadsheet(StarObject const &orig, bool 
duplicateState) : StarObject(orig, duplicateState), m_spreadsheetState(new 
StarObjectSpreadsheetInternal::State)
+ {
+ }
+ 
+-- 
+2.7.4
+
diff --git a/external/libstaroffice/ExternalPackage_libstaroffice.mk 
b/external/libstaroffice/ExternalPackage_libstaroffice.mk
new file mode 100644
index 0000000..939fbbc
--- /dev/null
+++ b/external/libstaroffice/ExternalPackage_libstaroffice.mk
@@ -0,0 +1,22 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_ExternalPackage_ExternalPackage,libstaroffice,libstaroffice))
+
+$(eval $(call 
gb_ExternalPackage_use_external_project,libstaroffice,libstaroffice))
+
+ifeq ($(OS),MACOSX)
+$(eval $(call 
gb_ExternalPackage_add_file,libstaroffice,$(LIBO_LIB_FOLDER)/libstaroffice-0.0.0.dylib,src/lib/.libs/libstaroffice-0.0.0.dylib))
+else ifeq ($(OS),WNT)
+$(eval $(call 
gb_ExternalPackage_add_file,libstaroffice,$(LIBO_LIB_FOLDER)/libstaroffice-0.0.dll,src/lib/.libs/libstaroffice-0.0.dll))
+else ifeq ($(DISABLE_DYNLOADING),)
+$(eval $(call 
gb_ExternalPackage_add_file,libstaroffice,$(LIBO_LIB_FOLDER)/libstaroffice-0.0-lo.so.0,src/lib/.libs/libstaroffice-0.0-lo.so.0.0.$(STAROFFICE_VERSION_MICRO)))
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libstaroffice/ExternalProject_libstaroffice.mk 
b/external/libstaroffice/ExternalProject_libstaroffice.mk
new file mode 100644
index 0000000..8d77cb8
--- /dev/null
+++ b/external/libstaroffice/ExternalProject_libstaroffice.mk
@@ -0,0 +1,53 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_ExternalProject_ExternalProject,libstaroffice))
+
+$(eval $(call gb_ExternalProject_use_autoconf,libstaroffice,build))
+
+$(eval $(call gb_ExternalProject_register_targets,libstaroffice,\
+       build \
+))
+
+$(eval $(call gb_ExternalProject_use_externals,libstaroffice,\
+       revenge \
+))
+
+$(call gb_ExternalProject_get_state_target,libstaroffice,build) :
+       $(call gb_ExternalProject_run,build,\
+               export PKG_CONFIG="" \
+               && ./configure \
+                       --with-pic \
+                       $(if $(DISABLE_DYNLOADING), \
+                               --enable-static --disable-shared \
+                       , \
+                               --enable-shared --disable-static \
+                       ) \
+                       --with-sharedptr=c++11 \
+                       --without-docs \
+                       --disable-tools \
+                       --disable-zip \
+                       $(if $(ENABLE_DEBUG),--enable-debug,--disable-debug) \
+                       $(if 
$(verbose),--disable-silent-rules,--enable-silent-rules) \
+                       --disable-werror \
+                       CXXFLAGS="$(CXXFLAGS) $(CXXFLAGS_CXX11)" \
+                       $(if $(filter LINUX,$(OS)),$(if $(SYSTEM_REVENGE),, \
+                               'LDFLAGS=-Wl$(COMMA)-z$(COMMA)origin \
+                                       -Wl$(COMMA)-rpath$(COMMA)\$$$$ORIGIN')) 
\
+                       $(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) 
--host=$(HOST_PLATFORM)) \
+                       $(if $(filter 
MACOSX,$(OS)),--prefix=/@.__________________________________________________OOO)
 \
+               && (cd $(EXTERNAL_WORKDIR)/src/lib && \
+                       $(MAKE)) \
+               $(if $(filter MACOSX,$(OS)),\
+                       && $(PERL) 
$(SRCDIR)/solenv/bin/macosx-change-install-names.pl shl OOO \
+                               
$(EXTERNAL_WORKDIR)/src/lib/.libs/libstaroffice-0.0.0.dylib \
+               ) \
+       )
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libstaroffice/Library_staroffice.mk 
b/external/libstaroffice/Library_staroffice.mk
new file mode 100644
index 0000000..0bd8ed7
--- /dev/null
+++ b/external/libstaroffice/Library_staroffice.mk
@@ -0,0 +1,108 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Library_Library,staroffice))
+
+$(eval $(call gb_Library_use_unpacked,staroffice,libstaroffice))
+
+$(eval $(call gb_Library_use_externals,staroffice,\
+    revenge \
+))
+
+$(eval $(call gb_Library_set_warnings_not_errors,staroffice))
+
+$(eval $(call gb_Library_set_include,staroffice,\
+    -I$(call gb_UnpackedTarball_get_dir,libstaroffice)/inc \
+    $$(INCLUDE) \
+))
+
+$(eval $(call gb_Library_add_defs,staroffice,\
+       -DBUILD_STOFF \
+       -DDLL_EXPORT \
+       -DNDEBUG \
+       -DSHAREDPTR_STD \
+))
+
+$(eval $(call gb_Library_add_generated_exception_objects,staroffice,\
+       UnpackedTarball/libstaroffice/src/lib/SDAParser \
+       UnpackedTarball/libstaroffice/src/lib/SDCParser \
+       UnpackedTarball/libstaroffice/src/lib/SDGParser \
+       UnpackedTarball/libstaroffice/src/lib/SDWParser \
+       UnpackedTarball/libstaroffice/src/lib/SDXParser \
+       UnpackedTarball/libstaroffice/src/lib/STOFFCell \
+       UnpackedTarball/libstaroffice/src/lib/STOFFCellStyle \
+       UnpackedTarball/libstaroffice/src/lib/STOFFChart \
+       UnpackedTarball/libstaroffice/src/lib/STOFFDebug \
+       UnpackedTarball/libstaroffice/src/lib/STOFFDocument \
+       UnpackedTarball/libstaroffice/src/lib/STOFFEntry \
+       UnpackedTarball/libstaroffice/src/lib/STOFFFont \
+       UnpackedTarball/libstaroffice/src/lib/STOFFGraphicDecoder \
+       UnpackedTarball/libstaroffice/src/lib/STOFFGraphicEncoder \
+       UnpackedTarball/libstaroffice/src/lib/STOFFGraphicListener \
+       UnpackedTarball/libstaroffice/src/lib/STOFFGraphicShape \
+       UnpackedTarball/libstaroffice/src/lib/STOFFGraphicStyle \
+       UnpackedTarball/libstaroffice/src/lib/STOFFHeader \
+       UnpackedTarball/libstaroffice/src/lib/STOFFInputStream \
+       UnpackedTarball/libstaroffice/src/lib/STOFFList \
+       UnpackedTarball/libstaroffice/src/lib/STOFFListener \
+       UnpackedTarball/libstaroffice/src/lib/STOFFOLEParser \
+       UnpackedTarball/libstaroffice/src/lib/STOFFPageSpan \
+       UnpackedTarball/libstaroffice/src/lib/STOFFParagraph \
+       UnpackedTarball/libstaroffice/src/lib/STOFFParser \
+       UnpackedTarball/libstaroffice/src/lib/STOFFPosition \
+       UnpackedTarball/libstaroffice/src/lib/STOFFPropertyHandler \
+       UnpackedTarball/libstaroffice/src/lib/STOFFSection \
+       UnpackedTarball/libstaroffice/src/lib/STOFFSpreadsheetDecoder \
+       UnpackedTarball/libstaroffice/src/lib/STOFFSpreadsheetEncoder \
+       UnpackedTarball/libstaroffice/src/lib/STOFFSpreadsheetListener \
+       UnpackedTarball/libstaroffice/src/lib/STOFFStringStream \
+       UnpackedTarball/libstaroffice/src/lib/STOFFSubDocument \
+       UnpackedTarball/libstaroffice/src/lib/STOFFTable \
+       UnpackedTarball/libstaroffice/src/lib/STOFFTextListener \
+       UnpackedTarball/libstaroffice/src/lib/SWFieldManager \
+       UnpackedTarball/libstaroffice/src/lib/StarAttribute \
+       UnpackedTarball/libstaroffice/src/lib/StarBitmap \
+       UnpackedTarball/libstaroffice/src/lib/StarCellAttribute \
+       UnpackedTarball/libstaroffice/src/lib/StarCellFormula \
+       UnpackedTarball/libstaroffice/src/lib/StarCharAttribute \
+       UnpackedTarball/libstaroffice/src/lib/StarEncoding \
+       UnpackedTarball/libstaroffice/src/lib/StarEncodingChinese \
+       UnpackedTarball/libstaroffice/src/lib/StarEncodingJapanese \
+       UnpackedTarball/libstaroffice/src/lib/StarEncodingKorean \
+       UnpackedTarball/libstaroffice/src/lib/StarEncodingOtherKorean \
+       UnpackedTarball/libstaroffice/src/lib/StarEncodingTradChinese \
+       UnpackedTarball/libstaroffice/src/lib/StarEncryption \
+       UnpackedTarball/libstaroffice/src/lib/StarFileManager \
+       UnpackedTarball/libstaroffice/src/lib/StarFormatManager \
+       UnpackedTarball/libstaroffice/src/lib/StarGraphicAttribute \
+       UnpackedTarball/libstaroffice/src/lib/StarGraphicStruct \
+       UnpackedTarball/libstaroffice/src/lib/StarItem \
+       UnpackedTarball/libstaroffice/src/lib/StarItemPool \
+       UnpackedTarball/libstaroffice/src/lib/StarLanguage \
+       UnpackedTarball/libstaroffice/src/lib/StarLayout \
+       UnpackedTarball/libstaroffice/src/lib/StarObject \
+       UnpackedTarball/libstaroffice/src/lib/StarObjectChart \
+       UnpackedTarball/libstaroffice/src/lib/StarObjectDraw \
+       UnpackedTarball/libstaroffice/src/lib/StarObjectModel \
+       UnpackedTarball/libstaroffice/src/lib/StarObjectNumericRuler \
+       UnpackedTarball/libstaroffice/src/lib/StarObjectPageStyle \
+       UnpackedTarball/libstaroffice/src/lib/StarObjectSmallGraphic \
+       UnpackedTarball/libstaroffice/src/lib/StarObjectSmallText \
+       UnpackedTarball/libstaroffice/src/lib/StarObjectSpreadsheet \
+       UnpackedTarball/libstaroffice/src/lib/StarObjectText \
+       UnpackedTarball/libstaroffice/src/lib/StarPageAttribute \
+       UnpackedTarball/libstaroffice/src/lib/StarParagraphAttribute \
+       UnpackedTarball/libstaroffice/src/lib/StarState \
+       UnpackedTarball/libstaroffice/src/lib/StarTable \
+       UnpackedTarball/libstaroffice/src/lib/StarWriterStruct \
+       UnpackedTarball/libstaroffice/src/lib/StarZone \
+       UnpackedTarball/libstaroffice/src/lib/libstaroffice_internal \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libstaroffice/Makefile b/external/libstaroffice/Makefile
new file mode 100644
index 0000000..e4968cf8
--- /dev/null
+++ b/external/libstaroffice/Makefile
@@ -0,0 +1,7 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+
+module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
+
+include $(module_directory)/../../solenv/gbuild/partial_build.mk
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libstaroffice/Module_libstaroffice.mk 
b/external/libstaroffice/Module_libstaroffice.mk
new file mode 100644
index 0000000..b96bde2
--- /dev/null
+++ b/external/libstaroffice/Module_libstaroffice.mk
@@ -0,0 +1,31 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Module_Module,libstaroffice))
+
+$(eval $(call gb_Module_add_targets,libstaroffice,\
+       UnpackedTarball_libstaroffice \
+))
+
+ifeq ($(COM),MSC)
+
+$(eval $(call gb_Module_add_targets,libstaroffice,\
+       Library_staroffice \
+))
+
+else
+
+$(eval $(call gb_Module_add_targets,libstaroffice,\
+       ExternalPackage_libstaroffice \
+       ExternalProject_libstaroffice \
+))
+
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libstaroffice/README b/external/libstaroffice/README
new file mode 100644
index 0000000..957fb49
--- /dev/null
+++ b/external/libstaroffice/README
@@ -0,0 +1,3 @@
+Library parsing different document file formats of StarOffice.
+
+https://github.com/fosnola/libstaroffice
diff --git a/external/libstaroffice/UnpackedTarball_libstaroffice.mk 
b/external/libstaroffice/UnpackedTarball_libstaroffice.mk
new file mode 100644
index 0000000..957c118
--- /dev/null
+++ b/external/libstaroffice/UnpackedTarball_libstaroffice.mk
@@ -0,0 +1,42 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_UnpackedTarball_UnpackedTarball,libstaroffice))
+
+$(eval $(call 
gb_UnpackedTarball_set_tarball,libstaroffice,$(STAROFFICE_TARBALL)))
+
+$(eval $(call gb_UnpackedTarball_set_patchlevel,libstaroffice,0))
+
+ifeq ($(COM_IS_CLANG),TRUE)
+ifneq ($(filter -fsanitize=%,$(CC)),)
+$(eval $(call gb_UnpackedTarball_add_patches,libstaroffice, \
+    external/libstaroffice/ubsan-visibility.patch \
+))
+endif
+endif
+
+ifneq ($(OS),MACOSX)
+ifneq ($(OS),WNT)
+$(eval $(call gb_UnpackedTarball_add_patches,libstaroffice, \
+    external/libstaroffice/libstaroffice-bundled-soname.patch.0 \
+))
+endif
+endif
+
+ifeq ($(SYSTEM_REVENGE),)
+$(eval $(call gb_UnpackedTarball_add_patches,libstaroffice, \
+    external/libstaroffice/rpath.patch \
+))
+endif
+
+$(eval $(call gb_UnpackedTarball_add_patches,libstaroffice, \
+    
external/libstaroffice/0001-error-C2512-StarObject-no-appropriate-default-constr.patch.1
 \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libstaroffice/libstaroffice-bundled-soname.patch.0 
b/external/libstaroffice/libstaroffice-bundled-soname.patch.0
new file mode 100644
index 0000000..00b064d
--- /dev/null
+++ b/external/libstaroffice/libstaroffice-bundled-soname.patch.0
@@ -0,0 +1,11 @@
+--- src/lib/Makefile.in.orig   2015-08-07 14:04:47.646611627 +0200
++++ src/lib/Makefile.in        2015-08-07 14:25:49.888589996 +0200
+@@ -418,7 +418,7 @@
+ AM_CXXFLAGS = -I$(top_srcdir)/inc $(REVENGE_CFLAGS) $(DEBUG_CXXFLAGS) 
$(ZLIB_CFLAGS) -DBUILD_STAROFFICE=1
+ libstaroffice_@STAROFFICE_MAJOR_VERSION@_@STAROFFICE_MINOR_VERSION@_la_LIBADD 
= $(REVENGE_LIBS) $(ZLIB_LIBS) @LIBSTAROFFICE_WIN32_RESOURCE@
+ 
libstaroffice_@STAROFFICE_MAJOR_VERSION@_@STAROFFICE_MINOR_VERSION@_la_DEPENDENCIES
 = @LIBSTAROFFICE_WIN32_RESOURCE@
+-libstaroffice_@STAROFFICE_MAJOR_VERSION@_@STAROFFICE_MINOR_VERSION@_la_LDFLAGS
 = $(version_info) -export-dynamic -no-undefined
++libstaroffice_@STAROFFICE_MAJOR_VERSION@_@STAROFFICE_MINOR_VERSION@_la_LDFLAGS
 = $(version_info) -export-dynamic -no-undefined -release lo
+ 
libstaroffice_@STAROFFICE_MAJOR_VERSION@_@STAROFFICE_MINOR_VERSION@_la_SOURCES 
= \
+       SDAParser.cxx                           \
+       SDAParser.hxx                           \
diff --git a/external/libstaroffice/rpath.patch 
b/external/libstaroffice/rpath.patch
new file mode 100644
index 0000000..a73d8ae
--- /dev/null
+++ b/external/libstaroffice/rpath.patch
@@ -0,0 +1,10 @@
+--- configure
++++ configure
+@@ -15353,6 +15353,7 @@
+           esac
+           ;;
+       esac
++hardcode_libdir_flag_spec_CXX=
+       ;;
+ 
+       lynxos*)
diff --git a/external/libstaroffice/ubsan-visibility.patch 
b/external/libstaroffice/ubsan-visibility.patch
new file mode 100644
index 0000000..a14d201
--- /dev/null
+++ b/external/libstaroffice/ubsan-visibility.patch
@@ -0,0 +1,11 @@
+--- configure
++++ configure
+@@ -17225,7 +17225,7 @@
+         { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 
-fvisibility=hidden compiler flag" >&5
+ $as_echo_n "checking for -fvisibility=hidden compiler flag... " >&6; }
+         saved_CXXFLAGS="$CXXFLAGS"
+-        CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
++        CXXFLAGS="$CXXFLAGS -fvisibility-ms-compat"
+         cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ 
diff --git a/filter/Configuration_filter.mk b/filter/Configuration_filter.mk
index 44c4420..2d36991 100644
--- a/filter/Configuration_filter.mk
+++ b/filter/Configuration_filter.mk
@@ -352,6 +352,7 @@ $(eval $(call 
filter_Configuration_add_types,fcfg_langpack,fcfg_writer_types.xcu
        writer_ApplePages \
        MWAW_Text_Document \
        Palm_Text_Document \
+       StarOffice_Writer \
 ))
 
 $(eval $(call 
filter_Configuration_add_filters,fcfg_langpack,fcfg_writer_filters.xcu,filter/source/config/fragments/filters,\
@@ -397,6 +398,7 @@ $(eval $(call 
filter_Configuration_add_filters,fcfg_langpack,fcfg_writer_filters
        ApplePages \
        MWAW_Text_Document \
        Palm_Text_Document \
+       StarOffice_Writer \
 ))
 
 # fcfg_web
@@ -486,6 +488,7 @@ $(eval $(call 
filter_Configuration_add_types,fcfg_langpack,fcfg_calc_types.xcu,f
        calc_AppleNumbers \
        MWAW_Database \
        MWAW_Spreadsheet \
+       StarOffice_Spreadsheet \
 ))
 
 $(eval $(call 
filter_Configuration_add_filters,fcfg_langpack,fcfg_calc_filters.xcu,filter/source/config/fragments/filters,\
@@ -528,6 +531,7 @@ $(eval $(call 
filter_Configuration_add_filters,fcfg_langpack,fcfg_calc_filters.x
        AppleNumbers \
        MWAW_Database \
        MWAW_Spreadsheet \
+       StarOffice_Spreadsheet \
 ))
 
 # fcfg_draw
@@ -550,6 +554,7 @@ $(eval $(call 
filter_Configuration_add_types,fcfg_langpack,fcfg_draw_types.xcu,f
        draw_ZMF_Document \
        MWAW_Bitmap \
        MWAW_Drawing \
+       StarOffice_Drawing \
 ))
 
 $(eval $(call 
filter_Configuration_add_filters,fcfg_langpack,fcfg_draw_filters.xcu,filter/source/config/fragments/filters,\
@@ -570,6 +575,7 @@ $(eval $(call 
filter_Configuration_add_filters,fcfg_langpack,fcfg_draw_filters.x
        ZMFDocument \
        MWAW_Bitmap \
        MWAW_Drawing \
+       StarOffice_Drawing \
 ))
 
 # fcfg_impress
diff --git a/filter/source/config/fragments/filters/StarOffice_Drawing.xcu 
b/filter/source/config/fragments/filters/StarOffice_Drawing.xcu
new file mode 100644
index 0000000..f820fe0
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarOffice_Drawing.xcu
@@ -0,0 +1,29 @@
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+-->
+
+<node oor:name="StarOffice_Drawing" oor:op="replace">
+    <prop oor:name="Flags">
+        <value>IMPORT ALIEN 3RDPARTYFILTER PREFERRED</value>
+    </prop>
+    <prop oor:name="FilterService">
+        <value>org.libreoffice.comp.Draw.StarOfficeDrawImportFilter</value>
+    </prop>
+    <prop oor:name="UIName">
+        <value xml:lang="en-US">Legacy StarOffice Drawing</value>
+    </prop>
+    <prop oor:name="FileFormatVersion">
+        <value>0</value>
+    </prop>
+    <prop oor:name="Type">
+        <value>StarOffice_Drawing</value>
+    </prop>
+    <prop oor:name="DocumentService">
+        <value>com.sun.star.drawing.DrawingDocument</value>
+    </prop>
+</node>
diff --git a/filter/source/config/fragments/filters/StarOffice_Spreadsheet.xcu 
b/filter/source/config/fragments/filters/StarOffice_Spreadsheet.xcu
new file mode 100644
index 0000000..d6ac855
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarOffice_Spreadsheet.xcu
@@ -0,0 +1,29 @@
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+-->
+
+<node oor:name="StarOffice_Spreadsheet" oor:op="replace">
+    <prop oor:name="Flags">
+        <value>IMPORT ALIEN 3RDPARTYFILTER PREFERRED</value>
+    </prop>
+    <prop oor:name="FilterService">
+        <value>org.libreoffice.comp.Calc.StarOfficeCalcImportFilter</value>
+    </prop>
+    <prop oor:name="UIName">
+        <value xml:lang="en-US">Legacy StarOffice Spreadsheet</value>
+    </prop>
+    <prop oor:name="FileFormatVersion">
+        <value>0</value>
+    </prop>
+    <prop oor:name="Type">
+        <value>StarOffice_Spreadsheet</value>
+    </prop>
+    <prop oor:name="DocumentService">
+        <value>com.sun.star.sheet.SpreadsheetDocument</value>
+    </prop>
+</node>
diff --git a/filter/source/config/fragments/filters/StarOffice_Writer.xcu 
b/filter/source/config/fragments/filters/StarOffice_Writer.xcu
new file mode 100644
index 0000000..537a410
--- /dev/null
+++ b/filter/source/config/fragments/filters/StarOffice_Writer.xcu
@@ -0,0 +1,29 @@
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+-->
+
+<node oor:name="StarOffice_Writer" oor:op="replace">
+    <prop oor:name="Flags">
+        <value>IMPORT ALIEN 3RDPARTYFILTER PREFERRED</value>
+    </prop>
+    <prop oor:name="FilterService">
+        <value>org.libreoffice.comp.Writer.StarOfficeWriterImportFilter</value>
+    </prop>
+    <prop oor:name="UIName">
+        <value xml:lang="en-US">Legacy StarOffice Writer</value>
+    </prop>
+    <prop oor:name="FileFormatVersion">
+        <value>0</value>
+    </prop>
+    <prop oor:name="Type">
+        <value>StarOffice_Writer</value>
+    </prop>
+    <prop oor:name="DocumentService">
+        <value>com.sun.star.text.TextDocument</value>
+    </prop>
+</node>
diff --git a/filter/source/config/fragments/types/StarOffice_Drawing.xcu 
b/filter/source/config/fragments/types/StarOffice_Drawing.xcu
new file mode 100644
index 0000000..cad6f68
--- /dev/null
+++ b/filter/source/config/fragments/types/StarOffice_Drawing.xcu
@@ -0,0 +1,27 @@
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+-->
+
+<node oor:name="StarOffice_Drawing" oor:op="replace">
+    <prop oor:name="DetectService">
+        <value>org.libreoffice.comp.Draw.StarOfficeDrawImportFilter</value>
+    </prop>
+    <prop oor:name="Extensions">
+        <value>sda</value>
+    </prop>
+    <prop oor:name="MediaType"/>
+    <prop oor:name="Preferred">
+        <value>true</value>
+    </prop>
+    <prop oor:name="PreferredFilter">
+        <value>StarOffice_Drawing</value>
+    </prop>
+    <prop oor:name="UIName">
+        <value>Legacy StarOffice Drawing</value>
+    </prop>
+</node>
diff --git a/filter/source/config/fragments/types/StarOffice_Spreadsheet.xcu 
b/filter/source/config/fragments/types/StarOffice_Spreadsheet.xcu
new file mode 100644
index 0000000..f4f472b
--- /dev/null
+++ b/filter/source/config/fragments/types/StarOffice_Spreadsheet.xcu
@@ -0,0 +1,27 @@
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+-->
+
+<node oor:name="StarOffice_Spreadsheet" oor:op="replace">
+    <prop oor:name="DetectService">
+        <value>org.libreoffice.comp.Calc.StarOfficeCalcImportFilter</value>
+    </prop>
+    <prop oor:name="Extensions">
+        <value>sdc</value>
+    </prop>
+    <prop oor:name="MediaType"/>
+    <prop oor:name="Preferred">
+        <value>true</value>
+    </prop>
+    <prop oor:name="PreferredFilter">
+        <value>StarOffice_Spreadsheet</value>
+    </prop>
+    <prop oor:name="UIName">
+        <value>Legacy StarOffice Spreadsheet</value>
+    </prop>
+</node>
diff --git a/filter/source/config/fragments/types/StarOffice_Writer.xcu 
b/filter/source/config/fragments/types/StarOffice_Writer.xcu
new file mode 100644
index 0000000..6f6944e
--- /dev/null
+++ b/filter/source/config/fragments/types/StarOffice_Writer.xcu
@@ -0,0 +1,27 @@
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+-->
+
+<node oor:name="StarOffice_Writer" oor:op="replace">
+    <prop oor:name="DetectService">
+        <value>org.libreoffice.comp.Writer.StarOfficeWriterImportFilter</value>
+    </prop>
+    <prop oor:name="Extensions">
+        <value>sdw</value>
+    </prop>
+    <prop oor:name="MediaType"/>
+    <prop oor:name="Preferred">
+        <value>true</value>
+    </prop>
+    <prop oor:name="PreferredFilter">
+        <value>StarOffice_Writer</value>
+    </prop>
+    <prop oor:name="UIName">
+        <value>Legacy StarOffice Writer</value>
+    </prop>
+</node>
diff --git a/writerperfect/Library_wpftcalc.mk 
b/writerperfect/Library_wpftcalc.mk
index 1672e63..3d378cb 100644
--- a/writerperfect/Library_wpftcalc.mk
+++ b/writerperfect/Library_wpftcalc.mk
@@ -49,6 +49,7 @@ $(eval $(call gb_Library_use_externals,wpftcalc,\
        odfgen \
        revenge \
        mwaw \
+       staroffice \
        wps \
        zlib \
        lcms2 \
@@ -61,6 +62,7 @@ $(eval $(call gb_Library_add_exception_objects,wpftcalc,\
        writerperfect/source/calc/MSWorksCalcImportFilter \
        writerperfect/source/calc/MWAWCalcImportFilter \
        writerperfect/source/calc/NumbersImportFilter \
+       writerperfect/source/calc/StarOfficeCalcImportFilter \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/writerperfect/Library_wpftdraw.mk 
b/writerperfect/Library_wpftdraw.mk
index cdec029..23d2945 100644
--- a/writerperfect/Library_wpftdraw.mk
+++ b/writerperfect/Library_wpftdraw.mk
@@ -52,6 +52,7 @@ $(eval $(call gb_Library_use_externals,wpftdraw,\
        odfgen \
        pagemaker \
        revenge \
+       staroffice \
        visio \
        wpg \
        wpd \
@@ -70,6 +71,7 @@ $(eval $(call gb_Library_add_exception_objects,wpftdraw,\
        writerperfect/source/draw/MSPUBImportFilter \
        writerperfect/source/draw/MWAWDrawImportFilter \
        writerperfect/source/draw/PageMakerImportFilter \
+       writerperfect/source/draw/StarOfficeDrawImportFilter \
        writerperfect/source/draw/VisioImportFilter \
        writerperfect/source/draw/WPGImportFilter \
        writerperfect/source/draw/ZMFImportFilter \
diff --git a/writerperfect/Library_wpftwriter.mk 
b/writerperfect/Library_wpftwriter.mk
index 9ec43c4..b260dc4 100644
--- a/writerperfect/Library_wpftwriter.mk
+++ b/writerperfect/Library_wpftwriter.mk
@@ -57,6 +57,7 @@ $(eval $(call gb_Library_use_externals,wpftwriter,\
        mwaw \
        odfgen \
        revenge \
+       staroffice \
        wpd \
        wpg \
        wps \
@@ -69,6 +70,7 @@ $(eval $(call gb_Library_add_exception_objects,wpftwriter,\
        writerperfect/source/writer/MSWorksImportFilter \
        writerperfect/source/writer/MWAWImportFilter \
        writerperfect/source/writer/PagesImportFilter \
+       writerperfect/source/writer/StarOfficeWriterImportFilter \
        writerperfect/source/writer/WordPerfectImportFilter \
 ))
 
diff --git a/writerperfect/source/calc/StarOfficeCalcImportFilter.cxx 
b/writerperfect/source/calc/StarOfficeCalcImportFilter.cxx
new file mode 100644
index 0000000..5accde1
--- /dev/null
+++ b/writerperfect/source/calc/StarOfficeCalcImportFilter.cxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <cppuhelper/supportsservice.hxx>
+
+#include <libstaroffice/libstaroffice.hxx>
+#include <libodfgen/libodfgen.hxx>
+
+#include "StarOfficeCalcImportFilter.hxx"
+
+using com::sun::star::uno::Sequence;
+using com::sun::star::uno::XInterface;
+using com::sun::star::uno::RuntimeException;
+using com::sun::star::uno::XComponentContext;
+
+static bool handleEmbeddedSTOFFGraphicObject(const librevenge::RVNGBinaryData 
&data, OdfDocumentHandler *pHandler,  const OdfStreamType streamType)
+{
+    OdgGenerator exporter;
+    exporter.addDocumentHandler(pHandler, streamType);
+    return STOFFDocument::decodeGraphic(data, &exporter);
+}
+
+static bool handleEmbeddedSTOFFSpreadsheetObject(const 
librevenge::RVNGBinaryData &data, OdfDocumentHandler *pHandler,  const 
OdfStreamType streamType)
+{
+    OdsGenerator exporter;
+    exporter.addDocumentHandler(pHandler, streamType);
+    return STOFFDocument::decodeSpreadsheet(data, &exporter);
+}
+
+bool StarOfficeCalcImportFilter::doImportDocument(librevenge::RVNGInputStream 
&rInput, OdsGenerator &rGenerator, utl::MediaDescriptor &)
+{
+    return STOFFDocument::STOFF_R_OK == STOFFDocument::parse(&rInput, 
&rGenerator);
+}
+
+bool StarOfficeCalcImportFilter::doDetectFormat(librevenge::RVNGInputStream 
&rInput, OUString &rTypeName)
+{
+    rTypeName.clear();
+    STOFFDocument::Kind docKind = STOFFDocument::STOFF_K_UNKNOWN;
+    const STOFFDocument::Confidence confidence = 
STOFFDocument::isFileFormatSupported(&rInput, docKind);
+    if (confidence == STOFFDocument::STOFF_C_EXCELLENT || confidence == 
STOFFDocument::STOFF_C_SUPPORTED_ENCRYPTION)
+    {
+        switch (docKind)
+        {
+        case STOFFDocument::STOFF_K_DATABASE:
+        case STOFFDocument::STOFF_K_SPREADSHEET:
+            rTypeName = "StarOffice_Spreadsheet";
+            break;
+        default:
+            break;
+        }
+    }
+
+    return !rTypeName.isEmpty();
+}
+
+void StarOfficeCalcImportFilter::doRegisterHandlers(OdsGenerator &rGenerator)
+{
+    rGenerator.registerEmbeddedObjectHandler("image/stoff-odg", 
&handleEmbeddedSTOFFGraphicObject);
+    rGenerator.registerEmbeddedObjectHandler("image/stoff-ods", 
&handleEmbeddedSTOFFSpreadsheetObject);
+}
+
+// XServiceInfo
+OUString SAL_CALL StarOfficeCalcImportFilter::getImplementationName()
+throw (RuntimeException, std::exception)
+{
+    return OUString("org.libreoffice.comp.Calc.StarOfficeCalcImportFilter");
+}
+
+sal_Bool SAL_CALL StarOfficeCalcImportFilter::supportsService(const OUString 
&rServiceName)
+throw (RuntimeException, std::exception)
+{
+    return cppu::supportsService(this, rServiceName);
+}
+
+Sequence< OUString > SAL_CALL 
StarOfficeCalcImportFilter::getSupportedServiceNames()
+throw (RuntimeException, std::exception)
+{
+    return Sequence< OUString >{"com.sun.star.document.ImportFilter", 
"com.sun.star.document.ExtendedTypeDetection"};
+}
+
+extern "C"
+SAL_DLLPUBLIC_EXPORT css::uno::XInterface *SAL_CALL
+org_libreoffice_comp_Calc_StarOfficeCalcImportFilter_get_implementation(
+    css::uno::XComponentContext *const context,
+    const css::uno::Sequence<css::uno::Any> &)
+{
+    return cppu::acquire(new StarOfficeCalcImportFilter(context));
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/calc/StarOfficeCalcImportFilter.hxx 
b/writerperfect/source/calc/StarOfficeCalcImportFilter.hxx
new file mode 100644
index 0000000..bcf457f
--- /dev/null
+++ b/writerperfect/source/calc/StarOfficeCalcImportFilter.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_WRITERPERFECT_SOURCE_CALC_STAROFFICECALCIMPORTFILTER_HXX
+#define INCLUDED_WRITERPERFECT_SOURCE_CALC_STAROFFICECALCIMPORTFILTER_HXX
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include "ImportFilter.hxx"
+
+#include "DocumentHandlerForOds.hxx"
+
+/* This component will be instantiated for both import or export. Whether it 
calls
+ * setSourceDocument or setTargetDocument determines which Impl function the 
filter
+ * member calls */
+class StarOfficeCalcImportFilter : public 
writerperfect::ImportFilter<OdsGenerator>
+{
+public:
+    explicit StarOfficeCalcImportFilter(const css::uno::Reference< 
css::uno::XComponentContext > &rxContext)
+        : writerperfect::ImportFilter<OdsGenerator>(rxContext) {}
+
+    // XServiceInfo
+    virtual OUString SAL_CALL getImplementationName()
+    throw (css::uno::RuntimeException, std::exception) override;
+    virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName)
+    throw (css::uno::RuntimeException, std::exception) override;
+    virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
+    throw (css::uno::RuntimeException, std::exception) override;
+
+private:
+    virtual bool doDetectFormat(librevenge::RVNGInputStream &rInput, OUString 
&rTypeName) override;
+    virtual bool doImportDocument(librevenge::RVNGInputStream &rInput, 
OdsGenerator &rGenerator, utl::MediaDescriptor &) override;
+    virtual void doRegisterHandlers(OdsGenerator &rGenerator) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/calc/wpftcalc.component 
b/writerperfect/source/calc/wpftcalc.component
index 117ec1f..404d09b 100644
--- a/writerperfect/source/calc/wpftcalc.component
+++ b/writerperfect/source/calc/wpftcalc.component
@@ -24,4 +24,9 @@
     <service name="com.sun.star.document.ImportFilter"/>
     <service name="com.sun.star.document.ExtendedTypeDetection"/>
   </implementation>
+  <implementation name="org.libreoffice.comp.Calc.StarOfficeCalcImportFilter"
+      
constructor="org_libreoffice_comp_Calc_StarOfficeCalcImportFilter_get_implementation">
+    <service name="com.sun.star.document.ImportFilter"/>
+    <service name="com.sun.star.document.ExtendedTypeDetection"/>
+  </implementation>
 </component>
diff --git a/writerperfect/source/common/WPXSvInputStream.cxx 
b/writerperfect/source/common/WPXSvInputStream.cxx
index d52c696..c5e3448 100644
--- a/writerperfect/source/common/WPXSvInputStream.cxx
+++ b/writerperfect/source/common/WPXSvInputStream.cxx
@@ -44,8 +44,8 @@ class PositionHolder
 public:
     explicit PositionHolder(const Reference<XSeekable> &rxSeekable);
     ~PositionHolder();
-    PositionHolder(const PositionHolder&) = delete;
-    PositionHolder& operator=(const PositionHolder&) = delete;
+    PositionHolder(const PositionHolder &) = delete;
+    PositionHolder &operator=(const PositionHolder &) = delete;
 
 private:
     const Reference<XSeekable> mxSeekable;
diff --git a/writerperfect/source/draw/StarOfficeDrawImportFilter.cxx 
b/writerperfect/source/draw/StarOfficeDrawImportFilter.cxx
new file mode 100644
index 0000000..57dfb7f
--- /dev/null
+++ b/writerperfect/source/draw/StarOfficeDrawImportFilter.cxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <cppuhelper/supportsservice.hxx>
+
+#include <libstaroffice/libstaroffice.hxx>
+#include <libodfgen/libodfgen.hxx>
+
+#include "StarOfficeDrawImportFilter.hxx"
+
+using com::sun::star::uno::Sequence;
+using com::sun::star::uno::XInterface;
+using com::sun::star::uno::RuntimeException;
+using com::sun::star::uno::XComponentContext;
+
+static bool handleEmbeddedSTOFFGraphicObject(const librevenge::RVNGBinaryData 
&data, OdfDocumentHandler *pHandler,  const OdfStreamType streamType)
+{
+    OdgGenerator exporter;
+    exporter.addDocumentHandler(pHandler, streamType);
+    return STOFFDocument::decodeGraphic(data, &exporter);
+}
+
+static bool handleEmbeddedSTOFFSpreadsheetObject(const 
librevenge::RVNGBinaryData &data, OdfDocumentHandler *pHandler,  const 
OdfStreamType streamType)
+{
+    OdsGenerator exporter;
+    exporter.registerEmbeddedObjectHandler("image/stoff-odg", 
&handleEmbeddedSTOFFGraphicObject);
+    exporter.addDocumentHandler(pHandler, streamType);
+    return STOFFDocument::decodeSpreadsheet(data, &exporter);
+}
+
+bool StarOfficeDrawImportFilter::doImportDocument(librevenge::RVNGInputStream 
&rInput, OdgGenerator &rGenerator, utl::MediaDescriptor &)
+{
+    return STOFFDocument::STOFF_R_OK == STOFFDocument::parse(&rInput, 
&rGenerator);
+}
+
+bool StarOfficeDrawImportFilter::doDetectFormat(librevenge::RVNGInputStream 
&rInput, OUString &rTypeName)
+{
+    rTypeName.clear();
+
+    STOFFDocument::Kind docKind = STOFFDocument::STOFF_K_UNKNOWN;
+    const STOFFDocument::Confidence confidence = 
STOFFDocument::isFileFormatSupported(&rInput, docKind);
+
+    if (confidence == STOFFDocument::STOFF_C_EXCELLENT || confidence == 
STOFFDocument::STOFF_C_SUPPORTED_ENCRYPTION)
+    {
+        switch (docKind)
+        {
+        case STOFFDocument::STOFF_K_DRAW:
+            rTypeName = "StarOffice_Drawing";
+            break;
+        default:
+            break;
+        }
+    }
+
+    return !rTypeName.isEmpty();
+}
+
+void StarOfficeDrawImportFilter::doRegisterHandlers(OdgGenerator &rGenerator)
+{
+    rGenerator.registerEmbeddedObjectHandler("image/stoff-odg", 
&handleEmbeddedSTOFFGraphicObject);
+    rGenerator.registerEmbeddedObjectHandler("image/stoff-ods", 
&handleEmbeddedSTOFFSpreadsheetObject);
+}
+
+// XServiceInfo
+OUString SAL_CALL StarOfficeDrawImportFilter::getImplementationName()
+throw (RuntimeException, std::exception)
+{
+    return OUString("org.libreoffice.comp.Draw.StarOfficeDrawImportFilter");
+}
+
+sal_Bool SAL_CALL StarOfficeDrawImportFilter::supportsService(const OUString 
&rServiceName)
+throw (RuntimeException, std::exception)
+{
+    return cppu::supportsService(this, rServiceName);
+}
+
+Sequence< OUString > SAL_CALL 
StarOfficeDrawImportFilter::getSupportedServiceNames()
+throw (RuntimeException, std::exception)
+{
+    return Sequence< OUString >{"com.sun.star.document.ImportFilter", 
"com.sun.star.document.ExtendedTypeDetection"};
+}
+
+extern "C"
+SAL_DLLPUBLIC_EXPORT css::uno::XInterface *SAL_CALL
+org_libreoffice_comp_Draw_StarOfficeDrawImportFilter_get_implementation(
+    css::uno::XComponentContext *const context,
+    const css::uno::Sequence<css::uno::Any> &)
+{
+    return cppu::acquire(new StarOfficeDrawImportFilter(context));
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/draw/StarOfficeDrawImportFilter.hxx 
b/writerperfect/source/draw/StarOfficeDrawImportFilter.hxx
new file mode 100644
index 0000000..2fd9b7b
--- /dev/null
+++ b/writerperfect/source/draw/StarOfficeDrawImportFilter.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_WRITERPERFECT_SOURCE_DRAW_STAROFFICEDRAWIMPORTFILTER_HXX
+#define INCLUDED_WRITERPERFECT_SOURCE_DRAW_STAROFFICEDRAWIMPORTFILTER_HXX
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include "ImportFilter.hxx"
+
+#include "DocumentHandlerForOdg.hxx"
+
+/* This component will be instantiated for both import or export. Whether it 
calls
+ * setSourceDocument or setTargetDocument determines which Impl function the 
filter
+ * member calls */
+class StarOfficeDrawImportFilter : public 
writerperfect::ImportFilter<OdgGenerator>
+{
+public:
+    explicit StarOfficeDrawImportFilter(const css::uno::Reference< 
css::uno::XComponentContext > &rxContext)
+        : writerperfect::ImportFilter<OdgGenerator>(rxContext) {}
+
+    // XServiceInfo
+    virtual OUString SAL_CALL getImplementationName()
+    throw (css::uno::RuntimeException, std::exception) override;
+    virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName)
+    throw (css::uno::RuntimeException, std::exception) override;
+    virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
+    throw (css::uno::RuntimeException, std::exception) override;
+
+private:
+    virtual bool doDetectFormat(librevenge::RVNGInputStream &rInput, OUString 
&rTypeName) override;
+    virtual bool doImportDocument(librevenge::RVNGInputStream &rInput, 
OdgGenerator &rGenerator, utl::MediaDescriptor &) override;
+    virtual void doRegisterHandlers(OdgGenerator &rGenerator) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/draw/wpftdraw.component 
b/writerperfect/source/draw/wpftdraw.component
index c315fa9..72330b2 100644
--- a/writerperfect/source/draw/wpftdraw.component
+++ b/writerperfect/source/draw/wpftdraw.component
@@ -34,6 +34,11 @@
     <service name="com.sun.star.document.ImportFilter"/>
     <service name="com.sun.star.document.ExtendedTypeDetection"/>
   </implementation>
+  <implementation name="org.libreoffice.comp.Draw.StarOfficeDrawImportFilter"
+      
constructor="org_libreoffice_comp_Draw_StarOfficeDrawImportFilter_get_implementation">
+    <service name="com.sun.star.document.ImportFilter"/>
+    <service name="com.sun.star.document.ExtendedTypeDetection"/>
+  </implementation>
   <implementation name="com.sun.star.comp.Draw.VisioImportFilter"
       
constructor="com_sun_star_comp_Draw_VisioImportFilter_get_implementation">
     <service name="com.sun.star.document.ImportFilter"/>
diff --git a/writerperfect/source/writer/StarOfficeWriterImportFilter.cxx 
b/writerperfect/source/writer/StarOfficeWriterImportFilter.cxx
new file mode 100644
index 0000000..e0580dc
--- /dev/null
+++ b/writerperfect/source/writer/StarOfficeWriterImportFilter.cxx
@@ -0,0 +1,116 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <cppuhelper/supportsservice.hxx>
+
+#include <libstaroffice/libstaroffice.hxx>
+
+#include <sfx2/passwd.hxx>
+
+#include "StarOfficeWriterImportFilter.hxx"
+
+using com::sun::star::uno::Sequence;
+using com::sun::star::uno::XInterface;
+using com::sun::star::uno::RuntimeException;
+using com::sun::star::uno::XComponentContext;
+
+static bool handleEmbeddedSTOFFWriterGraphicObject(const 
librevenge::RVNGBinaryData &data, OdfDocumentHandler *pHandler,  const 
OdfStreamType streamType)
+{
+    OdgGenerator exporter;
+    exporter.addDocumentHandler(pHandler, streamType);
+    return STOFFDocument::decodeGraphic(data, &exporter);
+}
+
+static bool handleEmbeddedSTOFFWriterSpreadsheetObject(const 
librevenge::RVNGBinaryData &data, OdfDocumentHandler *pHandler,  const 
OdfStreamType streamType)
+{
+    OdsGenerator exporter;
+    exporter.registerEmbeddedObjectHandler("image/stoff-odg", 
&handleEmbeddedSTOFFWriterGraphicObject);
+    exporter.addDocumentHandler(pHandler, streamType);
+    return STOFFDocument::decodeSpreadsheet(data, &exporter);
+}
+
+bool 
StarOfficeWriterImportFilter::doImportDocument(librevenge::RVNGInputStream 
&rInput, OdtGenerator &rGenerator, utl::MediaDescriptor &)
+{
+    STOFFDocument::Kind docKind = STOFFDocument::STOFF_K_UNKNOWN;
+    const STOFFDocument::Confidence confidence = 
STOFFDocument::isFileFormatSupported(&rInput, docKind);
+    OString aUtf8Passwd;
+    if (confidence==STOFFDocument::STOFF_C_SUPPORTED_ENCRYPTION) {
+        // try to ask for a password
+        try {
+            ScopedVclPtrInstance< SfxPasswordDialog > aPasswdDlg(nullptr);
+            aPasswdDlg->SetMinLen(0);
+            if (!aPasswdDlg->Execute())
+                return false;
+            OUString aPasswd = aPasswdDlg->GetPassword();
+            aUtf8Passwd = OUStringToOString(aPasswd, RTL_TEXTENCODING_UTF8);
+        }
+        catch (...) {
+            // ok, we will probably guess it
+        }
+    }
+    return STOFFDocument::STOFF_R_OK == STOFFDocument::parse(&rInput, 
&rGenerator, !aUtf8Passwd.isEmpty() ? aUtf8Passwd.getStr() : nullptr);
+}
+
+bool StarOfficeWriterImportFilter::doDetectFormat(librevenge::RVNGInputStream 
&rInput, OUString &rTypeName)
+{
+    rTypeName.clear();
+
+    STOFFDocument::Kind docKind = STOFFDocument::STOFF_K_UNKNOWN;
+    const STOFFDocument::Confidence confidence = 
STOFFDocument::isFileFormatSupported(&rInput, docKind);
+
+    if (confidence == STOFFDocument::STOFF_C_EXCELLENT|| confidence == 
STOFFDocument::STOFF_C_SUPPORTED_ENCRYPTION)
+    {
+        switch (docKind)
+        {
+        case STOFFDocument::STOFF_K_TEXT:
+            rTypeName = "StarOffice_Writer";
+            break;
+        default:
+            break;
+        }
+    }
+
+    return !rTypeName.isEmpty();
+}
+
+void StarOfficeWriterImportFilter::doRegisterHandlers(OdtGenerator &rGenerator)
+{
+    rGenerator.registerEmbeddedObjectHandler("image/stoff-odg", 
&handleEmbeddedSTOFFWriterGraphicObject);
+    rGenerator.registerEmbeddedObjectHandler("image/stoff-ods", 
&handleEmbeddedSTOFFWriterSpreadsheetObject);
+}
+
+// XServiceInfo
+OUString SAL_CALL StarOfficeWriterImportFilter::getImplementationName()
+throw (RuntimeException, std::exception)
+{
+    return 
OUString("org.libreoffice.comp.Writer.StarOfficeWriterImportFilter");
+}
+
+sal_Bool SAL_CALL StarOfficeWriterImportFilter::supportsService(const OUString 
&rServiceName)
+throw (RuntimeException, std::exception)
+{
+    return cppu::supportsService(this, rServiceName);
+}
+
+Sequence< OUString > SAL_CALL 
StarOfficeWriterImportFilter::getSupportedServiceNames()
+throw (RuntimeException, std::exception)
+{
+    return Sequence< OUString >{"com.sun.star.document.ImportFilter", 
"com.sun.star.document.ExtendedTypeDetection"};
+}
+
+extern "C"
+SAL_DLLPUBLIC_EXPORT css::uno::XInterface *SAL_CALL
+org_libreoffice_comp_Writer_StarOfficeWriterImportFilter_get_implementation(
+    css::uno::XComponentContext *const context,
+    const css::uno::Sequence<css::uno::Any> &)
+{
+    return cppu::acquire(new StarOfficeWriterImportFilter(context));
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/writer/StarOfficeWriterImportFilter.hxx 
b/writerperfect/source/writer/StarOfficeWriterImportFilter.hxx
new file mode 100644
index 0000000..65805e0
--- /dev/null
+++ b/writerperfect/source/writer/StarOfficeWriterImportFilter.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_WRITERPERFECT_SOURCE_WRITER_STAROFFICEWRITERIMPORTFILTER_HXX
+#define INCLUDED_WRITERPERFECT_SOURCE_WRITER_STAROFFICEWRITERIMPORTFILTER_HXX
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include "ImportFilter.hxx"
+
+#include "DocumentHandlerForOdt.hxx"
+
+/* This component will be instantiated for both import or export. Whether it 
calls
+ * setSourceDocument or setTargetDocument determines which Impl function the 
filter
+ * member calls */
+class StarOfficeWriterImportFilter : public 
writerperfect::ImportFilter<OdtGenerator>
+{
+public:
+    explicit StarOfficeWriterImportFilter(const css::uno::Reference< 
css::uno::XComponentContext > &rxContext)
+        : writerperfect::ImportFilter<OdtGenerator>(rxContext) {}
+
+    // XServiceInfo
+    virtual OUString SAL_CALL getImplementationName()
+    throw (css::uno::RuntimeException, std::exception) override;
+    virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName)
+    throw (css::uno::RuntimeException, std::exception) override;
+    virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
+    throw (css::uno::RuntimeException, std::exception) override;
+
+private:
+    virtual bool doDetectFormat(librevenge::RVNGInputStream &rInput, OUString 
&rTypeName) override;
+    virtual bool doImportDocument(librevenge::RVNGInputStream &rInput, 
OdtGenerator &rGenerator, utl::MediaDescriptor &) override;
+    virtual void doRegisterHandlers(OdtGenerator &rGenerator) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/writer/wpftwriter.component 
b/writerperfect/source/writer/wpftwriter.component
index 4c5f37f..ace6b68 100644
--- a/writerperfect/source/writer/wpftwriter.component
+++ b/writerperfect/source/writer/wpftwriter.component
@@ -48,4 +48,9 @@
     <service name="com.sun.star.document.ExtendedTypeDetection"/>
     <service name="com.sun.star.document.ImportFilter"/>
   </implementation>
+  <implementation 
name="org.libreoffice.comp.Writer.StarOfficeWriterImportFilter"
+      
constructor="org_libreoffice_comp_Writer_StarOfficeWriterImportFilter_get_implementation">
+    <service name="com.sun.star.document.ImportFilter"/>
+    <service name="com.sun.star.document.ExtendedTypeDetection"/>
+  </implementation>
 </component>
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to