1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
11 #ifndef INCLUDED_FILTER_SOURCE_XSLTFILTER_OLEHANDLER_HXX
12 #define INCLUDED_FILTER_SOURCE_XSLTFILTER_OLEHANDLER_HXX
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
;
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.
59 OleHandler(const css::uno::Reference
<XComponentContext
>& rxContext
)
60 : m_xContext(rxContext
)
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
)
75 m_tcontext
->_private
= this;
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: */