Branch data 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 : :
20 : : #ifndef INCLUDED_WW8_RESOURCE_MODEL_IMPL_HXX
21 : : #define INCLUDED_WW8_RESOURCE_MODEL_IMPL_HXX
22 : :
23 : : #include <doctok/WW8Document.hxx>
24 : :
25 : : #include <resourcemodel/WW8ResourceModel.hxx>
26 : : #include "WW8StructBase.hxx"
27 : :
28 : : #include <resourcemodel/OutputWithDepth.hxx>
29 : :
30 : : #include <map>
31 : :
32 : : namespace writerfilter {
33 : : namespace doctok
34 : : {
35 : : using namespace ::std;
36 : :
37 : : class WW8PropertiesReference : public writerfilter::Reference<Properties>
38 : : {
39 : : WW8PropertySet::Pointer_t mpPropSet;
40 : :
41 : : public:
42 : :
43 : 0 : WW8PropertiesReference(WW8PropertySet::Pointer_t pPropSet)
44 [ # # ]: 0 : : mpPropSet(pPropSet)
45 : : {
46 : 0 : }
47 : :
48 : 0 : virtual ~WW8PropertiesReference()
49 [ # # ]: 0 : {
50 [ # # ]: 0 : }
51 : :
52 : : virtual void resolve(Properties & rHandler);
53 : :
54 : : virtual string getType() const;
55 : : };
56 : :
57 : : class WW8TableReference : public writerfilter::Reference<Table>
58 : : {
59 : : public:
60 : : WW8TableReference()
61 : : {
62 : : }
63 : :
64 : 0 : virtual ~WW8TableReference()
65 : 0 : {
66 [ # # ]: 0 : }
67 : :
68 : : virtual void resolve(Table & rHandler);
69 : :
70 : : virtual string getType() const;
71 : : };
72 : :
73 [ # # ]: 0 : class WW8BinaryObjReference : public writerfilter::Reference<BinaryObj>,
74 : : public WW8StructBase
75 : : {
76 : : public:
77 : : typedef boost::shared_ptr<WW8BinaryObjReference> Pointer_t;
78 : : WW8BinaryObjReference(WW8Stream & rStream, sal_uInt32 nOffset,
79 : : sal_uInt32 nCount);
80 : : WW8BinaryObjReference(WW8StructBase & rParent, sal_uInt32 nOffset,
81 : : sal_uInt32 nCount);
82 : : WW8BinaryObjReference(WW8StructBase * pParent, sal_uInt32 nOffset,
83 : : sal_uInt32 nCount);
84 : : WW8BinaryObjReference(WW8StructBase * pParent);
85 : :
86 : : WW8BinaryObjReference()
87 : : : WW8StructBase(WW8StructBase::Sequence())
88 : : {
89 : : }
90 : :
91 : 0 : ~WW8BinaryObjReference()
92 [ # # ]: 0 : {
93 [ # # ]: 0 : }
94 : :
95 : : virtual writerfilter::Reference<BinaryObj>::Pointer_t getBinary();
96 : :
97 : : virtual void resolve(BinaryObj & rHandler);
98 : :
99 : : virtual string getType() const;
100 : :
101 [ # # ]: 0 : virtual WW8BinaryObjReference * clone() { return new WW8BinaryObjReference(*this); }
102 : : };
103 : :
104 : : class WW8Sprm : public Sprm
105 : : {
106 : : WW8Property::Pointer_t mpProperty;
107 : : WW8BinaryObjReference::Pointer_t mpBinary;
108 : :
109 : : public:
110 : 0 : WW8Sprm(WW8Property::Pointer_t pProperty)
111 [ # # ][ # # ]: 0 : : mpProperty(pProperty)
112 : : {
113 : 0 : }
114 : :
115 : 0 : WW8Sprm(WW8BinaryObjReference::Pointer_t pBinary)
116 [ # # ][ # # ]: 0 : : mpBinary(pBinary)
117 : : {
118 : 0 : }
119 : :
120 : : WW8Sprm()
121 : : {
122 : : }
123 : :
124 : 0 : WW8Sprm(const WW8Sprm & rSprm)
125 [ # # ][ # # ]: 0 : : Sprm(rSprm), mpProperty(rSprm.mpProperty), mpBinary(rSprm.mpBinary)
126 : : {
127 : 0 : }
128 : :
129 : 0 : virtual ~WW8Sprm()
130 [ # # ][ # # ]: 0 : {
131 [ # # ]: 0 : }
132 : :
133 : : virtual Value::Pointer_t getValue();
134 : : virtual writerfilter::Reference<BinaryObj>::Pointer_t getBinary();
135 : : virtual writerfilter::Reference<Stream>::Pointer_t getStream();
136 : : virtual writerfilter::Reference<Properties>::Pointer_t getProps();
137 : : virtual Kind getKind();
138 : :
139 : : virtual sal_uInt32 getId() const;
140 : : virtual string toString() const;
141 : : virtual string getName() const;
142 : :
143 [ # # ]: 0 : virtual WW8Sprm * clone() const { return new WW8Sprm(*this); }
144 : : };
145 : :
146 : 0 : class WW8Value : public Value
147 : : {
148 : : public:
149 : 0 : WW8Value() {}
150 [ # # ]: 0 : virtual ~WW8Value() {}
151 : :
152 : : virtual string toString() const;
153 : : virtual int getInt() const;
154 : : virtual OUString getString() const;
155 : : virtual uno::Any getAny() const;
156 : : virtual writerfilter::Reference<Properties>::Pointer_t getProperties();
157 : : virtual writerfilter::Reference<Stream>::Pointer_t getStream();
158 : : virtual writerfilter::Reference<BinaryObj>::Pointer_t getBinary();
159 : : virtual WW8Value * clone() const = 0;
160 : : };
161 : :
162 : 0 : class WW8IntValue : public WW8Value
163 : : {
164 : : int mValue;
165 : : public:
166 : 0 : WW8IntValue(int value) : mValue(value) {}
167 [ # # ]: 0 : virtual ~WW8IntValue() {}
168 : :
169 : : virtual int getInt() const;
170 : : virtual OUString getString() const;
171 : : virtual uno::Any getAny() const;
172 : :
173 : : virtual string toString() const;
174 : :
175 : 0 : virtual WW8Value * clone() const { return new WW8IntValue(*this); }
176 : : };
177 : :
178 : : /**
179 : : Creates value from an integer.
180 : :
181 : : @param value integer to create value from.
182 : : */
183 : : WW8Value::Pointer_t createValue(int value);
184 : :
185 : : ostream & operator << (ostream & o, const WW8Value & rValue);
186 : :
187 : 0 : class WW8StringValue : public WW8Value
188 : : {
189 : : OUString mString;
190 : :
191 : : public:
192 : 0 : WW8StringValue(OUString string_) : mString(string_) {}
193 [ # # ]: 0 : virtual ~WW8StringValue() {}
194 : :
195 : : virtual int getInt() const;
196 : : virtual OUString getString() const;
197 : : virtual uno::Any getAny() const;
198 : :
199 : : virtual string toString() const;
200 : :
201 : 0 : virtual WW8Value * clone() const { return new WW8StringValue(*this); }
202 : : };
203 : :
204 : : /**
205 : : Creates value from a string.
206 : :
207 : : @param rStr string to create value from.
208 : : */
209 : : WW8Value::Pointer_t createValue(const OUString & rStr);
210 : :
211 : : class WW8PropertiesValue : public WW8Value
212 : : {
213 : : mutable writerfilter::Reference<Properties>::Pointer_t mRef;
214 : :
215 : : public:
216 : 0 : WW8PropertiesValue(writerfilter::Reference<Properties>::Pointer_t rRef)
217 [ # # ]: 0 : : mRef(rRef)
218 : : {
219 : 0 : }
220 : :
221 : 0 : virtual ~WW8PropertiesValue()
222 [ # # ]: 0 : {
223 [ # # ]: 0 : }
224 : :
225 : : virtual writerfilter::Reference<Properties>::Pointer_t getProperties();
226 : :
227 : : virtual string toString() const;
228 : :
229 [ # # ][ # # ]: 0 : virtual WW8Value * clone() const { return new WW8PropertiesValue(mRef); }
230 : : };
231 : :
232 : : class WW8StreamValue : public WW8Value
233 : : {
234 : : mutable writerfilter::Reference<Stream>::Pointer_t mRef;
235 : :
236 : : public:
237 : 0 : WW8StreamValue(writerfilter::Reference<Stream>::Pointer_t rRef)
238 [ # # ]: 0 : : mRef(rRef)
239 : : {
240 : 0 : }
241 : :
242 : 0 : virtual ~WW8StreamValue()
243 [ # # ]: 0 : {
244 [ # # ]: 0 : }
245 : :
246 : : virtual writerfilter::Reference<Stream>::Pointer_t getStream();
247 : :
248 : : virtual string toString() const;
249 : :
250 [ # # ][ # # ]: 0 : virtual WW8Value * clone() const { return new WW8StreamValue(mRef); }
251 : : };
252 : :
253 : : /**
254 : : Creates value from a properties reference.
255 : :
256 : : @param rRef reference to create value from.
257 : : */
258 : : WW8Value::Pointer_t createValue(writerfilter::Reference<Properties>::Pointer_t rRef);
259 : :
260 : : /**
261 : : Creates value from another value.
262 : :
263 : : @param value the value to copy
264 : : */
265 : : WW8Value::Pointer_t createValue(WW8Value::Pointer_t value);
266 : :
267 : : /**
268 : : Creates value from a stream reference.
269 : :
270 : : @param rRef reference to the stream
271 : : */
272 : : WW8Value::Pointer_t createValue(writerfilter::Reference<Stream>::Pointer_t rRef);
273 : :
274 : : class WW8BinaryObjValue : public WW8Value
275 : : {
276 : : mutable writerfilter::Reference<BinaryObj>::Pointer_t mRef;
277 : :
278 : : public:
279 : 0 : WW8BinaryObjValue(writerfilter::Reference<BinaryObj>::Pointer_t rRef)
280 [ # # ]: 0 : : mRef(rRef)
281 : : {
282 : 0 : }
283 : :
284 : 0 : virtual ~WW8BinaryObjValue()
285 [ # # ]: 0 : {
286 [ # # ]: 0 : }
287 : :
288 : : virtual writerfilter::Reference<BinaryObj>::Pointer_t getBinary();
289 : :
290 : : virtual string toString() const;
291 : :
292 [ # # ][ # # ]: 0 : virtual WW8Value * clone() const { return new WW8BinaryObjValue(mRef); }
293 : : };
294 : :
295 : : /**
296 : : Creates value from a binary object reference.
297 : :
298 : : @param rRef reference to the stream
299 : : */
300 : : WW8Value::Pointer_t createValue(writerfilter::Reference<BinaryObj>::Pointer_t rRef);
301 : :
302 : : Sprm::Kind SprmKind(sal_uInt32 sprmCode);
303 : :
304 : : }}
305 : :
306 : : #endif // INCLUDED_WW8_RESOURCE_MODEL_IMPL_HXX
307 : :
308 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|