Line data Source code
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 : #ifndef INCLUDED_OOXML_DOCUMENT_IMPL_HXX
20 : #define INCLUDED_OOXML_DOCUMENT_IMPL_HXX
21 :
22 : #include <ooxml/OOXMLDocument.hxx>
23 :
24 : #include <com/sun/star/xml/sax/XFastTokenHandler.hpp>
25 : #include <com/sun/star/xml/dom/XDocument.hpp>
26 :
27 : #include "OOXMLPropertySet.hxx"
28 :
29 : #include <vector>
30 :
31 : namespace writerfilter {
32 : namespace ooxml
33 : {
34 :
35 : using namespace ::com::sun::star;
36 :
37 : class OOXMLDocumentImpl : public OOXMLDocument
38 : {
39 : OOXMLStream::Pointer_t mpStream;
40 : uno::Reference<task::XStatusIndicator> mxStatusIndicator;
41 : sal_Int32 mnXNoteId;
42 : Id mXNoteType;
43 :
44 : uno::Reference<frame::XModel> mxModel;
45 : uno::Reference<drawing::XDrawPage> mxDrawPage;
46 : uno::Reference<xml::dom::XDocument> mxGlossaryDocDom;
47 : uno::Sequence < uno::Sequence< uno::Any > > mxGlossaryDomList;
48 : uno::Reference<xml::sax::XFastShapeContextHandler> mxShapeContext;
49 : uno::Reference<xml::dom::XDocument> mxThemeDom;
50 : uno::Sequence<uno::Reference<xml::dom::XDocument> > mxCustomXmlDomList;
51 : uno::Sequence<uno::Reference<xml::dom::XDocument> > mxCustomXmlDomPropsList;
52 : uno::Reference<xml::dom::XDocument> mxCustomXmlProsDom;
53 : uno::Sequence<uno::Reference<xml::dom::XDocument> > mxActiveXDomList;
54 : uno::Sequence<uno::Reference<io::XInputStream> > mxActiveXBinList;
55 : uno::Reference<io::XInputStream> mxActiveXBin;
56 : uno::Reference<io::XInputStream> mxEmbeddings;
57 : uno::Sequence < beans::PropertyValue > mxEmbeddingsList;
58 : std::vector<beans::PropertyValue> mxEmbeddingsListTemp;
59 : bool mbIsSubstream;
60 : /// How many paragraphs equal to 1 percent?
61 : sal_Int32 mnPercentSize;
62 : /// Position progress when it was last updated, possibly not after every paragraph in case of large documents.
63 : sal_Int32 mnProgressLastPos;
64 : /// Current position progress, updated after every paragraph.
65 : sal_Int32 mnProgressCurrentPos;
66 : /// End position, i.e. the estimated number of paragraphs.
67 : sal_Int32 mnProgressEndPos;
68 :
69 : protected:
70 : virtual void resolveFastSubStream(Stream & rStream,
71 : OOXMLStream::StreamType_t nType);
72 :
73 : virtual void resolveFastSubStreamWithId(Stream & rStream,
74 : writerfilter::Reference<Stream>::Pointer_t pStream,
75 : sal_uInt32 nId);
76 :
77 : uno::Reference<xml::dom::XDocument> importSubStream(OOXMLStream::StreamType_t nType);
78 :
79 : void importSubStreamRelations(OOXMLStream::Pointer_t pStream, OOXMLStream::StreamType_t nType);
80 :
81 : writerfilter::Reference<Stream>::Pointer_t
82 : getSubStream(const OUString & rId);
83 :
84 : writerfilter::Reference<Stream>::Pointer_t
85 : getXNoteStream(OOXMLStream::StreamType_t nType,
86 : const Id & rType,
87 : const sal_Int32 nNoteId);
88 :
89 0 : void setIsSubstream( bool bSubstream ) { mbIsSubstream = bSubstream; };
90 : void resolveCustomXmlStream(Stream & rStream);
91 : void resolveActiveXStream(Stream & rStream);
92 : void resolveGlossaryStream(Stream & rStream);
93 : void resolveEmbeddingsStream(OOXMLStream::Pointer_t pStream);
94 : public:
95 : OOXMLDocumentImpl(OOXMLStream::Pointer_t pStream, const uno::Reference<task::XStatusIndicator>& xStatusIndicator);
96 : virtual ~OOXMLDocumentImpl();
97 :
98 : virtual void resolve(Stream & rStream) SAL_OVERRIDE;
99 :
100 : virtual string getType() const SAL_OVERRIDE;
101 :
102 : virtual void resolveFootnote(Stream & rStream,
103 : const Id & rType,
104 : const sal_Int32 nNoteId) SAL_OVERRIDE;
105 : virtual void resolveEndnote(Stream & rStream,
106 : const Id & rType,
107 : const sal_Int32 nNoteId) SAL_OVERRIDE;
108 : virtual void resolveHeader(Stream & rStream,
109 : const sal_Int32 type,
110 : const OUString & rId) SAL_OVERRIDE;
111 : virtual void resolveFooter(Stream & rStream,
112 : const sal_Int32 type,
113 : const OUString & rId) SAL_OVERRIDE;
114 :
115 : virtual void resolveComment(Stream & rStream, const sal_Int32 nId) SAL_OVERRIDE;
116 :
117 : virtual OOXMLPropertySet * getPicturePropSet
118 : (const OUString & rId);
119 : virtual void resolvePicture(Stream & rStream, const OUString & rId) SAL_OVERRIDE;
120 :
121 : virtual OUString getTargetForId(const OUString & rId) SAL_OVERRIDE;
122 :
123 : virtual void setModel(uno::Reference<frame::XModel> xModel) SAL_OVERRIDE;
124 : virtual uno::Reference<frame::XModel> getModel() SAL_OVERRIDE;
125 : virtual void setDrawPage(uno::Reference<drawing::XDrawPage> xDrawPage) SAL_OVERRIDE;
126 : virtual uno::Reference<drawing::XDrawPage> getDrawPage() SAL_OVERRIDE;
127 : virtual uno::Reference<io::XInputStream> getInputStream() SAL_OVERRIDE;
128 : virtual uno::Reference<io::XInputStream> getStorageStream() SAL_OVERRIDE;
129 : virtual uno::Reference<io::XInputStream> getInputStreamForId(const OUString & rId) SAL_OVERRIDE;
130 : virtual void setXNoteId(const sal_Int32 nId) SAL_OVERRIDE;
131 : virtual sal_Int32 getXNoteId() const SAL_OVERRIDE;
132 : virtual void setXNoteType(const Id & rId) SAL_OVERRIDE;
133 : virtual const Id & getXNoteType() const SAL_OVERRIDE;
134 : virtual const OUString & getTarget() const SAL_OVERRIDE;
135 : virtual uno::Reference<xml::sax::XFastShapeContextHandler> getShapeContext( ) SAL_OVERRIDE;
136 : virtual void setShapeContext( uno::Reference<xml::sax::XFastShapeContextHandler> xContext ) SAL_OVERRIDE;
137 : virtual void setThemeDom(uno::Reference<xml::dom::XDocument> xThemeDom) SAL_OVERRIDE;
138 : virtual uno::Reference<xml::dom::XDocument> getThemeDom() SAL_OVERRIDE;
139 : virtual uno::Sequence<uno::Reference<xml::dom::XDocument> > getCustomXmlDomList() SAL_OVERRIDE;
140 : virtual uno::Sequence<uno::Reference<xml::dom::XDocument> > getCustomXmlDomPropsList() SAL_OVERRIDE;
141 : virtual uno::Sequence<uno::Reference<xml::dom::XDocument> > getActiveXDomList() SAL_OVERRIDE;
142 : virtual uno::Sequence<uno::Reference<io::XInputStream> > getActiveXBinList() SAL_OVERRIDE;
143 : virtual uno::Reference<xml::dom::XDocument> getGlossaryDocDom() SAL_OVERRIDE;
144 : virtual uno::Sequence<uno::Sequence< uno::Any> > getGlossaryDomList() SAL_OVERRIDE;
145 : virtual uno::Sequence<beans::PropertyValue > getEmbeddingsList() SAL_OVERRIDE;
146 :
147 : void incrementProgress();
148 : };
149 : }}
150 : #endif // OOXML_DOCUMENT_IMPL_HXX
151 :
152 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|