summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--oox/inc/oox/core/binaryfilterbase.hxx2
-rw-r--r--oox/inc/oox/core/fasttokenhandler.hxx1
-rw-r--r--oox/inc/oox/core/filterbase.hxx10
-rw-r--r--oox/inc/oox/core/xmlfilterbase.hxx85
-rw-r--r--oox/inc/oox/drawingml/chart/chartconverter.hxx3
-rw-r--r--oox/inc/oox/drawingml/table/tablestylelist.hxx3
-rw-r--r--oox/inc/oox/helper/olestorage.hxx2
-rw-r--r--oox/inc/oox/helper/storagebase.hxx14
-rw-r--r--oox/inc/oox/helper/zipstorage.hxx2
-rw-r--r--oox/prj/d.lst18
-rw-r--r--oox/source/core/binaryfilterbase.cxx4
-rw-r--r--oox/source/core/filterbase.cxx15
-rw-r--r--oox/source/core/xmlfilterbase.cxx89
-rw-r--r--oox/source/drawingml/table/tablestylelist.cxx1
-rw-r--r--oox/source/helper/olestorage.cxx6
-rw-r--r--oox/source/helper/storagebase.cxx24
-rw-r--r--oox/source/helper/zipstorage.cxx43
-rw-r--r--oox/source/shape/FastTokenHandlerService.cxx5
-rw-r--r--oox/source/shape/FastTokenHandlerService.hxx1
-rw-r--r--oox/source/token/tokenmap.cxx10
-rw-r--r--oox/source/token/tokens.txt1
-rw-r--r--oox/util/makefile.mk2
-rw-r--r--oox/workben/ooxml-export-notes.txt220
-rw-r--r--writerfilter/source/ooxml/OOXMLFastTokenHandler.cxx10
-rw-r--r--writerfilter/source/ooxml/OOXMLFastTokenHandler.hxx1
25 files changed, 530 insertions, 42 deletions
diff --git a/oox/inc/oox/core/binaryfilterbase.hxx b/oox/inc/oox/core/binaryfilterbase.hxx
index ca00d9807c01..1595557d628b 100644
--- a/oox/inc/oox/core/binaryfilterbase.hxx
+++ b/oox/inc/oox/core/binaryfilterbase.hxx
@@ -50,7 +50,7 @@ public:
private:
virtual StorageRef implCreateStorage(
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream,
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rxOutStream ) const;
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxStream ) const;
};
typedef ::rtl::Reference< BinaryFilterBase > BinaryFilterRef;
diff --git a/oox/inc/oox/core/fasttokenhandler.hxx b/oox/inc/oox/core/fasttokenhandler.hxx
index 56df6f4d429f..3944011507b2 100644
--- a/oox/inc/oox/core/fasttokenhandler.hxx
+++ b/oox/inc/oox/core/fasttokenhandler.hxx
@@ -44,6 +44,7 @@ public:
virtual ::sal_Int32 SAL_CALL getToken( const ::rtl::OUString& Identifier ) throw (::com::sun::star::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getIdentifier( ::sal_Int32 Token ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL getUTF8Identifier( ::sal_Int32 Token ) throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Int32 SAL_CALL getTokenFromUTF8( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& Identifier ) throw (::com::sun::star::uno::RuntimeException);
};
diff --git a/oox/inc/oox/core/filterbase.hxx b/oox/inc/oox/core/filterbase.hxx
index 19a816d0aaae..445123f4e8ca 100644
--- a/oox/inc/oox/core/filterbase.hxx
+++ b/oox/inc/oox/core/filterbase.hxx
@@ -39,9 +39,11 @@
#include <com/sun/star/document/XFilter.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XStream.hpp>
#include <cppuhelper/implbase5.hxx>
#include "oox/helper/helper.hxx"
#include "oox/helper/storagebase.hxx"
+#include <oox/dllapi.h>
namespace com { namespace sun { namespace star {
namespace lang { class XMultiServiceFactory; }
@@ -50,6 +52,7 @@ namespace com { namespace sun { namespace star {
namespace task { class XInteractionHandler; }
namespace io { class XInputStream; }
namespace io { class XOutputStream; }
+ namespace io { class XStream; }
} } }
namespace oox {
@@ -59,7 +62,7 @@ namespace core {
struct FilterBaseImpl;
-class FilterBase : public ::cppu::WeakImplHelper5<
+class OOX_DLLPUBLIC FilterBase : public ::cppu::WeakImplHelper5<
::com::sun::star::lang::XServiceInfo,
::com::sun::star::lang::XInitialization,
::com::sun::star::document::XImporter,
@@ -148,6 +151,9 @@ public:
::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
openOutputStream( const ::rtl::OUString& rStreamName ) const;
+ /** Commits changes to base storage (and substorages) */
+ void commit() { getStorage()->commit(); }
+
// com.sun.star.lang.XServiceInfo interface -------------------------------
virtual ::rtl::OUString SAL_CALL
@@ -198,7 +204,7 @@ private:
virtual StorageRef implCreateStorage(
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream,
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rxOutStream ) const = 0;
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxStream ) const = 0;
private:
::std::auto_ptr< FilterBaseImpl > mxImpl;
diff --git a/oox/inc/oox/core/xmlfilterbase.hxx b/oox/inc/oox/core/xmlfilterbase.hxx
index 52001d88605f..b951ea76f246 100644
--- a/oox/inc/oox/core/xmlfilterbase.hxx
+++ b/oox/inc/oox/core/xmlfilterbase.hxx
@@ -32,10 +32,13 @@
#define OOX_CORE_XMLFILTERBASE_HXX
#include <rtl/ref.hxx>
+#include <rtl/string.hxx>
+#include <rtl/ustring.hxx>
#include "oox/vml/drawing.hxx"
#include "oox/drawingml/table/tablestylelist.hxx"
#include "oox/core/filterbase.hxx"
#include "oox/core/relations.hxx"
+#include <oox/dllapi.h>
namespace com { namespace sun { namespace star {
namespace container { class XNameContainer; }
@@ -46,6 +49,12 @@ namespace com { namespace sun { namespace star {
namespace oox { namespace drawingml { class Theme; } }
namespace oox { namespace drawingml { namespace chart { class ChartConverter; } } }
+namespace sax_fastparser {
+ class FastSerializerHelper;
+
+ typedef boost::shared_ptr< FastSerializerHelper > FSHelperPtr;
+}
+
namespace oox {
namespace core {
@@ -56,7 +65,7 @@ class ModelObjectContainer;
struct XmlFilterBaseImpl;
-class XmlFilterBase : public FilterBase
+class OOX_DLLPUBLIC XmlFilterBase : public FilterBase
{
public:
explicit XmlFilterBase(
@@ -102,6 +111,33 @@ public:
*/
RelationsRef importRelations( const ::rtl::OUString& rFragmentPath );
+ /** Adds new relation.
+
+ @param rType
+ Relation type.
+
+ @param rTarget
+ Relation target.
+
+ @return Added relation Id.
+ */
+ ::rtl::OUString addRelation( const ::rtl::OUString& rType, const ::rtl::OUString& rTarget, const ::rtl::OUString& rTargetMode = ::rtl::OUString() );
+
+ /** Adds new relation to part's relations.
+
+ @param rPartName
+ Part name the relations are related to. The relations will be stored in <rPartName::path>/_rels/<rPartName::name>.rels.
+
+ @param rType
+ Relation type.
+
+ @param rTarget
+ Relation target.
+
+ @return Added relation Id.
+ */
+ ::rtl::OUString addRelation( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xOutputStream, const ::rtl::OUString& rType, const ::rtl::OUString& rTarget, const ::rtl::OUString& rTargetMode = ::rtl::OUString() );
+
/** Copies the picture element specified with rPicturePath from the source
document to the target models picture substorage.
@@ -112,13 +148,58 @@ public:
/** Returns object containers for various named drawing objects for the imported document. */
ModelObjectContainer& getModelObjectContainer() const;
+ /** Opens and returns the specified output stream from the base storage with specified media type.
+
+ @param rStreamName
+ The name of the embedded storage stream. The name may contain
+ slashes to open streams from embedded substorages. If base stream
+ access has been enabled in the storage, the base stream can be
+ accessed by passing an empty string as stream name.
+
+ @param rMediaType
+ The media type string, used in [Content_Types].xml stream in base storage.
+
+ @return The opened output stream.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
+ openOutputStream( const ::rtl::OUString& rStreamName,
+ const ::rtl::OUString& rMediaType );
+
+ /** Opens specified output stream from the base storage with specified media type and returns new fast serializer for that stream.
+
+ @param rStreamName
+ The name of the embedded storage stream. The name may contain
+ slashes to open streams from embedded substorages. If base stream
+ access has been enabled in the storage, the base stream can be
+ accessed by passing an empty string as stream name.
+
+ @param rMediaType
+ The media type string, used in [Content_Types].xml stream in base storage.
+
+ @return newly created serializer helper.
+ */
+ ::sax_fastparser::FSHelperPtr
+ openOutputStreamWithSerializer( const ::rtl::OUString& rStreamName,
+ const ::rtl::OUString& rMediaType );
+
+ /** Returns new unique ID for exported document.
+
+ @return newly created ID.
+ */
+ inline sal_Int32 GetUniqueId() { return mnMaxDocId++; }
+ inline ::rtl::OString GetUniqueIdOString() { return ::rtl::OString::valueOf( mnMaxDocId++ ); }
+ inline ::rtl::OUString GetUniqueIdOUString() { return ::rtl::OUString::valueOf( mnMaxDocId++ ); }
+
private:
virtual StorageRef implCreateStorage(
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream,
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rxOutStream ) const;
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxStream ) const;
private:
+
::std::auto_ptr< XmlFilterBaseImpl > mxImpl;
+ sal_Int32 mnRelId;
+ sal_Int32 mnMaxDocId;
};
typedef ::rtl::Reference< XmlFilterBase > XmlFilterRef;
diff --git a/oox/inc/oox/drawingml/chart/chartconverter.hxx b/oox/inc/oox/drawingml/chart/chartconverter.hxx
index 950130781ca0..63cae67b8af1 100644
--- a/oox/inc/oox/drawingml/chart/chartconverter.hxx
+++ b/oox/inc/oox/drawingml/chart/chartconverter.hxx
@@ -33,6 +33,7 @@
#define OOX_DRAWINGML_CHART_CHARTCONVERTER_HXX
#include <com/sun/star/uno/Reference.hxx>
+#include <oox/dllapi.h>
namespace com { namespace sun { namespace star {
namespace chart2 { class XChartDocument; }
@@ -53,7 +54,7 @@ struct DataSequenceModel;
// ============================================================================
-class ChartConverter
+class OOX_DLLPUBLIC ChartConverter
{
public:
explicit ChartConverter();
diff --git a/oox/inc/oox/drawingml/table/tablestylelist.hxx b/oox/inc/oox/drawingml/table/tablestylelist.hxx
index c58b8202f72a..6f5fc55550e9 100644
--- a/oox/inc/oox/drawingml/table/tablestylelist.hxx
+++ b/oox/inc/oox/drawingml/table/tablestylelist.hxx
@@ -34,11 +34,12 @@
#include <rtl/ustring.hxx>
#include <boost/shared_ptr.hpp>
-#include "oox/drawingml/table/tablestyle.hxx"
#include <vector>
namespace oox { namespace drawingml { namespace table {
+class TableStyle;
+
class TableStyleList
{
public:
diff --git a/oox/inc/oox/helper/olestorage.hxx b/oox/inc/oox/helper/olestorage.hxx
index bf662dae2d12..c2b48f931bbb 100644
--- a/oox/inc/oox/helper/olestorage.hxx
+++ b/oox/inc/oox/helper/olestorage.hxx
@@ -54,7 +54,7 @@ public:
explicit OleStorage(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
- const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rxOutStream,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxStream,
bool bBaseStreamAccess );
virtual ~OleStorage();
diff --git a/oox/inc/oox/helper/storagebase.hxx b/oox/inc/oox/helper/storagebase.hxx
index 486b472cb414..74a77602b918 100644
--- a/oox/inc/oox/helper/storagebase.hxx
+++ b/oox/inc/oox/helper/storagebase.hxx
@@ -36,11 +36,13 @@
#include <boost/shared_ptr.hpp>
#include <rtl/ustring.hxx>
#include <com/sun/star/uno/Reference.hxx>
+#include <oox/dllapi.h>
namespace com { namespace sun { namespace star {
namespace embed { class XStorage; }
namespace io { class XInputStream; }
namespace io { class XOutputStream; }
+ namespace io { class XStream; }
} } }
namespace oox {
@@ -56,7 +58,7 @@ typedef ::boost::shared_ptr< StorageBase > StorageRef;
for ZIP storages containing XML streams, and OLE storages containing binary
data streams.
*/
-class StorageBase
+class OOX_DLLPUBLIC StorageBase
{
public:
explicit StorageBase(
@@ -64,7 +66,7 @@ public:
bool bBaseStreamAccess );
explicit StorageBase(
- const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rxOutStream,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxStream,
bool bBaseStreamAccess );
virtual ~StorageBase();
@@ -117,6 +119,10 @@ public:
::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
openOutputStream( const ::rtl::OUString& rStreamName );
+ /** Commits the changes to the storage and all the substorages. (in case it is transacted object)
+ */
+ void commit();
+
protected:
/** Special constructor for sub storage objects. */
explicit StorageBase( const StorageBase& rParentStorage, const ::rtl::OUString& rStorageName );
@@ -151,11 +157,11 @@ private:
private:
typedef ::std::map< ::rtl::OUString, StorageRef > SubStorageMap;
typedef ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > XInputStreamRef;
- typedef ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > XOutputStreamRef;
+ typedef ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > XStreamRef;
SubStorageMap maSubStorages; /// Map of direct sub storages.
XInputStreamRef mxInStream; /// Cached base input stream (to keep it alive).
- XOutputStreamRef mxOutStream; /// Cached base output stream (to keep it alive).
+ XStreamRef mxStream; /// Cached base output stream (to keep it alive).
::rtl::OUString maStorageName; /// Name of this storage, if it is a substorage.
const StorageBase* mpParentStorage; /// Parent storage if this is a sub storage.
bool mbBaseStreamAccess; /// True = access base streams with empty stream name.
diff --git a/oox/inc/oox/helper/zipstorage.hxx b/oox/inc/oox/helper/zipstorage.hxx
index 62f75d4e4622..b787f3c4eee5 100644
--- a/oox/inc/oox/helper/zipstorage.hxx
+++ b/oox/inc/oox/helper/zipstorage.hxx
@@ -51,7 +51,7 @@ public:
explicit ZipStorage(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
- const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rxOutStream );
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxStream );
virtual ~ZipStorage();
diff --git a/oox/prj/d.lst b/oox/prj/d.lst
index 90b640bebc05..54fc7f76b6f1 100644
--- a/oox/prj/d.lst
+++ b/oox/prj/d.lst
@@ -1,4 +1,10 @@
mkdir: %_DEST%\inc%_EXT%\oox
+mkdir: %_DEST%\inc%_EXT%\oox\core
+mkdir: %_DEST%\inc%_EXT%\oox\helper
+mkdir: %_DEST%\inc%_EXT%\oox\vml
+mkdir: %_DEST%\inc%_EXT%\oox\drawingml
+mkdir: %_DEST%\inc%_EXT%\oox\drawingml\chart
+mkdir: %_DEST%\inc%_EXT%\oox\drawingml\table
..\%__SRC%\misc\*.map %_DEST%\bin%_EXT%\*.map
..\%__SRC%\lib\ixo.lib %_DEST%\lib%_EXT%\ixo.lib
@@ -6,9 +12,21 @@ mkdir: %_DEST%\inc%_EXT%\oox
..\%__SRC%\lib\libxol.a %_DEST%\lib%_EXT%\libxol.a
..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\*.dll
..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT%\lib*.so
+..\%__SRC%\lib\i*.lib %_DEST%\lib%_EXT%\i*.lib
..\inc\oox\dllapi.h %_DEST%\inc%_EXT%\oox\dllapi.h
..\source\token\tokens.txt %_DEST%\inc%_EXT%\oox\token.txt
+..\inc\oox\core\filterbase.hxx %_DEST%\inc%_EXT%\oox\core\filterbase.hxx
+..\inc\oox\core\relations.hxx %_DEST%\inc%_EXT%\oox\core\relations.hxx
+..\%__SRC%\inc\tokens.hxx %_DEST%\inc%_EXT%\oox\core\tokens.hxx
+..\inc\oox\core\xmlfilterbase.hxx %_DEST%\inc%_EXT%\oox\core\xmlfilterbase.hxx
+..\inc\oox\helper\helper.hxx %_DEST%\inc%_EXT%\oox\helper\helper.hxx
+..\inc\oox\helper\storagebase.hxx %_DEST%\inc%_EXT%\oox\helper\storagebase.hxx
+..\inc\oox\helper\zipstorage.hxx %_DEST%\inc%_EXT%\oox\helper\zipstorage.hxx
+..\inc\oox\vml\drawing.hxx %_DEST%\inc%_EXT%\oox\vml\drawing.hxx
+..\inc\oox\drawingml\chart\chartconverter.hxx %_DEST%\inc%_EXT%\oox\drawingml\chart\chartconverter.hxx
+..\inc\oox\drawingml\table\tablestylelist.hxx %_DEST%\inc%_EXT%\oox\drawingml\table\tablestylelist.hxx
+..\inc\oox\vml\shape.hxx %_DEST%\inc%_EXT%\oox\vml\shape.hxx
..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib
diff --git a/oox/source/core/binaryfilterbase.cxx b/oox/source/core/binaryfilterbase.cxx
index 3e7040cb9c21..2e6251b61424 100644
--- a/oox/source/core/binaryfilterbase.cxx
+++ b/oox/source/core/binaryfilterbase.cxx
@@ -35,7 +35,7 @@ using ::rtl::OUString;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::lang::XMultiServiceFactory;
using ::com::sun::star::io::XInputStream;
-using ::com::sun::star::io::XOutputStream;
+using ::com::sun::star::io::XStream;
namespace oox {
namespace core {
@@ -52,7 +52,7 @@ BinaryFilterBase::~BinaryFilterBase()
}
StorageRef BinaryFilterBase::implCreateStorage(
- Reference< XInputStream >& rxInStream, Reference< XOutputStream >& rxOutStream ) const
+ Reference< XInputStream >& rxInStream, Reference< XStream >& rxOutStream ) const
{
StorageRef xStorage;
if( rxInStream.is() )
diff --git a/oox/source/core/filterbase.cxx b/oox/source/core/filterbase.cxx
index 169a4884958a..e3babeec61e4 100644
--- a/oox/source/core/filterbase.cxx
+++ b/oox/source/core/filterbase.cxx
@@ -49,6 +49,7 @@ using ::com::sun::star::beans::PropertyValue;
using ::com::sun::star::frame::XModel;
using ::com::sun::star::io::XInputStream;
using ::com::sun::star::io::XOutputStream;
+using ::com::sun::star::io::XStream;
using ::com::sun::star::task::XStatusIndicator;
using ::com::sun::star::task::XInteractionHandler;
using ::comphelper::MediaDescriptor;
@@ -68,7 +69,7 @@ struct FilterBaseImpl
Reference< XMultiServiceFactory > mxFactory;
Reference< XModel > mxModel;
Reference< XInputStream > mxInStream;
- Reference< XOutputStream > mxOutStream;
+ Reference< XStream > mxStream;
Reference< XStatusIndicator > mxStatusIndicator;
Reference< XInteractionHandler > mxInteractionHandler;
@@ -87,13 +88,15 @@ FilterBaseImpl::FilterBaseImpl( const Reference< XMultiServiceFactory >& rxFacto
void FilterBaseImpl::setMediaDescriptor( const Sequence< PropertyValue >& rDescriptor )
{
maDescriptor = rDescriptor;
- maDescriptor.addInputStream();
maFileUrl = maDescriptor.getUnpackedValueOrDefault( MediaDescriptor::PROP_URL(), maFileUrl );
mxInStream = maDescriptor.getUnpackedValueOrDefault( MediaDescriptor::PROP_INPUTSTREAM(), mxInStream );
- mxOutStream = maDescriptor.getUnpackedValueOrDefault( MediaDescriptor::PROP_OUTPUTSTREAM(), mxOutStream );
+ mxStream = maDescriptor.getUnpackedValueOrDefault( MediaDescriptor::PROP_STREAMFOROUTPUT(), mxStream );
mxStatusIndicator = maDescriptor.getUnpackedValueOrDefault( MediaDescriptor::PROP_STATUSINDICATOR(), mxStatusIndicator );
mxInteractionHandler = maDescriptor.getUnpackedValueOrDefault( MediaDescriptor::PROP_INTERACTIONHANDLER(), mxInteractionHandler );
+
+ if( mxInStream.is() )
+ maDescriptor.addInputStream();
}
// ============================================================================
@@ -114,7 +117,7 @@ bool FilterBase::isImportFilter() const
bool FilterBase::isExportFilter() const
{
- return mxImpl->mxOutStream.is();
+ return mxImpl->mxStream.is();
}
// ----------------------------------------------------------------------------
@@ -288,13 +291,13 @@ sal_Bool SAL_CALL FilterBase::filter( const Sequence< PropertyValue >& rDescript
if( mxImpl->mxFactory.is() && mxImpl->mxModel.is() )
{
mxImpl->setMediaDescriptor( rDescriptor );
- mxImpl->mxStorage = implCreateStorage( mxImpl->mxInStream, mxImpl->mxOutStream );
+ mxImpl->mxStorage = implCreateStorage( mxImpl->mxInStream, mxImpl->mxStream );
if( mxImpl->mxStorage.get() )
{
mxImpl->mxModel->lockControllers();
if( mxImpl->mxInStream.is() )
bRet = importDocument();
- else if( mxImpl->mxOutStream.is() )
+ else if( mxImpl->mxStream.is() )
bRet = exportDocument();
mxImpl->mxModel->unlockControllers();
}
diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index 6e7f4e6c9f55..5460b3c73b23 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -30,12 +30,17 @@
#include "oox/core/xmlfilterbase.hxx"
#include <set>
+#include <stdio.h>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/document/XDocumentSubStorageSupplier.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/embed/XTransactedObject.hpp>
+#include <com/sun/star/embed/XRelationshipAccess.hpp>
#include <com/sun/star/xml/sax/InputSource.hpp>
#include <com/sun/star/xml/sax/XFastParser.hpp>
+#include <sax/fshelper.hxx>
#include "oox/helper/containerhelper.hxx"
#include "oox/helper/zipstorage.hxx"
#include "oox/core/fasttokenhandler.hxx"
@@ -46,16 +51,23 @@
#include "oox/core/relationshandler.hxx"
using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::beans::StringPair;
using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
using ::com::sun::star::uno::Exception;
using ::com::sun::star::uno::RuntimeException;
using ::com::sun::star::uno::UNO_QUERY;
using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::uno::makeAny;
using ::com::sun::star::lang::XMultiServiceFactory;
+using ::com::sun::star::embed::XRelationshipAccess;
using ::com::sun::star::embed::XStorage;
using ::com::sun::star::embed::XTransactedObject;
using ::com::sun::star::io::XInputStream;
using ::com::sun::star::io::XOutputStream;
+using ::com::sun::star::io::XStream;
using ::com::sun::star::container::XNameContainer;
using ::com::sun::star::document::XDocumentSubStorageSupplier;
using ::com::sun::star::xml::sax::XFastParser;
@@ -63,6 +75,8 @@ using ::com::sun::star::xml::sax::XFastTokenHandler;
using ::com::sun::star::xml::sax::XFastDocumentHandler;
using ::com::sun::star::xml::sax::InputSource;
using ::com::sun::star::xml::sax::SAXException;
+using ::sax_fastparser::FastSerializerHelper;
+using ::sax_fastparser::FSHelperPtr;
namespace oox {
namespace core {
@@ -97,11 +111,13 @@ XmlFilterBaseImpl::XmlFilterBaseImpl() :
XmlFilterBase::XmlFilterBase( const Reference< XMultiServiceFactory >& rxFactory ) :
FilterBase( rxFactory ),
- mxImpl( new XmlFilterBaseImpl )
+ mxImpl( new XmlFilterBaseImpl ),
+ mnRelId( 1 ),
+ mnMaxDocId( 0 )
{
}
-XmlFilterBase::~XmlFilterBase()
+SAL_CALL XmlFilterBase::~XmlFilterBase()
{
}
@@ -274,16 +290,79 @@ ModelObjectContainer& XmlFilterBase::getModelObjectContainer() const
}
StorageRef XmlFilterBase::implCreateStorage(
- Reference< XInputStream >& rxInStream, Reference< XOutputStream >& rxOutStream ) const
+ Reference< XInputStream >& rxInStream, Reference< XStream >& rxStream ) const
{
StorageRef xStorage;
if( rxInStream.is() )
xStorage.reset( new ZipStorage( getGlobalFactory(), rxInStream ) );
- else if( rxOutStream.is() )
- xStorage.reset( new ZipStorage( getGlobalFactory(), rxOutStream ) );
+ else if( rxStream.is() )
+ xStorage.reset( new ZipStorage( getGlobalFactory(), rxStream ) );
+
return xStorage;
}
+Reference< XOutputStream > XmlFilterBase::openOutputStream( const OUString& rStreamName, const OUString& rMediaType )
+{
+ Reference< XOutputStream > xOutputStream = FilterBase::openOutputStream( rStreamName );
+ Reference< XPropertySet > xPropSet( xOutputStream, UNO_QUERY_THROW );
+
+ if( xPropSet.is() )
+ xPropSet->setPropertyValue( CREATE_OUSTRING( "MediaType" ),
+ makeAny( rMediaType ) );
+
+ return xOutputStream;
+}
+
+FSHelperPtr XmlFilterBase::openOutputStreamWithSerializer( const OUString& rStreamName, const OUString& rMediaType )
+{
+ return FSHelperPtr( new FastSerializerHelper ( openOutputStream( rStreamName, rMediaType ) ) );
+}
+
+static OUString addRelation_impl( const Reference< XRelationshipAccess > xRelations, sal_Int32 nId, const OUString& rType, const OUString& rTarget, const OUString& rTargetMode )
+{
+ OUString sId = OUStringBuffer().appendAscii( "rId" ).append( nId ).makeStringAndClear();
+
+ Sequence< StringPair > aEntry( rTargetMode.getLength() > 0 ? 3 : 2 );
+ aEntry[0].First = CREATE_OUSTRING( "Type" );
+ aEntry[0].Second = rType;
+ aEntry[1].First = CREATE_OUSTRING( "Target" );
+ aEntry[1].Second = rTarget;
+ if( rTargetMode.getLength() > 0 )
+ {
+ aEntry[2].First = CREATE_OUSTRING( "TargetMode" );
+ aEntry[2].Second = rTargetMode;
+ }
+ xRelations->insertRelationshipByID( sId, aEntry, true );
+
+ return sId;
+}
+
+OUString XmlFilterBase::addRelation( const OUString& rType, const OUString& rTarget, const OUString& rTargetMode )
+{
+ Reference< XRelationshipAccess > xRelations( getStorage()->getXStorage(), UNO_QUERY );
+ if( xRelations.is() )
+ return addRelation_impl( xRelations, mnRelId ++, rType, rTarget, rTargetMode );
+
+ return OUString();
+}
+
+OUString XmlFilterBase::addRelation( const Reference< XOutputStream > xOutputStream, const OUString& rType, const OUString& rTarget, const OUString& rTargetMode )
+{
+ sal_Int32 nId = 0;
+
+ Reference< XPropertySet > xPropertySet( xOutputStream, UNO_QUERY );
+ if( xPropertySet.is() )
+ xPropertySet->getPropertyValue( CREATE_OUSTRING( "RelId" ) ) >>= nId;
+ else
+ nId = mnRelId ++;
+
+ Reference< XRelationshipAccess > xRelations( xOutputStream, UNO_QUERY );
+ if( xRelations.is() )
+ return addRelation_impl( xRelations, nId, rType, rTarget, rTargetMode );
+
+ return OUString();
+}
+
// ============================================================================
} // namespace core
diff --git a/oox/source/drawingml/table/tablestylelist.cxx b/oox/source/drawingml/table/tablestylelist.cxx
index b5cc36f28651..dd98499c390c 100644
--- a/oox/source/drawingml/table/tablestylelist.cxx
+++ b/oox/source/drawingml/table/tablestylelist.cxx
@@ -29,6 +29,7 @@
************************************************************************/
#include "oox/drawingml/table/tablestylelist.hxx"
+#include "oox/drawingml/table/tablestyle.hxx"
namespace oox { namespace drawingml { namespace table {
diff --git a/oox/source/helper/olestorage.cxx b/oox/source/helper/olestorage.cxx
index 96a83b49f423..93ff538a2939 100644
--- a/oox/source/helper/olestorage.cxx
+++ b/oox/source/helper/olestorage.cxx
@@ -34,6 +34,7 @@
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XStream.hpp>
#include "oox/helper/helper.hxx"
using ::rtl::OUString;
@@ -49,6 +50,7 @@ using ::com::sun::star::beans::PropertyValue;
using ::com::sun::star::embed::XStorage;
using ::com::sun::star::io::XInputStream;
using ::com::sun::star::io::XOutputStream;
+using ::com::sun::star::io::XStream;
namespace oox {
@@ -72,9 +74,9 @@ OleStorage::OleStorage(
OleStorage::OleStorage(
const Reference< XMultiServiceFactory >& rxFactory,
- const Reference< XOutputStream >& rxOutStream,
+ const Reference< XStream >& rxStream,
bool bBaseStreamAccess ) :
- StorageBase( rxOutStream, bBaseStreamAccess )
+ StorageBase( rxStream, bBaseStreamAccess )
{
OSL_ENSURE( rxFactory.is(), "OleStorage::OleStorage - missing service factory" );
(void)rxFactory; // prevent compiler warning
diff --git a/oox/source/helper/storagebase.cxx b/oox/source/helper/storagebase.cxx
index c4206f9ee1b6..bb130f962f98 100644
--- a/oox/source/helper/storagebase.cxx
+++ b/oox/source/helper/storagebase.cxx
@@ -29,14 +29,19 @@
************************************************************************/
#include "oox/helper/storagebase.hxx"
+#include <com/sun/star/io/XStream.hpp>
+#include <com/sun/star/embed/XTransactedObject.hpp>
#include <rtl/ustrbuf.hxx>
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::UNO_QUERY;
using ::com::sun::star::embed::XStorage;
+using ::com::sun::star::embed::XTransactedObject;
using ::com::sun::star::io::XInputStream;
using ::com::sun::star::io::XOutputStream;
+using ::com::sun::star::io::XStream;
namespace oox {
@@ -70,12 +75,12 @@ StorageBase::StorageBase( const Reference< XInputStream >& rxInStream, bool bBas
OSL_ENSURE( mxInStream.is(), "StorageBase::StorageBase - missing base input stream" );
}
-StorageBase::StorageBase( const Reference< XOutputStream >& rxOutStream, bool bBaseStreamAccess ) :
- mxOutStream( rxOutStream ),
+StorageBase::StorageBase( const Reference< XStream >& rxStream, bool bBaseStreamAccess ) :
+ mxStream( rxStream ),
mpParentStorage( 0 ),
mbBaseStreamAccess( bBaseStreamAccess )
{
- OSL_ENSURE( mxOutStream.is(), "StorageBase::StorageBase - missing base output stream" );
+ OSL_ENSURE( mxStream.is(), "StorageBase::StorageBase - missing base output stream" );
}
StorageBase::StorageBase( const StorageBase& rParentStorage, const OUString& rStorageName ) :
@@ -178,7 +183,7 @@ Reference< XOutputStream > StorageBase::openOutputStream( const OUString& rStrea
}
else if( mbBaseStreamAccess )
{
- xOutStream = mxOutStream;
+ xOutStream = mxStream->getOutputStream();
}
return xOutStream;
}
@@ -190,6 +195,17 @@ StorageRef StorageBase::getSubStorage( const OUString& rElementName, bool bCreat
(maSubStorages[ rElementName ] = implOpenSubStorage( rElementName, bCreate )) : aIt->second;
}
+void StorageBase::commit()
+{
+ for( SubStorageMap::iterator aIt = maSubStorages.begin(); aIt != maSubStorages.end(); aIt ++ )
+ aIt->second->commit();
+
+ Reference< XTransactedObject > xTransactedObj( getXStorage(), UNO_QUERY );
+
+ if( xTransactedObj.is() )
+ xTransactedObj->commit();
+}
+
// ============================================================================
} // namespace oox
diff --git a/oox/source/helper/zipstorage.cxx b/oox/source/helper/zipstorage.cxx
index ddc3ee9f5e7c..7685b32e2b23 100644
--- a/oox/source/helper/zipstorage.cxx
+++ b/oox/source/helper/zipstorage.cxx
@@ -29,8 +29,10 @@
************************************************************************/
#include "oox/helper/zipstorage.hxx"
+#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/embed/XStorage.hpp>
+#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <comphelper/storagehelper.hxx>
@@ -46,6 +48,7 @@ using ::com::sun::star::lang::XMultiServiceFactory;
using ::com::sun::star::embed::XStorage;
using ::com::sun::star::io::XInputStream;
using ::com::sun::star::io::XOutputStream;
+using ::com::sun::star::io::XStream;
namespace oox {
@@ -69,12 +72,23 @@ ZipStorage::ZipStorage(
ZipStorage::ZipStorage(
const Reference< XMultiServiceFactory >& rxFactory,
- const Reference< XOutputStream >& rxOutStream ) :
- StorageBase( rxOutStream, false )
+ const Reference< XStream >& rxStream ) :
+ StorageBase( rxStream, false )
{
OSL_ENSURE( rxFactory.is(), "ZipStorage::ZipStorage - missing service factory" );
- (void)rxFactory; // prevent compiler warning
- OSL_ENSURE( false, "ZipStorage::ZipStorage - not implemented" );
+ // create base storage object
+ try
+ {
+ mxStorage = ::comphelper::OStorageHelper::GetStorageOfFormatFromStream( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OFOPXMLFormat" ) ),
+ rxStream,
+ com::sun::star::embed::ElementModes::READWRITE
+ | com::sun::star::embed::ElementModes::TRUNCATE,
+ rxFactory );
+ }
+ catch( Exception& )
+ {
+ OSL_ENSURE( false, "ZipStorage::ZipStorage - cannot open output storage" );
+ }
}
ZipStorage::ZipStorage( const ZipStorage& rParentStorage, const Reference< XStorage >& rxStorage, const OUString& rElementName ) :
@@ -114,10 +128,8 @@ void ZipStorage::implGetElementNames( ::std::vector< OUString >& orElementNames
StorageRef ZipStorage::implOpenSubStorage( const OUString& rElementName, bool bCreate )
{
- OSL_ENSURE( !bCreate, "ZipStorage::implOpenSubStorage - creating new sub storages not implemented" );
- (void)bCreate; // prevent compiler warning
-
Reference< XStorage > xSubXStorage;
+ bool bMissing = false;
if( mxStorage.is() ) try
{
// XStorage::isStorageElement may throw various exceptions...
@@ -125,10 +137,24 @@ StorageRef ZipStorage::implOpenSubStorage( const OUString& rElementName, bool bC
xSubXStorage = mxStorage->openStorageElement(
rElementName, ::com::sun::star::embed::ElementModes::READ );
}
+ catch( ::com::sun::star::container::NoSuchElementException& )
+ {
+ bMissing = true;
+ }
catch( Exception& )
{
}
+ if( bMissing && bCreate )
+ try
+ {
+ xSubXStorage = mxStorage->openStorageElement(
+ rElementName, ::com::sun::star::embed::ElementModes::READWRITE );
+ }
+ catch( Exception& )
+ {
+ }
+
StorageRef xSubStorage;
if( xSubXStorage.is() )
xSubStorage.reset( new ZipStorage( *this, xSubXStorage, rElementName ) );
@@ -153,8 +179,7 @@ Reference< XOutputStream > ZipStorage::implOpenOutputStream( const OUString& rEl
Reference< XOutputStream > xOutStream;
if( mxStorage.is() ) try
{
- (void)rElementName;
- OSL_ENSURE( false, "ZipStorage::implOpenOutputStream - not implemented" );
+ xOutStream.set( mxStorage->openStreamElement( rElementName, ::com::sun::star::embed::ElementModes::READWRITE ), UNO_QUERY );
}
catch( Exception& )
{
diff --git a/oox/source/shape/FastTokenHandlerService.cxx b/oox/source/shape/FastTokenHandlerService.cxx
index fae38b6ab8ea..d97ec886f88a 100644
--- a/oox/source/shape/FastTokenHandlerService.cxx
+++ b/oox/source/shape/FastTokenHandlerService.cxx
@@ -70,6 +70,11 @@ uno::Sequence< ::rtl::OUString > SAL_CALL FastTokenHandlerService::getSupportedS
return mFastTokenHandler.getIdentifier(Token);
}
+::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL FastTokenHandlerService::getUTF8Identifier( ::sal_Int32 Token ) throw (::com::sun::star::uno::RuntimeException)
+{
+ return mFastTokenHandler.getUTF8Identifier(Token);
+}
+
::sal_Int32 SAL_CALL FastTokenHandlerService::getTokenFromUTF8(const ::com::sun::star::uno::Sequence< ::sal_Int8 > & Identifier) throw (::com::sun::star::uno::RuntimeException)
{
return mFastTokenHandler.getTokenFromUTF8(Identifier);
diff --git a/oox/source/shape/FastTokenHandlerService.hxx b/oox/source/shape/FastTokenHandlerService.hxx
index 4f848db8a772..64b79ab943ee 100644
--- a/oox/source/shape/FastTokenHandlerService.hxx
+++ b/oox/source/shape/FastTokenHandlerService.hxx
@@ -60,6 +60,7 @@ public:
// ::com::sun::star::xml::sax::XFastTokenHandler:
virtual ::sal_Int32 SAL_CALL getToken(const ::rtl::OUString & Identifier) throw (css::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getIdentifier(::sal_Int32 Token) throw (css::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL getUTF8Identifier( ::sal_Int32 Token ) throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Int32 SAL_CALL getTokenFromUTF8(const css::uno::Sequence< ::sal_Int8 > & Identifier) throw (css::uno::RuntimeException);
private:
diff --git a/oox/source/token/tokenmap.cxx b/oox/source/token/tokenmap.cxx
index 8e79ec2d7449..93da78313a69 100644
--- a/oox/source/token/tokenmap.cxx
+++ b/oox/source/token/tokenmap.cxx
@@ -110,6 +110,16 @@ OUString FastTokenHandler::getIdentifier( sal_Int32 nToken ) throw( RuntimeExcep
return aTokens[nToken];
}
+Sequence< sal_Int8 > FastTokenHandler::getUTF8Identifier( sal_Int32 nToken ) throw( RuntimeException )
+{
+ MutexGuard aGuard( lclGetTokenMutex() );
+
+ if( nToken >= XML_TOKEN_COUNT )
+ return Sequence< sal_Int8 >();
+
+ return Sequence< sal_Int8 >( reinterpret_cast< const sal_Int8 *>(tokentowordlist[nToken]), strlen(tokentowordlist[nToken]));
+}
+
sal_Int32 FastTokenHandler::getTokenFromUTF8( const Sequence< sal_Int8 >& rIdentifier ) throw( RuntimeException )
{
MutexGuard aGuard( lclGetTokenMutex() );
diff --git a/oox/source/token/tokens.txt b/oox/source/token/tokens.txt
index 711cb31f4bb1..96f14da3f37c 100644
--- a/oox/source/token/tokens.txt
+++ b/oox/source/token/tokens.txt
@@ -5530,6 +5530,7 @@ xmlCellPr
xmlColumnPr
xmlDataType
xmlPr
+xmlns
xpath
xrange
xscale
diff --git a/oox/util/makefile.mk b/oox/util/makefile.mk
index ff47635e1aa3..6c08249eb3f6 100644
--- a/oox/util/makefile.mk
+++ b/oox/util/makefile.mk
@@ -62,7 +62,7 @@ LIB1FILES= \
# --- Shared-Library -----------------------------------------------
SHL1TARGET= $(TARGET)$(DLLPOSTFIX)
-SHL1IMPLIB= i$(SHL1TARGET)
+SHL1IMPLIB= i$(TARGET)
SHL1USE_EXPORTS=name
SHL1STDLIBS= \
diff --git a/oox/workben/ooxml-export-notes.txt b/oox/workben/ooxml-export-notes.txt
new file mode 100644
index 000000000000..8da4582b72b1
--- /dev/null
+++ b/oox/workben/ooxml-export-notes.txt
@@ -0,0 +1,220 @@
+How to install this
+-------------------
+
+> cd instsetoo_native/util
+> LOCALINSTALLDIR=/where/you/want dmake openoffice_en-US PKGFORMAT=installed
+
+OOXML generally
+---------------
+
+- http://www.ecma-international.org/publications/standards/Ecma-376.htm
+- http://www.asahi-net.or.jp/~eb2m-mrt/ooxml/dependencies.html
+
+Related modules
+---------------
+
+- oox
+ - .xlsx and .pptx import
+
+- writerfilter
+ - import of .docx, uses also oox for the graphics etc.
+ - can also parse .doc; but used for ooxml only for now
+
+- filter
+ - the configuration stuff (so that the filters appear in the filepicker)
+
+Old binary filters (export)
+---------------------------
+
+- doc export
+ - sw/source/filter/ww8/wrtww8*
+ - wrtww8.cxx:2191 [SwWW8Writer::StoreDoc()] is the entry point
+
+ - eg.
+ #0 SwWW8Writer::WriteText (this=0x2aaab3dfb7c0) at /local/ooxml/ooxml/sw/source/filter/ww8/wrtww8.cxx:1846
+ #1 0x00002aaaae75a545 in SwWW8Writer::WriteMainText (this=0x2aaab3d6a870)
+ at /local/ooxml/ooxml/sw/source/filter/ww8/wrtww8.cxx:1925
+ #2 0x00002aaaae75e357 in SwWW8Writer::StoreDoc1 (this=0x2aaab3d6a870)
+ at /local/ooxml/ooxml/sw/source/filter/ww8/wrtww8.cxx:2076
+ #3 0x00002aaaae7605ec in SwWW8Writer::StoreDoc (this=0x2aaab3d6a870)
+ at /local/ooxml/ooxml/sw/source/filter/ww8/wrtww8.cxx:2383
+ #4 0x00002aaaae760fd5 in SwWW8Writer::WriteStorage (this=0x2aaab3d6a870)
+ at /local/ooxml/ooxml/sw/source/filter/ww8/wrtww8.cxx:2547
+ #5 0x00002aaaae70b793 in StgWriter::Write (this=0x2aaab3d6a870, rPaM=@0x2b3802a2b640, rStg=@0x2aaab3d621c0,
+ pFName=0x7fffb1b285c0) at /local/ooxml/ooxml/sw/source/filter/writer/writer.cxx:653
+ #6 0x00002aaaae70b84d in Writer::Write (this=0x2aaab3d6a870, rPaM=@0x2b3802a2b640, rStrm=@0x2aaaad979d20,
+ pFName=0x7fffb1b285c0) at /local/ooxml/ooxml/sw/source/filter/writer/writer.cxx:358
+ #7 0x00002aaaae70b993 in Writer::Write (this=0x2aaab3d6a870, rPam=@0x2b3802a2b640, rMed=@0x2aaaad999f30,
+ pFileName=0x7fffb1b285c0) at /local/ooxml/ooxml/sw/source/filter/writer/writer.cxx:385
+ #8 0x00002aaaae6375d7 in SwWriter::Write (this=0x7fffb1b28410, rxWriter=@0x7fffb1b285d0,
+ pRealFileName=0x7fffb1b285c0) at /local/ooxml/ooxml/sw/source/filter/basflt/shellio.cxx:963
+ #9 0x00002aaaae87cc1e in SwDocShell::ConvertTo (this=0xcc27f0, rMedium=@0x2aaaad999f30)
+ at /local/ooxml/ooxml/sw/source/ui/app/docsh.cxx:924
+ #10 0x00002b37faae6b58 in SfxObjectShell::DoLoad ()
+ from /local/ooxml/inst/openoffice.org3.0/program/../basis-link/program//libsfxlx.so
+
+- xls export
+ - sc/source/filter/excel/xe*
+
+ - eg.
+ #0 XclExpRecord::Save (this=0x11ae4c0, rStrm=@0x7fff5e6335d0)
+ at /local/ooxml/ooxml/sc/source/filter/excel/xerecord.cxx:88
+ #1 0x00002aaaae562c4a in ExcRecord::Save (this=0x11ae4c0, rStrm=@0x7fff5e6335d0)
+ at /local/ooxml/ooxml/sc/source/filter/excel/excrecds.cxx:168
+ #2 0x00002aaaae54b0fa in XclExpRecordList<XclExpRecordBase>::Save (this=0x11c5d18, rStrm=@0x7fff5e6335d0)
+ at ../inc/xerecord.hxx:281
+ #3 0x00002aaaae547541 in ExcTable::Write (this=0x11c5cf8, rStr=@0x7fff5e6335d0)
+ at /local/ooxml/ooxml/sc/source/filter/excel/excdoc.cxx:455
+ #4 0x00002aaaae5475fb in ExcDocument::Write (this=0x11c5ce0, rSvStrm=@0x2aaab3dcd070)
+ at /local/ooxml/ooxml/sc/source/filter/excel/excdoc.cxx:525
+ #5 0x00002aaaae568add in ExportBiff5::Write (this=0x7fff5e6339c0)
+ at /local/ooxml/ooxml/sc/source/filter/excel/expop2.cxx:119
+ #6 0x00002aaaae54f4af in ScExportExcel5 (rMedium=@0x2aaab3d87410, pDocument=0xce6a00, bBiff8=1 '\001', eNach=1)
+ at /local/ooxml/ooxml/sc/source/filter/excel/excel.cxx:252
+ #7 0x00002aaaadf1b70a in ScDocShell::ConvertTo (this=0xce6990, rMed=@0x2aaab3d87410)
+ at /local/ooxml/ooxml/sc/source/ui/docshell/docsh.cxx:2080
+ #8 0x00002b354dfd8b58 in SfxObjectShell::DoLoad ()
+ from /local/ooxml/inst/openoffice.org3.0/program/../basis-link/program//libsfxlx.so
+
+ - Current approach is to add a XclExpRecordBase::SaveXml() method, which
+ would be used to write the XML content (while Save() would continue
+ writing the BIFF format).
+ - Q: How do we get to the Save()/SaveXml() methods (e.g. the SST export code)
+ #0 XclExpSstImpl::Save (this=0x1b170b0, rStrm=@0x7fffd4d5c4a0)
+ at /home/jon/Development/OpenOffice.org/ooxml/sc/source/filter/excel/xecontent.cxx:224
+ #1 0x00007f68b7e46ff7 in XclExpSst::Save (this=0x1abc300,
+ rStrm=@0x7fffd4d5c4a0)
+ at /home/jon/Development/OpenOffice.org/ooxml/sc/source/filter/excel/xecontent.cxx:351
+ #2 0x00007f68b7de5090 in XclExpRecordList<XclExpRecordBase>::Save (
+ this=0x1b2d168, rStrm=@0x7fffd4d5c4a0) at ../inc/xerecord.hxx:282
+ // as above, starting at frame 2
+
+ - Thus, to get to the SaveXml() method, we need to add a slew of WriteXml()
+ methods that will (eventually) invoke the SaveXml() methods.
+
+ - ZipStorage for XML handling and StorageRef (XStorage interface)
+ - To construct ZipStorage, need XMultiServiceFactory (!), and
+ XInputStream.
+ - Have an SvStream; need to wrap SvStream with XInputStream
+ - OInputStreamWrapper in <unotools/streamwrap.hxx>
+ - Where do I get XMultiServiceFactory?
+ - Lots of places -- just grep
+ - perhaps XmlFilterBase _does_ make sense here.
+ - Do it anyway.
+ - Looking into having XclExpXmlStream inherit from ZipFilterBase
+ - problem: exception during construction, because ZipStorage hates me:
+ #0 OStorageFactory::createInstanceWithArguments (this=0x10612a0,
+ aArguments=@0x7fffe2ef76d0)
+ at /home/jon/Development/OpenOffice.org/ooxml/package/source/xstor/xfactory.cxx:275
+ #1 0x00007f12d93f0d5c in comphelper::OStorageHelper::GetStorageOfFormatFromStream (aFormat=@0x7fffe2ef7780, xStream=@0x1a502d8, nStorageMode=15,
+ xFactory=@0x1a502c0)
+ at /home/jon/Development/OpenOffice.org/ooxml/comphelper/source/misc/storagehelper.cxx:342
+ #2 0x00007f12c33d1a6d in ZipStorage (this=0x1a92550, rxFactory=@0x1a502c0,
+ rxStream=@0x1a502d8)
+ at /home/jon/Development/OpenOffice.org/ooxml/oox/source/helper/zipstorage.cxx:87
+ #3 0x00007f12c33f089e in oox::core::XmlFilterBase::implCreateStorage (
+ this=0x7fffe2ef7930, rxInStream=@0x1a502d0, rxStream=@0x1a502d8)
+ at /home/jon/Development/OpenOffice.org/ooxml/oox/source/core/xmlfilterbase.cxx:298
+ #4 0x00007f12c33dd204 in oox::core::FilterBase::filter (this=0x7fffe2ef7930,
+ rDescriptor=@0x7fffe2ef78d0)
+ at /home/jon/Development/OpenOffice.org/ooxml/oox/source/core/filterbase.cxx:284
+ #5 0x00007f12c68097a2 in XclExpXmlStream (this=0x7fffe2ef7930,
+ rSMgr=@0x7fffe2ef79a0, rStrm=@0x18d6f90)
+ at /home/jon/Development/OpenOffice.org/ooxml/sc/source/filter/excel/xestream.cxx:659
+ #6 0x00007f12c674c8c1 in ExcDocument::WriteXml (this=0x15911f0,
+ rStrm=@0x18d6f90)
+ at /home/jon/Development/OpenOffice.org/ooxml/sc/source/filter/excel/excdoc.cxx:575
+ ...
+ - Actual problem: xfactory.cxx:274, the CheckPackageSignature_Impl() call.
+ - fails because the empty file has content (!), thus fails the "package
+ signature check" (which tries to ensure the file format is correct).
+ - Underlying file is an SvFileStream, created in
+ SfxMedium::GetOutStream().
+ - So why's CheckPackageSignature_Impl() fail? Because
+ lcl_ExportExcel2007Xml() had the code:
+
+ SotStorageRef xRootStrg = new SotStorage( pMedStrm, FALSE );
+
+ That is, it was creating an OLE Structured Storage document over the
+ SvStream, and then (later) used the *same* SvStream and passed it to
+ ZipStorage. This caused ZipStorage to complain because OLESS data was
+ already present in the file, with a different file signature than what
+ ZipPackage was expecting (go figure).
+
+- ppt export
+ - sd/source/filter/eppt/*
+ - svx/source/msfilter
+ - for eg. Escher export
+ - Escher: http://chicago.sourceforge.net/devel/docs/escher/index.html
+
+ - eg.
+ #0 PPTWriter (this=0x15807d0, rSvStorage=@0x7fff894f5340, rXModel=@0x142a2e8, rXStatInd=@0x142a2f0, pVBA=0x0,
+ nCnvrtFlags=15) at /local/ooxml/ooxml/sd/source/filter/eppt/eppt.cxx:268
+ #1 0x00002aaab3895719 in ExportPPT (rSvStorage=@0x7fff894f5340, rXModel=@0x142a2e8, rXStatInd=@0x142a2f0,
+ pVBA=0x0, nCnvrtFlags=15) at /local/ooxml/ooxml/sd/source/filter/eppt/eppt.cxx:2503
+ #2 0x00002aaaadef85b7 in SdPage::onParagraphRemoving ()
+ from /local/ooxml/inst/openoffice.org3.0/program/../basis-link/program/libsdlx.so
+ #3 0x00002aaaade202e3 in sd::DrawDocShell::ConvertTo ()
+ from /local/ooxml/inst/openoffice.org3.0/program/../basis-link/program/libsdlx.so
+ #4 0x00002aec23119b58 in SfxObjectShell::DoLoad ()
+ from /local/ooxml/inst/openoffice.org3.0/program/../basis-link/program//libsfxlx.so
+
+- odp export
+ #0 ZipPackage (this=0x1805e80, xNewFactory=@0x7fffe284e990) at /home/rodo/git/ooxml/package/source/zippackage/ZipPackage.cxx:279
+ #1 0x00002aaaadd3dc94 in ZipPackage_createInstance (xMgr=@0x7fffe284e990) at /home/rodo/git/ooxml/package/source/zippackage/ZipPackage.cxx:1546
+ #2 0x00002b0fca7ab6b3 in ?? () from /opt/openoffice.org3.0/program/../basis-link/program/../ure-link/lib/libuno_cppuhelpergcc3.so.3
+ #3 0x00002b0fca7a7fda in ?? () from /opt/openoffice.org3.0/program/../basis-link/program/../ure-link/lib/libuno_cppuhelpergcc3.so.3
+ #4 0x00002b0fca7a811e in ?? () from /opt/openoffice.org3.0/program/../basis-link/program/../ure-link/lib/libuno_cppuhelpergcc3.so.3
+ #5 0x00002b0fca7aa7cc in ?? () from /opt/openoffice.org3.0/program/../basis-link/program/../ure-link/lib/libuno_cppuhelpergcc3.so.3
+ #6 0x00002b0fca7aacbe in ?? () from /opt/openoffice.org3.0/program/../basis-link/program/../ure-link/lib/libuno_cppuhelpergcc3.so.3
+ #7 0x00002b0fca7aa035 in ?? () from /opt/openoffice.org3.0/program/../basis-link/program/../ure-link/lib/libuno_cppuhelpergcc3.so.3
+ #8 0x00002aaaaadae1b3 in ?? () from /opt/openoffice.org/ure/lib/bootstrap.uno.so
+ #9 0x00002aaaaadaa84c in ?? () from /opt/openoffice.org/ure/lib/bootstrap.uno.so
+ #10 0x00002aaab5c7a7e5 in OStorage_Impl::OpenOwnPackage (this=0x185cac0) at /home/rodo/git/ooxml/package/source/xstor/xstorage.cxx:549
+ #11 0x00002aaab5c7ab3e in OStorage_Impl::ReadContents (this=0x185cac0) at /home/rodo/git/ooxml/package/source/xstor/xstorage.cxx:649
+ #12 0x00002aaab5c7d32f in OStorage_Impl::FindElement (this=0x185cac0, rName=@0x7fffe284f280) at /home/rodo/git/ooxml/package/source/xstor/xstorage.cxx:1387
+ #13 0x00002aaab5c7dc45 in OStorage::hasByName (this=0x1808880, aName=@0x7fffe284f280) at /home/rodo/git/ooxml/package/source/xstor/xstorage.cxx:4045
+ #14 0x00002aaab1fde8c5 in XMLVersionListPersistence::load () from /opt/openoffice.org3.0/program/../basis-link/program/libxolx.so
+ #15 0x00002b0fcb058bb2 in SfxMedium::GetVersionList (this=0x1750050, _bNoReload=false) at /home/rodo/git/ooxml/sfx2/source/doc/docfile.cxx:3247
+ #16 0x00002b0fcb0571b5 in SfxMedium::GetStorage (this=0x1750050) at /home/rodo/git/ooxml/sfx2/source/doc/docfile.cxx:1328
+ #17 0x00002b0fcb05d0d7 in SfxMedium::GetOutputStorage (this=0x1750050) at /home/rodo/git/ooxml/sfx2/source/doc/docfile.cxx:1068
+ #18 0x00002b0fcb091227 in SfxObjectShell::SaveTo_Impl (this=0xf44d60, rMedium=@0x1750050, pSet=0x0) at /home/rodo/git/ooxml/sfx2/source/doc/objstor.cxx:1557
+ #19 0x00002b0fcb09443c in SfxObjectShell::PreDoSaveAs_Impl (this=0xf44d60, rFileName=@0x7fffe2850700, aFilterName=@0x7fffe28507f0, pParams=0xf10c10)
+ at /home/rodo/git/ooxml/sfx2/source/doc/objstor.cxx:2984
+ #20 0x00002b0fcb094ea5 in SfxObjectShell::CommonSaveAs_Impl (this=0xf44d60, aURL=@0x7fffe2850870, aFilterName=@0x7fffe28507f0, aParams=0x1740310)
+ at /home/rodo/git/ooxml/sfx2/source/doc/objstor.cxx:2855
+ #21 0x00002b0fcb0a1da2 in SfxObjectShell::APISaveAs_Impl (this=0xf44d60, aFileName=@0x7fffe2850b70, aParams=0x1740310)
+ at /home/rodo/git/ooxml/sfx2/source/doc/objserv.cxx:432
+ #22 0x00002b0fcb0e74c8 in SfxBaseModel::impl_store (this=0xf96a00, sURL=@0x7fffe28516b0, seqArguments=@0x7fffe2851ae0, bSaveTo=0 '\0')
+ at /home/rodo/git/ooxml/sfx2/source/doc/sfxbasemodel.cxx:2591
+ #23 0x00002b0fcb0f124b in SfxBaseModel::storeAsURL (this=0xf96a00, rURL=@0x7fffe28516b0, rArgs=@0x7fffe2851ae0)
+ at /home/rodo/git/ooxml/sfx2/source/doc/sfxbasemodel.cxx:1568
+ #24 0x00002b0fcb101d3d in SfxStoringHelper::GUIStoreModel (this=0x7fffe28519f0, xModel=@0xf18798, aSlotName=@0x7fffe2852200, aArgsSequence=@0x7fffe2851ae0,
+ bPreselectPassword=0 '\0') at /home/rodo/git/ooxml/sfx2/source/doc/guisaveas.cxx:1529
+ #25 0x00002b0fcb0a4051 in SfxObjectShell::ExecFile_Impl (this=0xf44d60, rReq=@0x1484f20) at /home/rodo/git/ooxml/sfx2/source/doc/objserv.cxx:744
+ #26 0x00002b0fcb0a5c73 in SfxStubSfxObjectShellExecFile_Impl (pShell=0xf44d60, rReq=@0x1484f20) at ../../unxlngx6.pro/inc/sfxslots.hxx:161
+ #27 0x00002b0fcb17f398 in SfxShell::CallExec (this=0xf44d60, pFunc=0x2b0fcb0a5c56 <SfxStubSfxObjectShellExecFile_Impl(SfxShell*, SfxRequest&)>, rReq=@0x1484f20)
+ at ../../inc/sfx2/shell.hxx:226
+ #28 0x00002b0fcb17cec3 in SfxDispatcher::Call_Impl (this=0x110fde0, rShell=@0xf44d60, rSlot=@0x2b0fcb576368, rReq=@0x1484f20, bRecord=1 '\001')
+ at /home/rodo/git/ooxml/sfx2/source/control/dispatch.cxx:338
+ #29 0x00002b0fcb17d3f2 in SfxDispatcher::PostMsgHandler (this=0x110fde0, pReq=0x1484f20) at /home/rodo/git/ooxml/sfx2/source/control/dispatch.cxx:1643
+ #30 0x00002b0fcb17d51d in SfxDispatcher::LinkStubPostMsgHandler (pThis=0x110fde0, pCaller=0x1484f20) at /home/rodo/git/ooxml/sfx2/source/control/dispatch.cxx:1610
+ #31 0x00002b0fcafb3e70 in Link::Call (this=0x11488f8, pCaller=0x1484f20) at /home/rodo/git/ooxml/solver/300/unxlngx6.pro/inc/tools/link.hxx:158
+ #32 0x00002b0fcb1a9952 in GenLink::Call (this=0x11488f8, pCaller=0x1484f20) at ../../inc/sfx2/genlink.hxx:63
+ #33 0x00002b0fcb1a9773 in SfxHintPoster::Event (this=0x11488e0, pPostedHint=0x1484f20) at /home/rodo/git/ooxml/sfx2/source/notify/hintpost.cxx:98
+ #34 0x00002b0fcb1a9984 in SfxHintPoster::DoEvent_Impl (this=0x11488e0, pPostedHint=0x1484f20) at /home/rodo/git/ooxml/sfx2/source/notify/hintpost.cxx:88
+ #35 0x00002b0fcb1a974f in SfxHintPoster::LinkStubDoEvent_Impl (pThis=0x11488e0, pCaller=0x1484f20) at /home/rodo/git/ooxml/sfx2/source/notify/hintpost.cxx:92
+ #36 0x00002b0fccef69f8 in ImplWindowFrameProc () from /opt/openoffice.org3.0/program/../basis-link/program/libvcllx.so
+ #37 0x00002b0fd3f91f8f in SalDisplay::DispatchInternalEvent () from /opt/openoffice.org/basis3.0/program/libvclplug_genlx.so
+ #38 0x00002b0fd0fa4a84 in GtkXLib::userEventFn () from /opt/openoffice.org/basis3.0/program/libvclplug_gtklx.so
+ #39 0x00002b0fd3cb0204 in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0
+ #40 0x00002b0fd3cb34fd in ?? () from /usr/lib64/libglib-2.0.so.0
+ #41 0x00002b0fd3cb39ce in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
+ #42 0x00002b0fd0fa4fd9 in GtkXLib::Yield () from /opt/openoffice.org/basis3.0/program/libvclplug_gtklx.so
+ #43 0x00002b0fccd1859e in Application::Yield () from /opt/openoffice.org3.0/program/../basis-link/program/libvcllx.so
+ #44 0x00002b0fccd18677 in Application::Execute () from /opt/openoffice.org3.0/program/../basis-link/program/libvcllx.so
+ #45 0x00002b0fc86fd803 in ?? () from /opt/openoffice.org3.0/program/../basis-link/program/libsoffice.so
+ #46 0x00002b0fccd1da24 in ImplSVMain () from /opt/openoffice.org3.0/program/../basis-link/program/libvcllx.so
+ #47 0x00002b0fccd1db15 in SVMain () from /opt/openoffice.org3.0/program/../basis-link/program/libvcllx.so
+ #48 0x00002b0fc872fe6c in soffice_main () from /opt/openoffice.org3.0/program/../basis-link/program/libsoffice.so
+ #49 0x000000000040114b in main ()
diff --git a/writerfilter/source/ooxml/OOXMLFastTokenHandler.cxx b/writerfilter/source/ooxml/OOXMLFastTokenHandler.cxx
index 95f054dfd3e6..6d6692b671fc 100644
--- a/writerfilter/source/ooxml/OOXMLFastTokenHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastTokenHandler.cxx
@@ -29,6 +29,7 @@
************************************************************************/
#include <iostream>
+#include <string.h>
#include <ooxml/resourceids.hxx>
#include "OOXMLFastTokenHandler.hxx"
#include "gperffasttoken.hxx"
@@ -85,6 +86,15 @@ OOXMLFastTokenHandler::OOXMLFastTokenHandler
return sResult;
}
+css::uno::Sequence< ::sal_Int8 > SAL_CALL OOXMLFastTokenHandler::getUTF8Identifier(::sal_Int32 Token)
+ throw (css::uno::RuntimeException)
+{
+ if ( Token < 0 || Token >= OOXML_FAST_TOKENS_END )
+ return css::uno::Sequence< ::sal_Int8 >();
+
+ return css::uno::Sequence< ::sal_Int8 >(reinterpret_cast< const sal_Int8 *>(tokenmap::wordlist[Token].name), strlen(tokenmap::wordlist[Token].name));
+}
+
::sal_Int32 SAL_CALL OOXMLFastTokenHandler::getTokenFromUTF8
(const css::uno::Sequence< ::sal_Int8 > & Identifier) throw (css::uno::RuntimeException)
{
diff --git a/writerfilter/source/ooxml/OOXMLFastTokenHandler.hxx b/writerfilter/source/ooxml/OOXMLFastTokenHandler.hxx
index a67fea77cebf..bb534dd5d955 100644
--- a/writerfilter/source/ooxml/OOXMLFastTokenHandler.hxx
+++ b/writerfilter/source/ooxml/OOXMLFastTokenHandler.hxx
@@ -52,6 +52,7 @@ public:
// ::com::sun::star::xml::sax::XFastTokenHandler:
virtual ::sal_Int32 SAL_CALL getToken(const ::rtl::OUString & Identifier) throw (css::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getIdentifier(::sal_Int32 Token) throw (css::uno::RuntimeException);
+ virtual css::uno::Sequence< ::sal_Int8 > SAL_CALL getUTF8Identifier(::sal_Int32 Token) throw (css::uno::RuntimeException);
virtual ::sal_Int32 SAL_CALL getTokenFromUTF8(const css::uno::Sequence< ::sal_Int8 > & Identifier) throw (css::uno::RuntimeException);
private: