nss: upgrade to release 3.73
[LibreOffice.git] / writerfilter / source / ooxml / OOXMLPropertySet.hxx
blob2df6fee85d9acb0c952eb2049bcc1921e7dfb2b4
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
19 #ifndef INCLUDED_WRITERFILTER_SOURCE_OOXML_OOXMLPROPERTYSET_HXX
20 #define INCLUDED_WRITERFILTER_SOURCE_OOXML_OOXMLPROPERTYSET_HXX
22 #include <vector>
23 #include "OOXMLBinaryObjectReference.hxx"
24 #include <com/sun/star/embed/XEmbeddedObject.hpp>
25 #include <dmapper/resourcemodel.hxx>
27 namespace writerfilter::ooxml
29 class OOXMLValue : public Value
31 public:
32 typedef tools::SvRef<OOXMLValue> Pointer_t;
33 OOXMLValue();
34 virtual ~OOXMLValue() override;
36 OOXMLValue(OOXMLValue const&) = default;
37 OOXMLValue(OOXMLValue&&) = default;
38 OOXMLValue& operator=(OOXMLValue const&) = default;
39 OOXMLValue& operator=(OOXMLValue&&) = default;
41 virtual int getInt() const override;
43 virtual OUString getString() const override;
44 virtual css::uno::Any getAny() const override;
45 virtual writerfilter::Reference<Properties>::Pointer_t getProperties() override;
46 virtual writerfilter::Reference<BinaryObj>::Pointer_t getBinary() override;
47 #ifdef DBG_UTIL
48 virtual std::string toString() const override;
49 #endif
50 virtual OOXMLValue* clone() const;
53 class OOXMLProperty : public Sprm
55 public:
56 typedef tools::SvRef<OOXMLProperty> Pointer_t;
57 enum Type_t
59 SPRM,
60 ATTRIBUTE
63 private:
64 Id mId;
65 mutable OOXMLValue::Pointer_t mpValue;
66 Type_t meType;
68 public:
69 OOXMLProperty(Id id, const OOXMLValue::Pointer_t& pValue, Type_t eType);
70 OOXMLProperty(const OOXMLProperty& rSprm) = delete;
71 virtual ~OOXMLProperty() override;
73 sal_uInt32 getId() const override;
74 Value::Pointer_t getValue() override;
75 writerfilter::Reference<Properties>::Pointer_t getProps() override;
76 #ifdef DBG_UTIL
77 std::string getName() const override;
78 std::string toString() const override;
79 #endif
80 void resolve(Properties& rProperties);
83 class OOXMLBinaryValue : public OOXMLValue
85 mutable OOXMLBinaryObjectReference::Pointer_t mpBinaryObj;
87 public:
88 explicit OOXMLBinaryValue(OOXMLBinaryObjectReference::Pointer_t const& pBinaryObj);
89 virtual ~OOXMLBinaryValue() override;
91 virtual writerfilter::Reference<BinaryObj>::Pointer_t getBinary() override;
92 #ifdef DBG_UTIL
93 virtual std::string toString() const override;
94 #endif
95 virtual OOXMLValue* clone() const override;
98 class OOXMLBooleanValue : public OOXMLValue
100 bool mbValue;
101 explicit OOXMLBooleanValue(bool bValue);
103 public:
104 static OOXMLValue::Pointer_t const& Create(bool bValue);
105 static OOXMLValue::Pointer_t const& Create(const char* pValue);
107 virtual ~OOXMLBooleanValue() override;
109 OOXMLBooleanValue(OOXMLBooleanValue const&) = default;
110 OOXMLBooleanValue(OOXMLBooleanValue&&) = default;
111 OOXMLBooleanValue& operator=(OOXMLBooleanValue const&) = delete; // due to const mbValue
112 OOXMLBooleanValue& operator=(OOXMLBooleanValue&&) = delete; // due to const mbValue
114 virtual int getInt() const override;
115 virtual css::uno::Any getAny() const override;
116 #ifdef DBG_UTIL
117 virtual std::string toString() const override;
118 #endif
119 virtual OOXMLValue* clone() const override;
122 class OOXMLStringValue : public OOXMLValue
124 OUString mStr;
126 public:
127 explicit OOXMLStringValue(const OUString& rStr);
128 virtual ~OOXMLStringValue() override;
130 OOXMLStringValue(OOXMLStringValue const&) = default;
131 OOXMLStringValue(OOXMLStringValue&&) = default;
132 OOXMLStringValue& operator=(OOXMLStringValue const&) = delete; // due to const mStr
133 OOXMLStringValue& operator=(OOXMLStringValue&&) = delete; // due to const mStr
135 virtual css::uno::Any getAny() const override;
136 virtual OUString getString() const override;
137 #ifdef DBG_UTIL
138 virtual std::string toString() const override;
139 #endif
140 virtual OOXMLValue* clone() const override;
143 class OOXMLInputStreamValue : public OOXMLValue
145 css::uno::Reference<css::io::XInputStream> mxInputStream;
147 public:
148 explicit OOXMLInputStreamValue(css::uno::Reference<css::io::XInputStream> const& xInputStream);
149 virtual ~OOXMLInputStreamValue() override;
151 virtual css::uno::Any getAny() const override;
152 #ifdef DBG_UTIL
153 virtual std::string toString() const override;
154 #endif
155 virtual OOXMLValue* clone() const override;
158 class OOXMLPropertySet : public writerfilter::Reference<Properties>
160 public:
161 typedef std::vector<OOXMLProperty::Pointer_t> OOXMLProperties_t;
162 typedef tools::SvRef<OOXMLPropertySet> Pointer_t;
164 private:
165 OOXMLProperties_t mProperties;
166 void add(const OOXMLProperty::Pointer_t& pProperty);
168 public:
169 OOXMLPropertySet();
170 virtual ~OOXMLPropertySet() override;
172 OOXMLPropertySet(OOXMLPropertySet const&) = default;
173 OOXMLPropertySet(OOXMLPropertySet&&) = default;
174 OOXMLPropertySet& operator=(OOXMLPropertySet const&) = default;
175 OOXMLPropertySet& operator=(OOXMLPropertySet&&) = default;
177 void resolve(Properties& rHandler) override;
178 void add(Id id, const OOXMLValue::Pointer_t& pValue, OOXMLProperty::Type_t eType);
179 void add(const OOXMLPropertySet::Pointer_t& pPropertySet);
180 OOXMLPropertySet* clone() const;
182 OOXMLProperties_t::iterator begin();
183 OOXMLProperties_t::iterator end();
184 OOXMLProperties_t::const_iterator begin() const;
185 OOXMLProperties_t::const_iterator end() const;
187 #ifdef DBG_UTIL
188 std::string toString();
189 #endif
192 class OOXMLValue;
194 class OOXMLTable : public writerfilter::Reference<Table>
196 public:
197 typedef tools::SvRef<OOXMLValue> ValuePointer_t;
198 OOXMLTable();
199 virtual ~OOXMLTable() override;
201 OOXMLTable(OOXMLTable const&) = default;
202 OOXMLTable(OOXMLTable&&) = default;
203 OOXMLTable& operator=(OOXMLTable const&) = default;
204 OOXMLTable& operator=(OOXMLTable&&) = default;
206 void resolve(Table& rTable) override;
207 void add(const ValuePointer_t& pPropertySet);
208 OOXMLTable* clone() const;
210 private:
211 typedef std::vector<ValuePointer_t> PropertySets_t;
212 PropertySets_t mPropertySets;
215 class OOXMLPropertySetValue : public OOXMLValue
217 OOXMLPropertySet::Pointer_t mpPropertySet;
219 public:
220 explicit OOXMLPropertySetValue(const OOXMLPropertySet::Pointer_t& pPropertySet);
221 virtual ~OOXMLPropertySetValue() override;
223 OOXMLPropertySetValue(OOXMLPropertySetValue const&) = default;
224 OOXMLPropertySetValue(OOXMLPropertySetValue&&) = default;
225 OOXMLPropertySetValue& operator=(OOXMLPropertySetValue const&)
226 = delete; // due to const mpPropertySet
227 OOXMLPropertySetValue& operator=(OOXMLPropertySetValue&&)
228 = delete; // due to const mpPropertySet
230 virtual writerfilter::Reference<Properties>::Pointer_t getProperties() override;
231 #ifdef DBG_UTIL
232 virtual std::string toString() const override;
233 #endif
234 virtual OOXMLValue* clone() const override;
237 class OOXMLIntegerValue : public OOXMLValue
239 sal_Int32 mnValue;
240 explicit OOXMLIntegerValue(sal_Int32 nValue);
242 public:
243 static OOXMLValue::Pointer_t Create(sal_Int32 nValue);
244 virtual ~OOXMLIntegerValue() override;
246 OOXMLIntegerValue(OOXMLIntegerValue const&) = default;
247 OOXMLIntegerValue(OOXMLIntegerValue&&) = default;
248 OOXMLIntegerValue& operator=(OOXMLIntegerValue const&) = delete; // due to const mnValue
249 OOXMLIntegerValue& operator=(OOXMLIntegerValue&&) = delete; // due to const mnValue
251 virtual int getInt() const override;
252 virtual css::uno::Any getAny() const override;
253 #ifdef DBG_UTIL
254 virtual std::string toString() const override;
255 #endif
256 virtual OOXMLValue* clone() const override;
259 class OOXMLHexValue : public OOXMLValue
261 protected:
262 sal_uInt32 mnValue;
264 public:
265 explicit OOXMLHexValue(sal_uInt32 nValue);
266 explicit OOXMLHexValue(const char* pValue);
267 virtual ~OOXMLHexValue() override;
269 OOXMLHexValue(OOXMLHexValue const&) = default;
270 OOXMLHexValue(OOXMLHexValue&&) = default;
271 OOXMLHexValue& operator=(OOXMLHexValue const&) = default;
272 OOXMLHexValue& operator=(OOXMLHexValue&&) = default;
274 virtual int getInt() const override;
275 #ifdef DBG_UTIL
276 virtual std::string toString() const override;
277 #endif
278 virtual OOXMLValue* clone() const override;
281 class OOXMLHexColorValue : public OOXMLHexValue
283 public:
284 explicit OOXMLHexColorValue(const char* pValue);
287 class OOXMLUniversalMeasureValue : public OOXMLValue
289 private:
290 int mnValue;
292 public:
293 OOXMLUniversalMeasureValue(const char* pValue, sal_uInt32 npPt);
294 virtual ~OOXMLUniversalMeasureValue() override;
296 OOXMLUniversalMeasureValue(OOXMLUniversalMeasureValue const&) = default;
297 OOXMLUniversalMeasureValue(OOXMLUniversalMeasureValue&&) = default;
298 OOXMLUniversalMeasureValue& operator=(OOXMLUniversalMeasureValue const&) = default;
299 OOXMLUniversalMeasureValue& operator=(OOXMLUniversalMeasureValue&&) = default;
301 virtual int getInt() const override;
302 #ifdef DBG_UTIL
303 virtual std::string toString() const override;
304 #endif
307 /// npPt is quotient defining how much units are in 1 pt
308 template <sal_uInt32 npPt> class OOXMLNthPtMeasureValue : public OOXMLUniversalMeasureValue
310 public:
311 explicit OOXMLNthPtMeasureValue(const char* pValue)
312 : OOXMLUniversalMeasureValue(pValue, npPt)
315 virtual OOXMLValue* clone() const override { return new OOXMLNthPtMeasureValue<npPt>(*this); }
318 /// Handles OOXML's ST_TwipsMeasure value.
319 typedef OOXMLNthPtMeasureValue<20> OOXMLTwipsMeasureValue;
321 /// Handles OOXML's ST_HpsMeasure value.
322 typedef OOXMLNthPtMeasureValue<2> OOXMLHpsMeasureValue;
324 class OOXMLMeasurementOrPercentValue : public OOXMLValue
326 int mnValue;
328 public:
329 explicit OOXMLMeasurementOrPercentValue(const char* pValue);
331 virtual int getInt() const override;
332 virtual OOXMLValue* clone() const override { return new OOXMLMeasurementOrPercentValue(*this); }
333 #ifdef DBG_UTIL
334 virtual std::string toString() const override;
335 #endif
338 class OOXMLShapeValue : public OOXMLValue
340 css::uno::Reference<css::drawing::XShape> mrShape;
342 public:
343 explicit OOXMLShapeValue(css::uno::Reference<css::drawing::XShape> const& rShape);
344 virtual ~OOXMLShapeValue() override;
346 virtual css::uno::Any getAny() const override;
347 #ifdef DBG_UTIL
348 virtual std::string toString() const override;
349 #endif
350 virtual OOXMLValue* clone() const override;
353 class OOXMLStarMathValue : public OOXMLValue
355 css::uno::Reference<css::embed::XEmbeddedObject> component;
357 public:
358 explicit OOXMLStarMathValue(css::uno::Reference<css::embed::XEmbeddedObject> const& component);
359 virtual ~OOXMLStarMathValue() override;
361 virtual css::uno::Any getAny() const override;
362 #ifdef DBG_UTIL
363 virtual std::string toString() const override;
364 #endif
365 virtual OOXMLValue* clone() const override;
368 class OOXMLPropertySetEntryToString : public Properties
370 Id mnId;
371 OUString mStr;
373 public:
374 explicit OOXMLPropertySetEntryToString(Id nId);
375 virtual ~OOXMLPropertySetEntryToString() override;
377 virtual void sprm(Sprm& rSprm) override;
378 virtual void attribute(Id nId, Value& rValue) override;
380 const OUString& getString() const { return mStr; }
383 class OOXMLPropertySetEntryToInteger : public Properties
385 Id mnId;
386 int mnValue;
388 public:
389 explicit OOXMLPropertySetEntryToInteger(Id nId);
390 virtual ~OOXMLPropertySetEntryToInteger() override;
392 virtual void sprm(Sprm& rSprm) override;
393 virtual void attribute(Id nId, Value& rValue) override;
395 int getValue() const { return mnValue; }
398 class OOXMLPropertySetEntryToBool : public Properties
400 Id mnId;
401 bool mValue;
403 public:
404 explicit OOXMLPropertySetEntryToBool(Id nId);
405 virtual ~OOXMLPropertySetEntryToBool() override;
407 virtual void sprm(Sprm& rSprm) override;
408 virtual void attribute(Id nId, Value& rValue) override;
410 bool getValue() const { return mValue; }
414 #endif // INCLUDED_WRITERFILTER_SOURCE_OOXML_OOXMLPROPERTYSET_HXX
416 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */