1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: OOXMLPropertySetImpl.hxx,v $
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
34 #include "OOXMLPropertySet.hxx"
35 #include "OOXMLBinaryObjectReference.hxx"
44 namespace writerfilter
{
47 using namespace ::std
;
48 using ::com::sun::star::drawing::XShape
;
50 class OOXMLValue
: public Value
53 typedef boost::shared_ptr
<OOXMLValue
> Pointer_t
;
54 OOXMLValue(const rtl::OUString
& rValue
);
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
72 enum Type_t
{ SPRM
, ATTRIBUTE
};
75 mutable OOXMLValue::Pointer_t mpValue
;
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
100 mutable OOXMLBinaryObjectReference::Pointer_t mpBinaryObj
;
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
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
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
143 uno::Reference
<io::XInputStream
> mxInputStream
;
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
163 typedef vector
<OOXMLProperty::Pointer_t
> OOXMLProperties_t
;
165 OOXMLProperties_t mProperties
;
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
;
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
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
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
232 OOXMLListValue(sal_Int32 nValue
);
233 virtual ~OOXMLListValue();
236 class OOXMLShapeValue
: public OOXMLValue
239 uno::Reference
<XShape
> mrShape
;
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
252 typedef boost::shared_ptr
<OOXMLValue
> ValuePointer_t
;
254 typedef vector
<ValuePointer_t
> PropertySets_t
;
255 PropertySets_t mPropertySets
;
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
270 ::rtl::OUString mStr
;
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
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
);
299 } // namespace writerfilter
301 #endif // INCLUDED_OOXML_PROPERTY_SET_IMPL_HXX