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
{
34 class OOXMLStreamImpl
: public OOXMLStream
38 css::uno::Reference
<css::uno::XComponentContext
> mxContext
;
39 css::uno::Reference
<css::io::XInputStream
> mxStorageStream
;
40 css::uno::Reference
<css::embed::XStorage
> mxStorage
;
41 css::uno::Reference
<css::embed::XRelationshipAccess
> mxRelationshipAccess
;
42 css::uno::Reference
<css::io::XStream
> mxDocumentStream
;
43 css::uno::Reference
<css::xml::sax::XFastParser
> mxFastParser
;
44 css::uno::Reference
<css::xml::sax::XFastTokenHandler
> mxFastTokenHandler
;
46 StreamType_t
const mnStreamType
;
52 /// Cache holding an Id <-> Target map of external relations.
53 std::map
<OUString
, OUString
> maIdCache
;
55 bool lcl_getTarget(const css::uno::Reference
<css::embed::XRelationshipAccess
>& xRelationshipAccess
,
56 StreamType_t nStreamType
,
58 OUString
& rDocumentTarget
);
60 typedef tools::SvRef
<OOXMLStreamImpl
> Pointer_t
;
63 (OOXMLStreamImpl
const & rStream
, StreamType_t nType
);
65 (css::uno::Reference
<css::uno::XComponentContext
> const & xContext
,
66 css::uno::Reference
<css::io::XInputStream
> const & xStorageStream
,
67 StreamType_t nType
, bool bRepairStorage
);
68 OOXMLStreamImpl(OOXMLStreamImpl
const & rStream
, const OUString
& rId
);
70 virtual ~OOXMLStreamImpl() override
;
72 virtual css::uno::Reference
<css::xml::sax::XFastParser
> getFastParser() override
;
73 virtual css::uno::Reference
<css::io::XInputStream
> getDocumentStream() override
;
74 virtual css::uno::Reference
<css::uno::XComponentContext
> getContext() override
;
75 virtual OUString
getTargetForId(const OUString
& rId
) override
;
76 virtual const OUString
& getTarget() const override
;
78 virtual css::uno::Reference
<css::xml::sax::XFastTokenHandler
> getFastTokenHandler() override
;
80 // Giving access to mxDocumentStream. It is needed by resolving custom xml to get list of customxml's used in document.
81 const css::uno::Reference
<css::io::XStream
>& accessDocumentStream() { return mxDocumentStream
;}
84 #endif // INCLUDED_WRITERFILTER_SOURCE_OOXML_OOXMLSTREAMIMPL_HXX
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */