merge the formfield patch from ooo-build
[ooovba.git] / writerfilter / source / ooxml / OOXMLPropertySetImpl.hxx
blob3fb7929a4711d8c50dcfe7b2ec00a5d4c1b66977
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: OOXMLPropertySetImpl.hxx,v $
10 * $Revision: 1.23 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef INCLUDED_OOXML_PROPERTY_SET_IMPL_HXX
31 #define INCLUDED_OOXML_PROPERTY_SET_IMPL_HXX
33 #include <vector>
34 #include "OOXMLPropertySet.hxx"
35 #include "OOXMLBinaryObjectReference.hxx"
37 namespace com {
38 namespace sun {
39 namespace star {
40 namespace drawing {
41 class XShape;
42 }}}}
44 namespace writerfilter {
45 namespace ooxml
47 using namespace ::std;
48 using ::com::sun::star::drawing::XShape;
50 class OOXMLValue : public Value
52 public:
53 typedef boost::shared_ptr<OOXMLValue> Pointer_t;
54 OOXMLValue(const rtl::OUString & rValue);
55 OOXMLValue();
56 virtual ~OOXMLValue();
58 virtual int getInt() const;
59 virtual bool getBool() const;
60 virtual ::rtl::OUString getString() const;
61 virtual uno::Any getAny() const;
62 virtual writerfilter::Reference<Properties>::Pointer_t getProperties();
63 virtual writerfilter::Reference<Stream>::Pointer_t getStream();
64 virtual writerfilter::Reference<BinaryObj>::Pointer_t getBinary();
65 virtual string toString() const;
66 virtual OOXMLValue * clone() const;
69 class OOXMLPropertyImpl : public OOXMLProperty
71 public:
72 enum Type_t { SPRM, ATTRIBUTE };
73 private:
74 Id mId;
75 mutable OOXMLValue::Pointer_t mpValue;
76 Type_t meType;
78 public:
79 typedef boost::shared_ptr<OOXMLProperty> Pointer_t;
81 OOXMLPropertyImpl(Id id, OOXMLValue::Pointer_t pValue, Type_t eType);
82 OOXMLPropertyImpl(const OOXMLPropertyImpl & rSprm);
83 virtual ~OOXMLPropertyImpl();
85 virtual sal_uInt32 getId() const;
86 virtual Value::Pointer_t getValue();
87 virtual writerfilter::Reference<BinaryObj>::Pointer_t getBinary();
88 virtual writerfilter::Reference<Stream>::Pointer_t getStream();
89 virtual writerfilter::Reference<Properties>::Pointer_t getProps();
90 virtual string getName() const;
91 virtual Kind getKind();
92 virtual string toString() const;
93 virtual Sprm * clone();
94 virtual void resolve(Properties & rProperties);
97 class OOXMLBinaryValue : public OOXMLValue
99 protected:
100 mutable OOXMLBinaryObjectReference::Pointer_t mpBinaryObj;
101 public:
102 explicit OOXMLBinaryValue(OOXMLBinaryObjectReference::Pointer_t pBinaryObj);
103 virtual ~OOXMLBinaryValue();
105 virtual writerfilter::Reference<BinaryObj>::Pointer_t getBinary();
106 virtual string toString() const;
107 virtual OOXMLValue * clone() const;
110 class OOXMLBooleanValue : public OOXMLValue
112 protected:
113 bool mbValue;
114 public:
115 explicit OOXMLBooleanValue(bool bValue);
116 explicit OOXMLBooleanValue(const rtl::OUString & rValue);
117 virtual ~OOXMLBooleanValue();
119 virtual int getInt() const;
120 virtual bool getBool() const;
121 virtual uno::Any getAny() const;
122 virtual string toString() const;
123 virtual OOXMLValue * clone() const;
126 class OOXMLStringValue : public OOXMLValue
128 protected:
129 rtl::OUString mStr;
130 public:
131 explicit OOXMLStringValue(const rtl::OUString & rStr);
132 virtual ~OOXMLStringValue();
134 virtual uno::Any getAny() const;
135 virtual rtl::OUString getString() const;
136 virtual string toString() const;
137 virtual OOXMLValue * clone() const;
140 class OOXMLInputStreamValue : public OOXMLValue
142 protected:
143 uno::Reference<io::XInputStream> mxInputStream;
145 public:
146 explicit OOXMLInputStreamValue(uno::Reference<io::XInputStream> xInputStream);
147 virtual ~OOXMLInputStreamValue();
149 virtual uno::Any getAny() const;
150 virtual string toString() const;
151 virtual OOXMLValue * clone() const;
154 struct OOXMLPropertySetImplCompare
156 bool operator()(const OOXMLProperty::Pointer_t x,
157 const OOXMLProperty::Pointer_t y) const;
160 class OOXMLPropertySetImpl : public OOXMLPropertySet
162 public:
163 typedef vector<OOXMLProperty::Pointer_t> OOXMLProperties_t;
164 private:
165 OOXMLProperties_t mProperties;
166 string msType;
167 public:
168 OOXMLPropertySetImpl();
169 virtual ~OOXMLPropertySetImpl();
171 virtual void resolve(Properties & rHandler);
172 virtual string getType() const;
173 virtual void add(OOXMLProperty::Pointer_t pProperty);
174 virtual void add(OOXMLPropertySet::Pointer_t pPropertySet);
175 virtual OOXMLPropertySet * clone() const;
177 OOXMLProperties_t::iterator begin();
178 OOXMLProperties_t::iterator end();
179 OOXMLProperties_t::const_iterator begin() const;
180 OOXMLProperties_t::const_iterator end() const;
182 virtual void setType(const string & rsType);
184 virtual string toString();
187 class OOXMLPropertySetValue : public OOXMLValue
189 OOXMLPropertySet::Pointer_t mpPropertySet;
190 public:
191 OOXMLPropertySetValue(OOXMLPropertySet::Pointer_t pPropertySet);
192 virtual ~OOXMLPropertySetValue();
194 virtual writerfilter::Reference<Properties>::Pointer_t getProperties();
195 virtual string toString() const;
196 virtual OOXMLValue * clone() const;
199 class OOXMLIntegerValue : public OOXMLValue
201 protected:
202 sal_Int32 mnValue;
203 public:
204 explicit OOXMLIntegerValue(sal_Int32 nValue);
205 explicit OOXMLIntegerValue(const rtl::OUString & rValue);
206 virtual ~OOXMLIntegerValue();
208 virtual int getInt() const;
209 virtual uno::Any getAny() const;
210 virtual string toString() const;
211 virtual OOXMLValue * clone() const;
214 class OOXMLHexValue : public OOXMLValue
216 protected:
217 sal_uInt32 mnValue;
218 public:
219 explicit OOXMLHexValue(sal_uInt32 nValue);
220 explicit OOXMLHexValue(const rtl::OUString & rValue);
221 virtual ~OOXMLHexValue();
223 virtual int getInt() const;
224 virtual string toString() const;
225 virtual OOXMLValue * clone() const;
228 class OOXMLListValue : public OOXMLIntegerValue
230 public:
231 OOXMLListValue();
232 OOXMLListValue(sal_Int32 nValue);
233 virtual ~OOXMLListValue();
236 class OOXMLShapeValue : public OOXMLValue
238 protected:
239 uno::Reference<XShape> mrShape;
240 public:
241 explicit OOXMLShapeValue(uno::Reference<XShape> rShape);
242 virtual ~OOXMLShapeValue();
244 virtual uno::Any getAny() const;
245 virtual string toString() const;
246 virtual OOXMLValue * clone() const;
249 class OOXMLTableImpl : public OOXMLTable
251 public:
252 typedef boost::shared_ptr<OOXMLValue> ValuePointer_t;
253 private:
254 typedef vector<ValuePointer_t> PropertySets_t;
255 PropertySets_t mPropertySets;
257 public:
258 OOXMLTableImpl();
259 virtual ~OOXMLTableImpl();
261 virtual void resolve(Table & rTable);
262 virtual void add(ValuePointer_t pPropertySet);
263 virtual string getType() const;
264 virtual OOXMLTable * clone() const;
267 class OOXMLPropertySetEntryToString : public Properties
269 Id mnId;
270 ::rtl::OUString mStr;
272 public:
273 OOXMLPropertySetEntryToString(Id nId);
274 virtual ~OOXMLPropertySetEntryToString();
276 virtual void sprm(Sprm & rSprm);
277 virtual void attribute(Id nId, Value & rValue);
279 const ::rtl::OUString & getString() const;
282 class OOXMLPropertySetEntryToInteger : public Properties
284 Id mnId;
285 int mnValue;
286 public:
287 OOXMLPropertySetEntryToInteger(Id nId);
288 virtual ~OOXMLPropertySetEntryToInteger();
290 virtual void sprm(Sprm & rSprm);
291 virtual void attribute(Id nId, Value & rValue);
293 int getValue() const;
296 Sprm::Kind SprmKind(sal_uInt32 nSprmCode);
298 } // namespace ooxml
299 } // namespace writerfilter
301 #endif // INCLUDED_OOXML_PROPERTY_SET_IMPL_HXX