Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include "OOXMLPropertySetImpl.hxx"
21 : #include <stdio.h>
22 : #include <iostream>
23 : #include <resourcemodel/QNameToString.hxx>
24 : #include <com/sun/star/drawing/XShape.hpp>
25 : #include <ooxml/OOXMLFastTokens.hxx>
26 : #include "ooxmlLoggers.hxx"
27 : #include <ooxml/resourceids.hxx>
28 :
29 : namespace writerfilter {
30 : namespace ooxml
31 : {
32 : using namespace ::std;
33 :
34 0 : OOXMLProperty::~OOXMLProperty()
35 : {
36 0 : }
37 :
38 0 : OOXMLPropertySet::~OOXMLPropertySet()
39 : {
40 0 : }
41 :
42 0 : OOXMLTable::~OOXMLTable()
43 : {
44 0 : }
45 :
46 0 : OOXMLPropertyImpl::OOXMLPropertyImpl(Id id, OOXMLValue::Pointer_t pValue,
47 : OOXMLPropertyImpl::Type_t eType)
48 0 : : mId(id), mpValue(pValue), meType(eType)
49 : {
50 0 : }
51 :
52 0 : OOXMLPropertyImpl::OOXMLPropertyImpl(const OOXMLPropertyImpl & rSprm)
53 0 : : OOXMLProperty(), mId(rSprm.mId), mpValue(rSprm.mpValue), meType(rSprm.meType)
54 : {
55 0 : }
56 :
57 0 : OOXMLPropertyImpl::~OOXMLPropertyImpl()
58 : {
59 0 : }
60 :
61 0 : sal_uInt32 OOXMLPropertyImpl::getId() const
62 : {
63 0 : return mId;
64 : }
65 :
66 0 : Value::Pointer_t OOXMLPropertyImpl::getValue()
67 : {
68 0 : Value::Pointer_t pResult;
69 :
70 0 : if (mpValue.get() != NULL)
71 0 : pResult = Value::Pointer_t(mpValue->clone());
72 : else
73 0 : pResult = Value::Pointer_t(new OOXMLValue());
74 :
75 0 : return pResult;
76 : }
77 :
78 0 : writerfilter::Reference<BinaryObj>::Pointer_t OOXMLPropertyImpl::getBinary()
79 : {
80 0 : writerfilter::Reference<BinaryObj>::Pointer_t pResult;
81 :
82 0 : if (mpValue.get() != NULL)
83 0 : pResult = mpValue->getBinary();
84 :
85 0 : return pResult;
86 : }
87 :
88 0 : writerfilter::Reference<Stream>::Pointer_t OOXMLPropertyImpl::getStream()
89 : {
90 0 : writerfilter::Reference<Stream>::Pointer_t pResult;
91 :
92 0 : if (mpValue.get() != NULL)
93 0 : pResult = mpValue->getStream();
94 :
95 0 : return pResult;
96 : }
97 :
98 0 : writerfilter::Reference<Properties>::Pointer_t OOXMLPropertyImpl::getProps()
99 : {
100 0 : writerfilter::Reference<Properties>::Pointer_t pResult;
101 :
102 0 : if (mpValue.get() != NULL)
103 0 : pResult = mpValue->getProperties();
104 :
105 0 : return pResult;
106 : }
107 :
108 0 : string OOXMLPropertyImpl::getName() const
109 : {
110 0 : string sResult = (*QNameToString::Instance())(mId);
111 :
112 0 : if (sResult.length() == 0)
113 0 : sResult = fastTokenToId(mId);
114 :
115 0 : if (sResult.length() == 0)
116 : {
117 : static char sBuffer[256];
118 :
119 0 : snprintf(sBuffer, sizeof(sBuffer), "%" SAL_PRIxUINT32, mId);
120 0 : sResult = sBuffer;
121 : }
122 :
123 0 : return sResult;
124 : }
125 :
126 0 : string OOXMLPropertyImpl::toString() const
127 : {
128 0 : string sResult = "(";
129 :
130 0 : sResult += getName();
131 0 : sResult += ", ";
132 0 : if (mpValue.get() != NULL)
133 0 : sResult += mpValue->toString();
134 : else
135 0 : sResult +="(null)";
136 0 : sResult +=")";
137 :
138 0 : return sResult;
139 : }
140 :
141 0 : Sprm::Kind OOXMLPropertyImpl::getKind()
142 : {
143 0 : return SprmKind(getId());
144 : }
145 :
146 0 : Sprm * OOXMLPropertyImpl::clone()
147 : {
148 0 : return new OOXMLPropertyImpl(*this);
149 : }
150 :
151 0 : void OOXMLPropertyImpl::resolve(writerfilter::Properties & rProperties)
152 : {
153 0 : writerfilter::Properties * pProperties = NULL;
154 0 : pProperties = &rProperties;
155 :
156 0 : switch (meType)
157 : {
158 : case SPRM:
159 0 : if (mId != 0x0)
160 0 : pProperties->sprm(*this);
161 0 : break;
162 : case ATTRIBUTE:
163 0 : pProperties->attribute(mId, *getValue());
164 0 : break;
165 : }
166 0 : }
167 :
168 : /*
169 : class OOXMLValue
170 : */
171 :
172 0 : OOXMLValue::OOXMLValue()
173 : {
174 0 : }
175 :
176 0 : OOXMLValue::~OOXMLValue()
177 : {
178 0 : }
179 :
180 0 : bool OOXMLValue::getBool() const
181 : {
182 0 : return false;
183 : }
184 :
185 0 : int OOXMLValue::getInt() const
186 : {
187 0 : return 0;
188 : }
189 :
190 0 : OUString OOXMLValue::getString() const
191 : {
192 0 : return OUString();
193 : }
194 :
195 0 : uno::Any OOXMLValue::getAny() const
196 : {
197 0 : return uno::Any();
198 : }
199 :
200 0 : writerfilter::Reference<Properties>::Pointer_t OOXMLValue::getProperties()
201 : {
202 0 : return writerfilter::Reference<Properties>::Pointer_t();
203 : }
204 :
205 0 : writerfilter::Reference<Stream>::Pointer_t OOXMLValue::getStream()
206 : {
207 0 : return writerfilter::Reference<Stream>::Pointer_t();
208 : }
209 :
210 0 : writerfilter::Reference<BinaryObj>::Pointer_t OOXMLValue::getBinary()
211 : {
212 0 : return writerfilter::Reference<BinaryObj>::Pointer_t();
213 : }
214 :
215 0 : string OOXMLValue::toString() const
216 : {
217 0 : return "OOXMLValue";
218 : }
219 :
220 0 : OOXMLValue * OOXMLValue::clone() const
221 : {
222 0 : return new OOXMLValue(*this);
223 : }
224 :
225 : /*
226 : class OOXMLBinaryValue
227 : */
228 :
229 0 : OOXMLBinaryValue::OOXMLBinaryValue(OOXMLBinaryObjectReference::Pointer_t
230 : pBinaryObj)
231 0 : : mpBinaryObj(pBinaryObj)
232 : {
233 0 : }
234 :
235 0 : OOXMLBinaryValue::~OOXMLBinaryValue()
236 : {
237 0 : }
238 :
239 0 : writerfilter::Reference<BinaryObj>::Pointer_t OOXMLBinaryValue::getBinary()
240 : {
241 0 : return mpBinaryObj;
242 : }
243 :
244 0 : string OOXMLBinaryValue::toString() const
245 : {
246 0 : return "BinaryObj";
247 : }
248 :
249 0 : OOXMLValue * OOXMLBinaryValue::clone() const
250 : {
251 0 : return new OOXMLBinaryValue(mpBinaryObj);
252 : }
253 :
254 : /*
255 : class OOXMLBooleanValue
256 : */
257 :
258 0 : OOXMLBooleanValue::OOXMLBooleanValue(bool bValue)
259 0 : : mbValue(bValue)
260 : {
261 0 : }
262 :
263 0 : OOXMLBooleanValue::OOXMLBooleanValue(const OUString & rValue)
264 0 : : mbValue(false)
265 : {
266 0 : mbValue = (rValue == "true"
267 0 : || rValue == "True"
268 0 : || rValue == "1"
269 0 : || rValue == "on"
270 0 : || rValue == "On");
271 0 : }
272 :
273 0 : OOXMLBooleanValue::~OOXMLBooleanValue()
274 : {
275 0 : }
276 :
277 0 : bool OOXMLBooleanValue::getBool() const
278 : {
279 0 : return mbValue;
280 : }
281 :
282 0 : int OOXMLBooleanValue::getInt() const
283 : {
284 0 : return mbValue ? 1 : 0;
285 : }
286 :
287 0 : uno::Any OOXMLBooleanValue::getAny() const
288 : {
289 0 : uno::Any aResult(mbValue);
290 :
291 0 : return aResult;
292 : }
293 :
294 0 : string OOXMLBooleanValue::toString() const
295 : {
296 0 : return mbValue ? "true" : "false";
297 : }
298 :
299 0 : OOXMLValue * OOXMLBooleanValue::clone() const
300 : {
301 0 : return new OOXMLBooleanValue(*this);
302 : }
303 :
304 : /*
305 : class OOXMLStringValue
306 : */
307 :
308 0 : OOXMLStringValue::OOXMLStringValue(const OUString & rStr)
309 0 : : mStr(rStr)
310 : {
311 0 : }
312 :
313 0 : OOXMLStringValue::~OOXMLStringValue()
314 : {
315 0 : }
316 :
317 0 : uno::Any OOXMLStringValue::getAny() const
318 : {
319 0 : uno::Any aAny(mStr);
320 :
321 0 : return aAny;
322 : }
323 :
324 0 : OUString OOXMLStringValue::getString() const
325 : {
326 0 : return mStr;
327 : }
328 :
329 0 : string OOXMLStringValue::toString() const
330 : {
331 0 : return OUStringToOString(mStr, RTL_TEXTENCODING_ASCII_US).getStr();
332 : }
333 :
334 0 : OOXMLValue * OOXMLStringValue::clone() const
335 : {
336 0 : return new OOXMLStringValue(*this);
337 : }
338 :
339 : /*
340 : class OOXMLInputStreamValue
341 : */
342 0 : OOXMLInputStreamValue::OOXMLInputStreamValue(uno::Reference<io::XInputStream> xInputStream)
343 0 : : mxInputStream(xInputStream)
344 : {
345 0 : }
346 :
347 0 : OOXMLInputStreamValue::~OOXMLInputStreamValue()
348 : {
349 0 : }
350 :
351 0 : uno::Any OOXMLInputStreamValue::getAny() const
352 : {
353 0 : uno::Any aAny(mxInputStream);
354 :
355 0 : return aAny;
356 : }
357 :
358 0 : string OOXMLInputStreamValue::toString() const
359 : {
360 0 : return "InputStream";
361 : }
362 :
363 0 : OOXMLValue * OOXMLInputStreamValue::clone() const
364 : {
365 0 : return new OOXMLInputStreamValue(mxInputStream);
366 : }
367 :
368 : /*
369 : struct OOXMLPropertySetImplCompare
370 : */
371 :
372 0 : bool OOXMLPropertySetImplCompare::operator()(const OOXMLProperty::Pointer_t x,
373 : const OOXMLProperty::Pointer_t y) const
374 : {
375 0 : bool bResult = false;
376 :
377 0 : if (x.get() == NULL && y.get() != NULL)
378 0 : bResult = true;
379 0 : else if (x.get() != NULL && y.get() != NULL)
380 0 : bResult = x->getId() < y->getId();
381 :
382 0 : return bResult;
383 : }
384 :
385 : /**
386 : class OOXMLPropertySetImpl
387 : */
388 :
389 0 : OOXMLPropertySetImpl::OOXMLPropertySetImpl()
390 0 : : msType("OOXMLPropertySetImpl")
391 : {
392 0 : }
393 :
394 0 : OOXMLPropertySetImpl::~OOXMLPropertySetImpl()
395 : {
396 0 : }
397 :
398 0 : void OOXMLPropertySetImpl::resolve(Properties & rHandler)
399 : {
400 0 : size_t nIt = 0;
401 :
402 : // The pProp->resolve(rHandler) call below can cause elements to
403 : // be appended to mProperties. I don't think it can cause elements
404 : // to be deleted. But let's check with < here just to be safe that
405 : // the indexing below works.
406 0 : while (nIt < mProperties.size())
407 : {
408 0 : OOXMLProperty::Pointer_t pProp = mProperties[nIt];
409 :
410 0 : if (pProp.get() != NULL)
411 0 : pProp->resolve(rHandler);
412 : #ifdef DEBUG_RESOLVE
413 : else
414 : {
415 : debug_logger->startElement("error");
416 : debug_logger->chars(std::string("zero-property"));
417 : debug_logger->endElement();
418 : }
419 : #endif
420 :
421 0 : ++nIt;
422 0 : }
423 0 : }
424 :
425 0 : OOXMLPropertySetImpl::OOXMLProperties_t::iterator OOXMLPropertySetImpl::begin()
426 : {
427 0 : return mProperties.begin();
428 : }
429 :
430 0 : OOXMLPropertySetImpl::OOXMLProperties_t::iterator OOXMLPropertySetImpl::end()
431 : {
432 0 : return mProperties.end();
433 : }
434 :
435 : OOXMLPropertySetImpl::OOXMLProperties_t::const_iterator
436 0 : OOXMLPropertySetImpl::begin() const
437 : {
438 0 : return mProperties.begin();
439 : }
440 :
441 : OOXMLPropertySetImpl::OOXMLProperties_t::const_iterator
442 0 : OOXMLPropertySetImpl::end() const
443 : {
444 0 : return mProperties.end();
445 : }
446 :
447 0 : string OOXMLPropertySetImpl::getType() const
448 : {
449 0 : return msType;
450 : }
451 :
452 0 : void OOXMLPropertySetImpl::add(OOXMLProperty::Pointer_t pProperty)
453 : {
454 : #ifdef DEBUG_PROPERTY_SET
455 : debug_logger->startElement("propertyset.add");
456 : debug_logger->chars(pProperty->toString());
457 : #endif
458 :
459 0 : if (pProperty.get() != NULL && pProperty->getId() != 0x0)
460 : {
461 : /*
462 : HACK: Ugly hack. This retarded overdesigned writerfilter thing
463 : processes attributes in random order (as given by boost::unordered_map
464 : when iterating it), but StyleSheetTable::lcl_attribute() needs
465 : to know whether NS_ooxml::LN_CT_Style_type is STYLE_TYPE_TABLE first.
466 : And all this overdesigned machinery doesn't even give a reasonable
467 : way to find out if an attribute is there before encountering it
468 : in random order in lcl_attribute(), so just make sure here that
469 : the attribute comes first.
470 : */
471 0 : if( pProperty->getId() == NS_ooxml::LN_CT_Style_type )
472 0 : mProperties.insert( mProperties.begin(), pProperty );
473 : else
474 0 : mProperties.push_back(pProperty);
475 : }
476 : #ifdef DEBUG_PROPERTY_SET
477 : else
478 : {
479 : debug_logger->element("warning.property_not_added");
480 : }
481 :
482 : debug_logger->endElement("propertyset.add");
483 : #endif
484 0 : }
485 :
486 0 : void OOXMLPropertySetImpl::add(OOXMLPropertySet::Pointer_t pPropertySet)
487 : {
488 0 : if (pPropertySet.get() != NULL)
489 : {
490 : OOXMLPropertySetImpl * pSet =
491 0 : dynamic_cast<OOXMLPropertySetImpl *>(pPropertySet.get());
492 :
493 0 : if (pSet != NULL)
494 : {
495 0 : mProperties.resize(mProperties.size() + pSet->mProperties.size());
496 0 : for (OOXMLProperties_t::iterator aIt = pSet->mProperties.begin();
497 0 : aIt != pSet->mProperties.end(); ++aIt)
498 0 : add(*aIt);
499 : }
500 : }
501 0 : }
502 :
503 0 : OOXMLPropertySet * OOXMLPropertySetImpl::clone() const
504 : {
505 0 : return new OOXMLPropertySetImpl(*this);
506 : }
507 :
508 0 : void OOXMLPropertySetImpl::setType(const string & rsType)
509 : {
510 0 : msType = rsType;
511 0 : }
512 :
513 0 : string OOXMLPropertySetImpl::toString()
514 : {
515 0 : string sResult = "[";
516 : char sBuffer[256];
517 0 : snprintf(sBuffer, sizeof(sBuffer), "%p", this);
518 0 : sResult += sBuffer;
519 0 : sResult += ":";
520 :
521 0 : OOXMLProperties_t::iterator aItBegin = begin();
522 0 : OOXMLProperties_t::iterator aItEnd = end();
523 :
524 0 : for (OOXMLProperties_t::iterator aIt = aItBegin; aIt != aItEnd; ++aIt)
525 : {
526 0 : if (aIt != aItBegin)
527 0 : sResult += ", ";
528 :
529 0 : if ((*aIt).get() != NULL)
530 0 : sResult += (*aIt)->toString();
531 : else
532 0 : sResult += "0x0";
533 : }
534 :
535 0 : sResult += "]";
536 :
537 0 : return sResult;
538 : }
539 :
540 : /*
541 : class OOXMLPropertySetValue
542 : */
543 :
544 0 : OOXMLPropertySetValue::OOXMLPropertySetValue
545 : (OOXMLPropertySet::Pointer_t pPropertySet)
546 0 : : mpPropertySet(pPropertySet)
547 : {
548 0 : }
549 :
550 0 : OOXMLPropertySetValue::~OOXMLPropertySetValue()
551 : {
552 0 : }
553 :
554 0 : writerfilter::Reference<Properties>::Pointer_t OOXMLPropertySetValue::getProperties()
555 : {
556 : return writerfilter::Reference<Properties>::Pointer_t
557 0 : (mpPropertySet->clone());
558 : }
559 :
560 0 : string OOXMLPropertySetValue::toString() const
561 : {
562 : char sBuffer[256];
563 :
564 0 : snprintf(sBuffer, sizeof(sBuffer), "t:%p, m:%p", this, mpPropertySet.get());
565 :
566 0 : return "OOXMLPropertySetValue(" + string(sBuffer) + ")";
567 : }
568 :
569 0 : OOXMLValue * OOXMLPropertySetValue::clone() const
570 : {
571 0 : return new OOXMLPropertySetValue(*this);
572 : }
573 :
574 : /*
575 : class OOXMLIntegerValue
576 : */
577 :
578 0 : OOXMLIntegerValue::OOXMLIntegerValue(sal_Int32 nValue)
579 0 : : mnValue(nValue)
580 : {
581 0 : }
582 :
583 0 : OOXMLIntegerValue::OOXMLIntegerValue(const OUString & rValue)
584 0 : : mnValue(0)
585 : {
586 0 : mnValue = rValue.toInt32();
587 0 : }
588 :
589 0 : OOXMLIntegerValue::~OOXMLIntegerValue()
590 : {
591 0 : }
592 :
593 0 : int OOXMLIntegerValue::getInt() const
594 : {
595 0 : return mnValue;
596 : }
597 :
598 0 : uno::Any OOXMLIntegerValue::getAny() const
599 : {
600 0 : uno::Any aResult(mnValue);
601 :
602 0 : return aResult;
603 : }
604 :
605 0 : OOXMLValue * OOXMLIntegerValue::clone() const
606 : {
607 0 : return new OOXMLIntegerValue(*this);
608 : }
609 :
610 0 : string OOXMLIntegerValue::toString() const
611 : {
612 : char buffer[256];
613 0 : snprintf(buffer, sizeof(buffer), "%" SAL_PRIdINT32, mnValue);
614 :
615 0 : return buffer;
616 : }
617 :
618 : /*
619 : class OOXMLHexValue
620 : */
621 :
622 0 : OOXMLHexValue::OOXMLHexValue(sal_uInt32 nValue)
623 0 : : mnValue(nValue)
624 : {
625 0 : }
626 :
627 0 : OOXMLHexValue::OOXMLHexValue(const OUString & rValue)
628 : {
629 0 : mnValue = rValue.toUInt32(16);
630 0 : }
631 :
632 0 : OOXMLHexValue::~OOXMLHexValue()
633 : {
634 0 : }
635 :
636 0 : int OOXMLHexValue::getInt() const
637 : {
638 0 : return mnValue;
639 : }
640 :
641 0 : OOXMLValue * OOXMLHexValue::clone() const
642 : {
643 0 : return new OOXMLHexValue(*this);
644 : }
645 :
646 0 : string OOXMLHexValue::toString() const
647 : {
648 : char buffer[256];
649 0 : snprintf(buffer, sizeof(buffer), "0x%" SAL_PRIxUINT32, mnValue);
650 :
651 0 : return buffer;
652 : }
653 :
654 : // OOXMLUniversalMeasureValue
655 :
656 0 : OOXMLUniversalMeasureValue::OOXMLUniversalMeasureValue(const OUString& rValue)
657 : {
658 0 : if (rValue.endsWith("pt"))
659 0 : mnValue = rValue.copy(0, rValue.getLength() - 2).toInt32() * 20;
660 : else
661 0 : mnValue = rValue.toInt32();
662 0 : }
663 :
664 0 : OOXMLUniversalMeasureValue::~OOXMLUniversalMeasureValue()
665 : {
666 0 : }
667 :
668 0 : int OOXMLUniversalMeasureValue::getInt() const
669 : {
670 0 : return mnValue;
671 : }
672 :
673 0 : OOXMLValue* OOXMLUniversalMeasureValue::clone() const
674 : {
675 0 : return new OOXMLUniversalMeasureValue(*this);
676 : }
677 :
678 0 : string OOXMLUniversalMeasureValue::toString() const
679 : {
680 0 : return OString::number(mnValue).getStr();
681 : }
682 :
683 : /*
684 : class OOXMLShapeValue
685 : */
686 :
687 :
688 0 : OOXMLShapeValue::OOXMLShapeValue(uno::Reference<XShape> rShape)
689 0 : : mrShape(rShape)
690 : {
691 0 : }
692 :
693 0 : OOXMLShapeValue::~OOXMLShapeValue()
694 : {
695 0 : }
696 :
697 0 : uno::Any OOXMLShapeValue::getAny() const
698 : {
699 0 : return uno::Any(mrShape);
700 : }
701 :
702 0 : string OOXMLShapeValue::toString() const
703 : {
704 0 : return "Shape";
705 : }
706 :
707 0 : OOXMLValue * OOXMLShapeValue::clone() const
708 : {
709 0 : return new OOXMLShapeValue(mrShape);
710 : }
711 :
712 : /*
713 : class OOXMLStarMathValue
714 : */
715 :
716 :
717 0 : OOXMLStarMathValue::OOXMLStarMathValue( uno::Reference< embed::XEmbeddedObject > c )
718 0 : : component(c)
719 : {
720 0 : }
721 :
722 0 : OOXMLStarMathValue::~OOXMLStarMathValue()
723 : {
724 0 : }
725 :
726 0 : uno::Any OOXMLStarMathValue::getAny() const
727 : {
728 0 : return uno::Any(component);
729 : }
730 :
731 0 : string OOXMLStarMathValue::toString() const
732 : {
733 0 : return "StarMath";
734 : }
735 :
736 0 : OOXMLValue * OOXMLStarMathValue::clone() const
737 : {
738 0 : return new OOXMLStarMathValue( component );
739 : }
740 :
741 : /*
742 : class OOXMLTableImpl
743 : */
744 :
745 0 : OOXMLTableImpl::OOXMLTableImpl()
746 : {
747 0 : }
748 :
749 0 : OOXMLTableImpl::~OOXMLTableImpl()
750 : {
751 0 : }
752 :
753 0 : void OOXMLTableImpl::resolve(Table & rTable)
754 : {
755 0 : Table * pTable = &rTable;
756 :
757 0 : int nPos = 0;
758 :
759 0 : PropertySets_t::iterator it = mPropertySets.begin();
760 0 : PropertySets_t::iterator itEnd = mPropertySets.end();
761 :
762 0 : while (it != itEnd)
763 : {
764 : writerfilter::Reference<Properties>::Pointer_t pProperties
765 0 : ((*it)->getProperties());
766 :
767 0 : if (pProperties.get() != NULL)
768 0 : pTable->entry(nPos, pProperties);
769 :
770 0 : ++nPos;
771 0 : ++it;
772 0 : }
773 0 : }
774 :
775 0 : void OOXMLTableImpl::add(ValuePointer_t pPropertySet)
776 : {
777 0 : if (pPropertySet.get() != NULL)
778 0 : mPropertySets.push_back(pPropertySet);
779 0 : }
780 :
781 0 : string OOXMLTableImpl::getType() const
782 : {
783 0 : return "OOXMLTableImpl";
784 : }
785 :
786 0 : OOXMLTable * OOXMLTableImpl::clone() const
787 : {
788 0 : return new OOXMLTableImpl(*this);
789 : }
790 :
791 : /*
792 : class: OOXMLPropertySetEntryToString
793 : */
794 :
795 0 : OOXMLPropertySetEntryToString::OOXMLPropertySetEntryToString(Id nId)
796 0 : : mnId(nId)
797 : {
798 0 : }
799 :
800 0 : OOXMLPropertySetEntryToString::~OOXMLPropertySetEntryToString()
801 : {
802 0 : }
803 :
804 0 : void OOXMLPropertySetEntryToString::sprm(Sprm & /*rSprm*/)
805 : {
806 0 : }
807 :
808 0 : void OOXMLPropertySetEntryToString::attribute(Id nId, Value & rValue)
809 : {
810 0 : if (nId == mnId)
811 0 : mStr = rValue.getString();
812 0 : }
813 :
814 0 : const OUString & OOXMLPropertySetEntryToString::getString() const
815 : {
816 0 : return mStr;
817 : }
818 :
819 0 : OOXMLPropertySetEntryToInteger::OOXMLPropertySetEntryToInteger(Id nId)
820 0 : : mnId(nId), mnValue(0)
821 : {
822 0 : }
823 :
824 0 : OOXMLPropertySetEntryToInteger::~OOXMLPropertySetEntryToInteger()
825 : {
826 0 : }
827 :
828 0 : void OOXMLPropertySetEntryToInteger::sprm(Sprm & /*rSprm*/)
829 : {
830 0 : }
831 :
832 0 : void OOXMLPropertySetEntryToInteger::attribute(Id nId, Value & rValue)
833 : {
834 0 : if (nId == mnId)
835 0 : mnValue = rValue.getInt();
836 0 : }
837 :
838 0 : int OOXMLPropertySetEntryToInteger::getValue() const
839 : {
840 0 : return mnValue;
841 : }
842 :
843 0 : }}
844 :
845 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|