update dev300-m58
[ooovba.git] / writerfilter / source / ooxml / OOXMLFastContextHandler.cxx
blob7a6418d0d3ef70384b36a33a246070152bbb1367
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: OOXMLFastContextHandler.cxx,v $
10 * $Revision: 1.12 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include <stdio.h>
32 #include <iostream>
33 #include <set>
34 #include <rtl/uuid.h>
35 #include <com/sun/star/drawing/XShapes.hpp>
36 #include <resourcemodel/QNameToString.hxx>
37 #include <resourcemodel/util.hxx>
38 #include <ooxml/resourceids.hxx>
39 #include <ooxml/OOXMLnamespaceids.hxx>
40 #include "OOXMLFastContextHandler.hxx"
41 #include "Handler.hxx"
42 #include "ooxmlLoggers.hxx"
44 static const sal_uInt8 s0x7[] = { 0x7, 0x0 };
45 static const sal_uInt8 s0xd[] = { 0xd, 0x0 };
46 static const sal_uInt8 sCR[] = { 0xd, 0x0 };
47 static const sal_uInt8 sFtnEdnRef[] = { 0x2, 0x0 };
48 static const sal_uInt8 sFtnEdnSep[] = { 0x3, 0x0 };
49 static const sal_uInt8 sFtnEdnCont[] = { 0x4, 0x0 };
50 static const sal_uInt8 sTab[] = { 0x9, 0x0 };
51 static const sal_uInt8 sPgNum[] = { 0x0, 0x0 };
52 static const sal_uInt8 sFieldStart[] = { 0x13 };
53 static const sal_uInt8 sFieldSep[] = { 0x14 };
54 static const sal_uInt8 sFieldEnd[] = { 0x15 };
55 static const sal_uInt8 sNoBreakHyphen[] = { 0x1e, 0x0 };
56 static const sal_uInt8 sSoftHyphen[] = { 0x1f, 0x0 };
58 namespace writerfilter {
59 namespace ooxml
61 using ::com::sun::star::lang::XMultiComponentFactory;
62 using namespace ::com::sun::star;
63 using namespace ::std;
65 static uno::Sequence< sal_Int8 > CreateUnoTunnelId()
67 static osl::Mutex aCreateMutex;
68 osl::Guard<osl::Mutex> aGuard( aCreateMutex );
69 uno::Sequence< sal_Int8 > aSeq( 16 );
70 rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
71 return aSeq;
74 static string resourceToString
75 (OOXMLFastContextHandler::ResourceEnum_t eResource)
77 string sResult;
79 switch (eResource)
81 case OOXMLFastContextHandler::STREAM:
82 sResult = "Stream";
83 break;
84 case OOXMLFastContextHandler::PROPERTIES:
85 sResult = "Properties";
86 break;
87 case OOXMLFastContextHandler::TABLE:
88 sResult = "Table";
89 break;
90 case OOXMLFastContextHandler::SHAPE:
91 sResult = "Shape";
92 break;
93 default:
94 sResult = "??";
97 return sResult;
100 set<OOXMLFastContextHandler *> aSetContexts;
103 class OOXMLIdToString : public IdToString
105 public:
106 OOXMLIdToString() : IdToString() {}
107 virtual ~OOXMLIdToString() {}
109 virtual string toString(const Id & rId) const
111 string s(fastTokenToId(rId));
113 if (s.size() == 0)
114 s = (*QNameToString::Instance())(rId);
116 return s;
121 class OOXMLFastContextHandler
124 sal_uInt32 OOXMLFastContextHandler::mnInstanceCount = 0;
126 OOXMLFastContextHandler::OOXMLFastContextHandler
127 (uno::Reference< uno::XComponentContext > const & context)
128 : mpParent(NULL),
129 mId(0),
130 mnToken(OOXML_FAST_TOKENS_END),
131 mpStream(NULL),
132 mnTableDepth(0),
133 mnInstanceNumber(mnInstanceCount),
134 mnRefCount(0),
135 m_xContext(context),
136 mbFallback(false)
138 mnInstanceCount++;
139 aSetContexts.insert(this);
141 if (mpParserState.get() == NULL)
142 mpParserState.reset(new OOXMLParserState());
144 mpParserState->incContextCount();
147 OOXMLFastContextHandler::OOXMLFastContextHandler
148 (OOXMLFastContextHandler * pContext)
149 : cppu::WeakImplHelper1<com::sun::star::xml::sax::XFastContextHandler>(),
150 mpParent(pContext),
151 mnToken(OOXML_FAST_TOKENS_END),
152 mpStream(NULL),
153 mnTableDepth(0),
154 mnInstanceNumber(mnInstanceCount),
155 mnRefCount(0),
156 m_xContext(pContext->m_xContext),
157 mbFallback(false)
159 if (pContext != NULL)
161 mpStream = pContext->mpStream;
162 mpParserState = pContext->mpParserState;
163 mnTableDepth = pContext->mnTableDepth;
164 m_xContext = pContext->m_xContext;
167 if (mpParserState.get() == NULL)
168 mpParserState.reset(new OOXMLParserState());
170 mnInstanceCount++;
171 aSetContexts.insert(this);
172 mpParserState->incContextCount();
175 OOXMLFastContextHandler::~OOXMLFastContextHandler()
177 aSetContexts.erase(this);
180 void OOXMLFastContextHandler::dumpOpenContexts()
182 debug_logger->startElement("open-contexts");
183 XMLTag aTag("open-contexts");
185 set<OOXMLFastContextHandler *>::iterator aIt(aSetContexts.begin());
186 while (aIt != aSetContexts.end())
188 debug_logger->startElement("open-context");
189 debug_logger->addTag((*aIt)->toTag());
190 debug_logger->endElement("open-context");
192 aIt++;
195 static char buffer[256];
196 snprintf(buffer, sizeof(buffer), "%" SAL_PRI_SIZET "u",
197 aSetContexts.size());
199 debug_logger->attribute("count", buffer);
200 debug_logger->endElement("open-contexts");
203 #ifdef DEBUG_MEMORY
204 void SAL_CALL OOXMLFastContextHandler::acquire()
205 throw ()
207 mnRefCount++;
209 static char buffer[256];
210 snprintf(buffer, sizeof(buffer), "%ld: %s: aquire(%ld)", mnInstanceNumber,
211 getType().c_str(), mnRefCount);
212 logger("MEMORY", buffer);
214 cppu::WeakImplHelper1<com::sun::star::xml::sax::XFastContextHandler>::acquire();
217 void SAL_CALL OOXMLFastContextHandler::release()
218 throw ()
220 static char buffer[256];
221 snprintf(buffer, sizeof(buffer), "%s: release(%ld)", mnInstanceNumber,
222 getType().c_str(), mnRefCount);
223 logger("MEMORY", buffer);
225 cppu::WeakImplHelper1<com::sun::star::xml::sax::XFastContextHandler>::release();
226 mnRefCount--;
228 #endif
230 sal_uInt32 OOXMLFastContextHandler::getInstanceNumber() const
232 return mnInstanceNumber;
235 // ::com::sun::star::xml::sax::XFastContextHandler:
236 void SAL_CALL OOXMLFastContextHandler::startFastElement
237 (Token_t Element,
238 const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
239 throw (uno::RuntimeException, xml::sax::SAXException)
241 #ifdef DEBUG_ELEMENT
242 debug_logger->startElement("element");
243 debug_logger->attribute("token", fastTokenToId(Element));
244 debug_logger->attribute("type",getType());
245 debug_logger->startElement("at-start");
246 debug_logger->addTag(toTag());
247 debug_logger->endElement("at-start");
248 #endif
249 #ifdef DEBUG_MEMORY
250 static char buffer[256];
251 snprintf(buffer, sizeof(buffer), "%ld: startFastElement", mnInstanceNumber);
252 logger("MEMORY", buffer);
253 #endif
255 attributes(Attribs);
256 lcl_startFastElement(Element, Attribs);
259 void SAL_CALL OOXMLFastContextHandler::startUnknownElement
260 (const ::rtl::OUString & Namespace, const ::rtl::OUString & Name,
261 const uno::Reference< xml::sax::XFastAttributeList > & /*Attribs*/)
262 throw (uno::RuntimeException, xml::sax::SAXException)
264 #ifdef DEBUG_CONTEXT_STACK
265 debug_logger->startElement("unknown-element");
266 debug_logger->attribute("namespace", Namespace);
267 debug_logger->attribute("name", Name);
268 #else
269 (void) Namespace;
270 (void) Name;
271 #endif
274 void SAL_CALL OOXMLFastContextHandler::endFastElement(Token_t Element)
275 throw (uno::RuntimeException, xml::sax::SAXException)
277 lcl_endFastElement(Element);
279 #ifdef DEBUG_ELEMENT
280 debug_logger->startElement("at-end");
281 debug_logger->addTag(toTag());
282 debug_logger->endElement("at-end");
283 debug_logger->endElement("element");
284 #endif
285 #ifdef DEBUG_MEMORY
286 static char buffer[256];
287 snprintf(buffer, sizeof(buffer), "%ld: %s:endFastElement", mnInstanceNumber,
288 getType().c_str());
289 logger("MEMORY", buffer);
290 #endif
293 void OOXMLFastContextHandler::lcl_startFastElement
294 (Token_t Element,
295 const uno::Reference< xml::sax::XFastAttributeList > & /*Attribs*/)
296 throw (uno::RuntimeException, xml::sax::SAXException)
298 startAction(Element);
301 void OOXMLFastContextHandler::lcl_endFastElement
302 (Token_t Element)
303 throw (uno::RuntimeException, xml::sax::SAXException)
305 #ifdef DEBUG_CONTEXT_STACK
306 debug_logger->startElement("endAction");
307 debug_logger->endElement("endAction");
308 debug_logger->startElement("token");
309 debug_logger->chars(fastTokenToId(Element));
310 debug_logger->endElement("token");
311 #endif
313 endAction(Element);
316 void SAL_CALL OOXMLFastContextHandler::endUnknownElement
317 (const ::rtl::OUString & , const ::rtl::OUString & )
318 throw (uno::RuntimeException, xml::sax::SAXException)
320 #ifdef DEBUG_ELEMENT
321 debug_logger->startElement("unknown-element");
322 debug_logger->endElement("unknown-element");
323 #endif
326 uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
327 OOXMLFastContextHandler::createFastChildContext
328 (Token_t Element,
329 const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
330 throw (uno::RuntimeException, xml::sax::SAXException)
332 #ifdef DEBUG_CONTEXT_STACK
333 debug_logger->startElement("createFastChildContext");
334 debug_logger->attribute("token", fastTokenToId(Element));
335 debug_logger->attribute("type", getType());
336 #endif
338 uno::Reference< xml::sax::XFastContextHandler > xResult
339 (lcl_createFastChildContext(Element, Attribs));
341 #ifdef DEBUG_CONTEXT_STACK
342 debug_logger->endElement("createFastChildContext");
343 #endif
345 return xResult;
348 uno::Reference< xml::sax::XFastContextHandler >
349 OOXMLFastContextHandler::lcl_createFastChildContext
350 (Token_t /*Element*/,
351 const uno::Reference< xml::sax::XFastAttributeList > & /*Attribs*/)
352 throw (uno::RuntimeException, xml::sax::SAXException)
354 OOXMLFastContextHandler * pResult = new OOXMLFastContextHandler(this);
355 pResult->setFallback(true);
357 return uno::Reference< xml::sax::XFastContextHandler > (pResult);
360 uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
361 OOXMLFastContextHandler::createUnknownChildContext
362 (const ::rtl::OUString & Namespace,
363 const ::rtl::OUString & Name,
364 const uno::Reference< xml::sax::XFastAttributeList > & /*Attribs*/)
365 throw (uno::RuntimeException, xml::sax::SAXException)
367 #ifdef DEBUG_ELEMENT
368 debug_logger->startElement("createUnknownChildContext");
369 debug_logger->attribute("namespace", Namespace);
370 debug_logger->attribute("name", Name);
371 debug_logger->endElement("createUnknownChildContext");
372 #else
373 (void) Namespace;
374 (void) Name;
375 #endif
377 return uno::Reference< xml::sax::XFastContextHandler >
378 (new OOXMLFastContextHandler(*const_cast<const OOXMLFastContextHandler *>(this)));
381 void SAL_CALL OOXMLFastContextHandler::characters
382 (const ::rtl::OUString & aChars)
383 throw (uno::RuntimeException, xml::sax::SAXException)
385 lcl_characters(aChars);
388 void OOXMLFastContextHandler::lcl_characters
389 (const ::rtl::OUString & /*aChars*/)
390 throw (uno::RuntimeException, xml::sax::SAXException)
394 const uno::Sequence< sal_Int8 > & OOXMLFastContextHandler::getUnoTunnelId()
396 static uno::Sequence< sal_Int8 > aSeq = CreateUnoTunnelId();
397 return aSeq;
400 sal_Int64 SAL_CALL OOXMLFastContextHandler::getSomething( const uno::Sequence< sal_Int8 >& rId )
401 throw(uno::RuntimeException)
403 if( rId.getLength() == 16
404 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
405 rId.getConstArray(), 16 ) )
407 return sal::static_int_cast<sal_Int64>
408 (reinterpret_cast<sal_IntPtr>(this));
411 return 0x0;
414 void OOXMLFastContextHandler::setStream(Stream * pStream)
416 mpStream = pStream;
419 OOXMLValue::Pointer_t OOXMLFastContextHandler::getValue() const
421 return OOXMLValue::Pointer_t();
424 void OOXMLFastContextHandler::attributes
425 (const uno::Reference< xml::sax::XFastAttributeList > & /*Attribs*/)
426 throw (uno::RuntimeException, xml::sax::SAXException)
430 void OOXMLFastContextHandler::startAction(Token_t Element)
432 #ifdef DEBUG_ELEMENT
433 debug_logger->startElement("startAction");
434 #endif
435 lcl_startAction(Element);
436 #ifdef DEBUG_ELEMENT
437 debug_logger->endElement("startAction");
438 #endif
441 void OOXMLFastContextHandler::lcl_startAction(Token_t /* Element */)
445 void OOXMLFastContextHandler::endAction(Token_t Element)
447 #ifdef DEBUG_ELEMENT
448 debug_logger->startElement("endAction");
449 #endif
450 lcl_endAction(Element);
451 #ifdef DEBUG_ELEMENT
452 debug_logger->endElement("endAction");
453 #endif
456 void OOXMLFastContextHandler::lcl_endAction(Token_t /* Element */)
460 XMLTag::Pointer_t OOXMLFastContextHandler::toPropertiesTag
461 (OOXMLPropertySet::Pointer_t pProps)
463 XMLTag::Pointer_t pTag;
465 if (pProps.get() != NULL)
467 PropertySetToTagHandler aHandler(IdToString::Pointer_t(new OOXMLIdToString()));
469 pProps->resolve(aHandler);
470 pTag = aHandler.getTag();
473 return pTag;
476 XMLTag::Pointer_t OOXMLFastContextHandler::toTag() const
478 XMLTag::Pointer_t pTag(new XMLTag("context"));
480 static char sBuffer[128];
481 snprintf(sBuffer, sizeof(sBuffer), "%p", this);
483 pTag->addAttr("parent", sBuffer);
484 pTag->addAttr("type", getType());
485 pTag->addAttr("resource", getResourceString());
486 pTag->addAttr("token", fastTokenToId(getToken()));
487 pTag->addAttr("id", (*QNameToString::Instance())(getId()));
489 OOXMLValue::Pointer_t pVal(getValue());
491 if (pVal.get() != NULL)
492 pTag->addAttr("value", pVal->toString());
493 else
494 pTag->addAttr("value", "(null)");
496 XMLTag::Pointer_t pTagProps(toPropertiesTag(getPropertySet()));
497 if (pTagProps.get() != NULL)
498 pTag->addTag(pTagProps);
500 pTag->addTag(mpParserState->toTag());
502 return pTag;
505 string OOXMLFastContextHandler::toString() const
507 return toTag()->toString();
510 string OOXMLFastContextHandler::getResourceString() const
512 return resourceToString(getResource());
515 void OOXMLFastContextHandler::setId(Id rId)
517 #ifdef DEBUG_ELEMENT
518 debug_logger->startElement("setId");
520 static char sBuffer[256];
521 snprintf(sBuffer, sizeof(sBuffer), "%ld", rId);
523 debug_logger->attribute("id", sBuffer);
524 debug_logger->chars((*QNameToString::Instance())(rId));
525 debug_logger->endElement("setId");
526 #endif
528 mId = rId;
531 Id OOXMLFastContextHandler::getId() const
533 return mId;
536 void OOXMLFastContextHandler::setFallback(bool bFallback)
538 mbFallback = bFallback;
541 bool OOXMLFastContextHandler::isFallback() const
543 return mbFallback;
546 OOXMLParserState::Pointer_t OOXMLFastContextHandler::getParserState() const
548 return mpParserState;
551 void OOXMLFastContextHandler::setToken(Token_t nToken)
553 mnToken = nToken;
555 #ifdef DEBUG_CONTEXT_STACK
556 msTokenString = fastTokenToId(mnToken);
557 #endif
560 Token_t OOXMLFastContextHandler::getToken() const
562 return mnToken;
565 void OOXMLFastContextHandler::mark(const Id & rId, OOXMLValue::Pointer_t pVal)
567 OOXMLPropertySetImpl::Pointer_t pPropSet(new OOXMLPropertySetImpl());
568 OOXMLPropertyImpl::Pointer_t pProperty
569 (new OOXMLPropertyImpl(rId, pVal, OOXMLPropertyImpl::ATTRIBUTE));
571 #ifdef DEBUG_PROPERTIES
572 debug_logger->startElement("mark");
573 debug_logger->chars(xmlify(pProperty->toString()));
574 debug_logger->endElement("mark");
575 #endif
576 pPropSet->add(pProperty);
577 mpStream->props(pPropSet);
580 void OOXMLFastContextHandler::setParent
581 (OOXMLFastContextHandler * pParent)
583 mpParent = pParent;
586 OOXMLPropertySet * OOXMLFastContextHandler::getPicturePropSet
587 (const ::rtl::OUString & rId)
589 return dynamic_cast<OOXMLDocumentImpl *>(mpParserState->getDocument())->
590 getPicturePropSet(rId);
593 void OOXMLFastContextHandler::sendTableDepth() const
595 #ifdef DEBUG_ELEMENT
596 debug_logger->startElement("sendTableDepth");
597 #endif
599 if (mnTableDepth > 0)
601 OOXMLPropertySet * pProps = new OOXMLPropertySetImpl();
603 OOXMLValue::Pointer_t pVal
604 (new OOXMLIntegerValue(mnTableDepth));
605 OOXMLProperty::Pointer_t pProp
606 (new OOXMLPropertyImpl(0x6649, pVal, OOXMLPropertyImpl::SPRM));
607 pProps->add(pProp);
610 OOXMLValue::Pointer_t pVal
611 (new OOXMLIntegerValue(1));
612 OOXMLProperty::Pointer_t pProp
613 (new OOXMLPropertyImpl(0x2416, pVal, OOXMLPropertyImpl::SPRM));
614 pProps->add(pProp);
617 #ifdef DEBUG_PROPERTIES
618 debug_logger->startElement("props");
619 debug_logger->chars(pProps->toString());
620 debug_logger->endElement("props");
621 #endif
622 mpStream->props(writerfilter::Reference<Properties>::Pointer_t(pProps));
623 #ifdef DEBUG_PROPERTIES
624 debug_logger->endElement("sendTableDepth");
625 #endif
629 void OOXMLFastContextHandler::setHandle()
631 mpParserState->setHandle();
632 mpStream->info(mpParserState->getHandle());
635 void OOXMLFastContextHandler::startCharacterGroup()
637 if (isForwardEvents())
639 if (mpParserState->isInCharacterGroup())
640 endCharacterGroup();
642 if (! mpParserState->isInParagraphGroup())
643 startParagraphGroup();
645 if (! mpParserState->isInCharacterGroup())
647 #ifdef DEBUG_ELEMENT
648 debug_logger->element("startCharacterGroup");
649 #endif
651 mpStream->startCharacterGroup();
652 mpParserState->setInCharacterGroup(true);
653 mpParserState->resolveCharacterProperties(*mpStream);
658 void OOXMLFastContextHandler::endCharacterGroup()
660 if (isForwardEvents() && mpParserState->isInCharacterGroup())
662 #ifdef DEBUG_ELEMENT
663 debug_logger->element("endCharacterGroup");
664 #endif
666 mpStream->endCharacterGroup();
667 mpParserState->setInCharacterGroup(false);
671 void OOXMLFastContextHandler::startParagraphGroup()
673 if (isForwardEvents())
675 if (mpParserState->isInParagraphGroup())
676 endParagraphGroup();
678 if (! mpParserState->isInSectionGroup())
679 startSectionGroup();
681 if (! mpParserState->isInParagraphGroup())
683 #ifdef DEBUG_ELEMENT
684 debug_logger->element("startParagraphGroup");
685 #endif
687 mpStream->startParagraphGroup();
688 mpParserState->setInParagraphGroup(true);
693 void OOXMLFastContextHandler::endParagraphGroup()
695 if (isForwardEvents())
697 if (mpParserState->isInCharacterGroup())
698 endCharacterGroup();
700 if (mpParserState->isInParagraphGroup())
702 #ifdef DEBUG_ELEMENT
703 debug_logger->element("endParagraphGroup");
704 #endif
705 mpStream->endParagraphGroup();
706 mpParserState->setInParagraphGroup(false);
711 void OOXMLFastContextHandler::startSectionGroup()
713 if (isForwardEvents())
715 if (mpParserState->isInSectionGroup())
716 endSectionGroup();
718 if (! mpParserState->isInSectionGroup())
720 #ifdef DEBUG_ELEMENT
721 debug_logger->element("startSectionGroup");
722 #endif
723 mpStream->info(mpParserState->getHandle());
724 mpStream->startSectionGroup();
725 mpParserState->setInSectionGroup(true);
730 void OOXMLFastContextHandler::endSectionGroup()
732 if (isForwardEvents())
734 if (mpParserState->isInParagraphGroup())
735 endParagraphGroup();
737 if (mpParserState->isInSectionGroup())
739 #ifdef DEBUG_ELEMENT
740 debug_logger->element("endSectionGroup");
741 #endif
742 mpStream->endSectionGroup();
743 mpParserState->setInSectionGroup(false);
748 void OOXMLFastContextHandler::setLastParagraphInSection()
750 #ifdef DEBUG_ELEMENT
751 debug_logger->element("setLastParagraphInSection");
752 #endif
754 mpParserState->setLastParagraphInSection(true);
757 void OOXMLFastContextHandler::newProperty
758 (const Id & /*nId*/, OOXMLValue::Pointer_t /*pVal*/)
762 void OOXMLFastContextHandler::setPropertySet
763 (OOXMLPropertySet::Pointer_t /* pPropertySet */)
767 OOXMLPropertySet::Pointer_t OOXMLFastContextHandler::getPropertySet() const
769 return OOXMLPropertySet::Pointer_t();
772 void OOXMLFastContextHandler::startField()
774 #ifdef DEBUG_ELEMENT
775 debug_logger->element("startField");
776 #endif
777 startCharacterGroup();
778 if (isForwardEvents())
779 mpStream->text(sFieldStart, 1);
780 endCharacterGroup();
783 void OOXMLFastContextHandler::fieldSeparator()
785 #ifdef DEBUG_ELEMENT
786 debug_logger->element("fieldSeparator");
787 #endif
788 startCharacterGroup();
789 if (isForwardEvents())
790 mpStream->text(sFieldSep, 1);
791 endCharacterGroup();
794 void OOXMLFastContextHandler::endField()
796 #ifdef DEBUG_ELEMENT
797 debug_logger->element("endField");
798 #endif
799 startCharacterGroup();
800 if (isForwardEvents())
801 mpStream->text(sFieldEnd, 1);
802 endCharacterGroup();
805 void OOXMLFastContextHandler::ftnednref()
807 #ifdef DEBUG_ELEMENT
808 debug_logger->element("ftnednref");
809 #endif
810 if (isForwardEvents())
811 mpStream->utext(sFtnEdnRef, 1);
814 void OOXMLFastContextHandler::ftnednsep()
816 #ifdef DEBUG_ELEMENT
817 debug_logger->element("ftnednsep");
818 #endif
819 if (isForwardEvents())
820 mpStream->utext(sFtnEdnSep, 1);
823 void OOXMLFastContextHandler::ftnedncont()
825 #ifdef DEBUG_ELEMENT
826 debug_logger->element("ftnedncont");
827 #endif
828 if (isForwardEvents())
829 mpStream->text(sFtnEdnCont, 1);
832 void OOXMLFastContextHandler::pgNum()
834 #ifdef DEBUG_ELEMENT
835 debug_logger->element("pgNum");
836 #endif
837 if (isForwardEvents())
838 mpStream->utext((const sal_uInt8*)sPgNum, 1);
841 void OOXMLFastContextHandler::tab()
843 #ifdef DEBUG_ELEMENT
844 debug_logger->element("tab");
845 #endif
846 if (isForwardEvents())
847 mpStream->utext((const sal_uInt8*)sTab, 1);
850 void OOXMLFastContextHandler::cr()
852 #ifdef DEBUG_ELEMENT
853 debug_logger->element("cr");
854 #endif
855 if (isForwardEvents())
856 mpStream->utext((const sal_uInt8*)sCR, 1);
859 void OOXMLFastContextHandler::noBreakHyphen()
861 #ifdef DEBUG_ELEMENT
862 debug_logger->element("noBreakHyphen");
863 #endif
864 if (isForwardEvents())
865 mpStream->utext((const sal_uInt8*)sNoBreakHyphen, 1);
868 void OOXMLFastContextHandler::softHyphen()
870 #ifdef DEBUG_ELEMENT
871 debug_logger->element("softHyphen");
872 #endif
873 if (isForwardEvents())
874 mpStream->utext((const sal_uInt8*)sSoftHyphen, 1);
877 void OOXMLFastContextHandler::handleLastParagraphInSection()
879 #ifdef DEBUG_ELEMENT
880 debug_logger->element("handleLastParagraphInSection");
881 #endif
883 if (mpParserState->isLastParagraphInSection())
885 mpParserState->setLastParagraphInSection(false);
886 startSectionGroup();
890 void OOXMLFastContextHandler::endOfParagraph()
892 #ifdef DEBUG_ELEMENT
893 debug_logger->element("endOfParagraph");
894 #endif
895 if (! mpParserState->isInCharacterGroup())
896 startCharacterGroup();
897 if (isForwardEvents())
898 mpStream->utext((const sal_uInt8*)sCR, 1);
901 void OOXMLFastContextHandler::text(const ::rtl::OUString & sText)
903 #ifdef DEBUG_ELEMENT
904 debug_logger->startElement("text");
905 debug_logger->chars(sText);
906 debug_logger->endElement("text");
907 #endif
908 if (isForwardEvents())
909 mpStream->utext(reinterpret_cast < const sal_uInt8 * >
910 (sText.getStr()),
911 sText.getLength());
914 void OOXMLFastContextHandler::propagateCharacterProperties()
916 #ifdef DEBUG_ELEMENT
917 debug_logger->startElement("propagateCharacterProperties");
918 debug_logger->addTag(toPropertiesTag(getPropertySet()));
919 debug_logger->endElement("propagateCharacterProperties");
920 #endif
922 mpParserState->setCharacterProperties(getPropertySet());
925 void OOXMLFastContextHandler::propagateCharacterPropertiesAsSet(const Id & rId)
927 #ifdef DEBUG_ELEMENT
928 debug_logger->startElement("propagateCharacterPropertiesAsSet");
929 debug_logger->addTag(toPropertiesTag(getPropertySet()));
930 debug_logger->endElement("propagateCharacterPropertiesAsSet");
931 #endif
933 OOXMLValue::Pointer_t pValue(new OOXMLPropertySetValue(getPropertySet()));
934 OOXMLPropertySet::Pointer_t pPropertySet(new OOXMLPropertySetImpl());
936 OOXMLProperty::Pointer_t pProp
937 (new OOXMLPropertyImpl(rId, pValue, OOXMLPropertyImpl::SPRM));
939 pPropertySet->add(pProp);
940 mpParserState->setCharacterProperties(pPropertySet);
943 bool OOXMLFastContextHandler::propagatesProperties() const
945 return false;
948 void OOXMLFastContextHandler::propagateTableProperties()
950 #ifdef DEBUG_ELEMENT
951 debug_logger->element("propagateTableProperties");
952 #endif
954 mpParserState->setTableProperties(getPropertySet());
957 void OOXMLFastContextHandler::sendPropertiesWithId(const Id & rId)
959 #ifdef DEBUG_ELEMENT
960 debug_logger->startElement("sendPropertiesWithId");
961 debug_logger->attribute("id", fastTokenToId(rId));
962 #endif
964 OOXMLValue::Pointer_t pValue(new OOXMLPropertySetValue(getPropertySet()));
965 OOXMLPropertySet::Pointer_t pPropertySet(new OOXMLPropertySetImpl());
967 OOXMLProperty::Pointer_t pProp
968 (new OOXMLPropertyImpl(rId, pValue, OOXMLPropertyImpl::SPRM));
970 pPropertySet->add(pProp);
971 mpStream->props(pPropertySet);
973 #ifdef DEBUG_ELEMENT
974 debug_logger->addTag(toPropertiesTag(pPropertySet));
975 debug_logger->endElement("sendPropertiesWithId");
976 #endif
979 void OOXMLFastContextHandler::clearProps()
981 #ifdef DEBUG_ELEMENT
982 debug_logger->element("clearProps");
983 #endif
985 setPropertySet(OOXMLPropertySet::Pointer_t(new OOXMLPropertySetImpl()));
988 void OOXMLFastContextHandler::setDocument(OOXMLDocument * pDocument)
990 mpParserState->setDocument(pDocument);
993 OOXMLDocument * OOXMLFastContextHandler::getDocument()
995 return mpParserState->getDocument();
998 void OOXMLFastContextHandler::setForwardEvents(bool bForwardEvents)
1000 #ifdef DEBUG_ELEMENT
1001 debug_logger->startElement("setForwardEvents");
1003 if (bForwardEvents)
1004 debug_logger->chars("true");
1005 else
1006 debug_logger->chars("false");
1008 debug_logger->endElement("setForwardEvents");
1009 #endif
1011 mpParserState->setForwardEvents(bForwardEvents);
1014 bool OOXMLFastContextHandler::isForwardEvents() const
1016 return mpParserState->isForwardEvents();
1019 void OOXMLFastContextHandler::setXNoteId(const ::rtl::OUString & rId)
1021 mpParserState->setXNoteId(rId);
1024 const rtl::OUString & OOXMLFastContextHandler::getXNoteId() const
1026 return mpParserState->getXNoteId();
1029 void OOXMLFastContextHandler::resolveFootnote
1030 (const rtl::OUString & rId)
1032 mpParserState->getDocument()->resolveFootnote
1033 (*mpStream, 0, rId);
1036 void OOXMLFastContextHandler::resolveEndnote(const rtl::OUString & rId)
1038 mpParserState->getDocument()->resolveEndnote
1039 (*mpStream, 0, rId);
1042 void OOXMLFastContextHandler::resolveComment(const rtl::OUString & rId)
1044 mpParserState->getDocument()->resolveComment(*mpStream, rId);
1047 void OOXMLFastContextHandler::resolvePicture(const rtl::OUString & rId)
1049 mpParserState->getDocument()->resolvePicture(*mpStream, rId);
1052 void OOXMLFastContextHandler::resolveHeader
1053 (const sal_Int32 type, const rtl::OUString & rId)
1055 mpParserState->getDocument()->resolveHeader(*mpStream, type, rId);
1058 void OOXMLFastContextHandler::resolveFooter
1059 (const sal_Int32 type, const rtl::OUString & rId)
1061 mpParserState->getDocument()->resolveFooter(*mpStream, type, rId);
1064 void OOXMLFastContextHandler::resolveOLE(const rtl::OUString & rId)
1066 uno::Reference<io::XInputStream> xInputStream
1067 (mpParserState->getDocument()->getInputStreamForId(rId));
1069 OOXMLValue::Pointer_t aValue(new OOXMLInputStreamValue(xInputStream));
1071 newProperty(NS_ooxml::LN_inputstream, aValue);
1074 ::rtl::OUString OOXMLFastContextHandler::getTargetForId
1075 (const ::rtl::OUString & rId)
1077 return mpParserState->getDocument()->getTargetForId(rId);
1080 void OOXMLFastContextHandler::resolvePropertySetAttrs()
1084 void OOXMLFastContextHandler::sendPropertyToParent()
1086 if (mpParent != NULL)
1088 OOXMLPropertySet::Pointer_t pProps(mpParent->getPropertySet());
1090 if (pProps.get() != NULL)
1092 OOXMLProperty::Pointer_t
1093 pProp(new OOXMLPropertyImpl(mId, getValue(),
1094 OOXMLPropertyImpl::SPRM));
1095 pProps->add(pProp);
1100 uno::Reference< uno::XComponentContext >
1101 OOXMLFastContextHandler::getComponentContext()
1103 return m_xContext;
1107 class OOXMLFastContextHandlerNoResource
1109 OOXMLFastContextHandlerNoResource::OOXMLFastContextHandlerNoResource
1110 (OOXMLFastContextHandler * pContext)
1111 : OOXMLFastContextHandler(pContext)
1115 OOXMLFastContextHandlerNoResource::~OOXMLFastContextHandlerNoResource()
1120 class OOXMLFastContextHandlerStream
1123 OOXMLFastContextHandlerStream::OOXMLFastContextHandlerStream
1124 (OOXMLFastContextHandler * pContext)
1125 : OOXMLFastContextHandler(pContext),
1126 mpPropertySetAttrs(new OOXMLPropertySetImpl())
1130 OOXMLFastContextHandlerStream::~OOXMLFastContextHandlerStream()
1134 void OOXMLFastContextHandlerStream::newProperty(const Id & rId,
1135 OOXMLValue::Pointer_t pVal)
1137 if (rId != 0x0)
1139 OOXMLPropertyImpl::Pointer_t pProperty
1140 (new OOXMLPropertyImpl(rId, pVal, OOXMLPropertyImpl::ATTRIBUTE));
1142 mpPropertySetAttrs->add(pProperty);
1146 void OOXMLFastContextHandlerStream::sendProperty(Id nId)
1148 #ifdef DEBUG_PROPERTIES
1149 debug_logger->startElement("sendProperty");
1150 debug_logger->attribute("id", (*QNameToString::Instance())(nId));
1151 debug_logger->chars(xmlify(getPropertySetAttrs()->toString()));
1152 debug_logger->endElement("sendProperty");
1153 #endif
1155 OOXMLPropertySetEntryToString aHandler(nId);
1156 getPropertySetAttrs()->resolve(aHandler);
1157 const ::rtl::OUString & sText = aHandler.getString();
1158 mpStream->utext(reinterpret_cast < const sal_uInt8 * >
1159 (sText.getStr()),
1160 sText.getLength());
1163 void OOXMLFastContextHandlerStream::setPropertySetAttrs
1164 (OOXMLPropertySet::Pointer_t pPropertySetAttrs)
1166 mpPropertySetAttrs = pPropertySetAttrs;
1169 OOXMLPropertySet::Pointer_t
1170 OOXMLFastContextHandlerStream::getPropertySetAttrs() const
1172 return mpPropertySetAttrs;
1175 void OOXMLFastContextHandlerStream::resolvePropertySetAttrs()
1177 #ifdef DEBUG_PROPERTIES
1178 debug_logger->startElement("resolvePropertySetAttrs");
1179 debug_logger->chars(mpPropertySetAttrs->toString());
1180 debug_logger->endElement("resolvePropertySetAttrs");
1181 #endif
1182 mpStream->props(mpPropertySetAttrs);
1185 OOXMLPropertySet::Pointer_t OOXMLFastContextHandlerStream::getPropertySet()
1186 const
1188 return getPropertySetAttrs();
1191 void OOXMLFastContextHandlerStream::handleHyperlink()
1193 OOXMLHyperlinkHandler aHyperlinkHandler(this);
1194 getPropertySetAttrs()->resolve(aHyperlinkHandler);
1197 void OOXMLFastContextHandlerStream::lcl_characters
1198 (const ::rtl::OUString & rChars)
1199 throw (uno::RuntimeException, xml::sax::SAXException)
1201 text(rChars);
1205 class OOXMLFastContextHandlerProperties
1207 OOXMLFastContextHandlerProperties::OOXMLFastContextHandlerProperties
1208 (OOXMLFastContextHandler * pContext)
1209 : OOXMLFastContextHandler(pContext), mpPropertySet(new OOXMLPropertySetImpl()),
1210 mbResolve(false)
1212 if (pContext->getResource() == STREAM)
1213 mbResolve = true;
1216 OOXMLFastContextHandlerProperties::~OOXMLFastContextHandlerProperties()
1220 void OOXMLFastContextHandlerProperties::lcl_endFastElement
1221 (Token_t Element)
1222 throw (uno::RuntimeException, xml::sax::SAXException)
1224 endAction(Element);
1226 if (mbResolve)
1228 if (isForwardEvents())
1230 #ifdef DEBUG_PROPERTIES
1231 debug_logger->startElement("sendproperties");
1232 debug_logger->addTag(toPropertiesTag(getPropertySet()));
1233 debug_logger->endElement("sendproperties");
1234 #endif
1235 mpStream->props(mpPropertySet);
1238 else
1240 OOXMLValue::Pointer_t pVal
1241 (new OOXMLPropertySetValue(mpPropertySet));
1243 OOXMLPropertyImpl::Pointer_t pProperty
1244 (new OOXMLPropertyImpl(mId, pVal, OOXMLPropertyImpl::SPRM));
1246 OOXMLPropertySet::Pointer_t pProperties = (*mpParent).getPropertySet();
1248 if (pProperties.get() != NULL)
1250 #ifdef DEBUG_PROPERTIES
1251 debug_logger->startElement("property");
1252 debug_logger->chars(xmlify(pProperty->toString()));
1253 debug_logger->endElement("property");
1254 #endif
1255 pProperties->add(pProperty);
1257 #ifdef DEBUG_PROPERTIES
1258 else if (! propagatesProperties())
1260 debug_logger->startElement("warning");
1261 debug_logger->chars("properties lost");
1262 debug_logger->endElement("warning");
1264 #endif
1268 OOXMLValue::Pointer_t OOXMLFastContextHandlerProperties::getValue() const
1270 return OOXMLValue::Pointer_t(new OOXMLPropertySetValue(mpPropertySet));
1273 XMLTag::Pointer_t OOXMLFastContextHandlerProperties::toTag() const
1275 XMLTag::Pointer_t pTag(OOXMLFastContextHandler::toTag());
1276 pTag->addAttr("resolve", mbResolve ? "resolve" : "noResolve");
1278 return pTag;
1281 void OOXMLFastContextHandlerProperties::newProperty
1282 (const Id & rId, OOXMLValue::Pointer_t pVal)
1284 if (rId != 0x0)
1286 OOXMLPropertyImpl::Pointer_t pProperty
1287 (new OOXMLPropertyImpl(rId, pVal, OOXMLPropertyImpl::ATTRIBUTE));
1289 mpPropertySet->add(pProperty);
1293 void OOXMLFastContextHandlerProperties::handleXNotes()
1295 switch (mnToken)
1297 case NS_wordprocessingml|OOXML_footnoteReference:
1299 OOXMLFootnoteHandler aFootnoteHandler(this);
1300 mpPropertySet->resolve(aFootnoteHandler);
1302 break;
1303 case NS_wordprocessingml|OOXML_endnoteReference:
1305 OOXMLEndnoteHandler aEndnoteHandler(this);
1306 mpPropertySet->resolve(aEndnoteHandler);
1308 break;
1309 default:
1310 break;
1314 void OOXMLFastContextHandlerProperties::handleHdrFtr()
1316 switch (mnToken)
1318 case NS_wordprocessingml|OOXML_footerReference:
1320 OOXMLFooterHandler aFooterHandler(this);
1321 mpPropertySet->resolve(aFooterHandler);
1323 break;
1324 case NS_wordprocessingml|OOXML_headerReference:
1326 OOXMLHeaderHandler aHeaderHandler(this);
1327 mpPropertySet->resolve(aHeaderHandler);
1329 break;
1330 default:
1331 break;
1335 void OOXMLFastContextHandlerProperties::handleComment()
1337 #ifdef DEBUG_ELEMENT
1338 debug_logger->element("handleComment");
1339 #endif
1341 OOXMLCommentHandler aCommentHandler(this);
1342 getPropertySet()->resolve(aCommentHandler);
1345 void OOXMLFastContextHandlerProperties::handlePicture()
1347 #ifdef DEBUG_ELEMENT
1348 debug_logger->element("handlePicture");
1349 #endif
1351 OOXMLPictureHandler aPictureHandler(this);
1352 getPropertySet()->resolve(aPictureHandler);
1355 void OOXMLFastContextHandlerProperties::handleBreak()
1357 #ifdef DEBUG_ELEMENT
1358 debug_logger->element("handleBreak");
1359 #endif
1361 OOXMLBreakHandler aBreakHandler(*mpStream, this);
1362 getPropertySet()->resolve(aBreakHandler);
1365 void OOXMLFastContextHandlerProperties::handleOLE()
1367 #ifdef DEBUG_ELEMENT
1368 debug_logger->element("handleOLE");
1369 #endif
1371 OOXMLOLEHandler aOLEHandler(this);
1372 getPropertySet()->resolve(aOLEHandler);
1375 void OOXMLFastContextHandlerProperties::setParent
1376 (OOXMLFastContextHandler * pParent)
1378 #ifdef DEBUG_ELEMENT
1379 debug_logger->startElement("setParent");
1380 debug_logger->chars("OOXMLFastContextHandlerProperties");
1381 debug_logger->endElement("setParent");
1382 #endif
1384 OOXMLFastContextHandler::setParent(pParent);
1386 if (mpParent->getResource() == STREAM)
1387 mbResolve = true;
1390 void OOXMLFastContextHandlerProperties::setPropertySet
1391 (OOXMLPropertySet::Pointer_t pPropertySet)
1393 if (pPropertySet.get() != NULL)
1394 mpPropertySet = pPropertySet;
1397 OOXMLPropertySet::Pointer_t
1398 OOXMLFastContextHandlerProperties::getPropertySet() const
1400 return mpPropertySet;
1404 * class OOXMLFasContextHandlerPropertyTable
1407 OOXMLFastContextHandlerPropertyTable::OOXMLFastContextHandlerPropertyTable
1408 (OOXMLFastContextHandler * pContext)
1409 : OOXMLFastContextHandlerProperties(pContext)
1413 OOXMLFastContextHandlerPropertyTable::~OOXMLFastContextHandlerPropertyTable()
1417 void OOXMLFastContextHandlerPropertyTable::lcl_endFastElement
1418 (Token_t Element)
1419 throw (uno::RuntimeException, xml::sax::SAXException)
1421 OOXMLPropertySet::Pointer_t pPropSet(mpPropertySet->clone());
1422 OOXMLTableImpl::ValuePointer_t pTmpVal
1423 (new OOXMLPropertySetValue(pPropSet));
1425 mTable.add(pTmpVal);
1427 writerfilter::Reference<Table>::Pointer_t pTable(mTable.clone());
1428 mpStream->table(mId, pTable);
1430 endAction(Element);
1434 class OOXMLFastContextHandlerBooleanValue
1437 OOXMLFastContextHandlerBooleanValue::OOXMLFastContextHandlerBooleanValue
1438 (OOXMLFastContextHandler * pContext)
1439 : OOXMLFastContextHandler(pContext), mbValue(true)
1443 OOXMLFastContextHandlerBooleanValue::~OOXMLFastContextHandlerBooleanValue()
1447 void OOXMLFastContextHandlerBooleanValue::attributes
1448 (const uno::Reference < xml::sax::XFastAttributeList > & Attribs)
1449 throw (uno::RuntimeException, xml::sax::SAXException)
1451 if (Attribs->hasAttribute(NS_wordprocessingml|OOXML_val))
1452 mbValue = Attribs->getValue(NS_wordprocessingml|OOXML_val).toBoolean();
1455 OOXMLValue::Pointer_t OOXMLFastContextHandlerBooleanValue::getValue() const
1457 return OOXMLValue::Pointer_t(new OOXMLBooleanValue(mbValue));
1460 void OOXMLFastContextHandlerBooleanValue::setValue
1461 (const ::rtl::OUString & rString)
1463 static rtl::OUString sOn(RTL_CONSTASCII_USTRINGPARAM("on"));
1464 static rtl::OUString sOff(RTL_CONSTASCII_USTRINGPARAM("off"));
1465 static rtl::OUString sTrue(RTL_CONSTASCII_USTRINGPARAM("true"));
1466 static rtl::OUString sFalse(RTL_CONSTASCII_USTRINGPARAM("false"));
1468 if (rString == sOn || rString == sTrue)
1469 mbValue = true;
1470 else if (rString == sOff || rString == sFalse)
1471 mbValue = false;
1474 void OOXMLFastContextHandlerBooleanValue::lcl_endFastElement
1475 (Token_t Element)
1476 throw (uno::RuntimeException, xml::sax::SAXException)
1478 sendPropertyToParent();
1480 endAction(Element);
1484 class OOXMLFastContextHandlerIntegerValue
1487 OOXMLFastContextHandlerIntegerValue::OOXMLFastContextHandlerIntegerValue
1488 (OOXMLFastContextHandler * pContext)
1489 : OOXMLFastContextHandler(pContext), mnValue(0)
1493 OOXMLFastContextHandlerIntegerValue::~OOXMLFastContextHandlerIntegerValue()
1497 void OOXMLFastContextHandlerIntegerValue::attributes
1498 (const uno::Reference < xml::sax::XFastAttributeList > & Attribs)
1499 throw (uno::RuntimeException, xml::sax::SAXException)
1501 if (Attribs->hasAttribute(NS_wordprocessingml|OOXML_val))
1502 mnValue = Attribs->getValue(NS_wordprocessingml|OOXML_val).toInt32();
1505 void OOXMLFastContextHandlerIntegerValue::lcl_endFastElement
1506 (Token_t Element)
1507 throw (uno::RuntimeException, xml::sax::SAXException)
1509 sendPropertyToParent();
1511 endAction(Element);
1514 OOXMLValue::Pointer_t OOXMLFastContextHandlerIntegerValue::getValue() const
1516 return OOXMLValue::Pointer_t(new OOXMLIntegerValue(mnValue));
1520 class OOXMLFastContextHandlerStringValue
1523 OOXMLFastContextHandlerStringValue::OOXMLFastContextHandlerStringValue
1524 (OOXMLFastContextHandler * pContext)
1525 : OOXMLFastContextHandler(pContext)
1529 OOXMLFastContextHandlerStringValue::~OOXMLFastContextHandlerStringValue()
1533 void OOXMLFastContextHandlerStringValue::attributes
1534 (const uno::Reference < xml::sax::XFastAttributeList > & Attribs)
1535 throw (uno::RuntimeException, xml::sax::SAXException)
1537 if (Attribs->hasAttribute(NS_wordprocessingml|OOXML_val))
1538 msValue = Attribs->getValue(NS_wordprocessingml|OOXML_val);
1541 void OOXMLFastContextHandlerStringValue::lcl_endFastElement
1542 (Token_t Element)
1543 throw (uno::RuntimeException, xml::sax::SAXException)
1545 sendPropertyToParent();
1547 endAction(Element);
1550 OOXMLValue::Pointer_t OOXMLFastContextHandlerStringValue::getValue() const
1552 return OOXMLValue::Pointer_t(new OOXMLStringValue(msValue));
1556 class OOXMLFastContextHandlerHexValue
1559 OOXMLFastContextHandlerHexValue::OOXMLFastContextHandlerHexValue
1560 (OOXMLFastContextHandler * pContext)
1561 : OOXMLFastContextHandler(pContext), mnValue(0)
1565 OOXMLFastContextHandlerHexValue::~OOXMLFastContextHandlerHexValue()
1569 void OOXMLFastContextHandlerHexValue::attributes
1570 (const uno::Reference < xml::sax::XFastAttributeList > & Attribs)
1571 throw (uno::RuntimeException, xml::sax::SAXException)
1573 if (Attribs->hasAttribute(NS_wordprocessingml|OOXML_val))
1574 mnValue = Attribs->getValue(NS_wordprocessingml|OOXML_val).toInt32(16);
1577 void OOXMLFastContextHandlerHexValue::lcl_endFastElement
1578 (Token_t Element)
1579 throw (uno::RuntimeException, xml::sax::SAXException)
1581 sendPropertyToParent();
1583 endAction(Element);
1586 OOXMLValue::Pointer_t OOXMLFastContextHandlerHexValue::getValue() const
1588 return OOXMLValue::Pointer_t(new OOXMLIntegerValue(mnValue));
1592 class OOXMLFastContextHandlerListValue
1595 OOXMLFastContextHandlerListValue::OOXMLFastContextHandlerListValue
1596 (OOXMLFastContextHandler * pContext)
1597 : OOXMLFastContextHandler(pContext)
1601 OOXMLFastContextHandlerListValue::~OOXMLFastContextHandlerListValue()
1605 void OOXMLFastContextHandlerListValue::lcl_endFastElement
1606 (Token_t Element)
1607 throw (uno::RuntimeException, xml::sax::SAXException)
1609 sendPropertyToParent();
1611 endAction(Element);
1614 OOXMLValue::Pointer_t OOXMLFastContextHandlerListValue::getValue() const
1616 return mpValue;
1620 class OOXMLFastContextHandlerTable
1623 OOXMLFastContextHandlerTable::OOXMLFastContextHandlerTable
1624 (OOXMLFastContextHandler * pContext)
1625 : OOXMLFastContextHandler(pContext)
1629 OOXMLFastContextHandlerTable::~OOXMLFastContextHandlerTable()
1633 uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
1634 OOXMLFastContextHandlerTable::createFastChildContext
1635 (Token_t Element,
1636 const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
1637 throw (uno::RuntimeException, xml::sax::SAXException)
1639 addCurrentChild();
1641 mCurrentChild.set
1642 (OOXMLFastContextHandler::createFastChildContext(Element, Attribs));
1644 return mCurrentChild;
1647 void OOXMLFastContextHandlerTable::lcl_endFastElement
1648 (Token_t /*Element*/)
1649 throw (uno::RuntimeException, xml::sax::SAXException)
1651 addCurrentChild();
1653 writerfilter::Reference<Table>::Pointer_t pTable(mTable.clone());
1654 if (isForwardEvents() && mId != 0x0)
1655 mpStream->table(mId, pTable);
1658 void OOXMLFastContextHandlerTable::addCurrentChild()
1660 OOXMLFastContextHandler * pHandler = mCurrentChild.getPointer();
1661 if ( pHandler != NULL)
1663 OOXMLValue::Pointer_t pValue(pHandler->getValue());
1665 if (pValue.get() != NULL)
1667 OOXMLTableImpl::ValuePointer_t pTmpVal(pValue->clone());
1668 mTable.add(pTmpVal);
1673 void OOXMLFastContextHandlerTable::newPropertySet
1674 (OOXMLPropertySet::Pointer_t /*pPropertySet*/)
1680 class OOXMLFastContextHandlerXNote
1683 OOXMLFastContextHandlerXNote::OOXMLFastContextHandlerXNote
1684 (OOXMLFastContextHandler * pContext)
1685 : OOXMLFastContextHandler(pContext)
1689 OOXMLFastContextHandlerXNote::~OOXMLFastContextHandlerXNote()
1693 void OOXMLFastContextHandlerXNote::lcl_startFastElement
1694 (Token_t Element,
1695 const uno::Reference< xml::sax::XFastAttributeList > & /*Attribs*/)
1696 throw (uno::RuntimeException, xml::sax::SAXException)
1698 mbForwardEventsSaved = isForwardEvents();
1700 if (msMyXNoteId.compareTo(getXNoteId()) == 0)
1701 setForwardEvents(true);
1702 else
1703 setForwardEvents(false);
1705 startAction(Element);
1708 void OOXMLFastContextHandlerXNote::lcl_endFastElement
1709 (Token_t Element)
1710 throw (uno::RuntimeException, xml::sax::SAXException)
1712 endAction(Element);
1714 setForwardEvents(mbForwardEventsSaved);
1717 void OOXMLFastContextHandlerXNote::checkId(const rtl::OUString & rId)
1719 #ifdef DEBUG_ELEMENT
1720 debug_logger->startElement("checkId");
1721 debug_logger->attribute("myId", rId);
1722 debug_logger->attribute("id", getXNoteId());
1723 debug_logger->endElement("checkId");
1724 #endif
1726 msMyXNoteId = rId;
1730 class OOXMLFastContextHandlerTextTableCell
1733 OOXMLFastContextHandlerTextTableCell::OOXMLFastContextHandlerTextTableCell
1734 (OOXMLFastContextHandler * pContext)
1735 : OOXMLFastContextHandler(pContext)
1739 OOXMLFastContextHandlerTextTableCell::~OOXMLFastContextHandlerTextTableCell()
1743 void OOXMLFastContextHandlerTextTableCell::startCell()
1747 void OOXMLFastContextHandlerTextTableCell::endCell()
1749 if (isForwardEvents())
1751 OOXMLPropertySet * pProps = new OOXMLPropertySetImpl();
1753 OOXMLValue::Pointer_t pVal
1754 (new OOXMLIntegerValue(mnTableDepth));
1755 OOXMLProperty::Pointer_t pProp
1756 (new OOXMLPropertyImpl(0x6649, pVal, OOXMLPropertyImpl::SPRM));
1757 pProps->add(pProp);
1760 OOXMLValue::Pointer_t pVal
1761 (new OOXMLIntegerValue(1));
1762 OOXMLProperty::Pointer_t pProp
1763 (new OOXMLPropertyImpl(0x2416, pVal, OOXMLPropertyImpl::SPRM));
1764 pProps->add(pProp);
1767 OOXMLValue::Pointer_t pVal
1768 (new OOXMLIntegerValue(mnTableDepth));
1769 OOXMLProperty::Pointer_t pProp
1770 (new OOXMLPropertyImpl(0x244b, pVal, OOXMLPropertyImpl::SPRM));
1771 pProps->add(pProp);
1774 #ifdef DEBUG_PROPERTIES
1775 debug_logger->startElement("endcell");
1776 debug_logger->addTag(toPropertiesTag
1777 (OOXMLPropertySet::Pointer_t(pProps->clone())));
1778 debug_logger->endElement("endcell");
1779 #endif
1780 mpStream->props(writerfilter::Reference<Properties>::Pointer_t(pProps));
1785 class OOXMLFastContextHandlerTextTableRow
1788 OOXMLFastContextHandlerTextTableRow::OOXMLFastContextHandlerTextTableRow
1789 (OOXMLFastContextHandler * pContext)
1790 : OOXMLFastContextHandler(pContext)
1792 startRow();
1795 OOXMLFastContextHandlerTextTableRow::~OOXMLFastContextHandlerTextTableRow()
1797 endRow();
1800 void OOXMLFastContextHandlerTextTableRow::startRow()
1804 void OOXMLFastContextHandlerTextTableRow::endRow()
1806 startParagraphGroup();
1808 if (isForwardEvents())
1810 OOXMLPropertySet * pProps = new OOXMLPropertySetImpl();
1812 OOXMLValue::Pointer_t pVal
1813 (new OOXMLIntegerValue(mnTableDepth));
1814 OOXMLProperty::Pointer_t pProp
1815 (new OOXMLPropertyImpl(0x6649, pVal, OOXMLPropertyImpl::SPRM));
1816 pProps->add(pProp);
1819 OOXMLValue::Pointer_t pVal
1820 (new OOXMLIntegerValue(1));
1821 OOXMLProperty::Pointer_t pProp
1822 (new OOXMLPropertyImpl(0x2416, pVal, OOXMLPropertyImpl::SPRM));
1823 pProps->add(pProp);
1826 OOXMLValue::Pointer_t pVal
1827 (new OOXMLIntegerValue(1));
1828 OOXMLProperty::Pointer_t pProp
1829 (new OOXMLPropertyImpl(0x244c, pVal, OOXMLPropertyImpl::SPRM));
1830 pProps->add(pProp);
1833 #ifdef DEBUG_PROPERTIES
1834 debug_logger->startElement("endrow");
1835 debug_logger->addTag(toPropertiesTag
1836 (OOXMLPropertySet::Pointer_t(pProps->clone())));
1837 debug_logger->endElement("endrow");
1838 #endif
1840 mpStream->props(writerfilter::Reference<Properties>::Pointer_t(pProps));
1841 mpParserState->resolveTableProperties(*mpStream);
1844 startCharacterGroup();
1846 if (isForwardEvents())
1847 mpStream->utext(s0xd, 1);
1849 endParagraphGroup();
1853 class OOXMLFastContextHandlerTextTable
1856 OOXMLFastContextHandlerTextTable::OOXMLFastContextHandlerTextTable
1857 (OOXMLFastContextHandler * pContext)
1858 : OOXMLFastContextHandler(pContext)
1862 OOXMLFastContextHandlerTextTable::~OOXMLFastContextHandlerTextTable()
1866 void OOXMLFastContextHandlerTextTable::lcl_startFastElement
1867 (Token_t Element,
1868 const uno::Reference< xml::sax::XFastAttributeList > & /*Attribs*/)
1869 throw (uno::RuntimeException, xml::sax::SAXException)
1871 mnTableDepth++;
1873 startAction(Element);
1876 void OOXMLFastContextHandlerTextTable::lcl_endFastElement
1877 (Token_t Element)
1878 throw (uno::RuntimeException, xml::sax::SAXException)
1880 endAction(Element);
1882 mnTableDepth--;
1886 class OOXMLFastContextHandlerShape
1889 class ShapesNoAdd:
1890 public ::cppu::WeakImplHelper1<
1891 drawing::XShapes>
1893 public:
1894 explicit ShapesNoAdd(uno::Reference< uno::XComponentContext > const & context, uno::Reference< drawing::XShapes> const & xShapes);
1896 private:
1897 // container::XElementAccess:
1898 virtual uno::Type SAL_CALL getElementType() throw (uno::RuntimeException);
1899 virtual ::sal_Bool SAL_CALL hasElements() throw (uno::RuntimeException);
1901 // container::XIndexAccess:
1902 virtual ::sal_Int32 SAL_CALL getCount() throw (uno::RuntimeException);
1903 virtual uno::Any SAL_CALL getByIndex(::sal_Int32 Index) throw (uno::RuntimeException, lang::IndexOutOfBoundsException, lang::WrappedTargetException);
1905 // drawing::XShapes:
1906 virtual void SAL_CALL add(const uno::Reference< drawing::XShape > & xShape) throw (uno::RuntimeException);
1907 virtual void SAL_CALL remove(const uno::Reference< drawing::XShape > & xShape) throw (uno::RuntimeException);
1909 ShapesNoAdd(ShapesNoAdd &); // not defined
1910 void operator =(ShapesNoAdd &); // not defined
1912 virtual ~ShapesNoAdd() {}
1914 uno::Reference< uno::XComponentContext > m_xContext;
1915 uno::Reference< drawing::XShapes > m_xShapes;
1918 ShapesNoAdd::ShapesNoAdd(uno::Reference< uno::XComponentContext > const & context, uno::Reference< drawing::XShapes> const & xShapes) :
1919 m_xContext(context), m_xShapes(xShapes)
1922 // container::XElementAccess:
1923 uno::Type SAL_CALL ShapesNoAdd::getElementType() throw (uno::RuntimeException)
1925 return m_xShapes->getElementType();
1928 ::sal_Bool SAL_CALL ShapesNoAdd::hasElements() throw (uno::RuntimeException)
1930 return m_xShapes->hasElements();
1933 // container::XIndexAccess:
1934 ::sal_Int32 SAL_CALL ShapesNoAdd::getCount() throw (uno::RuntimeException)
1936 return m_xShapes->getCount();
1939 uno::Any SAL_CALL ShapesNoAdd::getByIndex(::sal_Int32 Index) throw (uno::RuntimeException, lang::IndexOutOfBoundsException, lang::WrappedTargetException)
1941 return m_xShapes->getByIndex(Index);
1944 // drawing::XShapes:
1945 void SAL_CALL ShapesNoAdd::add(const uno::Reference< drawing::XShape > &
1946 ) throw (uno::RuntimeException)
1950 void SAL_CALL ShapesNoAdd::remove(const uno::Reference< drawing::XShape > & xShape) throw (uno::RuntimeException)
1952 m_xShapes->remove(xShape);
1955 OOXMLFastContextHandlerShape::OOXMLFastContextHandlerShape
1956 (OOXMLFastContextHandler * pContext)
1957 : OOXMLFastContextHandlerProperties(pContext)
1959 uno::Reference<uno::XComponentContext> xContext(getComponentContext());
1961 if (xContext.is())
1963 uno::Reference<XMultiComponentFactory> rServiceManager
1964 (xContext->getServiceManager());
1966 mrShapeContext.set
1967 (rServiceManager->
1968 createInstanceWithContext
1969 (::rtl::OUString
1970 (RTL_CONSTASCII_USTRINGPARAM
1971 ("com.sun.star.xml.sax.FastShapeContextHandler")), xContext),
1972 uno::UNO_QUERY);
1974 if (mrShapeContext.is())
1976 mrShapeContext->setModel(getDocument()->getModel());
1977 mrShapeContext->setDrawPage(getDocument()->getDrawPage());
1978 mrShapeContext->setInputStream(getDocument()->getStorageStream());
1980 #ifdef DEBUG_ELEMENT
1981 debug_logger->startElement("setRelationFragmentPath");
1982 debug_logger->attribute("path", mpParserState->getTarget());
1983 debug_logger->endElement("setRelationFragmentPath");
1984 #endif
1985 mrShapeContext->setRelationFragmentPath
1986 (mpParserState->getTarget());
1988 #ifdef DEBUG_CONTEXT_STACK
1989 else
1991 debug_logger->startElement("error");
1992 debug_logger->chars("failed to get shape handler");
1993 debug_logger->endElement("error");
1995 #endif
1999 OOXMLFastContextHandlerShape::~OOXMLFastContextHandlerShape()
2003 void OOXMLFastContextHandlerShape::lcl_startFastElement
2004 (Token_t Element,
2005 const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
2006 throw (uno::RuntimeException, xml::sax::SAXException)
2008 startAction(Element);
2010 if (mrShapeContext.is())
2011 mrShapeContext->startFastElement(Element, Attribs);
2014 void SAL_CALL OOXMLFastContextHandlerShape::startUnknownElement
2015 (const ::rtl::OUString & Namespace,
2016 const ::rtl::OUString & Name,
2017 const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
2018 throw (uno::RuntimeException, xml::sax::SAXException)
2020 if (mrShapeContext.is())
2021 mrShapeContext->startUnknownElement(Namespace, Name, Attribs);
2024 void OOXMLFastContextHandlerShape::setToken(Token_t nToken)
2026 OOXMLFastContextHandler::setToken(nToken);
2028 if (mrShapeContext.is())
2029 mrShapeContext->setStartToken(nToken);
2032 void OOXMLFastContextHandlerShape::lcl_endFastElement
2033 (Token_t Element)
2034 throw (uno::RuntimeException, xml::sax::SAXException)
2036 if (mrShapeContext.is())
2038 mrShapeContext->endFastElement(Element);
2040 uno::Reference<drawing::XShape> xShape(mrShapeContext->getShape());
2042 if (xShape.is())
2044 awt::Point aPoint(xShape->getPosition());
2045 awt::Size aSize(xShape->getSize());
2047 OOXMLValue::Pointer_t
2048 pValue(new OOXMLShapeValue(xShape));
2049 newProperty(NS_ooxml::LN_shape, pValue);
2053 OOXMLFastContextHandlerProperties::lcl_endFastElement(Element);
2056 void SAL_CALL OOXMLFastContextHandlerShape::endUnknownElement
2057 (const ::rtl::OUString & Namespace,
2058 const ::rtl::OUString & Name)
2059 throw (uno::RuntimeException, xml::sax::SAXException)
2061 if (mrShapeContext.is())
2062 mrShapeContext->endUnknownElement(Namespace, Name);
2065 uno::Reference< xml::sax::XFastContextHandler >
2066 OOXMLFastContextHandlerShape::lcl_createFastChildContext
2067 (Token_t Element,
2068 const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
2069 throw (uno::RuntimeException, xml::sax::SAXException)
2071 uno::Reference< xml::sax::XFastContextHandler > xContextHandler;
2073 sal_uInt32 nNamespace = Element & 0xffff0000;
2075 switch (nNamespace)
2077 case NS_wordprocessingml:
2078 case NS_vml_wordprocessingDrawing:
2079 case NS_office:
2080 xContextHandler.set(createFromStart(Element, Attribs));
2081 break;
2082 default:
2083 if (mrShapeContext.is())
2085 uno::Reference<XFastContextHandler> pChildContext =
2086 mrShapeContext->createFastChildContext(Element, Attribs);
2088 OOXMLFastContextHandlerWrapper * pWrapper =
2089 new OOXMLFastContextHandlerWrapper(this, pChildContext);
2091 pWrapper->addNamespace(NS_wordprocessingml);
2092 pWrapper->addNamespace(NS_vml_wordprocessingDrawing);
2093 pWrapper->addNamespace(NS_office);
2095 xContextHandler.set(pWrapper);
2097 else
2098 xContextHandler.set(this);
2099 break;
2102 return xContextHandler;
2105 uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
2106 OOXMLFastContextHandlerShape::createUnknownChildContext
2107 (const ::rtl::OUString & Namespace,
2108 const ::rtl::OUString & Name,
2109 const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
2110 throw (uno::RuntimeException, xml::sax::SAXException)
2112 uno::Reference< xml::sax::XFastContextHandler > xResult;
2114 if (mrShapeContext.is())
2115 xResult.set(mrShapeContext->createUnknownChildContext
2116 (Namespace, Name, Attribs));
2118 return xResult;
2121 void OOXMLFastContextHandlerShape::lcl_characters
2122 (const ::rtl::OUString & aChars)
2123 throw (uno::RuntimeException, xml::sax::SAXException)
2125 if (mrShapeContext.is())
2126 mrShapeContext->characters(aChars);
2130 class OOXMLFastContextHandlerWrapper
2133 OOXMLFastContextHandlerWrapper::OOXMLFastContextHandlerWrapper
2134 (OOXMLFastContextHandler * pParent,
2135 uno::Reference<XFastContextHandler> xContext)
2136 : OOXMLFastContextHandler(pParent), mxContext(xContext)
2138 if (pParent != NULL)
2140 setId(pParent->getId());
2141 setToken(pParent->getToken());
2142 setPropertySet(pParent->getPropertySet());
2146 OOXMLFastContextHandlerWrapper::~OOXMLFastContextHandlerWrapper()
2150 void SAL_CALL OOXMLFastContextHandlerWrapper::startUnknownElement
2151 (const ::rtl::OUString & Namespace,
2152 const ::rtl::OUString & Name,
2153 const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
2154 throw (uno::RuntimeException, xml::sax::SAXException)
2156 if (mxContext.is())
2157 mxContext->startUnknownElement(Namespace, Name, Attribs);
2160 void SAL_CALL OOXMLFastContextHandlerWrapper::endUnknownElement
2161 (const ::rtl::OUString & Namespace,
2162 const ::rtl::OUString & Name)
2163 throw (uno::RuntimeException, xml::sax::SAXException)
2165 if (mxContext.is())
2166 mxContext->endUnknownElement(Namespace, Name);
2169 uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
2170 OOXMLFastContextHandlerWrapper::createUnknownChildContext
2171 (const ::rtl::OUString & Namespace,
2172 const ::rtl::OUString & Name,
2173 const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
2174 throw (uno::RuntimeException, xml::sax::SAXException)
2176 uno::Reference< xml::sax::XFastContextHandler > xResult;
2178 if (mxContext.is())
2179 xResult = mxContext->createUnknownChildContext
2180 (Namespace, Name, Attribs);
2181 else
2182 xResult.set(this);
2184 return xResult;
2187 void OOXMLFastContextHandlerWrapper::attributes
2188 (const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
2189 throw (uno::RuntimeException, xml::sax::SAXException)
2191 if (mxContext.is())
2193 OOXMLFastContextHandler * pHandler = getFastContextHandler();
2194 if (pHandler != NULL)
2195 pHandler->attributes(Attribs);
2199 OOXMLFastContextHandler::ResourceEnum_t
2200 OOXMLFastContextHandlerWrapper::getResource() const
2202 return UNKNOWN;
2205 void OOXMLFastContextHandlerWrapper::addNamespace(const Id & nId)
2207 mMyNamespaces.insert(nId);
2210 void OOXMLFastContextHandlerWrapper::lcl_startFastElement
2211 (Token_t Element,
2212 const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
2213 throw (uno::RuntimeException, xml::sax::SAXException)
2215 if (mxContext.is())
2216 mxContext->startFastElement(Element, Attribs);
2219 void OOXMLFastContextHandlerWrapper::lcl_endFastElement
2220 (Token_t Element)
2221 throw (uno::RuntimeException, xml::sax::SAXException)
2223 if (mxContext.is())
2224 mxContext->endFastElement(Element);
2227 uno::Reference< xml::sax::XFastContextHandler >
2228 OOXMLFastContextHandlerWrapper::lcl_createFastChildContext
2229 (Token_t Element,
2230 const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
2231 throw (uno::RuntimeException, xml::sax::SAXException)
2233 uno::Reference< xml::sax::XFastContextHandler > xResult;
2235 Id nNameSpace = Element & 0xffff0000;
2237 #ifdef DEBUG_ELEMENT
2238 debug_logger->startElement("Wrapper-createChildContext");
2239 debug_logger->attribute("token", fastTokenToId(Element));
2241 set<Id>::const_iterator aIt(mMyNamespaces.begin());
2242 while (aIt != mMyNamespaces.end())
2244 debug_logger->startElement("namespace");
2245 debug_logger->attribute("id", fastTokenToId(*aIt));
2246 debug_logger->endElement("namespace");
2248 aIt++;
2251 debug_logger->endElement("Wrapper-createChildContext");
2252 #endif
2254 if (mMyNamespaces.find(nNameSpace) != mMyNamespaces.end())
2255 xResult.set(createFromStart(Element, Attribs));
2256 else if (mxContext.is())
2258 OOXMLFastContextHandlerWrapper * pWrapper =
2259 new OOXMLFastContextHandlerWrapper
2260 (this, mxContext->createFastChildContext(Element, Attribs));
2261 pWrapper->mMyNamespaces = mMyNamespaces;
2262 pWrapper->setPropertySet(getPropertySet());
2263 xResult.set(pWrapper);
2265 else
2266 xResult.set(this);
2268 return xResult;
2271 void OOXMLFastContextHandlerWrapper::lcl_characters
2272 (const ::rtl::OUString & aChars)
2273 throw (uno::RuntimeException, xml::sax::SAXException)
2275 if (mxContext.is())
2276 mxContext->characters(aChars);
2279 OOXMLFastContextHandler *
2280 OOXMLFastContextHandlerWrapper::getFastContextHandler() const
2282 if (mxContext.is())
2283 return dynamic_cast<OOXMLFastContextHandler *>(mxContext.get());
2285 return NULL;
2288 void OOXMLFastContextHandlerWrapper::newProperty
2289 (const Id & rId, OOXMLValue::Pointer_t pVal)
2291 if (mxContext.is())
2293 OOXMLFastContextHandler * pHandler = getFastContextHandler();
2294 if (pHandler != NULL)
2295 pHandler->newProperty(rId, pVal);
2299 void OOXMLFastContextHandlerWrapper::setPropertySet
2300 (OOXMLPropertySet::Pointer_t pPropertySet)
2302 if (mxContext.is())
2304 OOXMLFastContextHandler * pHandler = getFastContextHandler();
2305 if (pHandler != NULL)
2306 pHandler->setPropertySet(pPropertySet);
2309 mpPropertySet = pPropertySet;
2312 OOXMLPropertySet::Pointer_t OOXMLFastContextHandlerWrapper::getPropertySet()
2313 const
2315 OOXMLPropertySet::Pointer_t pResult(mpPropertySet);
2317 if (mxContext.is())
2319 OOXMLFastContextHandler * pHandler = getFastContextHandler();
2320 if (pHandler != NULL)
2321 pResult = pHandler->getPropertySet();
2324 return pResult;
2327 string OOXMLFastContextHandlerWrapper::getType() const
2329 string sResult = "Wrapper(";
2331 if (mxContext.is())
2333 OOXMLFastContextHandler * pHandler = getFastContextHandler();
2334 if (pHandler != NULL)
2335 sResult += pHandler->getType();
2338 sResult += ")";
2340 return sResult;
2343 void OOXMLFastContextHandlerWrapper::setId(Id rId)
2345 OOXMLFastContextHandler::setId(rId);
2347 if (mxContext.is())
2349 OOXMLFastContextHandler * pHandler = getFastContextHandler();
2350 if (pHandler != NULL)
2351 pHandler->setId(rId);
2355 Id OOXMLFastContextHandlerWrapper::getId() const
2357 Id nResult = OOXMLFastContextHandler::getId();
2359 if (mxContext.is())
2361 OOXMLFastContextHandler * pHandler = getFastContextHandler();
2362 if (pHandler != NULL && pHandler->getId() != 0)
2363 nResult = pHandler->getId();
2366 return nResult;
2369 void OOXMLFastContextHandlerWrapper::setToken(Token_t nToken)
2371 OOXMLFastContextHandler::setToken(nToken);
2373 if (mxContext.is())
2375 OOXMLFastContextHandler * pHandler = getFastContextHandler();
2376 if (pHandler != NULL)
2377 pHandler->setToken(nToken);
2381 Token_t OOXMLFastContextHandlerWrapper::getToken() const
2383 Token_t nResult = OOXMLFastContextHandler::getToken();
2385 if (mxContext.is())
2387 OOXMLFastContextHandler * pHandler = getFastContextHandler();
2388 if (pHandler != NULL)
2389 nResult = pHandler->getToken();
2392 return nResult;