1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_WRITERFILTER_SOURCE_OOXML_OOXMLSTREAMIMPL_HXX
20 #define INCLUDED_WRITERFILTER_SOURCE_OOXML_OOXMLSTREAMIMPL_HXX
24 #include <ooxml/OOXMLDocument.hxx>
25 #include <comphelper/storagehelper.hxx>
26 #include <com/sun/star/embed/XRelationshipAccess.hpp>
27 #include <com/sun/star/io/XStream.hpp>
29 extern OUString customTarget
;
30 extern OUString embeddingsTarget
;
32 namespace writerfilter
{
36 class OOXMLStreamImpl
: public OOXMLStream
40 css::uno::Reference
<css::uno::XComponentContext
> mxContext
;
41 css::uno::Reference
<css::io::XInputStream
> mxStorageStream
;
42 css::uno::Reference
<css::embed::XStorage
> mxStorage
;
43 css::uno::Reference
<css::embed::XRelationshipAccess
> mxRelationshipAccess
;
44 css::uno::Reference
<css::io::XStream
> mxDocumentStream
;
45 css::uno::Reference
<css::xml::sax::XFastParser
> mxFastParser
;
46 css::uno::Reference
<css::xml::sax::XFastTokenHandler
> mxFastTokenHandler
;
48 StreamType_t mnStreamType
;
54 /// Cache holding an Id <-> Target map of external relations.
55 std::map
<OUString
, OUString
> maIdCache
;
57 bool lcl_getTarget(css::uno::Reference
<css::embed::XRelationshipAccess
>
59 StreamType_t nStreamType
,
61 OUString
& rDocumentTarget
);
63 typedef std::shared_ptr
<OOXMLStreamImpl
> Pointer_t
;
66 (OOXMLStreamImpl
& rStream
, StreamType_t nType
);
68 (css::uno::Reference
<css::uno::XComponentContext
> xContext
,
69 css::uno::Reference
<css::io::XInputStream
> xStorageStream
,
70 StreamType_t nType
, bool bRepairStorage
);
71 OOXMLStreamImpl(OOXMLStreamImpl
& rStream
, const OUString
& rId
);
73 virtual ~OOXMLStreamImpl();
75 virtual css::uno::Reference
<css::xml::sax::XParser
> getParser() SAL_OVERRIDE
;
76 virtual css::uno::Reference
<css::xml::sax::XFastParser
> getFastParser() SAL_OVERRIDE
;
77 virtual css::uno::Reference
<css::io::XInputStream
> getDocumentStream() SAL_OVERRIDE
;
78 virtual css::uno::Reference
<css::io::XInputStream
> getStorageStream() SAL_OVERRIDE
;
79 virtual css::uno::Reference
<css::uno::XComponentContext
> getContext() SAL_OVERRIDE
;
80 virtual OUString
getTargetForId(const OUString
& rId
) SAL_OVERRIDE
;
81 virtual const OUString
& getTarget() const SAL_OVERRIDE
;
83 virtual css::uno::Reference
<css::xml::sax::XFastTokenHandler
> getFastTokenHandler() SAL_OVERRIDE
;
85 void setInputStream(css::uno::Reference
<css::io::XInputStream
> rxInputStream
);
86 // Giving access to mxDocumentStream. It is needed by resolving custom xml to get list of customxml's used in document.
87 css::uno::Reference
<css::io::XStream
> accessDocumentStream() { return mxDocumentStream
;}
90 #endif // INCLUDED_WRITERFILTER_SOURCE_OOXML_OOXMLSTREAMIMPL_HXX
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */