1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef INCLUDED_OOXML_DOCUMENT_IMPL_HXX
24 #define INCLUDED_OOXML_DOCUMENT_IMPL_HXX
25 
26 #include <ooxml/OOXMLDocument.hxx>
27 
28 #ifndef _COM_SUN_STAR_XML_SAX_XFAST_TOKEN_HANDLER_HPP_
29 #include <com/sun/star/xml/sax/XFastTokenHandler.hpp>
30 #endif
31 
32 #include "OOXMLPropertySet.hxx"
33 
34 namespace writerfilter {
35 namespace ooxml
36 {
37 
38 using namespace ::com::sun::star;
39 
40 class OOXMLDocumentImpl : public OOXMLDocument
41 {
42     OOXMLStream::Pointer_t mpStream;
43     // ID for parsing certain item in a XNote stream
44     // used for footnotes, endnotes and comments streams
45     sal_Int32 mnIDForXNoteStream;
46 
47     uno::Reference<frame::XModel> mxModel;
48     uno::Reference<drawing::XDrawPage> mxDrawPage;
49 
50     const bool mbIsSubstream;
51 
52 protected:
53     virtual void resolveFastSubStream(
54         Stream & rStream,
55         OOXMLStream::StreamType_t nType);
56 
57     virtual void resolveFastSubStreamWithId(
58         Stream & rStream,
59         writerfilter::Reference<Stream>::Pointer_t pStream,
60         sal_uInt32 nId);
61 
62     writerfilter::Reference<Stream>::Pointer_t getSubStream(
63         const rtl::OUString & rId );
64 
65     writerfilter::Reference<Stream>::Pointer_t getXNoteStream(
66         OOXMLStream::StreamType_t nType,
67         const sal_Int32 nIDForXNoteStream );
68 
69 public:
70     explicit OOXMLDocumentImpl(
71         OOXMLStream::Pointer_t pStream );
72 
73     OOXMLDocumentImpl(
74         OOXMLStream::Pointer_t pStream,
75         uno::Reference<frame::XModel> xModel,
76         uno::Reference<drawing::XDrawPage> xDrawPage,
77         const bool bIsSubstream );
78 
79     OOXMLDocumentImpl(
80         OOXMLStream::Pointer_t pStream,
81         const sal_Int32 nIDForXNoteStream );
82 
83     virtual ~OOXMLDocumentImpl();
84 
85     virtual void resolve(Stream & rStream);
86 
87     virtual string getType() const;
88 
89     virtual void resolveFootnote(
90         Stream & rStream,
91         const Id & rType,
92         const sal_Int32 nIDForXNoteStream );
93     virtual void resolveEndnote(
94         Stream & rStream,
95         const Id & rType,
96         const sal_Int32 nIDForXNoteStream );
97     virtual void resolveComment(
98         Stream & rStream,
99         const sal_Int32 nIDForXNoteStream );
100 
101     virtual void resolveHeader(Stream & rStream,
102                                const sal_Int32 type,
103                                const rtl::OUString & rId);
104     virtual void resolveFooter(Stream & rStream,
105                                const sal_Int32 type,
106                                const rtl::OUString & rId);
107 
108     virtual OOXMLPropertySet * getPicturePropSet
109     (const ::rtl::OUString & rId);
110     virtual void resolvePicture(Stream & rStream, const rtl::OUString & rId);
111 
112     virtual ::rtl::OUString getTargetForId(const ::rtl::OUString & rId);
113 
114     virtual void setModel(uno::Reference<frame::XModel> xModel);
115     virtual uno::Reference<frame::XModel> getModel();
116     virtual void setDrawPage(uno::Reference<drawing::XDrawPage> xDrawPage);
117     virtual uno::Reference<drawing::XDrawPage> getDrawPage();
118     virtual uno::Reference<io::XInputStream> getInputStream();
119     virtual uno::Reference<io::XInputStream> getStorageStream();
120     virtual uno::Reference<io::XInputStream> getInputStreamForId(const rtl::OUString & rId);
121 
122     virtual void setIDForXNoteStream( const sal_Int32 nID );
123     virtual sal_Int32 getIDForXNoteStream() const;
124 
125     virtual const ::rtl::OUString & getTarget() const;
126 };
127 }}
128 #endif // OOXML_DOCUMENT_IMPL_HXX
129