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: WW8ResourceModelImpl.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 ************************************************************************/
31 #ifndef INCLUDED_WW8_RESOURCE_MODEL_IMPL_HXX
32 #define INCLUDED_WW8_RESOURCE_MODEL_IMPL_HXX
34 #include <doctok/WW8Document.hxx>
36 #ifndef INCLUDED_WW8_RESOURCE_MODEL_HXX
37 #include <resourcemodel/WW8ResourceModel.hxx>
39 #include <WW8StructBase.hxx>
41 #ifndef INCLUDED_OUTPUT_WITH_DEPTH_HXX
42 #include <resourcemodel/OutputWithDepth.hxx>
47 namespace writerfilter
{
50 using namespace ::std
;
52 class WW8PropertiesReference
: public writerfilter::Reference
<Properties
>
54 WW8PropertySet::Pointer_t mpPropSet
;
58 WW8PropertiesReference(WW8PropertySet::Pointer_t pPropSet
)
63 ~WW8PropertiesReference()
67 virtual void resolve(Properties
& rHandler
);
69 virtual string
getType() const;
72 class WW8TableReference
: public writerfilter::Reference
<Table
>
83 virtual void resolve(Table
& rHandler
);
85 virtual string
getType() const;
88 class WW8BinaryObjReference
: public writerfilter::Reference
<BinaryObj
>,
92 typedef boost::shared_ptr
<WW8BinaryObjReference
> Pointer_t
;
93 WW8BinaryObjReference(WW8Stream
& rStream
, sal_uInt32 nOffset
,
95 WW8BinaryObjReference(WW8StructBase
& rParent
, sal_uInt32 nOffset
,
97 WW8BinaryObjReference(WW8StructBase
* pParent
, sal_uInt32 nOffset
,
99 WW8BinaryObjReference(WW8StructBase
* pParent
);
101 WW8BinaryObjReference()
102 : WW8StructBase(WW8StructBase::Sequence())
106 ~WW8BinaryObjReference()
110 virtual writerfilter::Reference
<BinaryObj
>::Pointer_t
getBinary();
112 virtual void resolve(BinaryObj
& rHandler
);
114 virtual string
getType() const;
116 virtual WW8BinaryObjReference
* clone() { return new WW8BinaryObjReference(*this); }
119 class WW8Sprm
: public Sprm
121 WW8Property::Pointer_t mpProperty
;
122 WW8BinaryObjReference::Pointer_t mpBinary
;
125 WW8Sprm(WW8Property::Pointer_t pProperty
)
126 : mpProperty(pProperty
)
130 WW8Sprm(WW8BinaryObjReference::Pointer_t pBinary
)
139 WW8Sprm(const WW8Sprm
& rSprm
)
140 : Sprm(rSprm
), mpProperty(rSprm
.mpProperty
), mpBinary(rSprm
.mpBinary
)
148 virtual Value::Pointer_t
getValue();
149 virtual writerfilter::Reference
<BinaryObj
>::Pointer_t
getBinary();
150 virtual writerfilter::Reference
<Stream
>::Pointer_t
getStream();
151 virtual writerfilter::Reference
<Properties
>::Pointer_t
getProps();
152 virtual Kind
getKind();
154 virtual sal_uInt32
getId() const;
155 virtual string
toString() const;
156 virtual string
getName() const;
158 virtual WW8Sprm
* clone() const { return new WW8Sprm(*this); }
161 class WW8Value
: public Value
165 virtual ~WW8Value() {}
167 virtual string
toString() const;
168 virtual int getInt() const;
169 virtual ::rtl::OUString
getString() const;
170 virtual uno::Any
getAny() const;
171 virtual writerfilter::Reference
<Properties
>::Pointer_t
getProperties();
172 virtual writerfilter::Reference
<Stream
>::Pointer_t
getStream();
173 virtual writerfilter::Reference
<BinaryObj
>::Pointer_t
getBinary();
174 virtual WW8Value
* clone() const = 0;
177 class WW8IntValue
: public WW8Value
181 WW8IntValue(int value
) : mValue(value
) {}
182 virtual ~WW8IntValue() {}
184 virtual int getInt() const;
185 virtual ::rtl::OUString
getString() const;
186 virtual uno::Any
getAny() const;
188 virtual string
toString() const;
190 virtual WW8Value
* clone() const { return new WW8IntValue(*this); }
194 Creates value from an integer.
196 @param value integer to create value from.
198 WW8Value::Pointer_t
createValue(int value
);
200 ostream
& operator << (ostream
& o
, const WW8Value
& rValue
);
202 class WW8StringValue
: public WW8Value
204 ::rtl::OUString mString
;
207 WW8StringValue(::rtl::OUString string_
) : mString(string_
) {}
208 virtual ~WW8StringValue() {}
210 virtual int getInt() const;
211 virtual ::rtl::OUString
getString() const;
212 virtual uno::Any
getAny() const;
214 virtual string
toString() const;
216 virtual WW8Value
* clone() const { return new WW8StringValue(*this); }
220 Creates value from a string.
222 @param rStr string to create value from.
224 WW8Value::Pointer_t
createValue(const rtl::OUString
& rStr
);
226 class WW8PropertiesValue
: public WW8Value
228 mutable writerfilter::Reference
<Properties
>::Pointer_t mRef
;
231 WW8PropertiesValue(writerfilter::Reference
<Properties
>::Pointer_t rRef
)
236 virtual ~WW8PropertiesValue()
240 virtual writerfilter::Reference
<Properties
>::Pointer_t
getProperties();
242 virtual string
toString() const;
244 virtual WW8Value
* clone() const { return new WW8PropertiesValue(mRef
); }
247 class WW8StreamValue
: public WW8Value
249 mutable writerfilter::Reference
<Stream
>::Pointer_t mRef
;
252 WW8StreamValue(writerfilter::Reference
<Stream
>::Pointer_t rRef
)
257 virtual ~WW8StreamValue()
261 virtual writerfilter::Reference
<Stream
>::Pointer_t
getStream();
263 virtual string
toString() const;
265 virtual WW8Value
* clone() const { return new WW8StreamValue(mRef
); }
269 Creates value from a properties reference.
271 @param rRef reference to create value from.
273 WW8Value::Pointer_t
createValue(writerfilter::Reference
<Properties
>::Pointer_t rRef
);
276 Creates value from another value.
278 @param value the value to copy
280 WW8Value::Pointer_t
createValue(WW8Value::Pointer_t value
);
283 Creates value from a stream reference.
285 @param rRef reference to the stream
287 WW8Value::Pointer_t
createValue(writerfilter::Reference
<Stream
>::Pointer_t rRef
);
289 class WW8BinaryObjValue
: public WW8Value
291 mutable writerfilter::Reference
<BinaryObj
>::Pointer_t mRef
;
294 WW8BinaryObjValue(writerfilter::Reference
<BinaryObj
>::Pointer_t rRef
)
299 virtual ~WW8BinaryObjValue()
303 virtual writerfilter::Reference
<BinaryObj
>::Pointer_t
getBinary();
305 virtual string
toString() const;
307 virtual WW8Value
* clone() const { return new WW8BinaryObjValue(mRef
); }
311 Creates value from a binary object reference.
313 @param rRef reference to the stream
315 WW8Value::Pointer_t
createValue(writerfilter::Reference
<BinaryObj
>::Pointer_t rRef
);
317 Sprm::Kind
SprmKind(sal_uInt32 sprmCode
);
321 #endif // INCLUDED_WW8_RESOURCE_MODEL_IMPL_HXX