LibreOffice Module writerfilter (master) 1
OOXMLStreamImpl.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19#pragma once
20
21#include <map>
22
24#include <com/sun/star/embed/XRelationshipAccess.hpp>
25
26extern OUString customTarget;
27extern OUString embeddingsTarget;
28
29namespace writerfilter::ooxml
30{
31
33{
34 void init();
35
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;
43
45
46 OUString msId;
47 OUString msPath;
48 OUString msTarget;
49
51 std::map<OUString, OUString> maIdCache;
52
53 bool lcl_getTarget(const css::uno::Reference<css::embed::XRelationshipAccess>& xRelationshipAccess,
54 StreamType_t nStreamType,
55 const OUString & rId,
56 OUString & rDocumentTarget);
57public:
59
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);
67
68 virtual ~OOXMLStreamImpl() override;
69
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;
75
76 virtual css::uno::Reference<css::xml::sax::XFastTokenHandler> getFastTokenHandler() override;
77
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;}
80};
81}
82
83/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OUString customTarget
OUString embeddingsTarget
tools::SvRef< OOXMLStreamImpl > Pointer_t
css::uno::Reference< css::embed::XRelationshipAccess > mxRelationshipAccess
bool lcl_getTarget(const css::uno::Reference< css::embed::XRelationshipAccess > &xRelationshipAccess, StreamType_t nStreamType, const OUString &rId, OUString &rDocumentTarget)
css::uno::Reference< css::io::XStream > mxDocumentStream
OOXMLStreamImpl(OOXMLStreamImpl const &rStream, StreamType_t nType)
OOXMLStreamImpl(css::uno::Reference< css::uno::XComponentContext > const &xContext, css::uno::Reference< css::io::XInputStream > xStorageStream, StreamType_t nType, bool bRepairStorage)
css::uno::Reference< css::xml::sax::XFastParser > mxFastParser
virtual css::uno::Reference< css::io::XInputStream > getDocumentStream() override
css::uno::Reference< css::io::XInputStream > mxStorageStream
virtual css::uno::Reference< css::uno::XComponentContext > getContext() override
Returns component context for this stream.
virtual const OUString & getTarget() const override
css::uno::Reference< css::xml::sax::XFastTokenHandler > mxFastTokenHandler
virtual css::uno::Reference< css::xml::sax::XFastParser > getFastParser() override
Returns fast parser for this stream.
std::map< OUString, OUString > maIdCache
Cache holding an Id <-> Target map of external relations.
css::uno::Reference< css::uno::XComponentContext > mxContext
const css::uno::Reference< css::io::XStream > & accessDocumentStream()
css::uno::Reference< css::embed::XStorage > mxStorage
virtual css::uno::Reference< css::xml::sax::XFastTokenHandler > getFastTokenHandler() override
virtual OUString getTargetForId(const OUString &rId) override
Returns target URL from relationships for a given id.