Bump version to 4.1-6
[LibreOffice.git] / writerfilter / source / ooxml / OOXMLPropertySetImpl.hxx
blob8ea8d85836deca9dc23a501b8c0e5d9037f54efe
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_OOXML_PROPERTY_SET_IMPL_HXX
20 #define INCLUDED_OOXML_PROPERTY_SET_IMPL_HXX
22 #include <vector>
23 #include "OOXMLPropertySet.hxx"
24 #include "OOXMLBinaryObjectReference.hxx"
25 #include <com/sun/star/embed/XEmbeddedObject.hpp>
27 namespace com {
28 namespace sun {
29 namespace star {
30 namespace drawing {
31 class XShape;
32 }}}}
34 namespace writerfilter {
35 namespace ooxml
37 using namespace ::std;
38 using ::com::sun::star::drawing::XShape;
40 class OOXMLValue : public Value
42 public:
43 typedef boost::shared_ptr<OOXMLValue> Pointer_t;
44 OOXMLValue();
45 virtual ~OOXMLValue();
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;
58 class OOXMLPropertyImpl : public OOXMLProperty
60 public:
61 enum Type_t { SPRM, ATTRIBUTE };
62 private:
63 Id mId;
64 mutable OOXMLValue::Pointer_t mpValue;
65 Type_t meType;
67 public:
68 typedef boost::shared_ptr<OOXMLProperty> Pointer_t;
70 OOXMLPropertyImpl(Id id, OOXMLValue::Pointer_t pValue, Type_t eType);
71 OOXMLPropertyImpl(const OOXMLPropertyImpl & rSprm);
72 virtual ~OOXMLPropertyImpl();
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);
86 class OOXMLBinaryValue : public OOXMLValue
88 protected:
89 mutable OOXMLBinaryObjectReference::Pointer_t mpBinaryObj;
90 public:
91 explicit OOXMLBinaryValue(OOXMLBinaryObjectReference::Pointer_t pBinaryObj);
92 virtual ~OOXMLBinaryValue();
94 virtual writerfilter::Reference<BinaryObj>::Pointer_t getBinary();
95 virtual string toString() const;
96 virtual OOXMLValue * clone() const;
99 class OOXMLBooleanValue : public OOXMLValue
101 protected:
102 bool mbValue;
103 public:
104 explicit OOXMLBooleanValue(bool bValue);
105 explicit OOXMLBooleanValue(const OUString & rValue);
106 virtual ~OOXMLBooleanValue();
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;
115 class OOXMLStringValue : public OOXMLValue
117 protected:
118 OUString mStr;
119 public:
120 explicit OOXMLStringValue(const OUString & rStr);
121 virtual ~OOXMLStringValue();
123 virtual uno::Any getAny() const;
124 virtual OUString getString() const;
125 virtual string toString() const;
126 virtual OOXMLValue * clone() const;
129 class OOXMLInputStreamValue : public OOXMLValue
131 protected:
132 uno::Reference<io::XInputStream> mxInputStream;
134 public:
135 explicit OOXMLInputStreamValue(uno::Reference<io::XInputStream> xInputStream);
136 virtual ~OOXMLInputStreamValue();
138 virtual uno::Any getAny() const;
139 virtual string toString() const;
140 virtual OOXMLValue * clone() const;
143 struct OOXMLPropertySetImplCompare
145 bool operator()(const OOXMLProperty::Pointer_t x,
146 const OOXMLProperty::Pointer_t y) const;
149 class OOXMLPropertySetImpl : public OOXMLPropertySet
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();
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;
166 OOXMLProperties_t::iterator begin();
167 OOXMLProperties_t::iterator end();
168 OOXMLProperties_t::const_iterator begin() const;
169 OOXMLProperties_t::const_iterator end() const;
171 virtual void setType(const string & rsType);
173 virtual string toString();
176 class OOXMLPropertySetValue : public OOXMLValue
178 OOXMLPropertySet::Pointer_t mpPropertySet;
179 public:
180 OOXMLPropertySetValue(OOXMLPropertySet::Pointer_t pPropertySet);
181 virtual ~OOXMLPropertySetValue();
183 virtual writerfilter::Reference<Properties>::Pointer_t getProperties();
184 virtual string toString() const;
185 virtual OOXMLValue * clone() const;
188 class OOXMLIntegerValue : public OOXMLValue
190 protected:
191 sal_Int32 mnValue;
192 public:
193 explicit OOXMLIntegerValue(sal_Int32 nValue);
194 explicit OOXMLIntegerValue(const OUString & rValue);
195 virtual ~OOXMLIntegerValue();
197 virtual int getInt() const;
198 virtual uno::Any getAny() const;
199 virtual string toString() const;
200 virtual OOXMLValue * clone() const;
203 class OOXMLHexValue : public OOXMLValue
205 protected:
206 sal_uInt32 mnValue;
207 public:
208 explicit OOXMLHexValue(sal_uInt32 nValue);
209 explicit OOXMLHexValue(const OUString & rValue);
210 virtual ~OOXMLHexValue();
212 virtual int getInt() const;
213 virtual string toString() const;
214 virtual OOXMLValue * clone() const;
217 class OOXMLShapeValue : public OOXMLValue
219 protected:
220 uno::Reference<XShape> mrShape;
221 public:
222 explicit OOXMLShapeValue(uno::Reference<XShape> rShape);
223 virtual ~OOXMLShapeValue();
225 virtual uno::Any getAny() const;
226 virtual string toString() const;
227 virtual OOXMLValue * clone() const;
230 class OOXMLStarMathValue : public OOXMLValue
232 protected:
233 uno::Reference< embed::XEmbeddedObject > component;
234 public:
235 explicit OOXMLStarMathValue( uno::Reference< embed::XEmbeddedObject > component );
236 virtual ~OOXMLStarMathValue();
238 virtual uno::Any getAny() const;
239 virtual string toString() const;
240 virtual OOXMLValue * clone() const;
243 class OOXMLTableImpl : public OOXMLTable
245 public:
246 typedef boost::shared_ptr<OOXMLValue> ValuePointer_t;
247 private:
248 typedef vector<ValuePointer_t> PropertySets_t;
249 PropertySets_t mPropertySets;
251 public:
252 OOXMLTableImpl();
253 virtual ~OOXMLTableImpl();
255 virtual void resolve(Table & rTable);
256 virtual void add(ValuePointer_t pPropertySet);
257 virtual string getType() const;
258 virtual OOXMLTable * clone() const;
261 class OOXMLPropertySetEntryToString : public Properties
263 Id mnId;
264 OUString mStr;
266 public:
267 OOXMLPropertySetEntryToString(Id nId);
268 virtual ~OOXMLPropertySetEntryToString();
270 virtual void sprm(Sprm & rSprm);
271 virtual void attribute(Id nId, Value & rValue);
273 const OUString & getString() const;
276 class OOXMLPropertySetEntryToInteger : public Properties
278 Id mnId;
279 int mnValue;
280 public:
281 OOXMLPropertySetEntryToInteger(Id nId);
282 virtual ~OOXMLPropertySetEntryToInteger();
284 virtual void sprm(Sprm & rSprm);
285 virtual void attribute(Id nId, Value & rValue);
287 int getValue() const;
290 Sprm::Kind SprmKind(sal_uInt32 nSprmCode);
292 } // namespace ooxml
293 } // namespace writerfilter
295 #endif // INCLUDED_OOXML_PROPERTY_SET_IMPL_HXX
297 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */