nss: upgrade to release 3.73
[LibreOffice.git] / filter / source / xsltfilter / OleHandler.hxx
blob9c0c17ea030af112f4208d535aac2180a42b4103
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 /*
4 * This file is part of the LibreOffice project.
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 */
11 #ifndef INCLUDED_FILTER_SOURCE_XSLTFILTER_OLEHANDLER_HXX
12 #define INCLUDED_FILTER_SOURCE_XSLTFILTER_OLEHANDLER_HXX
13 #include <cstdio>
14 #include <cstring>
15 #include <map>
16 #include <vector>
17 #include <iostream>
18 #include <libxml/parser.h>
19 #include <libxml/tree.h>
20 #include <libxml/xmlIO.h>
21 #include <libxslt/transform.h>
22 #include <libxslt/xsltutils.h>
23 #include <libxslt/variables.h>
25 #include <cppuhelper/factory.hxx>
26 #include <osl/module.h>
27 #include <osl/file.hxx>
28 #include <osl/process.h>
29 #include <com/sun/star/lang/XComponent.hpp>
30 #include <com/sun/star/lang/XInitialization.hpp>
31 #include <com/sun/star/beans/NamedValue.hpp>
32 #include <com/sun/star/container/XNameContainer.hpp>
33 #include <com/sun/star/io/XInputStream.hpp>
34 #include <com/sun/star/io/XOutputStream.hpp>
35 #include <com/sun/star/io/XStream.hpp>
37 using namespace ::com::sun::star::uno;
38 using namespace ::com::sun::star::lang;
39 using namespace ::com::sun::star::container;
40 using namespace ::com::sun::star::io;
42 namespace XSLT
45 * OleHandler provides implementations for the XSLT extension functions used by the WordML 2003 XSLT filters.
47 * The extension functions takes base64 encoded string representations of embedded OLE objects provided by the XML filter framework,
48 * stores them into a com.sun.star.embed.OLESimpleStorage and retrieves them later as individual base64 OLE objects.
50 * The implementation is ported from the former Java based implementation XSLTOleExtrater (sic)
52 * I believe the whole thing should provide round-trip editing of embedded OLE objects.
53 * I'm not sure if it currently does anything meaningful, because the Java implementation seems to be broken both in OOo and LibO.
56 class OleHandler
58 public:
59 OleHandler(const css::uno::Reference<XComponentContext>& rxContext)
60 : m_xContext(rxContext)
61 , m_tcontext(nullptr)
64 ~OleHandler()
66 if (m_tcontext)
67 m_tcontext->_private = nullptr;
69 void insertByName(const OUString& streamName, const OString& content);
70 OString getByName(const OUString& streamName);
71 void registercontext(xsltTransformContextPtr context)
73 assert(context);
74 m_tcontext = context;
75 m_tcontext->_private = this;
78 private:
79 css::uno::Reference<XComponentContext> m_xContext;
80 css::uno::Reference<XNameContainer> m_storage;
81 css::uno::Reference<XStream> m_rootStream;
82 xsltTransformContextPtr m_tcontext;
84 void ensureCreateRootStorage();
85 OString encodeSubStorage(const OUString& streamName);
86 void insertSubStorage(const OUString& streamName, const OString& content);
87 void initRootStorageFromBase64(const OString& content);
88 css::uno::Reference<XStream> createTempFile();
92 #endif // INCLUDED_FILTER_SOURCE_XSLTFILTER_OLEHANDLER_HXX
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */