Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 :
3 : /*
4 : * Version: MPL 1.1 / GPLv3+ / LGPLv3+
5 : *
6 : * The contents of this file are subject to the Mozilla Public License Version
7 : * 1.1 (the "License"); you may not use this file except in compliance with
8 : * the License. You may obtain a copy of the License at
9 : * http://www.mozilla.org/MPL/
10 : *
11 : * Software distributed under the License is distributed on an "AS IS" basis,
12 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 : * for the specific language governing rights and limitations under the
14 : * License.
15 : *
16 : * The Initial Developer of the Original Code is
17 : * [ Peter Jentsch <pjotr@guineapics.de> ]
18 : * Portions created by the Initial Developer are Copyright (C) 2011 the
19 : * Initial Developer. All Rights Reserved.
20 : *
21 : * Contributor(s): Peter Jentsch <pjotr@guineapics.de>
22 : *
23 : * Alternatively, the contents of this file may be used under the terms of
24 : * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
25 : * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
26 : * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
27 : * instead of those above.
28 : */
29 :
30 : #ifndef OLEHANDLER_HXX_
31 : #define OLEHANDLER_HXX_
32 : #include <cstdio>
33 : #include <cstring>
34 : #include <list>
35 : #include <map>
36 : #include <vector>
37 : #include <iostream>
38 : #include <libxml/parser.h>
39 : #include <libxml/tree.h>
40 : #include <libxml/xmlIO.h>
41 : #include <libxslt/transform.h>
42 : #include <libxslt/xsltutils.h>
43 : #include <libxslt/variables.h>
44 :
45 : #include <cppuhelper/factory.hxx>
46 : #include <cppuhelper/implbase4.hxx>
47 : #include <cppuhelper/implbase.hxx>
48 : #include <osl/module.h>
49 : #include <osl/file.hxx>
50 : #include <osl/process.h>
51 : #include <com/sun/star/lang/XComponent.hpp>
52 : #include <com/sun/star/lang/XInitialization.hpp>
53 : #include <com/sun/star/uno/Any.hxx>
54 : #include <com/sun/star/beans/NamedValue.hpp>
55 : #include <com/sun/star/container/XNameContainer.hpp>
56 : #include <com/sun/star/io/XInputStream.hpp>
57 : #include <com/sun/star/io/XOutputStream.hpp>
58 : #include <com/sun/star/io/XStream.hpp>
59 :
60 : using namespace ::com::sun::star::uno;
61 : using namespace ::com::sun::star::lang;
62 : using namespace ::com::sun::star::container;
63 : using namespace ::com::sun::star::io;
64 : using namespace ::rtl;
65 :
66 : namespace XSLT
67 : {
68 : /*
69 : * OleHandler provides implementations for the XSLT extension functions used by the WordML 2003 XSLT filters.
70 : *
71 : * The extension functions takes base64 encoded string representations of embedded OLE objects provided by the XML filter framework,
72 : * stores them into a com.sun.star.embed.OLESimpleStorage and retrieves them later as individual base64 OLE objects.
73 : *
74 : * The implementation is ported from the former Java based implementation XSLTOleExtrater (sic)
75 : *
76 : * I believe the whole thing should provide round-trip editing of embedded OLE objects.
77 : * I'm not sure if it currently does anything meaningful, because the Java implementation seems to be broken both in OOo and LibO.
78 : *
79 : */
80 0 : class OleHandler
81 : {
82 : public:
83 0 : OleHandler(const com::sun::star::uno::Reference<XMultiServiceFactory>& msf){
84 0 : m_msf =msf;
85 0 : }
86 : void SAL_CALL
87 : insertByName(const OUString& streamName, const OString& content);
88 : const OString SAL_CALL
89 : getByName(const OUString& streamName);
90 :
91 : private:
92 : com::sun::star::uno::Reference<XMultiServiceFactory> m_msf;
93 : com::sun::star::uno::Reference<XNameContainer> m_storage;
94 : com::sun::star::uno::Reference<XStream> m_rootStream;
95 : void SAL_CALL
96 : ensureCreateRootStorage();
97 : OString SAL_CALL
98 : encodeSubStorage(const OUString& streamName);
99 : void SAL_CALL
100 : insertSubStorage(const OUString& streamName, const OString& content);
101 : void SAL_CALL
102 : initRootStorageFromBase64(const OString& content);
103 : com::sun::star::uno::Reference<XStream> SAL_CALL
104 : createTempFile();
105 : };
106 : }
107 :
108 :
109 : #endif /* OLEHANDLER_HXX_ */
|