1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
20 #ifndef INCLUDED_WW8_RESOURCE_MODEL_IMPL_HXX
21 #define INCLUDED_WW8_RESOURCE_MODEL_IMPL_HXX
23 #include <doctok/WW8Document.hxx>
25 #include <resourcemodel/WW8ResourceModel.hxx>
26 #include "WW8StructBase.hxx"
28 #include <resourcemodel/OutputWithDepth.hxx>
32 namespace writerfilter
{
35 using namespace ::std
;
37 class WW8PropertiesReference
: public writerfilter::Reference
<Properties
>
39 WW8PropertySet::Pointer_t mpPropSet
;
43 WW8PropertiesReference(WW8PropertySet::Pointer_t pPropSet
)
48 virtual ~WW8PropertiesReference()
52 virtual void resolve(Properties
& rHandler
);
54 virtual string
getType() const;
57 class WW8TableReference
: public writerfilter::Reference
<Table
>
64 virtual ~WW8TableReference()
68 virtual void resolve(Table
& rHandler
);
70 virtual string
getType() const;
73 class WW8BinaryObjReference
: public writerfilter::Reference
<BinaryObj
>,
77 typedef boost::shared_ptr
<WW8BinaryObjReference
> Pointer_t
;
78 WW8BinaryObjReference(WW8Stream
& rStream
, sal_uInt32 nOffset
,
80 WW8BinaryObjReference(WW8StructBase
& rParent
, sal_uInt32 nOffset
,
82 WW8BinaryObjReference(WW8StructBase
* pParent
, sal_uInt32 nOffset
,
84 WW8BinaryObjReference(WW8StructBase
* pParent
);
86 WW8BinaryObjReference()
87 : WW8StructBase(WW8StructBase::Sequence())
91 ~WW8BinaryObjReference()
95 virtual writerfilter::Reference
<BinaryObj
>::Pointer_t
getBinary();
97 virtual void resolve(BinaryObj
& rHandler
);
99 virtual string
getType() const;
101 virtual WW8BinaryObjReference
* clone() { return new WW8BinaryObjReference(*this); }
104 class WW8Sprm
: public Sprm
106 WW8Property::Pointer_t mpProperty
;
107 WW8BinaryObjReference::Pointer_t mpBinary
;
110 WW8Sprm(WW8Property::Pointer_t pProperty
)
111 : mpProperty(pProperty
)
115 WW8Sprm(WW8BinaryObjReference::Pointer_t pBinary
)
124 WW8Sprm(const WW8Sprm
& rSprm
)
125 : Sprm(rSprm
), mpProperty(rSprm
.mpProperty
), mpBinary(rSprm
.mpBinary
)
133 virtual Value::Pointer_t
getValue();
134 virtual writerfilter::Reference
<BinaryObj
>::Pointer_t
getBinary();
135 virtual writerfilter::Reference
<Stream
>::Pointer_t
getStream();
136 virtual writerfilter::Reference
<Properties
>::Pointer_t
getProps();
137 virtual Kind
getKind();
139 virtual sal_uInt32
getId() const;
140 virtual string
toString() const;
141 virtual string
getName() const;
143 virtual WW8Sprm
* clone() const { return new WW8Sprm(*this); }
146 class WW8Value
: public Value
150 virtual ~WW8Value() {}
152 virtual string
toString() const;
153 virtual int getInt() const;
154 virtual OUString
getString() const;
155 virtual uno::Any
getAny() const;
156 virtual writerfilter::Reference
<Properties
>::Pointer_t
getProperties();
157 virtual writerfilter::Reference
<Stream
>::Pointer_t
getStream();
158 virtual writerfilter::Reference
<BinaryObj
>::Pointer_t
getBinary();
159 virtual WW8Value
* clone() const = 0;
162 class WW8IntValue
: public WW8Value
166 WW8IntValue(int value
) : mValue(value
) {}
167 virtual ~WW8IntValue() {}
169 virtual int getInt() const;
170 virtual OUString
getString() const;
171 virtual uno::Any
getAny() const;
173 virtual string
toString() const;
175 virtual WW8Value
* clone() const { return new WW8IntValue(*this); }
179 Creates value from an integer.
181 @param value integer to create value from.
183 WW8Value::Pointer_t
createValue(int value
);
185 ostream
& operator << (ostream
& o
, const WW8Value
& rValue
);
187 class WW8StringValue
: public WW8Value
192 WW8StringValue(OUString string_
) : mString(string_
) {}
193 virtual ~WW8StringValue() {}
195 virtual int getInt() const;
196 virtual OUString
getString() const;
197 virtual uno::Any
getAny() const;
199 virtual string
toString() const;
201 virtual WW8Value
* clone() const { return new WW8StringValue(*this); }
205 Creates value from a string.
207 @param rStr string to create value from.
209 WW8Value::Pointer_t
createValue(const OUString
& rStr
);
211 class WW8PropertiesValue
: public WW8Value
213 mutable writerfilter::Reference
<Properties
>::Pointer_t mRef
;
216 WW8PropertiesValue(writerfilter::Reference
<Properties
>::Pointer_t rRef
)
221 virtual ~WW8PropertiesValue()
225 virtual writerfilter::Reference
<Properties
>::Pointer_t
getProperties();
227 virtual string
toString() const;
229 virtual WW8Value
* clone() const { return new WW8PropertiesValue(mRef
); }
232 class WW8StreamValue
: public WW8Value
234 mutable writerfilter::Reference
<Stream
>::Pointer_t mRef
;
237 WW8StreamValue(writerfilter::Reference
<Stream
>::Pointer_t rRef
)
242 virtual ~WW8StreamValue()
246 virtual writerfilter::Reference
<Stream
>::Pointer_t
getStream();
248 virtual string
toString() const;
250 virtual WW8Value
* clone() const { return new WW8StreamValue(mRef
); }
254 Creates value from a properties reference.
256 @param rRef reference to create value from.
258 WW8Value::Pointer_t
createValue(writerfilter::Reference
<Properties
>::Pointer_t rRef
);
261 Creates value from another value.
263 @param value the value to copy
265 WW8Value::Pointer_t
createValue(WW8Value::Pointer_t value
);
268 Creates value from a stream reference.
270 @param rRef reference to the stream
272 WW8Value::Pointer_t
createValue(writerfilter::Reference
<Stream
>::Pointer_t rRef
);
274 class WW8BinaryObjValue
: public WW8Value
276 mutable writerfilter::Reference
<BinaryObj
>::Pointer_t mRef
;
279 WW8BinaryObjValue(writerfilter::Reference
<BinaryObj
>::Pointer_t rRef
)
284 virtual ~WW8BinaryObjValue()
288 virtual writerfilter::Reference
<BinaryObj
>::Pointer_t
getBinary();
290 virtual string
toString() const;
292 virtual WW8Value
* clone() const { return new WW8BinaryObjValue(mRef
); }
296 Creates value from a binary object reference.
298 @param rRef reference to the stream
300 WW8Value::Pointer_t
createValue(writerfilter::Reference
<BinaryObj
>::Pointer_t rRef
);
302 Sprm::Kind
SprmKind(sal_uInt32 sprmCode
);
306 #endif // INCLUDED_WW8_RESOURCE_MODEL_IMPL_HXX
308 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */