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