lok: vcl: fix multiple floatwin removal case more robustly.
[LibreOffice.git] / writerfilter / source / ooxml / OOXMLDocumentImpl.hxx
blob1ad317a204d309f7e5dd9c2694f79e72d4fb5980
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_OOXMLDOCUMENTIMPL_HXX
20 #define INCLUDED_WRITERFILTER_SOURCE_OOXML_OOXMLDOCUMENTIMPL_HXX
22 #include <ooxml/OOXMLDocument.hxx>
24 #include <com/sun/star/xml/sax/XFastTokenHandler.hpp>
25 #include <com/sun/star/xml/dom/XDocument.hpp>
27 #include "OOXMLPropertySet.hxx"
29 #include <vector>
30 #include <stack>
32 namespace writerfilter {
33 namespace ooxml
36 class OOXMLDocumentImpl : public OOXMLDocument
38 OOXMLStream::Pointer_t mpStream;
39 css::uno::Reference<css::task::XStatusIndicator> mxStatusIndicator;
40 sal_Int32 mnXNoteId;
42 css::uno::Reference<css::frame::XModel> mxModel;
43 css::uno::Reference<css::drawing::XDrawPage> mxDrawPage;
44 css::uno::Reference<css::xml::dom::XDocument> mxGlossaryDocDom;
45 css::uno::Sequence < css::uno::Sequence< css::uno::Any > > mxGlossaryDomList;
46 /// Stack of shape contexts, 1 element for VML, 1 element / nesting level for drawingML.
47 std::stack< css::uno::Reference<css::xml::sax::XFastShapeContextHandler> > maShapeContexts;
48 css::uno::Reference<css::xml::dom::XDocument> mxThemeDom;
49 css::uno::Sequence<css::uno::Reference<css::xml::dom::XDocument> > mxCustomXmlDomList;
50 css::uno::Sequence<css::uno::Reference<css::xml::dom::XDocument> > mxCustomXmlDomPropsList;
51 css::uno::Reference<css::xml::dom::XDocument> mxCustomXmlProsDom;
52 css::uno::Reference<css::io::XInputStream> mxEmbeddings;
53 css::uno::Sequence < css::beans::PropertyValue > mxEmbeddingsList;
54 std::vector<css::beans::PropertyValue> aEmbeddings;
55 bool mbIsSubstream;
56 bool const mbSkipImages;
57 /// How many paragraphs equal to 1 percent?
58 sal_Int32 mnPercentSize;
59 /// Position progress when it was last updated, possibly not after every paragraph in case of large documents.
60 sal_Int32 mnProgressLastPos;
61 /// Current position progress, updated after every paragraph.
62 sal_Int32 mnProgressCurrentPos;
63 /// End position, i.e. the estimated number of paragraphs.
64 sal_Int32 mnProgressEndPos;
65 /// DocumentBaseURL
66 OUString const m_rBaseURL;
67 css::uno::Sequence<css::beans::PropertyValue> const maMediaDescriptor;
69 private:
70 void resolveFastSubStream(Stream & rStream,
71 OOXMLStream::StreamType_t nType);
73 static void resolveFastSubStreamWithId(Stream & rStream,
74 const writerfilter::Reference<Stream>::Pointer_t& pStream,
75 sal_uInt32 nId);
77 css::uno::Reference<css::xml::dom::XDocument> importSubStream(OOXMLStream::StreamType_t nType);
79 void importSubStreamRelations(const OOXMLStream::Pointer_t& pStream, OOXMLStream::StreamType_t nType);
81 writerfilter::Reference<Stream>::Pointer_t
82 getSubStream(const OUString & rId);
84 writerfilter::Reference<Stream>::Pointer_t
85 getXNoteStream(OOXMLStream::StreamType_t nType,
86 Id aType,
87 const sal_Int32 nNoteId);
89 void resolveCustomXmlStream(Stream & rStream);
90 void resolveGlossaryStream(Stream & rStream);
91 void resolveEmbeddingsStream(const OOXMLStream::Pointer_t& pStream);
92 public:
93 OOXMLDocumentImpl(OOXMLStream::Pointer_t const & pStream, const css::uno::Reference<css::task::XStatusIndicator>& xStatusIndicator, bool bSkipImages, const css::uno::Sequence<css::beans::PropertyValue>& rDescriptor);
94 virtual ~OOXMLDocumentImpl() override;
96 virtual void resolve(Stream & rStream) override;
98 virtual void resolveFootnote(Stream & rStream,
99 Id aType,
100 const sal_Int32 nNoteId) override;
101 virtual void resolveEndnote(Stream & rStream,
102 Id aType,
103 const sal_Int32 nNoteId) override;
104 virtual void resolveHeader(Stream & rStream,
105 const sal_Int32 type,
106 const OUString & rId) override;
107 virtual void resolveFooter(Stream & rStream,
108 const sal_Int32 type,
109 const OUString & rId) override;
111 virtual void resolveComment(Stream & rStream, const sal_Int32 nId) override;
113 OOXMLPropertySet * getPicturePropSet(const OUString & rId);
114 virtual void resolvePicture(Stream & rStream, const OUString & rId) override;
116 virtual OUString getTargetForId(const OUString & rId) override;
118 virtual void setModel(css::uno::Reference<css::frame::XModel> xModel) override;
119 virtual css::uno::Reference<css::frame::XModel> getModel() override;
120 virtual void setDrawPage(css::uno::Reference<css::drawing::XDrawPage> xDrawPage) override;
121 virtual css::uno::Reference<css::drawing::XDrawPage> getDrawPage() override;
122 virtual css::uno::Reference<css::io::XInputStream> getInputStreamForId(const OUString & rId) override;
123 virtual void setXNoteId(const sal_Int32 nId) override;
124 virtual sal_Int32 getXNoteId() const override;
125 virtual void setXNoteType(Id aId) override;
126 virtual const OUString & getTarget() const override;
127 virtual css::uno::Reference<css::xml::sax::XFastShapeContextHandler> getShapeContext( ) override;
128 virtual void setShapeContext( css::uno::Reference<css::xml::sax::XFastShapeContextHandler> xContext ) override;
129 void pushShapeContext() override;
130 void popShapeContext() override;
131 virtual css::uno::Reference<css::xml::dom::XDocument> getThemeDom() override;
132 virtual css::uno::Sequence<css::uno::Reference<css::xml::dom::XDocument> > getCustomXmlDomList() override;
133 virtual css::uno::Sequence<css::uno::Reference<css::xml::dom::XDocument> > getCustomXmlDomPropsList() override;
134 virtual css::uno::Reference<css::xml::dom::XDocument> getGlossaryDocDom() override;
135 virtual css::uno::Sequence<css::uno::Sequence< css::uno::Any> > getGlossaryDomList() override;
136 virtual css::uno::Sequence<css::beans::PropertyValue > getEmbeddingsList() override;
138 void incrementProgress();
139 bool IsSkipImages() { return mbSkipImages; };
140 OUString const& GetDocumentBaseURL() { return m_rBaseURL; };
141 const css::uno::Sequence<css::beans::PropertyValue>& getMediaDescriptor();
144 #endif // OOXML_DOCUMENT_IMPL_HXX
146 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */