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_PROPERTY_SET_IMPL_HXX
20 : #define INCLUDED_OOXML_PROPERTY_SET_IMPL_HXX
21 :
22 : #include <vector>
23 : #include "OOXMLPropertySet.hxx"
24 : #include "OOXMLBinaryObjectReference.hxx"
25 : #include <com/sun/star/embed/XEmbeddedObject.hpp>
26 :
27 : namespace com {
28 : namespace sun {
29 : namespace star {
30 : namespace drawing {
31 : class XShape;
32 : }}}}
33 :
34 : namespace writerfilter {
35 : namespace ooxml
36 : {
37 : using namespace ::std;
38 : using ::com::sun::star::drawing::XShape;
39 :
40 105327 : class OOXMLValue : public Value
41 : {
42 : public:
43 : typedef boost::shared_ptr<OOXMLValue> Pointer_t;
44 : OOXMLValue();
45 : virtual ~OOXMLValue();
46 :
47 : virtual int getInt() const;
48 : virtual bool getBool() const;
49 : virtual OUString getString() const;
50 : virtual uno::Any getAny() const;
51 : virtual writerfilter::Reference<Properties>::Pointer_t getProperties();
52 : virtual writerfilter::Reference<Stream>::Pointer_t getStream();
53 : virtual writerfilter::Reference<BinaryObj>::Pointer_t getBinary();
54 : virtual string toString() const;
55 : virtual OOXMLValue * clone() const;
56 : };
57 :
58 : class OOXMLPropertyImpl : public OOXMLProperty
59 : {
60 : public:
61 : enum Type_t { SPRM, ATTRIBUTE };
62 : private:
63 : Id mId;
64 : mutable OOXMLValue::Pointer_t mpValue;
65 : Type_t meType;
66 :
67 : public:
68 : typedef boost::shared_ptr<OOXMLProperty> Pointer_t;
69 :
70 : OOXMLPropertyImpl(Id id, OOXMLValue::Pointer_t pValue, Type_t eType);
71 : OOXMLPropertyImpl(const OOXMLPropertyImpl & rSprm);
72 : virtual ~OOXMLPropertyImpl();
73 :
74 : virtual sal_uInt32 getId() const;
75 : virtual Value::Pointer_t getValue();
76 : virtual writerfilter::Reference<BinaryObj>::Pointer_t getBinary();
77 : virtual writerfilter::Reference<Stream>::Pointer_t getStream();
78 : virtual writerfilter::Reference<Properties>::Pointer_t getProps();
79 : virtual string getName() const;
80 : virtual Kind getKind();
81 : virtual string toString() const;
82 : virtual Sprm * clone();
83 : virtual void resolve(Properties & rProperties);
84 : };
85 :
86 : class OOXMLBinaryValue : public OOXMLValue
87 : {
88 : protected:
89 : mutable OOXMLBinaryObjectReference::Pointer_t mpBinaryObj;
90 : public:
91 : explicit OOXMLBinaryValue(OOXMLBinaryObjectReference::Pointer_t pBinaryObj);
92 : virtual ~OOXMLBinaryValue();
93 :
94 : virtual writerfilter::Reference<BinaryObj>::Pointer_t getBinary();
95 : virtual string toString() const;
96 : virtual OOXMLValue * clone() const;
97 : };
98 :
99 8831 : class OOXMLBooleanValue : public OOXMLValue
100 : {
101 : protected:
102 : bool mbValue;
103 : public:
104 : explicit OOXMLBooleanValue(bool bValue);
105 : explicit OOXMLBooleanValue(const OUString & rValue);
106 : virtual ~OOXMLBooleanValue();
107 :
108 : virtual int getInt() const;
109 : virtual bool getBool() const;
110 : virtual uno::Any getAny() const;
111 : virtual string toString() const;
112 : virtual OOXMLValue * clone() const;
113 : };
114 :
115 16999 : class OOXMLStringValue : public OOXMLValue
116 : {
117 : protected:
118 : OUString mStr;
119 : public:
120 : explicit OOXMLStringValue(const OUString & rStr);
121 : virtual ~OOXMLStringValue();
122 :
123 : virtual uno::Any getAny() const;
124 : virtual OUString getString() const;
125 : virtual string toString() const;
126 : virtual OOXMLValue * clone() const;
127 : };
128 :
129 : class OOXMLInputStreamValue : public OOXMLValue
130 : {
131 : protected:
132 : uno::Reference<io::XInputStream> mxInputStream;
133 :
134 : public:
135 : explicit OOXMLInputStreamValue(uno::Reference<io::XInputStream> xInputStream);
136 : virtual ~OOXMLInputStreamValue();
137 :
138 : virtual uno::Any getAny() const;
139 : virtual string toString() const;
140 : virtual OOXMLValue * clone() const;
141 : };
142 :
143 : struct OOXMLPropertySetImplCompare
144 : {
145 : bool operator()(const OOXMLProperty::Pointer_t x,
146 : const OOXMLProperty::Pointer_t y) const;
147 : };
148 :
149 23179 : class OOXMLPropertySetImpl : public OOXMLPropertySet
150 : {
151 : public:
152 : typedef vector<OOXMLProperty::Pointer_t> OOXMLProperties_t;
153 : private:
154 : OOXMLProperties_t mProperties;
155 : string msType;
156 : public:
157 : OOXMLPropertySetImpl();
158 : virtual ~OOXMLPropertySetImpl();
159 :
160 : virtual void resolve(Properties & rHandler);
161 : virtual string getType() const;
162 : virtual void add(OOXMLProperty::Pointer_t pProperty);
163 : virtual void add(OOXMLPropertySet::Pointer_t pPropertySet);
164 : virtual OOXMLPropertySet * clone() const;
165 :
166 : OOXMLProperties_t::iterator begin();
167 : OOXMLProperties_t::iterator end();
168 : OOXMLProperties_t::const_iterator begin() const;
169 : OOXMLProperties_t::const_iterator end() const;
170 :
171 : virtual void setType(const string & rsType);
172 :
173 : virtual string toString();
174 : };
175 :
176 36675 : class OOXMLPropertySetValue : public OOXMLValue
177 : {
178 : OOXMLPropertySet::Pointer_t mpPropertySet;
179 : public:
180 : OOXMLPropertySetValue(OOXMLPropertySet::Pointer_t pPropertySet);
181 : virtual ~OOXMLPropertySetValue();
182 :
183 : virtual writerfilter::Reference<Properties>::Pointer_t getProperties();
184 : virtual string toString() const;
185 : virtual OOXMLValue * clone() const;
186 : };
187 :
188 36979 : class OOXMLIntegerValue : public OOXMLValue
189 : {
190 : protected:
191 : sal_Int32 mnValue;
192 : public:
193 : explicit OOXMLIntegerValue(sal_Int32 nValue);
194 : explicit OOXMLIntegerValue(const OUString & rValue);
195 : virtual ~OOXMLIntegerValue();
196 :
197 : virtual int getInt() const;
198 : virtual uno::Any getAny() const;
199 : virtual string toString() const;
200 : virtual OOXMLValue * clone() const;
201 : };
202 :
203 5843 : class OOXMLHexValue : public OOXMLValue
204 : {
205 : protected:
206 : sal_uInt32 mnValue;
207 : public:
208 : explicit OOXMLHexValue(sal_uInt32 nValue);
209 : explicit OOXMLHexValue(const OUString & rValue);
210 : virtual ~OOXMLHexValue();
211 :
212 : virtual int getInt() const;
213 : virtual string toString() const;
214 : virtual OOXMLValue * clone() const;
215 : };
216 :
217 : class OOXMLShapeValue : public OOXMLValue
218 : {
219 : protected:
220 : uno::Reference<XShape> mrShape;
221 : public:
222 : explicit OOXMLShapeValue(uno::Reference<XShape> rShape);
223 : virtual ~OOXMLShapeValue();
224 :
225 : virtual uno::Any getAny() const;
226 : virtual string toString() const;
227 : virtual OOXMLValue * clone() const;
228 : };
229 :
230 : class OOXMLStarMathValue : public OOXMLValue
231 : {
232 : protected:
233 : uno::Reference< embed::XEmbeddedObject > component;
234 : public:
235 : explicit OOXMLStarMathValue( uno::Reference< embed::XEmbeddedObject > component );
236 : virtual ~OOXMLStarMathValue();
237 :
238 : virtual uno::Any getAny() const;
239 : virtual string toString() const;
240 : virtual OOXMLValue * clone() const;
241 : };
242 :
243 584 : class OOXMLTableImpl : public OOXMLTable
244 : {
245 : public:
246 : typedef boost::shared_ptr<OOXMLValue> ValuePointer_t;
247 : private:
248 : typedef vector<ValuePointer_t> PropertySets_t;
249 : PropertySets_t mPropertySets;
250 :
251 : public:
252 : OOXMLTableImpl();
253 : virtual ~OOXMLTableImpl();
254 :
255 : virtual void resolve(Table & rTable);
256 : virtual void add(ValuePointer_t pPropertySet);
257 : virtual string getType() const;
258 : virtual OOXMLTable * clone() const;
259 : };
260 :
261 : class OOXMLPropertySetEntryToString : public Properties
262 : {
263 : Id mnId;
264 : OUString mStr;
265 :
266 : public:
267 : OOXMLPropertySetEntryToString(Id nId);
268 : virtual ~OOXMLPropertySetEntryToString();
269 :
270 : virtual void sprm(Sprm & rSprm);
271 : virtual void attribute(Id nId, Value & rValue);
272 :
273 : const OUString & getString() const;
274 : };
275 :
276 : class OOXMLPropertySetEntryToInteger : public Properties
277 : {
278 : Id mnId;
279 : int mnValue;
280 : public:
281 : OOXMLPropertySetEntryToInteger(Id nId);
282 : virtual ~OOXMLPropertySetEntryToInteger();
283 :
284 : virtual void sprm(Sprm & rSprm);
285 : virtual void attribute(Id nId, Value & rValue);
286 :
287 : int getValue() const;
288 : };
289 :
290 : Sprm::Kind SprmKind(sal_uInt32 nSprmCode);
291 :
292 : } // namespace ooxml
293 : } // namespace writerfilter
294 :
295 : #endif // INCLUDED_OOXML_PROPERTY_SET_IMPL_HXX
296 :
297 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|