Branch data 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/servicefactory.hxx>
47 : : #include <cppuhelper/implbase4.hxx>
48 : : #include <cppuhelper/implbase.hxx>
49 : : #include <osl/module.h>
50 : : #include <osl/file.hxx>
51 : : #include <osl/process.h>
52 : : #include <com/sun/star/lang/XComponent.hpp>
53 : : #include <com/sun/star/lang/XInitialization.hpp>
54 : : #include <com/sun/star/uno/Any.hxx>
55 : : #include <com/sun/star/beans/NamedValue.hpp>
56 : : #include <com/sun/star/container/XNameContainer.hpp>
57 : : #include <com/sun/star/io/XInputStream.hpp>
58 : : #include <com/sun/star/io/XOutputStream.hpp>
59 : : #include <com/sun/star/io/XStream.hpp>
60 : :
61 : : using namespace ::com::sun::star::uno;
62 : : using namespace ::com::sun::star::lang;
63 : : using namespace ::com::sun::star::container;
64 : : using namespace ::com::sun::star::io;
65 : : using namespace ::rtl;
66 : :
67 : : namespace XSLT
68 : : {
69 : : /*
70 : : * OleHandler provides implementations for the XSLT extension functions used by the WordML 2003 XSLT filters.
71 : : *
72 : : * The extension functions takes base64 encoded string representations of embedded OLE objects provided by the XML filter framework,
73 : : * stores them into a com.sun.star.embed.OLESimpleStorage and retrieves them later as individual base64 OLE objects.
74 : : *
75 : : * The implementation is ported from the former Java based implementation XSLTOleExtrater (sic)
76 : : *
77 : : * I believe the whole thing should provide round-trip editing of embedded OLE objects.
78 : : * I'm not sure if it currently does anything meaningful, because the Java implementation seems to be broken both in OOo and LibO.
79 : : *
80 : : */
81 : 0 : class OleHandler
82 : : {
83 : : public:
84 : 0 : OleHandler(const com::sun::star::uno::Reference<XMultiServiceFactory>& msf){
85 : 0 : m_msf =msf;
86 : 0 : }
87 : : void SAL_CALL
88 : : insertByName(const OUString& streamName, const OString& content);
89 : : const OString SAL_CALL
90 : : getByName(const OUString& streamName);
91 : :
92 : : private:
93 : : com::sun::star::uno::Reference<XMultiServiceFactory> m_msf;
94 : : com::sun::star::uno::Reference<XNameContainer> m_storage;
95 : : com::sun::star::uno::Reference<XStream> m_rootStream;
96 : : void SAL_CALL
97 : : ensureCreateRootStorage();
98 : : OString SAL_CALL
99 : : encodeSubStorage(const OUString& streamName);
100 : : void SAL_CALL
101 : : insertSubStorage(const OUString& streamName, const OString& content);
102 : : void SAL_CALL
103 : : initRootStorageFromBase64(const OString& content);
104 : : com::sun::star::uno::Reference<XStream> SAL_CALL
105 : : createTempFile();
106 : : };
107 : : }
108 : :
109 : :
110 : : #endif /* OLEHANDLER_HXX_ */
|