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 <osl/module.h>
29 : #include <osl/file.hxx>
30 : #include <osl/process.h>
31 : #include <com/sun/star/lang/XComponent.hpp>
32 : #include <com/sun/star/lang/XInitialization.hpp>
33 : #include <com/sun/star/uno/Any.hxx>
34 : #include <com/sun/star/beans/NamedValue.hpp>
35 : #include <com/sun/star/container/XNameContainer.hpp>
36 : #include <com/sun/star/io/XInputStream.hpp>
37 : #include <com/sun/star/io/XOutputStream.hpp>
38 : #include <com/sun/star/io/XStream.hpp>
39 :
40 : using namespace ::com::sun::star::uno;
41 : using namespace ::com::sun::star::lang;
42 : using namespace ::com::sun::star::container;
43 : using namespace ::com::sun::star::io;
44 :
45 : namespace XSLT
46 : {
47 : /*
48 : * OleHandler provides implementations for the XSLT extension functions used by the WordML 2003 XSLT filters.
49 : *
50 : * The extension functions takes base64 encoded string representations of embedded OLE objects provided by the XML filter framework,
51 : * stores them into a com.sun.star.embed.OLESimpleStorage and retrieves them later as individual base64 OLE objects.
52 : *
53 : * The implementation is ported from the former Java based implementation XSLTOleExtrater (sic)
54 : *
55 : * I believe the whole thing should provide round-trip editing of embedded OLE objects.
56 : * I'm not sure if it currently does anything meaningful, because the Java implementation seems to be broken both in OOo and LibO.
57 : *
58 : */
59 4 : class OleHandler
60 : {
61 : public:
62 4 : OleHandler(const com::sun::star::uno::Reference<XComponentContext>& rxContext){
63 4 : m_xContext = rxContext;
64 4 : }
65 : void SAL_CALL
66 : insertByName(const OUString& streamName, const OString& content);
67 : const OString SAL_CALL
68 : getByName(const OUString& streamName);
69 :
70 : private:
71 : com::sun::star::uno::Reference<XComponentContext> m_xContext;
72 : com::sun::star::uno::Reference<XNameContainer> m_storage;
73 : com::sun::star::uno::Reference<XStream> m_rootStream;
74 : void SAL_CALL
75 : ensureCreateRootStorage();
76 : OString SAL_CALL
77 : encodeSubStorage(const OUString& streamName);
78 : void SAL_CALL
79 : insertSubStorage(const OUString& streamName, const OString& content);
80 : void SAL_CALL
81 : initRootStorageFromBase64(const OString& content);
82 : com::sun::star::uno::Reference<XStream> SAL_CALL
83 : createTempFile();
84 : };
85 : }
86 :
87 :
88 : #endif // INCLUDED_FILTER_SOURCE_XSLTFILTER_OLEHANDLER_HXX
|