Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 :
3 : /*
4 : * This file is part of the LibreOffice project.
5 : *
6 : * This Source Code Form is subject to the terms of the Mozilla Public
7 : * License, v. 2.0. If a copy of the MPL was not distributed with this
8 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 : */
10 :
11 : #ifndef INCLUDED_FILTER_SOURCE_XSLTFILTER_OLEHANDLER_HXX
12 : #define INCLUDED_FILTER_SOURCE_XSLTFILTER_OLEHANDLER_HXX
13 : #include <cstdio>
14 : #include <cstring>
15 : #include <list>
16 : #include <map>
17 : #include <vector>
18 : #include <iostream>
19 : #include <libxml/parser.h>
20 : #include <libxml/tree.h>
21 : #include <libxml/xmlIO.h>
22 : #include <libxslt/transform.h>
23 : #include <libxslt/xsltutils.h>
24 : #include <libxslt/variables.h>
25 :
26 : #include <cppuhelper/factory.hxx>
27 : #include <cppuhelper/implbase4.hxx>
28 : #include <cppuhelper/implbase.hxx>
29 : #include <osl/module.h>
30 : #include <osl/file.hxx>
31 : #include <osl/process.h>
32 : #include <com/sun/star/lang/XComponent.hpp>
33 : #include <com/sun/star/lang/XInitialization.hpp>
34 : #include <com/sun/star/uno/Any.hxx>
35 : #include <com/sun/star/beans/NamedValue.hpp>
36 : #include <com/sun/star/container/XNameContainer.hpp>
37 : #include <com/sun/star/io/XInputStream.hpp>
38 : #include <com/sun/star/io/XOutputStream.hpp>
39 : #include <com/sun/star/io/XStream.hpp>
40 :
41 : using namespace ::com::sun::star::uno;
42 : using namespace ::com::sun::star::lang;
43 : using namespace ::com::sun::star::container;
44 : using namespace ::com::sun::star::io;
45 : using namespace ::rtl;
46 :
47 : namespace XSLT
48 : {
49 : /*
50 : * OleHandler provides implementations for the XSLT extension functions used by the WordML 2003 XSLT filters.
51 : *
52 : * The extension functions takes base64 encoded string representations of embedded OLE objects provided by the XML filter framework,
53 : * stores them into a com.sun.star.embed.OLESimpleStorage and retrieves them later as individual base64 OLE objects.
54 : *
55 : * The implementation is ported from the former Java based implementation XSLTOleExtrater (sic)
56 : *
57 : * I believe the whole thing should provide round-trip editing of embedded OLE objects.
58 : * I'm not sure if it currently does anything meaningful, because the Java implementation seems to be broken both in OOo and LibO.
59 : *
60 : */
61 0 : class OleHandler
62 : {
63 : public:
64 0 : OleHandler(const com::sun::star::uno::Reference<XComponentContext>& rxContext){
65 0 : m_xContext = rxContext;
66 0 : }
67 : void SAL_CALL
68 : insertByName(const OUString& streamName, const OString& content);
69 : const OString SAL_CALL
70 : getByName(const OUString& streamName);
71 :
72 : private:
73 : com::sun::star::uno::Reference<XComponentContext> m_xContext;
74 : com::sun::star::uno::Reference<XNameContainer> m_storage;
75 : com::sun::star::uno::Reference<XStream> m_rootStream;
76 : void SAL_CALL
77 : ensureCreateRootStorage();
78 : OString SAL_CALL
79 : encodeSubStorage(const OUString& streamName);
80 : void SAL_CALL
81 : insertSubStorage(const OUString& streamName, const OString& content);
82 : void SAL_CALL
83 : initRootStorageFromBase64(const OString& content);
84 : com::sun::star::uno::Reference<XStream> SAL_CALL
85 : createTempFile();
86 : };
87 : }
88 :
89 :
90 : #endif // INCLUDED_FILTER_SOURCE_XSLTFILTER_OLEHANDLER_HXX
|