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_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"
32 namespace writerfilter
{
36 class OOXMLDocumentImpl
: public OOXMLDocument
38 OOXMLStream::Pointer_t mpStream
;
39 css::uno::Reference
<css::task::XStatusIndicator
> mxStatusIndicator
;
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
;
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
;
66 OUString
const m_rBaseURL
;
67 css::uno::Sequence
<css::beans::PropertyValue
> const maMediaDescriptor
;
70 void resolveFastSubStream(Stream
& rStream
,
71 OOXMLStream::StreamType_t nType
);
73 static void resolveFastSubStreamWithId(Stream
& rStream
,
74 const writerfilter::Reference
<Stream
>::Pointer_t
& pStream
,
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
, const sal_Int32 nNoteId
);
87 void resolveCustomXmlStream(Stream
& rStream
);
88 void resolveGlossaryStream(Stream
& rStream
);
89 void resolveEmbeddingsStream(const OOXMLStream::Pointer_t
& pStream
);
91 OOXMLDocumentImpl(OOXMLStream::Pointer_t
const & pStream
, const css::uno::Reference
<css::task::XStatusIndicator
>& xStatusIndicator
, bool bSkipImages
, const css::uno::Sequence
<css::beans::PropertyValue
>& rDescriptor
);
92 virtual ~OOXMLDocumentImpl() override
;
94 virtual void resolve(Stream
& rStream
) override
;
96 virtual void resolveFootnote(Stream
& rStream
,
98 const sal_Int32 nNoteId
) override
;
99 virtual void resolveEndnote(Stream
& rStream
,
101 const sal_Int32 nNoteId
) override
;
102 virtual void resolveHeader(Stream
& rStream
,
103 const sal_Int32 type
,
104 const OUString
& rId
) override
;
105 virtual void resolveFooter(Stream
& rStream
,
106 const sal_Int32 type
,
107 const OUString
& rId
) override
;
109 virtual void resolveComment(Stream
& rStream
, const sal_Int32 nId
) override
;
111 OOXMLPropertySet
* getPicturePropSet(const OUString
& rId
);
112 virtual void resolvePicture(Stream
& rStream
, const OUString
& rId
) override
;
114 virtual OUString
getTargetForId(const OUString
& rId
) override
;
116 virtual void setModel(css::uno::Reference
<css::frame::XModel
> xModel
) override
;
117 virtual css::uno::Reference
<css::frame::XModel
> getModel() override
;
118 virtual void setDrawPage(css::uno::Reference
<css::drawing::XDrawPage
> xDrawPage
) override
;
119 virtual css::uno::Reference
<css::drawing::XDrawPage
> getDrawPage() override
;
120 virtual css::uno::Reference
<css::io::XInputStream
> getInputStreamForId(const OUString
& rId
) override
;
121 virtual void setXNoteId(const sal_Int32 nId
) override
;
122 virtual sal_Int32
getXNoteId() const override
;
123 virtual const OUString
& getTarget() const override
;
124 virtual css::uno::Reference
<css::xml::sax::XFastShapeContextHandler
> getShapeContext( ) override
;
125 virtual void setShapeContext( css::uno::Reference
<css::xml::sax::XFastShapeContextHandler
> xContext
) override
;
126 void pushShapeContext() override
;
127 void popShapeContext() override
;
128 virtual css::uno::Reference
<css::xml::dom::XDocument
> getThemeDom() override
;
129 virtual css::uno::Sequence
<css::uno::Reference
<css::xml::dom::XDocument
> > getCustomXmlDomList() override
;
130 virtual css::uno::Sequence
<css::uno::Reference
<css::xml::dom::XDocument
> > getCustomXmlDomPropsList() override
;
131 virtual css::uno::Reference
<css::xml::dom::XDocument
> getGlossaryDocDom() override
;
132 virtual css::uno::Sequence
<css::uno::Sequence
< css::uno::Any
> > getGlossaryDomList() override
;
133 virtual css::uno::Sequence
<css::beans::PropertyValue
> getEmbeddingsList() override
;
135 void incrementProgress();
136 bool IsSkipImages() const { return mbSkipImages
; };
137 OUString
const& GetDocumentBaseURL() const { return m_rBaseURL
; };
138 const css::uno::Sequence
<css::beans::PropertyValue
>& getMediaDescriptor() const;
141 #endif // OOXML_DOCUMENT_IMPL_HXX
143 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */