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 .
23 #include <ooxml/OOXMLDocument.hxx>
24 #include <com/sun/star/embed/XRelationshipAccess.hpp>
26 extern OUString customTarget
;
27 extern OUString embeddingsTarget
;
29 namespace writerfilter::ooxml
32 class OOXMLStreamImpl
: public OOXMLStream
36 css::uno::Reference
<css::uno::XComponentContext
> mxContext
;
37 css::uno::Reference
<css::io::XInputStream
> mxStorageStream
;
38 css::uno::Reference
<css::embed::XStorage
> mxStorage
;
39 css::uno::Reference
<css::embed::XRelationshipAccess
> mxRelationshipAccess
;
40 css::uno::Reference
<css::io::XStream
> mxDocumentStream
;
41 css::uno::Reference
<css::xml::sax::XFastParser
> mxFastParser
;
42 css::uno::Reference
<css::xml::sax::XFastTokenHandler
> mxFastTokenHandler
;
44 StreamType_t mnStreamType
;
50 /// Cache holding an Id <-> Target map of external relations.
51 std::map
<OUString
, OUString
> maIdCache
;
53 bool lcl_getTarget(const css::uno::Reference
<css::embed::XRelationshipAccess
>& xRelationshipAccess
,
54 StreamType_t nStreamType
,
56 OUString
& rDocumentTarget
);
58 typedef tools::SvRef
<OOXMLStreamImpl
> Pointer_t
;
61 (OOXMLStreamImpl
const & rStream
, StreamType_t nType
);
63 (css::uno::Reference
<css::uno::XComponentContext
> const & xContext
,
64 css::uno::Reference
<css::io::XInputStream
> xStorageStream
,
65 StreamType_t nType
, bool bRepairStorage
);
66 OOXMLStreamImpl(OOXMLStreamImpl
const & rStream
, OUString aId
);
68 virtual ~OOXMLStreamImpl() override
;
70 virtual css::uno::Reference
<css::xml::sax::XFastParser
> getFastParser() override
;
71 virtual css::uno::Reference
<css::io::XInputStream
> getDocumentStream() override
;
72 virtual css::uno::Reference
<css::uno::XComponentContext
> getContext() override
;
73 virtual OUString
getTargetForId(const OUString
& rId
) override
;
74 virtual const OUString
& getTarget() const override
;
76 virtual css::uno::Reference
<css::xml::sax::XFastTokenHandler
> getFastTokenHandler() override
;
78 // Giving access to mxDocumentStream. It is needed by resolving custom xml to get list of customxml's used in document.
79 const css::uno::Reference
<css::io::XStream
>& accessDocumentStream() { return mxDocumentStream
;}
83 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */