1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef INCLUDED_WW8_RESOURCE_MODEL_IMPL_HXX 25 #define INCLUDED_WW8_RESOURCE_MODEL_IMPL_HXX 26 27 #include <doctok/WW8Document.hxx> 28 29 #ifndef INCLUDED_WW8_RESOURCE_MODEL_HXX 30 #include <resourcemodel/WW8ResourceModel.hxx> 31 #endif 32 #include <WW8StructBase.hxx> 33 34 #ifndef INCLUDED_OUTPUT_WITH_DEPTH_HXX 35 #include <resourcemodel/OutputWithDepth.hxx> 36 #endif 37 38 #include <map> 39 40 namespace writerfilter { 41 namespace doctok 42 { 43 using namespace ::std; 44 45 class WW8PropertiesReference : public writerfilter::Reference<Properties> 46 { 47 WW8PropertySet::Pointer_t mpPropSet; 48 49 public: 50 WW8PropertiesReference(WW8PropertySet::Pointer_t pPropSet)51 WW8PropertiesReference(WW8PropertySet::Pointer_t pPropSet) 52 : mpPropSet(pPropSet) 53 { 54 } 55 ~WW8PropertiesReference()56 ~WW8PropertiesReference() 57 { 58 } 59 60 virtual void resolve(Properties & rHandler); 61 62 virtual string getType() const; 63 }; 64 65 class WW8TableReference : public writerfilter::Reference<Table> 66 { 67 public: WW8TableReference()68 WW8TableReference() 69 { 70 } 71 ~WW8TableReference()72 ~WW8TableReference() 73 { 74 } 75 76 virtual void resolve(Table & rHandler); 77 78 virtual string getType() const; 79 }; 80 81 class WW8BinaryObjReference : public writerfilter::Reference<BinaryObj>, 82 public WW8StructBase 83 { 84 public: 85 typedef boost::shared_ptr<WW8BinaryObjReference> Pointer_t; 86 WW8BinaryObjReference(WW8Stream & rStream, sal_uInt32 nOffset, 87 sal_uInt32 nCount); 88 WW8BinaryObjReference(WW8StructBase & rParent, sal_uInt32 nOffset, 89 sal_uInt32 nCount); 90 WW8BinaryObjReference(WW8StructBase * pParent, sal_uInt32 nOffset, 91 sal_uInt32 nCount); 92 WW8BinaryObjReference(WW8StructBase * pParent); 93 WW8BinaryObjReference()94 WW8BinaryObjReference() 95 : WW8StructBase(WW8StructBase::Sequence()) 96 { 97 } 98 ~WW8BinaryObjReference()99 ~WW8BinaryObjReference() 100 { 101 } 102 103 virtual writerfilter::Reference<BinaryObj>::Pointer_t getBinary(); 104 105 virtual void resolve(BinaryObj & rHandler); 106 107 virtual string getType() const; 108 clone()109 virtual WW8BinaryObjReference * clone() { return new WW8BinaryObjReference(*this); } 110 }; 111 112 class WW8Sprm : public Sprm 113 { 114 WW8Property::Pointer_t mpProperty; 115 WW8BinaryObjReference::Pointer_t mpBinary; 116 117 public: WW8Sprm(WW8Property::Pointer_t pProperty)118 WW8Sprm(WW8Property::Pointer_t pProperty) 119 : mpProperty(pProperty) 120 { 121 } 122 WW8Sprm(WW8BinaryObjReference::Pointer_t pBinary)123 WW8Sprm(WW8BinaryObjReference::Pointer_t pBinary) 124 : mpBinary(pBinary) 125 { 126 } 127 WW8Sprm()128 WW8Sprm() 129 { 130 } 131 WW8Sprm(const WW8Sprm & rSprm)132 WW8Sprm(const WW8Sprm & rSprm) 133 : Sprm(rSprm), mpProperty(rSprm.mpProperty), mpBinary(rSprm.mpBinary) 134 { 135 } 136 ~WW8Sprm()137 virtual ~WW8Sprm() 138 { 139 } 140 141 virtual Value::Pointer_t getValue(); 142 virtual writerfilter::Reference<BinaryObj>::Pointer_t getBinary(); 143 virtual writerfilter::Reference<Stream>::Pointer_t getStream(); 144 virtual writerfilter::Reference<Properties>::Pointer_t getProps(); 145 virtual Kind getKind(); 146 147 virtual sal_uInt32 getId() const; 148 virtual string toString() const; 149 virtual string getName() const; 150 clone() const151 virtual WW8Sprm * clone() const { return new WW8Sprm(*this); } 152 }; 153 154 class WW8Value : public Value 155 { 156 public: WW8Value()157 WW8Value() {} ~WW8Value()158 virtual ~WW8Value() {} 159 160 virtual string toString() const; 161 virtual sal_Int32 getInt() const; 162 virtual ::rtl::OUString getString() const; 163 virtual uno::Any getAny() const; 164 virtual writerfilter::Reference<Properties>::Pointer_t getProperties(); 165 virtual writerfilter::Reference<Stream>::Pointer_t getStream(); 166 virtual writerfilter::Reference<BinaryObj>::Pointer_t getBinary(); 167 virtual WW8Value * clone() const = 0; 168 }; 169 170 class WW8IntValue : public WW8Value 171 { 172 int mValue; 173 public: WW8IntValue(int value)174 WW8IntValue(int value) : mValue(value) {} ~WW8IntValue()175 virtual ~WW8IntValue() {} 176 177 virtual sal_Int32 getInt() const; 178 virtual ::rtl::OUString getString() const; 179 virtual uno::Any getAny() const; 180 181 virtual string toString() const; 182 clone() const183 virtual WW8Value * clone() const { return new WW8IntValue(*this); } 184 }; 185 186 /** 187 Creates value from an integer. 188 189 @param value integer to create value from. 190 */ 191 WW8Value::Pointer_t createValue(int value); 192 193 ostream & operator << (ostream & o, const WW8Value & rValue); 194 195 class WW8StringValue : public WW8Value 196 { 197 ::rtl::OUString mString; 198 199 public: WW8StringValue(::rtl::OUString string_)200 WW8StringValue(::rtl::OUString string_) : mString(string_) {} ~WW8StringValue()201 virtual ~WW8StringValue() {} 202 203 virtual sal_Int32 getInt() const; 204 virtual ::rtl::OUString getString() const; 205 virtual uno::Any getAny() const; 206 207 virtual string toString() const; 208 clone() const209 virtual WW8Value * clone() const { return new WW8StringValue(*this); } 210 }; 211 212 /** 213 Creates value from a string. 214 215 @param rStr string to create value from. 216 */ 217 WW8Value::Pointer_t createValue(const rtl::OUString & rStr); 218 219 class WW8PropertiesValue : public WW8Value 220 { 221 mutable writerfilter::Reference<Properties>::Pointer_t mRef; 222 223 public: WW8PropertiesValue(writerfilter::Reference<Properties>::Pointer_t rRef)224 WW8PropertiesValue(writerfilter::Reference<Properties>::Pointer_t rRef) 225 : mRef(rRef) 226 { 227 } 228 ~WW8PropertiesValue()229 virtual ~WW8PropertiesValue() 230 { 231 } 232 233 virtual writerfilter::Reference<Properties>::Pointer_t getProperties(); 234 235 virtual string toString() const; 236 clone() const237 virtual WW8Value * clone() const { return new WW8PropertiesValue(mRef); } 238 }; 239 240 class WW8StreamValue : public WW8Value 241 { 242 mutable writerfilter::Reference<Stream>::Pointer_t mRef; 243 244 public: WW8StreamValue(writerfilter::Reference<Stream>::Pointer_t rRef)245 WW8StreamValue(writerfilter::Reference<Stream>::Pointer_t rRef) 246 : mRef(rRef) 247 { 248 } 249 ~WW8StreamValue()250 virtual ~WW8StreamValue() 251 { 252 } 253 254 virtual writerfilter::Reference<Stream>::Pointer_t getStream(); 255 256 virtual string toString() const; 257 clone() const258 virtual WW8Value * clone() const { return new WW8StreamValue(mRef); } 259 }; 260 261 /** 262 Creates value from a properties reference. 263 264 @param rRef reference to create value from. 265 */ 266 WW8Value::Pointer_t createValue(writerfilter::Reference<Properties>::Pointer_t rRef); 267 268 /** 269 Creates value from another value. 270 271 @param value the value to copy 272 */ 273 WW8Value::Pointer_t createValue(WW8Value::Pointer_t value); 274 275 /** 276 Creates value from a stream reference. 277 278 @param rRef reference to the stream 279 */ 280 WW8Value::Pointer_t createValue(writerfilter::Reference<Stream>::Pointer_t rRef); 281 282 class WW8BinaryObjValue : public WW8Value 283 { 284 mutable writerfilter::Reference<BinaryObj>::Pointer_t mRef; 285 286 public: WW8BinaryObjValue(writerfilter::Reference<BinaryObj>::Pointer_t rRef)287 WW8BinaryObjValue(writerfilter::Reference<BinaryObj>::Pointer_t rRef) 288 : mRef(rRef) 289 { 290 } 291 ~WW8BinaryObjValue()292 virtual ~WW8BinaryObjValue() 293 { 294 } 295 296 virtual writerfilter::Reference<BinaryObj>::Pointer_t getBinary(); 297 298 virtual string toString() const; 299 clone() const300 virtual WW8Value * clone() const { return new WW8BinaryObjValue(mRef); } 301 }; 302 303 /** 304 Creates value from a binary object reference. 305 306 @param rRef reference to the stream 307 */ 308 WW8Value::Pointer_t createValue(writerfilter::Reference<BinaryObj>::Pointer_t rRef); 309 310 Sprm::Kind SprmKind(sal_uInt32 sprmCode); 311 312 }} 313 314 #endif // INCLUDED_WW8_RESOURCE_MODEL_IMPL_HXX 315