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 <com/sun/star/embed/XRelationshipAccess.hpp>
27 extern OUString customTarget
;
28 extern OUString embeddingsTarget
;
30 namespace writerfilter::ooxml
33 class OOXMLStreamImpl
: public OOXMLStream
37 css::uno::Reference
<css::uno::XComponentContext
> mxContext
;
38 css::uno::Reference
<css::io::XInputStream
> mxStorageStream
;
39 css::uno::Reference
<css::embed::XStorage
> mxStorage
;
40 css::uno::Reference
<css::embed::XRelationshipAccess
> mxRelationshipAccess
;
41 css::uno::Reference
<css::io::XStream
> mxDocumentStream
;
42 css::uno::Reference
<css::xml::sax::XFastParser
> mxFastParser
;
43 css::uno::Reference
<css::xml::sax::XFastTokenHandler
> mxFastTokenHandler
;
45 StreamType_t mnStreamType
;
51 /// Cache holding an Id <-> Target map of external relations.
52 std::map
<OUString
, OUString
> maIdCache
;
54 bool lcl_getTarget(const css::uno::Reference
<css::embed::XRelationshipAccess
>& xRelationshipAccess
,
55 StreamType_t nStreamType
,
57 OUString
& rDocumentTarget
);
59 typedef tools::SvRef
<OOXMLStreamImpl
> Pointer_t
;
62 (OOXMLStreamImpl
const & rStream
, StreamType_t nType
);
64 (css::uno::Reference
<css::uno::XComponentContext
> const & xContext
,
65 css::uno::Reference
<css::io::XInputStream
> const & xStorageStream
,
66 StreamType_t nType
, bool bRepairStorage
);
67 OOXMLStreamImpl(OOXMLStreamImpl
const & rStream
, const OUString
& rId
);
69 virtual ~OOXMLStreamImpl() override
;
71 virtual css::uno::Reference
<css::xml::sax::XFastParser
> getFastParser() override
;
72 virtual css::uno::Reference
<css::io::XInputStream
> getDocumentStream() override
;
73 virtual css::uno::Reference
<css::uno::XComponentContext
> getContext() override
;
74 virtual OUString
getTargetForId(const OUString
& rId
) override
;
75 virtual const OUString
& getTarget() const override
;
77 virtual css::uno::Reference
<css::xml::sax::XFastTokenHandler
> getFastTokenHandler() override
;
79 // Giving access to mxDocumentStream. It is needed by resolving custom xml to get list of customxml's used in document.
80 const css::uno::Reference
<css::io::XStream
>& accessDocumentStream() { return mxDocumentStream
;}
83 #endif // INCLUDED_WRITERFILTER_SOURCE_OOXML_OOXMLSTREAMIMPL_HXX
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */